Add Patch1: make the configure-script work with %%configure

Build and run the testsuite
Conditionalize %%license
Remove all el5-related things, since we need gcc >= 4.2 anyways
Fix %%{?_isa} on (Build)Requires
epel9
Björn Esser 9 years ago
parent b1777fa131
commit 89d8d0745a

@ -1,60 +0,0 @@
--- pngquant-2.4.0.1.orig/lib/Makefile 2015-04-11 23:24:38.000000000 +0100
+++ pngquant-2.4.0.1/lib/Makefile 2015-04-19 03:35:15.687199897 +0100
@@ -1,7 +1,8 @@
-include config.mk
STATICLIB=libimagequant.a
-SHAREDLIB=libimagequant.so.0
+SHAREDLIB=libimagequant.so
+SOVER=0
DLL=libimagequant.dll
DLLIMP=libimagequant_dll.a
@@ -36,7 +37,8 @@ $(SHAREDOBJS):
$(CC) -fPIC $(CFLAGS) -c $(@:.lo=.c) -o $@
$(SHAREDLIB): $(SHAREDOBJS)
- $(CC) -shared -o $@ $^ $(LDFLAGS)
+ $(CC) -shared -Wl,-soname,$(SHAREDLIB).$(SOVER) -o $(SHAREDLIB).$(SOVER) $^ $(LDFLAGS)
+ ln -fs $(SHAREDLIB).$(SOVER) $(SHAREDLIB)
$(OBJS): $(wildcard *.h) config.mk
--- pngquant-2.4.0.1.orig/Makefile 2015-04-11 23:24:38.000000000 +0100
+++ pngquant-2.4.0.1/Makefile 2015-04-19 02:19:40.340909213 +0100
@@ -11,6 +11,7 @@ OBJS += $(COCOA_OBJS)
endif
STATICLIB = lib/libimagequant.a
+SHAREDLIB = lib/libimagequant.so
DISTFILES = *.[chm] pngquant.1 Makefile configure README.md INSTALL CHANGELOG COPYRIGHT
TARNAME = pngquant-$(VERSION)
@@ -29,12 +30,17 @@ staticlib:
$(STATICLIB): config.mk staticlib
+sharedlib:
+ $(MAKE) -C lib shared
+
+$(SHAREDLIB): config.mk sharedlib
+
$(OBJS): $(wildcard *.h) config.mk
rwpng_cocoa.o: rwpng_cocoa.m
$(CC) -Wno-enum-conversion -c $(CFLAGS) -o $@ $< || clang -Wno-enum-conversion -c -O3 $(CFLAGS) -o $@ $<
-$(BIN): $(OBJS) $(STATICLIB)
+$(BIN): $(OBJS) $(SHAREDLIB)
$(CC) $^ $(LDFLAGS) -o $@
test: $(BIN)
@@ -60,7 +66,7 @@ uninstall:
clean:
$(MAKE) -C lib clean
- rm -f '$(BIN)' $(OBJS) $(COCOA_OBJS) $(STATICLIB) $(TARFILE)
+ rm -f '$(BIN)' $(OBJS) $(COCOA_OBJS) $(TARFILE)
distclean: clean
$(MAKE) -C lib distclean

@ -1,60 +0,0 @@
--- pngquant-2.4.0.1.orig/lib/Makefile 2015-04-11 23:24:38.000000000 +0100
+++ pngquant-2.4.0.1/lib/Makefile 2015-04-19 03:35:15.687199897 +0100
@@ -1,7 +1,8 @@
-include config.mk
STATICLIB=libimagequant.a
-SHAREDLIB=libimagequant.so.0
+SHAREDLIB=libimagequant.so
+SOVER=0
DLL=libimagequant.dll
DLLIMP=libimagequant_dll.a
@@ -36,7 +37,8 @@ $(SHAREDOBJS):
$(CC) -fPIC $(CFLAGS) -c $(@:.lo=.c) -o $@
$(SHAREDLIB): $(SHAREDOBJS)
- $(CC) -shared -o $@ $^ $(LDFLAGS)
+ $(CC) -shared -Wl,-soname,$(SHAREDLIB).$(SOVER) -o $(SHAREDLIB).$(SOVER) $^ $(LDFLAGS)
+ ln -fs $(SHAREDLIB).$(SOVER) $(SHAREDLIB)
$(OBJS): $(wildcard *.h) config.mk
--- ./Makefile.orig 2015-06-28 23:52:06.000000000 +0100
+++ ./Makefile 2015-07-02 13:59:38.465100226 +0100
@@ -11,6 +11,7 @@ OBJS += $(COCOA_OBJS)
endif
STATICLIB = lib/libimagequant.a
+SHAREDLIB = lib/libimagequant.so
DISTFILES = *.[chm] pngquant.1 Makefile configure README.md INSTALL CHANGELOG COPYRIGHT
TARNAME = pngquant-$(VERSION)
@@ -29,12 +30,17 @@ staticlib:
$(STATICLIB): config.mk staticlib
+sharedlib:
+ $(MAKE) -C lib shared
+
+$(SHAREDLIB): config.mk sharedlib
+
$(OBJS): $(wildcard *.h) config.mk
rwpng_cocoa.o: rwpng_cocoa.m
$(CC) -Wno-enum-conversion -c $(CFLAGS) -o $@ $< &> /dev/null || clang -Wno-enum-conversion -c -O3 $(CFLAGS) -o $@ $<
-$(BIN): $(OBJS) $(STATICLIB)
+$(BIN): $(OBJS) $(SHAREDLIB)
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
test: $(BIN)
@@ -60,7 +66,7 @@ uninstall:
clean:
$(MAKE) -C lib clean
- rm -f '$(BIN)' $(OBJS) $(COCOA_OBJS) $(STATICLIB) $(TARFILE)
+ rm -f '$(BIN)' $(OBJS) $(COCOA_OBJS) $(STATICLIB) $(SHAREDLIB) $(TARFILE)
distclean: clean
$(MAKE) -C lib distclean

@ -0,0 +1,14 @@
Index: pngquant-2.5.2/configure
===================================================================
--- pngquant-2.5.2.orig/configure
+++ pngquant-2.5.2/configure
@@ -102,8 +102,7 @@ fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS ${i#*=}"
;;
*)
- echo "error: unknown switch ${i%%=*} (see $0 --help for the list)"
- exit 1
+ echo "warning: unknown switch ${i%%=*} (see $0 --help for the list)"
;;
esac
done

@ -1,10 +1,17 @@
# add some speed-relevant compiler-flags
%global optflags %(echo %{optflags} -fno-math-errno -funroll-loops -fomit-frame-pointer -fPIC )
# we use %%license on recent distros, only
%if 0%{?fedora} >= 22 || 0%{?rhel} >= 8
%global with_license 1
%endif # 0%%{?fedora} >= 22 || 0%%{?rhel} >= 8
%global libname libimagequant %global libname libimagequant
Name: pngquant Name: pngquant
Version: 2.5.2 Version: 2.5.2
Release: 2%{?dist} Release: 3%{?dist}
Summary: PNG quantization tool for reducing image file size Summary: PNG quantization tool for reducing image file size
%{?el5:Group: Applications/Multimedia}
License: BSD with advertising License: BSD with advertising
@ -12,16 +19,14 @@ URL: http://%{name}.org
Source0: https://github.com/pornel/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source0: https://github.com/pornel/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: %{name}-2.5.1_fix-Makefile.patch Patch0: %{name}-2.5.1_fix-Makefile.patch
Patch1: %{name}-2.5.2-fix_configure.patch
BuildRequires: libpng-devel >= 1.2.46-1
%{?el5:BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)} BuildRequires: zlib-devel >= 1.2.3-1
BuildRequires: libpng-devel%{?_isa} >= 1.2.46-1
BuildRequires: zlib-devel%{?_isa} >= 1.2.3-1
BuildRequires: gcc%{?_isa} >= 4.2-1
BuildRequires: lcms2-devel BuildRequires: lcms2-devel
Requires: libpng%{?_isa} >= 1.2.46-1 Requires: libpng%{?_isa} >= 1.2.46-1
Requires: zlib%{?isa} >= 1.2.3-1 Requires: zlib%{?_isa} >= 1.2.3-1
Requires: %{libname} = %{version}-%{release} Requires: %{libname}%{?_isa} = %{version}-%{release}
%description %description
@ -34,7 +39,7 @@ their 24/32-bit version. %{name} uses the median cut algorithm.
%package -n %{libname} %package -n %{libname}
Summary: Small, portable C lib for HQ conversion of RGBA to 8-bit indexed-color Summary: Small, portable C lib for HQ conversion of RGBA to 8-bit indexed-color
%{?el5:Group: System Environment/Libraries}
%description -n %{libname} %description -n %{libname}
%{libname} converts 24/32-bit RGBA PNG images to 8-bit palette with alpha %{libname} converts 24/32-bit RGBA PNG images to 8-bit palette with alpha
@ -46,9 +51,8 @@ their 24/32-bit version. %{libname} uses the median cut algorithm.
%package -n %{libname}-devel %package -n %{libname}-devel
Summary: Development files for %{libname} Summary: Development files for %{libname}
%{?el5:Group: Development/Libraries} Requires: %{libname}%{?_isa} = %{version}-%{release}
Requires: %{libname} = %{version}-%{release}
%description -n %{libname}-devel %description -n %{libname}-devel
This package contains files for development with %{libname}. This package contains files for development with %{libname}.
@ -56,27 +60,24 @@ There is also some brief API-documentation.
%prep %prep
%global optflags %(echo %{optflags} -fno-math-errno -funroll-loops -fomit-frame-pointer -fPIC )
%setup -q %setup -q
%patch0 -p1 %patch0 -p1 -b .fix_makefile
rm lib/configure %patch1 -p1 -b .fix_configure
rm -f lib/configure
%build %build
# export flags like macro configure do %configure
# and don't use macro configure because fails in configure.
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS
FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS
./configure --prefix=%{_prefix}
make %{?_smp_mflags} PREFIX=%{_prefix} make %{?_smp_mflags} PREFIX=%{_prefix}
# build testsuite
pushd test
gcc $CFLAGS $LDFLAGS -L../lib -limagequant \
-o test test.c
popd
%install
%{?el5:rm -rf %{buildroot}}
%install
mkdir -p %{buildroot}%{_includedir}/imagequant \ mkdir -p %{buildroot}%{_includedir}/imagequant \
%{buildroot}%{_bindir} \ %{buildroot}%{_bindir} \
%{buildroot}%{_libdir} \ %{buildroot}%{_libdir} \
@ -95,28 +96,39 @@ install -pm 0644 lib/*.h \
install -pm 0644 %{name}.1 \ install -pm 0644 %{name}.1 \
%{buildroot}/%{_mandir}/man1/%{name}.1 %{buildroot}/%{_mandir}/man1/%{name}.1
mkdir -p %{buildroot}/%{_bindir} # install the binary
make install PREFIX=%{_prefix} DESTDIR=%{buildroot} install -pm 0755 %{name} \
install -Dpm0755 pngquant %{buildroot}/%{_bindir}/pngquant %{buildroot}/%{_bindir}/%{name}
install -Dpm0644 pngquant.1 %{buildroot}/%{_mandir}/man1/pngquant.1
%clean
%{?el5:rm -rf %{buildroot}}
%check
# needed by ld / testsuite to find libimagequant
export LD_LIBRARY_PATH="$(pwd)/lib:$LD_LIBRARY_PATH"
pushd test
./test.sh . ../pngquant ./test
popd
%post -n %{libname} -p /sbin/ldconfig
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig %postun -n %{libname} -p /sbin/ldconfig
%files %files
%doc README.md CHANGELOG %doc README.md CHANGELOG
%if 0%{?with_license}
%license COPYRIGHT %license COPYRIGHT
%else # 0%%{?with_license}
%doc COPYRIGHT
%endif # 0%%{?with_license}
%{_bindir}/%{name} %{_bindir}/%{name}
%{_mandir}/man1/%{name}.1* %{_mandir}/man1/%{name}.1*
%files -n %{libname} %files -n %{libname}
%if 0%{?with_license}
%license lib/COPYRIGHT %license lib/COPYRIGHT
%else # 0%%{?with_license}
%doc lib/COPYRIGHT
%endif # 0%%{?with_license}
%{_libdir}/%{libname}.so.* %{_libdir}/%{libname}.so.*
%files -n %{libname}-devel %files -n %{libname}-devel
@ -126,6 +138,13 @@ install -Dpm0644 pngquant.1 %{buildroot}/%{_mandir}/man1/pngquant.1
%changelog %changelog
* Sat Dec 19 2015 Björn Esser <fedora@besser82.io> - 2.5.2-3
- Add Patch1: make the configure-script work with %%configure
- Build and run the testsuite
- Conditionalize %%license
- Remove all el5-related things, since we need gcc >= 4.2 anyways
- Fix %%{?_isa} on (Build)Requires
* Sat Dec 19 2015 Sérgio Basto <sergio@serjux.com> - 2.5.2-2 * Sat Dec 19 2015 Sérgio Basto <sergio@serjux.com> - 2.5.2-2
- Disable pngquant debug (#1291885) - Disable pngquant debug (#1291885)
@ -150,7 +169,7 @@ install -Dpm0644 pngquant.1 %{buildroot}/%{_mandir}/man1/pngquant.1
- Add license tag. - Add license tag.
* Mon Apr 20 2015 Sérgio Basto <sergio@serjux.com> - 2.4.1-1 * Mon Apr 20 2015 Sérgio Basto <sergio@serjux.com> - 2.4.1-1
- Update to 2.4.1 - Update to 2.4.1
- Dropped "epel compile fix" patch - Dropped "epel compile fix" patch
* Sun Apr 19 2015 Sérgio Basto <sergio@serjux.com> - 2.4.0.1-4 * Sun Apr 19 2015 Sérgio Basto <sergio@serjux.com> - 2.4.0.1-4

Loading…
Cancel
Save