Blame 7zip.spec

7a25c7
#
7a25c7
# spec file for package 7zip
7a25c7
#
396e10
# Copyright (c) 2022 SUSE LLC
7a25c7
#
7a25c7
# All modifications and additions to the file contributed by third parties
7a25c7
# remain the property of their copyright owners, unless otherwise agreed
7a25c7
# upon. The license for this file, and modifications and additions to the
7a25c7
# file, is the same license as for the pristine package itself (unless the
7a25c7
# license for the pristine package is not an Open Source License, in which
7a25c7
# case the license is the MIT License). An "Open Source License" is a
7a25c7
# license that conforms to the Open Source Definition (Version 1.9)
7a25c7
# published by the Open Source Initiative.
7a25c7
7a25c7
# Please submit bugfixes or comments via https://bugs.opensuse.org/
7a25c7
#
7a25c7
7a25c7
471ead
%define stripped_version 2201
7a25c7
Name:           7zip
471ead
Version:        22.01
7a25c7
Release:        0
7a25c7
Summary:        File Archivier
7a25c7
# CPP/7zip/Compress/LzfseDecoder.cpp is under the BSD-3-Clause
7a25c7
# C/Sha1.c and C/Sha256.c are in the public domain
396e10
License:        BSD-3-Clause AND LGPL-2.1-or-later AND SUSE-Public-Domain
7a25c7
Group:          Productivity/Archiving/Compression
7a25c7
URL:            https://www.7-zip.org/
7a25c7
Source:         https://www.7-zip.org/a/7z%{stripped_version}-src.tar.xz
396e10
Source1:        p7zip
396e10
Source2:        p7zip.1
541c82
Patch0:         fix-compatib-with-p7zip.patch
7a25c7
BuildRequires:  dos2unix
7a25c7
BuildRequires:  gcc
7a25c7
BuildRequires:  gcc-c++
396e10
Conflicts:      p7zip
396e10
Conflicts:      p7zip-full
396e10
Provides:       p7zip = %{version}
396e10
Provides:       p7zip-full = %{version}
396e10
Obsoletes:      p7zip < %{version}
396e10
Obsoletes:      p7zip-full < %{version}
7a25c7
7a25c7
%description
7a25c7
This package contains the 7z command line utility for archiving and
7a25c7
extracting various formats.
7a25c7
7a25c7
%prep
396e10
tar xaf %{SOURCE0}
541c82
%patch0 -p1
7a25c7
dos2unix DOC/*.txt
7a25c7
# Remove executable perms from docs
7a25c7
chmod -x DOC/*.txt
7a25c7
7a25c7
# Remove -Werror to make build succeed
7a25c7
sed -i 's/-Werror//' CPP/7zip/7zip_gcc.mak
7a25c7
%if 0%{?suse_version} < 1550
7a25c7
# (gcc 7.x) Remove -Waddress-of-packed-member to make build succeed
7a25c7
sed -i -e 's/-Waddress-of-packed-member//' -e 's/-Wcast-align=strict//' C/warn_gcc.mak CPP/7zip/warn_gcc.mak
7a25c7
%endif
7a25c7
# Inject CFLAGS
7a25c7
sed -i 's/^ -fPIC/ -fPIC %{optflags}/' CPP/7zip/7zip_gcc.mak
7a25c7
7a25c7
%build
7a25c7
cd CPP/7zip//Bundles/Alone2
7a25c7
%make_build -f ../../cmpl_gcc.mak DISABLE_RAR_COMPRESS=1
7a25c7
7a25c7
%install
7a25c7
install -d -m 755 %{buildroot}%{_bindir}
7a25c7
install -Dt %{buildroot}%{_bindir} CPP/7zip/Bundles/Alone2/b/g/7zz
396e10
# Create links the executables provided by p7zip
396e10
ln -s %{_bindir}/7zz %{buildroot}%{_bindir}/7z
396e10
ln -s %{_bindir}/7z %{buildroot}%{_bindir}/7za
396e10
ln -s %{_bindir}/7z %{buildroot}%{_bindir}/7zr
396e10
# Install p7zip wrapper and its manpage
396e10
install -m755 %{SOURCE1} %{buildroot}%{_bindir}/p7zip
396e10
install -m644 -Dt %{buildroot}%{_mandir}/man1 %{SOURCE2}
396e10
# Remove a mention of the p7zip-rar package that we don't have
396e10
sed -i 's/RAR (if the non-free p7zip-rar package is installed)//g' %{buildroot}%{_mandir}/man1/p7zip.1
7a25c7
7a25c7
%files
7a25c7
%license DOC/copying.txt DOC/License.txt
7a25c7
%doc DOC/readme.txt DOC/7zC.txt DOC/Methods.txt DOC/src-history.txt
396e10
%{_bindir}/7z
396e10
%{_bindir}/7za
396e10
%{_bindir}/7zr
7a25c7
%{_bindir}/7zz
396e10
%{_bindir}/p7zip
396e10
%{_mandir}/man1/p7zip.1%{?ext_man}
7a25c7
7a25c7
%changelog