diff --git a/advancecomp.spec b/advancecomp.spec index 9f31420..f1b2780 100644 --- a/advancecomp.spec +++ b/advancecomp.spec @@ -33,6 +33,16 @@ Provides: bundled(libdeflate) = 0.6 BuildRequires: pkgconfig(libdeflate) %endif +%if 0%{?el9} || 0%{?el8} || 0%{?el7} +# No libzopfli/zopfli-devel in these distributions +# Version number based on HISTORY, which mentions that upstream commit +# 6818a0859063b946094fb6f94732836404a0d89a was used from +# https://github.com/google/zopfli/. +Provides: bundled(zopfli) = 1.0.2%{?!el7:^20160527git6818a08} +%else +BuildRequires: zopfli-devel +%endif + %description AdvanceCOMP contains recompression utilities for your .zip archives, .png images, .mng video clips and .gz files. @@ -55,7 +65,7 @@ dos2unix -k doc/*.txt %if ! 0%{?el7} # Patch out bundled libdeflate rm -rvf libdeflate -sed -r -i '/libdeflate/d' Makefile.am +sed -r -i '/libdeflate[\/_]/d' Makefile.am # Fix up #include paths. The find-then-modify pattern keeps us from discarding # mtimes on any sources that do not need modification. find . -type f -exec gawk \ @@ -64,6 +74,21 @@ find . -type f -exec gawk \ xargs -r -t sed -r -i 's@^([[:blank:]]*#include.*)libdeflate/@\1@' %endif +%if !(0%{?el9} || 0%{?el8} || 0%{?el7}) +# Patch out bundled zopfli +rm -rvf zopfli +sed -r -i \ + -e '/zopfli[\/_]/d' \ + -e 's/((\(7z_SOURCES\)|WindowOut\.h).*)[[:blank:]]*\\/\1/' \ + Makefile.am +# Fix up #include paths. The find-then-modify pattern keeps us from discarding +# mtimes on any sources that do not need modification. +find . -type f -exec gawk \ + '/^[[:blank:]]*#include.*zopfli/ { print FILENAME; nextfile }' \ + '{}' '+' | + xargs -r -t sed -r -i -e 's@^([[:blank:]]*#include.*)zopfli/@\1@' +%endif + %build autoreconf --force --install --verbose @@ -79,6 +104,11 @@ export CXXFLAGS="$(pkgconf --cflags libdeflate) ${CXXFLAGS-}" export LDFLAGS="$(pkgconf --libs libdeflate) ${LDFLAGS-}" %endif +%if !(0%{?el9} || 0%{?el8} || 0%{?el7}) +# Link against system zopfli +export LDFLAGS="-lzopfli ${LDFLAGS-}" +%endif + %configure %make_build @@ -102,6 +132,7 @@ export LDFLAGS="$(pkgconf --libs libdeflate) ${LDFLAGS-}" - Convert URLs from HTTP to HTTPS - Use modern spec file macros (make_build/make_install/etc.) - Unbundle libdeflate +- Unbundle zopfli where it is available as a system library (i.e., Fedora) * Mon Jul 27 2020 Jeff Law - 2.1-15 - Force C++14 as the code is not ready for C++17