From 3d2a34b928cc70140f936f090fd2478b2de758b4 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Wed, 29 Nov 2006 12:29:04 +0000 Subject: [PATCH] - splitting makefile patches - make LDFLAGS=$RPM_OPT_FLAGS - Use own makefile define - Fixing 216784 with upstream patch --- optipng-0.5.4-makefile-destdir.patch | 29 ++++++ optipng-0.5.4-makefile-externlibs.patch | 78 ++++++++++++++++ optipng-0.5.4-makefile.patch | 117 ------------------------ optipng.spec | 30 ++++-- optipngr.txt | 14 +++ 5 files changed, 145 insertions(+), 123 deletions(-) create mode 100644 optipng-0.5.4-makefile-destdir.patch create mode 100644 optipng-0.5.4-makefile-externlibs.patch delete mode 100644 optipng-0.5.4-makefile.patch create mode 100644 optipngr.txt diff --git a/optipng-0.5.4-makefile-destdir.patch b/optipng-0.5.4-makefile-destdir.patch new file mode 100644 index 0000000..16367a5 --- /dev/null +++ b/optipng-0.5.4-makefile-destdir.patch @@ -0,0 +1,29 @@ +diff -ru optipng-0.5.4/src/scripts/gcc.mak optipng-0.5.4.patched/src/scripts/gcc.mak +--- optipng-0.5.4/src/scripts/gcc.mak 2006-11-23 11:55:25.000000000 +0100 ++++ optipng-0.5.4.patched/src/scripts/gcc.mak 2006-11-23 11:56:28.000000000 +0100 +@@ -64,17 +64,17 @@ + + + install: $(OPTIPNG) +- -@if [ ! -d ${bindir} ]; then mkdir -p ${bindir}; fi +- -@if [ ! -d ${man1dir} ]; then mkdir -p ${man1dir}; fi +- -@rm -f ${bindir}/$(OPTIPNG) +- -@rm -f ${man1dir}/optipng.1 +- cp -p $(OPTIPNG) ${bindir} +- cp -p ../man/optipng.1 ${man1dir} ++ -@if [ ! -d ${DESTDIR}/${bindir} ]; then mkdir -p ${DESTDIR}/${bindir}; fi ++ -@if [ ! -d ${DESTDIR}/${man1dir} ]; then mkdir -p ${DESTDIR}/${man1dir}; fi ++ -@rm -f ${DESTDIR}/${bindir}/$(OPTIPNG) ++ -@rm -f ${DESTDIR}/${man1dir}/optipng.1 ++ cp -p $(OPTIPNG) ${DESTDIR}/${bindir} ++ cp -p ../man/optipng.1 ${DESTDIR}/${man1dir} + + + uninstall: +- rm -f ${bindir}/$(OPTIPNG) +- rm -f ${man1dir}/optipng.1 ++ rm -f ${DESTDIR}/${bindir}/$(OPTIPNG) ++ rm -f ${DESTDIR}/${man1dir}/optipng.1 + + + clean: diff --git a/optipng-0.5.4-makefile-externlibs.patch b/optipng-0.5.4-makefile-externlibs.patch new file mode 100644 index 0000000..cc2529c --- /dev/null +++ b/optipng-0.5.4-makefile-externlibs.patch @@ -0,0 +1,78 @@ +diff -ru optipng-0.5.4/lib/pngxtern/scripts/gcc.mak optipng-0.5.4.patched/lib/pngxtern/scripts/gcc.mak +--- optipng-0.5.4/lib/pngxtern/scripts/gcc.mak 2006-11-23 12:05:53.000000000 +0100 ++++ optipng-0.5.4.patched/lib/pngxtern/scripts/gcc.mak 2006-11-23 12:05:55.000000000 +0100 +@@ -39,7 +39,7 @@ + all: pngxtern$(A) + + .c$(O): +- $(CC) -c $(CFLAGS) -I$(ZDIR) -I$(PNGDIR) $< ++ $(CC) -c $(CFLAGS) $< + + pngxtern$(A): $(OBJS) + $(AR_RC) $@ $(OBJS) +diff -ru optipng-0.5.4/src/scripts/gcc.mak optipng-0.5.4.patched/src/scripts/gcc.mak +--- optipng-0.5.4/src/scripts/gcc.mak 2006-11-23 12:05:22.000000000 +0100 ++++ optipng-0.5.4.patched/src/scripts/gcc.mak 2006-11-23 12:05:21.000000000 +0100 +@@ -19,24 +19,20 @@ + ZLIB = libz.a + PNGLIB = libpng.a + PNGXLIB = pngxtern.a +-ZMAK = Makefile +-PNGMAK = scripts/makefile.gcc + PNGXMAK = scripts/gcc.mak +-ZDIR = ../lib/zlib +-PNGDIR = ../lib/libpng + PNGXDIR = ../lib/pngxtern + BACKHERE = ../../src + + OBJS = optipng.o opngio.o opngreduc.o cbitset.o osys.o strutil.o +-LIBS = $(PNGXDIR)/$(PNGXLIB) $(PNGDIR)/$(PNGLIB) $(ZDIR)/$(ZLIB) ++LIBS = $(PNGXDIR)/$(PNGXLIB) + + + $(OPTIPNG): $(OBJS) $(LIBS) +- $(LD) -o $(OPTIPNG) $(LDFLAGS) $(OBJS) $(LIBS) ++ $(LD) -o $(OPTIPNG) $(LDFLAGS) $(OBJS) $(LIBS) -lpng -lz + + + .c.o: +- $(CC) -c $(CFLAGS) -I$(ZDIR) -I$(PNGDIR) -I$(PNGXDIR) $*.c ++ $(CC) -c $(CFLAGS) -I$(PNGXDIR) $*.c + + optipng.o : optipng.c proginfo.h opng.h cexcept.h cbitset.h osys.h strutil.h + opngio.o : opngio.c opng.h +@@ -46,23 +42,11 @@ + strutil.o : strutil.c strutil.h + + +-$(PNGXDIR)/$(PNGXLIB): $(ZDIR)/$(ZLIB) $(PNGDIR)/$(PNGLIB) ++$(PNGXDIR)/$(PNGXLIB): + cd $(PNGXDIR); \ + $(MAKE) -f $(PNGXMAK) $(PNGXLIB); \ + cd $(BACKHERE) + +-$(PNGDIR)/$(PNGLIB): $(ZDIR)/$(ZLIB) +- cd $(PNGDIR); \ +- $(MAKE) -f $(PNGMAK) $(PNGLIB); \ +- cd $(BACKHERE) +- +-$(ZDIR)/$(ZLIB): +- cd $(ZDIR); \ +- ./configure; \ +- $(MAKE) -f $(ZMAK) $(ZLIB); \ +- cd $(BACKHERE) +- +- + install: $(OPTIPNG) + -@if [ ! -d ${bindir} ]; then mkdir -p ${bindir}; fi + -@if [ ! -d ${man1dir} ]; then mkdir -p ${man1dir}; fi +@@ -82,9 +66,3 @@ + cd $(PNGXDIR); \ + $(MAKE) -f $(PNGXMAK) clean; \ + cd $(BACKHERE) +- cd $(PNGDIR); \ +- $(MAKE) -f $(PNGMAK) clean; \ +- cd $(BACKHERE) +- cd $(ZDIR); \ +- $(MAKE) -f $(ZMAK) clean; \ +- cd $(BACKHERE) diff --git a/optipng-0.5.4-makefile.patch b/optipng-0.5.4-makefile.patch deleted file mode 100644 index fea268d..0000000 --- a/optipng-0.5.4-makefile.patch +++ /dev/null @@ -1,117 +0,0 @@ -diff -ru optipng-0.5.4.orig/lib/pngxtern/scripts/gcc.mak optipng-0.5.4/lib/pngxtern/scripts/gcc.mak ---- optipng-0.5.4.orig/lib/pngxtern/scripts/gcc.mak 2006-05-10 21:15:00.000000000 +0200 -+++ optipng-0.5.4/lib/pngxtern/scripts/gcc.mak 2006-09-14 22:17:47.528801620 +0200 -@@ -17,7 +17,9 @@ - CDEBUG = -g - LDDEBUG = - CRELEASE = -O2 --LDRELEASE = -s -+ -+# remove -s from LDRELEASE to prevent stripping -+LDRELEASE = - CFLAGS = -Wall $(CRELEASE) - LDFLAGS = $(LDRELEASE) - LIBS = -lpng -lz -lm -@@ -37,7 +39,7 @@ - all: pngxtern$(A) - - .c$(O): -- $(CC) -c $(CFLAGS) -I$(ZDIR) -I$(PNGDIR) $< -+ $(CC) -c $(CFLAGS) $< - - pngxtern$(A): $(OBJS) - $(AR_RC) $@ $(OBJS) -diff -ru optipng-0.5.4.orig/src/scripts/gcc.mak optipng-0.5.4/src/scripts/gcc.mak ---- optipng-0.5.4.orig/src/scripts/gcc.mak 2006-07-15 16:25:00.000000000 +0200 -+++ optipng-0.5.4/src/scripts/gcc.mak 2006-09-14 22:17:06.910263120 +0200 -@@ -13,30 +13,27 @@ - CC = gcc - LD = $(CC) - CFLAGS = -O2 -Wall --LDFLAGS = -s -+# remove -s from LDFLAGS to prevent stripping -+LDFLAGS = - - OPTIPNG = optipng$(EXE) - ZLIB = libz.a - PNGLIB = libpng.a - PNGXLIB = pngxtern.a --ZMAK = Makefile --PNGMAK = scripts/makefile.gcc - PNGXMAK = scripts/gcc.mak --ZDIR = ../lib/zlib --PNGDIR = ../lib/libpng - PNGXDIR = ../lib/pngxtern - BACKHERE = ../../src - - OBJS = optipng.o opngio.o opngreduc.o cbitset.o osys.o strutil.o --LIBS = $(PNGXDIR)/$(PNGXLIB) $(PNGDIR)/$(PNGLIB) $(ZDIR)/$(ZLIB) -+LIBS = $(PNGXDIR)/$(PNGXLIB) - - - $(OPTIPNG): $(OBJS) $(LIBS) -- $(LD) -o $(OPTIPNG) $(LDFLAGS) $(OBJS) $(LIBS) -+ $(LD) -o $(OPTIPNG) $(LDFLAGS) $(OBJS) $(LIBS) -lpng -lz - - - .c.o: -- $(CC) -c $(CFLAGS) -I$(ZDIR) -I$(PNGDIR) -I$(PNGXDIR) $*.c -+ $(CC) -c $(CFLAGS) -I$(PNGXDIR) $*.c - - optipng.o : optipng.c proginfo.h opng.h cexcept.h cbitset.h osys.h strutil.h - opngio.o : opngio.c opng.h -@@ -46,35 +43,23 @@ - strutil.o : strutil.c strutil.h - - --$(PNGXDIR)/$(PNGXLIB): $(ZDIR)/$(ZLIB) $(PNGDIR)/$(PNGLIB) -+$(PNGXDIR)/$(PNGXLIB): - cd $(PNGXDIR); \ - $(MAKE) -f $(PNGXMAK) $(PNGXLIB); \ - cd $(BACKHERE) - --$(PNGDIR)/$(PNGLIB): $(ZDIR)/$(ZLIB) -- cd $(PNGDIR); \ -- $(MAKE) -f $(PNGMAK) $(PNGLIB); \ -- cd $(BACKHERE) -- --$(ZDIR)/$(ZLIB): -- cd $(ZDIR); \ -- ./configure; \ -- $(MAKE) -f $(ZMAK) $(ZLIB); \ -- cd $(BACKHERE) -- -- - install: $(OPTIPNG) -- -@if [ ! -d ${bindir} ]; then mkdir -p ${bindir}; fi -- -@if [ ! -d ${man1dir} ]; then mkdir -p ${man1dir}; fi -- -@rm -f ${bindir}/$(OPTIPNG) -- -@rm -f ${man1dir}/optipng.1 -- cp -p $(OPTIPNG) ${bindir} -- cp -p ../man/optipng.1 ${man1dir} -+ -@if [ ! -d ${DESTDIR}/${bindir} ]; then mkdir -p ${DESTDIR}/${bindir}; fi -+ -@if [ ! -d ${DESTDIR}/${man1dir} ]; then mkdir -p ${DESTDIR}/${man1dir}; fi -+ -@rm -f ${DESTDIR}/${bindir}/$(OPTIPNG) -+ -@rm -f ${DESTDIR}/${man1dir}/optipng.1 -+ cp -p $(OPTIPNG) ${DESTDIR}/${bindir} -+ cp -p ../man/optipng.1 ${DESTDIR}/${man1dir} - - - uninstall: -- rm -f ${bindir}/$(OPTIPNG) -- rm -f ${man1dir}/optipng.1 -+ rm -f ${DESTDIR}/${bindir}/$(OPTIPNG) -+ rm -f ${DESTDIR}/${man1dir}/optipng.1 - - - clean: -@@ -82,9 +67,3 @@ - cd $(PNGXDIR); \ - $(MAKE) -f $(PNGXMAK) clean; \ - cd $(BACKHERE) -- cd $(PNGDIR); \ -- $(MAKE) -f $(PNGMAK) clean; \ -- cd $(BACKHERE) -- cd $(ZDIR); \ -- $(MAKE) -f $(ZMAK) clean; \ -- cd $(BACKHERE) diff --git a/optipng.spec b/optipng.spec index 4b0612f..808c433 100644 --- a/optipng.spec +++ b/optipng.spec @@ -1,13 +1,15 @@ Name: optipng Version: 0.5.4 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A PNG optimizer and converter Group: Applications/Multimedia License: zlib/libpng URL: http://optipng.sourceforge.net/ Source0: http://surfnet.dl.sourceforge.net/sourceforge/optipng/optipng-%{version}.tar.gz -Patch0: optipng-0.5.4-makefile.patch +Patch0: optipng-0.5.4-makefile-destdir.patch +Patch1: optipng-0.5.4-makefile-externlibs.patch +Patch2: http://www.icmc.usp.br/~naoliv/optipngr.txt BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: zlib-devel libpng-devel @@ -22,18 +24,23 @@ integrity checks and corrections. %prep %setup -q %patch0 -p1 +%patch1 -p1 +%patch2 -p1 + +%define makefile gcc.mak %build cd src/ -make -f scripts/gcc.mak %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" +make -f scripts/%{makefile} %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"\ + LDFLAGS="$RPM_OPT_FLAGS" %install rm -rf $RPM_BUILD_ROOT cd src/ -make -f scripts/gcc.mak install DESTDIR="$RPM_BUILD_ROOT"\ - prefix="%{_prefix}" \ - man1dir="%{_mandir}/man1" +make -f scripts/%{makefile} install DESTDIR="$RPM_BUILD_ROOT"\ + prefix="%{_prefix}" \ + man1dir="%{_mandir}/man1" %clean @@ -48,20 +55,31 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Nov 29 2006 Till Maas - 0.5.4-4 +- splitting makefile patches +- make LDFLAGS=$RPM_OPT_FLAGS +- Use own makefile define +- Fixing 216784 with upstream patch + * Wed Oct 11 2006 Till Maas - 0.5.4-3 - bumping release because of errors while importing to extras + * Tue Oct 10 2006 Till Maas - 0.5.4-2 - shortening Summary + * Thu Sep 14 2006 Till Maas - 0.5.4-1 - version bump - use system zlib and libpng - link without "-s" flag for non-empty debuginfo - use DESTDIR + * Fri Jul 28 2006 Till Maas - 0.5.3-1 - version bump - Changed license tag back to zlib/libpng (#198616 rpmlint) - use $RPM_OPT_FLAGS instead of %%{optflags} + * Thu Jul 06 2006 Till Maas - 0.5.2-2 - Changed license tag from zlib/libpng to zlib + * Tue Jul 04 2006 Till Maas - 0.5.2-1 - Created from scratch for fedora extras diff --git a/optipngr.txt b/optipngr.txt new file mode 100644 index 0000000..c0e4c12 --- /dev/null +++ b/optipngr.txt @@ -0,0 +1,14 @@ +diff -urN optipng-0.5.4.orig/src/opngreduc.c optipng-0.5.4/src/opngreduc.c +--- optipng-0.5.4.orig/src/opngreduc.c 2006-11-28 01:55:45.000000000 -0200 ++++ optipng-0.5.4/src/opngreduc.c 2006-11-28 01:56:54.000000000 -0200 +@@ -80,10 +80,6 @@ + if (png_get_sBIT(png_ptr, info_ptr, &sig_bit)) + if (sig_bit != &info_ptr->sig_bit) + goto error; +- if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &trans_values)) +- if (trans != info_ptr->trans || num_trans != info_ptr->num_trans || +- trans_values != &info_ptr->trans_values) +- goto error; + + /* Also check png_ptr. (It's not much, but we're doing what we can.) */ + if (png_get_compression_buffer_size(png_ptr) != png_ptr->zbuf_size)