Unbundle zopfli where it is available as a system library (i.e., Fedora)

This commit is contained in:
Benjamin A. Beasley 2022-09-24 10:22:11 -04:00
commit 76de68a740

View file

@ -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)
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.1-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild