From 1e3cea9eb893cabd80843ec9a7a659c17e20de61 Mon Sep 17 00:00:00 2001 From: Björn Esser Date: May 19 2013 10:11:32 +0000 Subject: add Patch0: respect system compiler-flags - touch a fake configure-script during prep - export system cflags invoking configure-macro --- diff --git a/pngquant.spec b/pngquant.spec index 1c37aa8..b6d20bd 100644 --- a/pngquant.spec +++ b/pngquant.spec @@ -3,12 +3,15 @@ Name: pngquant Version: 1.8.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: PNG quantization tool for reducing image file size License: BSD with advertising URL: http://%{name}.org Source0: http://%{name}.org/%{name}-%{version}-src.tar.bz2 +# this will be in the next version +Patch0: pngquant_respect_system_flags.patch + BuildRequires: libpng-devel @@ -23,26 +26,27 @@ median cut algorithm. %prep %setup -q +%patch0 %build -# Using {C,LD}FLAGSADD here makes sure {optflags} -# are appended to {C,LD}FLAGS set in Makefile. +# since there is no autotools/configure-script in sources +echo '#!/bin/sh' > configure +chmod +x configure + +#have the compiler-flags exported properly +%configure -make %{?_smp_mflags} \ - CFLAGSADD="%{optflags}" \ - LDFLAGSADD="%{optflags}" +make %{?_smp_mflags} %install -# repeating {C,LD}FLAGSADD from plain `make` -# is required during install or `make install` -# will start recompiling source without them. +# have the compiler-flags exported properly, again +# otherwise make_install will trigger rebuild without +# proper compiler-flags +%configure -%make_install \ - PREFIX=%{_prefix} \ - CFLAGSADD="%{optflags}" \ - LDFLAGSADD="%{optflags}" +%make_install PREFIX=%{_prefix} install -Dpm0644 %{name}.1 \ %{buildroot}/%{_mandir}/man1/%{name}.1 @@ -55,6 +59,11 @@ install -Dpm0644 %{name}.1 \ %changelog +* Sun May 19 2013 Björn Esser - 1.8.3-3 +- add Patch0: respect system compiler-flags +- touch a fake configure-script during prep +- export system cflags invoking configure-macro + * Fri May 17 2013 Björn Esser - 1.8.3-2 - changed License: BSD --> BSD with advertising - removed -n{name}-{version} from prep diff --git a/pngquant_respect_system_flags.patch b/pngquant_respect_system_flags.patch new file mode 100644 index 0000000..07b93d7 --- /dev/null +++ b/pngquant_respect_system_flags.patch @@ -0,0 +1,37 @@ +--- Makefile 2013-02-26 01:03:50.000000000 +0100 ++++ Makefile 2013-05-19 09:24:50.001314584 +0200 +@@ -12,13 +12,20 @@ + # Alternatively, build libpng in this directory: + CUSTOMLIBPNG ?= ../libpng + +-CFLAGSOPT ?= -DNDEBUG -O3 -fstrict-aliasing -ffast-math -funroll-loops -fomit-frame-pointer -ffinite-math-only ++CFLAGSSYS := $(CFLAGS) ++LDFLAGSSYS := $(LDFLAGS) + +-CFLAGS ?= -Wall -Wno-unknown-pragmas -I. -I$(CUSTOMLIBPNG) -I/usr/local/include/ -I/usr/include/ -I/usr/X11/include/ $(CFLAGSOPT) +-CFLAGS += -std=c99 $(CFLAGSADD) ++CFLAGSOPT ?= -DNDEBUG -O3 -fstrict-aliasing -ffast-math -funroll-loops ++CFLAGSOPT += -fomit-frame-pointer -ffinite-math-only ++CFLAGSOPT += -Wall -Wno-unknown-pragmas -I. -I$(CUSTOMLIBPNG) -I$(CUSTOMZLIB) ++CFLAGSOPT += -I/usr/local/include/ -I/usr/include/ -I/usr/X11/include/ ++CFLAGSOPT += -std=c99 + +-LDFLAGS ?= -L$(CUSTOMLIBPNG) -L/usr/local/lib/ -L/usr/lib/ -L/usr/X11/lib/ +-LDFLAGS += -lpng -lm $(LDFLAGSADD) ++LDFLAGSOPT ?= -L$(CUSTOMLIBPNG) -L/usr/local/lib/ -L/usr/lib/ -L/usr/X11/lib/ ++LDFLAGSOPT += -lpng -lm ++ ++CFLAGS = $(CFLAGSOPT) $(CFLAGSADD) $(CFLAGSSYS) ++LDFLAGS = $(LDFLAGSOPT) $(LDFLAGSADD) $(LDFLAGSSYS) + + OBJS = pngquant.o rwpng.o pam.o mediancut.o blur.o mempool.o viter.o nearest.o + COCOA_OBJS = rwpng_cocoa.o +@@ -28,7 +35,7 @@ + TARFILE = $(TARNAME)-src.tar.bz2 + + ifdef USE_COCOA +-CFLAGS += -DUSE_COCOA=1 ++CFLAGSOPT += -DUSE_COCOA=1 + OBJS += $(COCOA_OBJS) + FRAMEWORKS += -framework Cocoa + endif