add Patch0: respect system compiler-flags

- touch a fake configure-script during prep
- export system cflags invoking configure-macro
epel9
Björn Esser 12 years ago
parent f910b51411
commit 1e3cea9eb8

@ -3,12 +3,15 @@
Name: pngquant Name: pngquant
Version: 1.8.3 Version: 1.8.3
Release: 2%{?dist} Release: 3%{?dist}
Summary: PNG quantization tool for reducing image file size Summary: PNG quantization tool for reducing image file size
License: BSD with advertising License: BSD with advertising
URL: http://%{name}.org URL: http://%{name}.org
Source0: http://%{name}.org/%{name}-%{version}-src.tar.bz2 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 BuildRequires: libpng-devel
@ -23,26 +26,27 @@ median cut algorithm.
%prep %prep
%setup -q %setup -q
%patch0
%build %build
# Using {C,LD}FLAGSADD here makes sure {optflags} # since there is no autotools/configure-script in sources
# are appended to {C,LD}FLAGS set in Makefile. echo '#!/bin/sh' > configure
chmod +x configure
#have the compiler-flags exported properly
%configure
make %{?_smp_mflags} \ make %{?_smp_mflags}
CFLAGSADD="%{optflags}" \
LDFLAGSADD="%{optflags}"
%install %install
# repeating {C,LD}FLAGSADD from plain `make` # have the compiler-flags exported properly, again
# is required during install or `make install` # otherwise make_install will trigger rebuild without
# will start recompiling source without them. # proper compiler-flags
%configure
%make_install \ %make_install PREFIX=%{_prefix}
PREFIX=%{_prefix} \
CFLAGSADD="%{optflags}" \
LDFLAGSADD="%{optflags}"
install -Dpm0644 %{name}.1 \ install -Dpm0644 %{name}.1 \
%{buildroot}/%{_mandir}/man1/%{name}.1 %{buildroot}/%{_mandir}/man1/%{name}.1
@ -55,6 +59,11 @@ install -Dpm0644 %{name}.1 \
%changelog %changelog
* Sun May 19 2013 Björn Esser <bjoern.esser@gmail.com> - 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 <bjoern.esser@gmail.com> - 1.8.3-2 * Fri May 17 2013 Björn Esser <bjoern.esser@gmail.com> - 1.8.3-2
- changed License: BSD --> BSD with advertising - changed License: BSD --> BSD with advertising
- removed -n{name}-{version} from prep - removed -n{name}-{version} from prep

@ -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
Loading…
Cancel
Save