File p7zip.spec of Package p7zip.34729
#
# spec file for package p7zip
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: p7zip
Version: 9.20.1
Release: 0
Summary: 7-zip file compression program
License: LGPL-2.1-or-later
Group: Productivity/Archiving/Compression
URL: http://p7zip.sourceforge.net/
# Source: http://switch.dl.sourceforge.net/sourceforge/%{name}/%{name}_%{version}_src_all.tar.bz2
# Update note: RAR sources need to be removed from the package because of the incompatible licence
# Run the following commands after each package update to remove them
# export VERSION=9.20.1
# wget http://downloads.sourceforge.net/project/p7zip/p7zip/${VERSION}/p7zip_${VERSION}_src_all.tar.bz2
# tar xjvf p7zip_${VERSION}_src_all.tar.bz2
# rm -rf p7zip_${VERSION}/CPP/7zip/Compress/Rar*
# rm -rf p7zip_${VERSION}/DOCS/unRarLicense.txt
# tar cjvf p7zip_${VERSION}_src_all-norar.tar.bz2 p7zip_${VERSION}
# rm -rf p7zip_${VERSION}_src_all.tar.bz2
Source: p7zip_%{version}_src_all-norar.tar.bz2
Patch0: p7zip-CVE-2015-1038.patch
# PATCH-FIX-UPSTREAM bnc#979823 kstreitova@suse.com -- out-of-bounds read vulnerability
Patch1: p7zip-9.20.1-CVE-2016-2335.patch
# PATCH-FIX-SUSE bnc#1077978 kstreitova@suse.com -- adjust makefile not to use CPP/7zip/Compress/Rar* files
Patch2: p7zip_9.20.1_norar.patch
# PATCH-FIX-UPSTREAM bnc#1077725 kstreitova@suse.com -- fix heap-based buffer overflow in a shrink decoder
Patch3: p7zip-9.20.1-CVE-2017-17969.patch
# PATCH-FIX-UPSTREAM bnc#984650 kstreitova@suse.com -- fix crashes when processing 7z files
Patch4: p7zip-9.20.1-CVE-2016-1372.patch
Patch5: CVE-2023-52168.patch
Patch6: CVE-2023-52169.patch
BuildRequires: gcc-c++
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1100
BuildRequires: fdupes
%endif
%description
p7zip is a quick port of 7z.exe and 7za.exe (command line version of
7zip, see www.7-zip.org) for Unix. 7-Zip is a file archiver with
highest compression ratio. Since 4.10, p7zip (like 7-zip) supports
little-endian and big-endian machines.
%prep
%setup -q -n %{name}_%{version}
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%ifarch x86_64
cp makefile.linux_amd64_asm makefile.machine
%endif
%ifarch ppc64 s390x
cp makefile.linux_amd64 makefile.machine
%else
cp makefile.linux_any_cpu_gcc_4.X makefile.machine
%endif
sed -i s,444,644,g install.sh
sed -i s,555,755,g install.sh
perl -pi -e 's/ -s / /' makefile.machine
perl -pi -e 's/(\$\(LOCAL_FLAGS\))/'"%{optflags}"' \\\n\t$1/' makefile.machine
%build
%ifarch aarch64
make %{?_smp_mflags} OPTFLAGS="%{optflags} -fno-strict-aliasing -Wl,-z,now -fPIC -pie" all2
%else
make %{?_smp_mflags} all2
%endif
%install
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}%{_mandir}/man1
./install.sh \
%{_bindir} \
%{_libdir}/%{name} \
%{_mandir} \
%{_defaultdocdir}/%{name} \
%{buildroot}
%if 0%{?suse_version} > 1100
%fdupes -s %{buildroot}
%endif
%check
%if ! 0%{?qemu_user_space_build}
make test
make test_7z
%endif
%files
%defattr(-,root,root)
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/[0-9a-z]*
%{_bindir}/7z
%{_bindir}/7za
%doc %{_defaultdocdir}/%{name}
%{_mandir}/man1/*
%changelog