Blame 7zip.spec

7a25c7
#
7a25c7
# spec file for package 7zip
7a25c7
#
Bernhard M. Wiedemann 1cabc6
# Copyright (c) 2024 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
140660
%define stripped_version 2301
7a25c7
Name:           7zip
140660
Version:        23.01
7a25c7
Release:        0
Bernhard M. Wiedemann 1cabc6
Summary:        Command-line file archiver with high compression ratio
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
Bernhard M. Wiedemann 1cabc6
Source3:        7zz.1
541c82
Patch0:         fix-compatib-with-p7zip.patch
6217af
# PATCH-FIX-SUSE danilo.spinella@suse.com
6217af
# Fix build on SLE-15-SP6
6217af
# https://sourceforge.net/p/sevenzip/patches/420/
6217af
Patch1:         fix-avx-sle.patch
7a25c7
BuildRequires:  dos2unix
7a25c7
BuildRequires:  gcc
7a25c7
BuildRequires:  gcc-c++
408dbc
%ifarch x86_64 %ix86 %x86_64
15a42d
BuildRequires:  uasm
15a42d
%endif
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
0da4ce
%autosetup -p1 -c
0da4ce
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
140660
sed -i -e 's/-Waddress-of-packed-member//' -e 's/-Wcast-align=strict//' -e 's/-Wmissing-attributes//' 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
15a42d
sed -i 's/LFLAGS_ALL = -s/LFLAGS_ALL =/' CPP/7zip/7zip_gcc.mak
408dbc
%ifarch x86_64 %ix86 %x86_64
15a42d
sed -i 's/$(CXX) -o $(PROGPATH)/$(CXX) -Wl,-z,noexecstack -o $(PROGPATH)/' CPP/7zip/7zip_gcc.mak
15a42d
%endif
7a25c7
7a25c7
%build
15a42d
cd CPP/7zip/Bundles/Alone2
408dbc
%ifarch x86_64 %x86_64
15a42d
%make_build -f ../../cmpl_gcc_x64.mak MY_ASM=uasm
15a42d
%else
15a42d
%ifarch %ix86
15a42d
%make_build -f ../../cmpl_gcc_x86.mak MY_ASM=uasm
15a42d
%else
905946
%ifarch aarch64
905946
%make_build -f ../../cmpl_gcc_arm64.mak MY_ASM=gcc
905946
%else
15a42d
%make_build -f ../../cmpl_gcc.mak
15a42d
%endif
15a42d
%endif
905946
%endif
7a25c7
7a25c7
%install
408dbc
%ifarch x86_64 %x86_64
15a42d
install -Dm 755 CPP/7zip/Bundles/Alone2/b/g_x64/7zz %{buildroot}%{_bindir}/7zz
15a42d
%else
15a42d
%ifarch %ix86
15a42d
install -Dm 755 CPP/7zip/Bundles/Alone2/b/g_x86/7zz %{buildroot}%{_bindir}/7zz
15a42d
%else
905946
%ifarch aarch64
905946
install -Dm 755 CPP/7zip/Bundles/Alone2/b/g_arm64/7zz %{buildroot}%{_bindir}/7zz
905946
%else
15a42d
install -Dm 755 CPP/7zip/Bundles/Alone2/b/g/7zz %{buildroot}%{_bindir}/7zz
15a42d
%endif
15a42d
%endif
905946
%endif
Bernhard M. Wiedemann 1cabc6
Bernhard M. Wiedemann 1cabc6
# Create links for 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
Bernhard M. Wiedemann 1cabc6
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
Bernhard M. Wiedemann 1cabc6
# Install manpage for 7zz, and link 7z / 7za / 7zr accordingly
Bernhard M. Wiedemann 1cabc6
# This mimics the link structure used for the actual executables
Bernhard M. Wiedemann 1cabc6
install -m644 -Dt %{buildroot}%{_mandir}/man1 %{SOURCE3}
Bernhard M. Wiedemann 1cabc6
ln -s %{_mandir}/man1/7zz.1 %{buildroot}%{_mandir}/man1/7z.1
Bernhard M. Wiedemann 1cabc6
ln -s %{_mandir}/man1/7z.1 %{buildroot}%{_mandir}/man1/7za.1
Bernhard M. Wiedemann 1cabc6
ln -s %{_mandir}/man1/7z.1 %{buildroot}%{_mandir}/man1/7zr.1
Bernhard M. Wiedemann 1cabc6
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}
Bernhard M. Wiedemann 1cabc6
%{_mandir}/man1/7z.1%{?ext_man}
Bernhard M. Wiedemann 1cabc6
%{_mandir}/man1/7za.1%{?ext_man}
Bernhard M. Wiedemann 1cabc6
%{_mandir}/man1/7zr.1%{?ext_man}
Bernhard M. Wiedemann 1cabc6
%{_mandir}/man1/7zz.1%{?ext_man}
7a25c7
7a25c7
%changelog