advancecomp/advancecomp.spec
Benjamin A. Beasley 6fd5ef7304 Update License to SPDX
2022-09-28 14:19:53 -04:00

164 lines
5 KiB
RPMSpec

Name: advancecomp
Version: 2.1
Release: %autorelease
Summary: Recompression utilities for .png, .mng, .zip and .gz files
# Source file headers all specify GPL-2.0-or-later (see source file headers),
# except:
#
# The bundled and forked 7z (7-Zip code) in 7z/ is under the “LGPL” license.
# Based on https://www.7-zip.org/license.txt, and the absence of any mention
# of license changes in https://www.7-zip.org/history.txt, 7-Zip has always
# been licensed under LGPL-2.1-or-later, specifically; we thus assume this is
# the intended specific license for the contents of the 7z/ directory. None
# of the sources that would be covered by the “unRAR license restriction” or
# the BSD-3-Clause license for LZFSE are present in this fork.
#
# Certain build-system files, which do not contribute to the license of the
# binary RPM, are under other permissible licenses.
#
# However, in version 1.17, the COPYING file was updated to GPLv3, with a
# changelog message (in HISTORY and elsewhere) of “Changes to GPL3.” We
# interpret this as an overall license of GPL-3.0-only.
License: GPL-3.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later
URL: https://www.advancemame.it/
Source0: https://github.com/amadvance/advancecomp/releases/download/v%{version}/advancecomp-%{version}.tar.gz
# CVE-2019-8383 advancecomp: denial of service in function adv_png_unfilter_8
Patch0: advancecomp-CVE-2019-8383.patch
# CVE-2019-9210 advancecomp: integer overflow in png_compress in pngex.cc
Patch1: advancecomp-CVE-2019-9210.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: dos2unix
# System library supported by upstream
BuildRequires: zlib-devel
%if 0%{?el7}
# No libdeflate package in EPEL7
Provides: bundled(libdeflate) = 0.6
%else
# Unbundled downstream
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
# From 7z/README:
#
# This directory contains some source files from the
# 7z archive utility. (www.7-zip.org)
#
# All the files in this directory was originally released
# with the LGPL license.
#
# All the modifications made on the original files must
# be considered Copyright (C) 2002 Andrea Mazzoleni and
# released under the LGPL license.
#
# It is not clear which version was forked. Because 7-Zip does not provide a
# library, and because the implementation is modified, there is no possibility
# of unbundling. Note that this was forked from the original 7-Zip, not from
# p7zip.
Provides: bundled(7z)
%description
AdvanceCOMP contains recompression utilities for your .zip archives,
.png images, .mng video clips and .gz files.
The official site of AdvanceCOMP is:
https://www.advancemame.it
This package contains:
advzip - Recompression and test utility for zip files
advpng - Recompression utility for png files
advmng - Recompression utility for mng files
advdef - Recompression utility for deflate streams in .png, .mng and .gz files
%prep
%autosetup -p1
dos2unix -k doc/*.txt
%if ! 0%{?el7}
# Patch out bundled libdeflate
rm -rvf libdeflate
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 \
'/^[[:blank:]]*#include.*libdeflate/ { print FILENAME; nextfile }' \
'{}' '+' |
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
# error: ISO C++17 does not allow dynamic exception specifications
%set_build_flags
export CXXFLAGS="-std=gnu++14 ${CXXFLAGS-}"
%if ! 0%{?el7}
# Link against system libdeflate
export CFLAGS="$(pkgconf --cflags libdeflate) ${CFLAGS-}"
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
%install
%make_install
%files
%license COPYING
%doc AUTHORS HISTORY README
%doc doc/adv*.txt
%{_bindir}/*
%{_mandir}/man1/*
%changelog
%autochangelog