A new user interface for you! Read more...

File p7zip-16.spec of Package p7zip-16

#
# spec file for package p7zip
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%if 0%{?suse_version} >= 1320 || 0%{?is_opensuse}
%bcond_with     buildgui
%endif
Name:           p7zip-16
Version:        16.02
Release:        0
Summary:        7-zip file compression program
License:        LGPL-2.1+
Group:          Productivity/Archiving/Compression
Url:            http://p7zip.sourceforge.net/
Source:         http://downloads.sourceforge.net/project/p7zip/p7zip/%{version}/p7zip_%{version}_src_all.tar.bz2
Patch1:         CVE-2016-9296.patch
BuildRequires:  gcc-c++
BuildRoot:      %{_tmppath}/p7zip-%{version}-build
%if %{with buildgui}
BuildRequires:  cmake
BuildRequires:  hicolor-icon-theme
BuildRequires:  kf5-filesystem
BuildRequires:  ninja
BuildRequires:  wxWidgets-devel < 3.0
%endif
%ifarch x86_64
BuildRequires:  yasm
%endif
%if 0%{?suse_version} > 1100
BuildRequires:  fdupes
%endif
Provides:       p7zip = %{version}
%if 0%{?suse_version} > 1110
Conflicts:      p7zip
%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.

%if %{with buildgui}
%package gui
Summary:        GUI for 7-zip file compression program
Group:          Productivity/Archiving/Compression
Requires:       p7zip = %{version}
Requires:       kf5-filesystem
Requires(post): hicolor-icon-theme
Requires(post): update-desktop-files
Requires(postun): hicolor-icon-theme
Requires(postun): update-desktop-files

%description gui
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.
%endif

%prep
%setup -q -n p7zip_%{version}
%patch1 -p1

%ifarch x86_64
cp makefile.linux_amd64_asm makefile.machine
%else
%ifarch ppc64 s390x
cp makefile.linux_amd64 makefile.machine
%else
cp makefile.linux_any_cpu_gcc_4.X makefile.machine
%endif
%endif

sed -i s,444,644,g install.sh
sed -i s,555,755,g install.sh
%if %{with buildgui}
chmod 755 CPP/7zip/CMAKE/generate.sh
rm GUI/kde4/p7zip_compress2.desktop
%endif

perl -pi -e 's/ -s / /' makefile.machine
perl -pi -e 's/(\$\(LOCAL_FLAGS\))/'"%{optflags} -fno-strict-aliasing"' \\\n\t$1/' makefile.machine

%build
%if %{with buildgui}
pushd CPP/7zip/CMAKE/
./generate.sh
popd
make %{?_smp_mflags} OPTFLAGS="%{optflags} -fno-strict-aliasing -Wl,-z,now -fPIC -pie" all2 7zG
%else
make %{?_smp_mflags} OPTFLAGS="%{optflags} -fno-strict-aliasing -Wl,-z,now -fPIC -pie" all2
%endif

%install
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}%{_mandir}/man1
./install.sh \
    %{_bindir} \
    %{_libdir}/p7zip \
    %{_mandir} \
    %{_defaultdocdir}/p7zip \
    %{buildroot}
%if %{with buildgui}
mkdir -p %{buildroot}%{_kf5_servicesdir}/ServiceMenus
for i in 16x16 32x32; do
  mkdir -p %{buildroot}%{_datadir}/icons/hicolor/$i/apps
done
install -m644 GUI/kde4/*.desktop %{buildroot}%{_kf5_servicesdir}/ServiceMenus
install -m644 GUI/p7zip_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/p7zip.png
install -m644 GUI/p7zip_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/p7zip.png
chmod 755 %{buildroot}%{_bindir}/p7zipForFilemanager
%endif
%if 0%{?suse_version} > 1100
%fdupes -s %{buildroot}
%endif

%check
%if ! 0%{?qemu_user_space_build}
make %{?_smp_mflags} test
make %{?_smp_mflags} test_7z
%endif

%if %{with buildgui}
%post gui
%desktop_database_post
%icon_theme_cache_post

%postun gui
%desktop_database_postun
%icon_theme_cache_postun
%endif

%files
%defattr(-,root,root)
%doc %{_defaultdocdir}/p7zip
%dir %{_libdir}/p7zip
%dir %{_libdir}/p7zip/Codecs
%{_libdir}/p7zip/[0-9a-z]*
%{_libdir}/p7zip/Codecs/*
%{_bindir}/7z
%{_bindir}/7za
#%doc ChangeLog DOC/*.txt
%{_mandir}/man1/*
%if %{with buildgui}
%exclude %{_libdir}/p7zip/7zG
%endif

%if %{with buildgui}
%files gui
%defattr(-,root,root)
%{_bindir}/7zG
%{_bindir}/p7zipForFilemanager
%{_libdir}/p7zip/7zG
%dir %{_libdir}/p7zip/Lang
%{_libdir}/p7zip/Lang/*.txt
%{_libdir}/p7zip/Lang/en.ttt
%{_datadir}/icons/hicolor/*/apps/p7zip.png
%dir %{_kf5_servicesdir}/ServiceMenus
%{_kf5_servicesdir}/ServiceMenus/*.desktop
%endif

%changelog