%if 0%{?rhel} && ! 0%{?epel} %bcond_with gui %else %bcond_without gui %endif %define enable_7zfm %{nil} %define enable_7zfm 1 %define wx_version_major 2 %define wx_version_minor 8 %define wx_version %{wx_version_major}.%{wx_version_minor} %define force_wx_gtk2 %{nil} %define force_wx_gtk2 0 %define force_cmake3 %{nil} %define force_cmake3 1 %define without_unrar %{nil} %define without_unrar 1 ################################################################################ %define cmake3_package cmake %if 0%{?rhel}%{?fedora} %if 0%{?rhel} %if 0%{?rhel} <= 7 %define cmake3_package cmake3 %endif %endif %endif %define wx_name_postfix %{nil} %if 0%{?wx_version_major} >= 3 %if 0%{?wx_version_minor} == 0 %define wx_name_postfix %{wx_version_major} %else %define wx_name_postfix %{wx_version_major}%{wx_version_minor} %endif %endif # Force toolkit # e.g. gtk2 instead of gtk3 %define wx_toolkit %{nil} %if 0%{?force_wx_gtk2} %if 0%{?wx_version_major} >= 3 %if 0%{?wx_version_minor} == 0 %define wx_toolkit gtk2 %endif %endif %endif %define enable_test %{nil} %define enable_test 1 %if 0%{?rhel}%{?fedora} %if 0%{?rhel} %if 0%{?rhel} < 7 %define enable_test 0 %endif %else %if 0%{?fedora} < 19 %define enable_test 0 %endif %endif %endif %undefine update_mime_database_n %if 0%{?fedora}%{?rhel} %define update_mime_database_n 1 %endif %define doc_license %{nil} %define doc_license 1 %if 0%{?rhel}%{?fedora} %if 0%{?rhel} %if 0%{?rhel} < 7 %define doc_license 0 %endif %else %if 0%{?fedora} < 19 %define doc_license 0 %endif %endif %endif %define license_files copying.txt License.txt Summary: Very high compression ratio file archiver Name: p7zip Version: 16.02 Release: 11%{?dist} # Files under C/Compress/Lzma/ are dual LGPL or CPL License: LGPLv2 and (LGPLv2+ or CPL) Group: Applications/Archiving URL: http://p7zip.sourceforge.net/ %if 0%{?without_unrar} # RAR sources removed since their license is incompatible with the LGPL #Source: http://downloads.sf.net/p7zip/p7zip_%%{version}_src_all.tar.bz2 # export VERSION=16.02 # wget http://downloads.sf.net/p7zip/p7zip_${VERSION}_src_all.tar.bz2 # tar xjvf "p7zip_${VERSION}_src_all.tar.bz2" # rm -rf "p7zip_${VERSION}/CPP/7zip"/{Archive,Compress,Crypto,QMAKE}/Rar* # rm "p7zip_${VERSION}/DOC/unRarLicense.txt" # tar --numeric-owner -cjvf "p7zip_${VERSION}_src_all-norar.tar.bz2" "p7zip_${VERSION}" Source: p7zip_%{version}_src_all-norar.tar.bz2 %else Source: http://downloads.sf.net/p7zip/p7zip_%{version}_src_all.tar.bz2 %endif # https://aur.archlinux.org/cgit/aur.git/plain/7zFM.desktop?h=p7zip-gui Source1: 7zFM.desktop Patch0: p7zip_15.14-norar_cmake.patch # from Debain Patch4: p7zip-manpages.patch Patch5: 02-man.patch Patch6: CVE-2016-9296.patch Patch7: 05-hardening-flags.patch Patch10: CVE-2017-17969.patch Patch11: 14-Fix-g++-warning.patch %if 0%{?force_cmake3} BuildRequires: %{cmake3_package} %else BuildRequires: cmake %endif %if %{with gui} # for 7zG GUI #BuildRequires: wxGTK-devel BuildRequires: kde-filesystem %if "%{?wx_toolkit}" != "" BuildRequires: compat-wxGTK%{?wx_name_postfix}-%{wx_toolkit}-devel %else BuildRequires: wxGTK%{?wx_name_postfix}-devel %endif # endif for with gui %endif %ifarch %{ix86} BuildRequires: nasm %endif %ifarch x86_64 BuildRequires: yasm %endif %description p7zip is a port of 7za.exe for Unix. 7-Zip is a file archiver with a very high compression ratio. The original version can be found at http://www.7-zip.org/. %package plugins Summary: Additional plugins for p7zip Group: Applications/Archiving %description plugins Additional plugins that can be used with 7z to extend its abilities. This package contains also a virtual file system for Midnight Commander. %if %{with gui} %package gui Summary: 7zG - 7-Zip GUI version Requires: kde-filesystem Requires: p7zip-plugins %description gui 7zG is a gui provide by p7zip and it is now in beta stage. Also add some context menus for KDE4. This package is *experimental*. %endif %package doc Summary: Manual documentation and contrib directory BuildArch: noarch %description doc This package contains the p7zip manual documentation and some code contributions. %prep #%%autosetup -p1 -n "%{name}_%{version}" %setup -q -n %{name}_%{version} %if 0%{?without_unrar} %patch0 -p1 -b .norar_cmake %endif %patch4 -p1 -b .manpages %patch5 -p1 -b .man %patch6 -p1 -b .CVE-2016-9296 %patch7 -p1 -b .hardening %patch10 -p1 -b .CVE-2017-17969 %patch11 -p1 -b .gpp-warning # copy 7zFM desktop file to the build directory %{__cp} %{SOURCE1} . ## Remove backups from DOC directory #rm DOC/License.txt.* # move license files mv "DOC/License.txt" "DOC/copying.txt" . # no need anymore ## And fix useless executable bit while we're at it #find "docs" -type f -exec chmod -x {} \; #find "contrib" -type f -exec chmod -x {} \; %build %if 0%{wx_version_major} < 3 WXCONFIG="wx-config" %else WXCONFIG="wx-config-%{wx_version}" %endif export WXCONFIG %if "%{?wx_toolkit}" != "" if hash "${WXCONFIG}-%{?wx_toolkit}" >/dev/null 2>&1 ; then WXCONFIG="${WXCONFIG}-%{?wx_toolkit}" export WXCONFIG fi %endif # which(1) is an external program used to search PATH for an executable. # It behaves differently on different systems # and you can't rely on a useful exit code # use (from most to least portable) # ''command -v'' or ''type -P'' (to find the path) # or ''hash'' (to check) instead. # See http://mywiki.wooledge.org/BashFAQ/081 export WXCONFIG_PATH="$( command -v "${WXCONFIG}" 2>/dev/null )" # https://public.kitware.com/Bug/view.php?id=15540#c38641 # # Before: # -- Could NOT find wxWidgets (missing: wxWidgets_FOUND) # Warning : wxWidgets not found # # # After: # -- Found wxWidgets: -pthread;;;-lwx_gtk2u_core-3.0-gtk2;-lwx_baseu-3.0-gtk2;-lwx_gtk2u_adv-3.0-gtk2 (found version "3.0.2") find * -xtype f -name 'CMakeLists.txt' | xargs -I{} sed -i -re "/^[[:blank:]]*find_package\(wxWidgets[[:blank:]]/ {s|^|SET\(wxWidgets_CONFIG_EXECUTABLE \"${WXCONFIG_PATH}\"\)\n|;:a;n;ba}" '{}' # /bin/sh: wx-config: command not found find * -xtype f -iname 'makefile' | xargs -I{} sed -i -re "s|([^[:alnum:]-])wx-config([[:blank:]])|\1${WXCONFIG}\2|" '{}' pushd "CPP/7zip/CMAKE/" %if 0%{?force_cmake3} # change cmake to cmake3 sed -i -re 's/(^|[[:blank:]])(cmake)([[:blank:]])/\1\23\3/' generate.sh %endif sh ./generate.sh popd %ifarch %{ix86} cp -f "makefile.linux_x86_asm_gcc_4.X" "makefile.machine" %endif %ifarch x86_64 cp -f "makefile.linux_amd64_asm" "makefile.machine" %endif %ifarch ppc ppc64 cp -f "makefile.linux_any_cpu_gcc_4.X" "makefile.machine" %endif %make_build all2 \ %if %{with gui} 7zG \ %if 0%{?enable_7zfm} 7zFM \ %endif %endif OPTFLAGS="%{optflags}" \ DEST_HOME="%{_prefix}" \ DEST_BIN="%{_bindir}" \ DEST_SHARE="%{_libexecdir}/p7zip" \ DEST_MAN="%{_mandir}" \ %{nil} %install %{__make} install \ DEST_DIR="%{buildroot}" \ DEST_HOME="%{_prefix}" \ DEST_BIN="%{_bindir}" \ DEST_SHARE="%{_libexecdir}/p7zip" \ DEST_MAN="%{_mandir}" \ %{nil} %if %{with gui} # 7zFM %if 0%{?enable_7zfm} if [[ ! -f "bin/7zFM" ]]; then if [[ -f "bin/7zFM_do_not_use" ]]; then %{__cp} "bin/7zFM_do_not_use" "bin/7zFM" fi fi if [[ ! -f "%{buildroot}%{_libexecdir}/p7zip/7zFM" ]]; then %{__install} -p -m 0755 "bin/7zFM" "%{buildroot}%{_libexecdir}/p7zip/" fi if [[ ! -f "%{buildroot}%{_bindir}/7zFM" ]]; then if [[ -f "%{buildroot}%{_bindir}/7z" ]]; then %{__cp} "%{buildroot}%{_bindir}/7z" "%{buildroot}%{_bindir}/7zFM" sed -i -re 's|^"((/[^/]+)*/7z)"|"\1FM"|' "%{buildroot}%{_bindir}/7zFM" fi fi # desktop file %{__install} -D -p -m 644 "%{basename:%{SOURCE1}}" "%{buildroot}%{_datadir}/applications/%{basename:%{SOURCE1}}" %endif # icons for s in {16,32} ; do %{__install} -D -p -m 644 "GUI/%{name}_${s}.png" "%{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/%{name}.png" done # endif for with gui %endif # remove redundant DOC dir mv "%{buildroot}%{_docdir}/p7zip/DOC"/* "%{buildroot}%{_docdir}/p7zip" rmdir "%{buildroot}%{_docdir}/p7zip/DOC/" %if %{with gui} mkdir -p "%{buildroot}%{_kde4_datadir}/kde4/services/ServiceMenus/" # remove a duplicated of p7zip_compress.desktop rm "GUI/kde4/p7zip_compress2.desktop" cp "GUI/kde4"/*.desktop "%{buildroot}%{_kde4_datadir}/kde4/services/ServiceMenus/" #fix non-executable-in-bin chmod +x "%{buildroot}%{_bindir}/p7zipForFilemanager" %endif %check %if 0%{?enable_test} %{__make} test %endif # Next test fails, because we don't have X11 envoirment ... # Error: Unable to initialize gtk, is DISPLAY set properly? #make test_7zG || : %postun /sbin/ldconfig %post /sbin/ldconfig %postun plugins /sbin/ldconfig %post plugins /sbin/ldconfig %if %{with gui} %post gui /bin/touch --no-create "%{_datadir}/icons/hicolor" &>/dev/null || : /usr/bin/update-mime-database "%{_datadir}/mime" &> /dev/null || : update-desktop-database &> /dev/null || : /sbin/ldconfig %postun gui if [[ "${1}" -eq "0" ]] ; then /bin/touch --no-create "%{_datadir}/icons/hicolor" &>/dev/null /usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &>/dev/null || : /usr/bin/update-mime-database "%{_datadir}/mime" &> /dev/null || : fi update-desktop-database &> /dev/null || : /sbin/ldconfig %posttrans gui /usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &>/dev/null || : /usr/bin/update-mime-database %{?update_mime_database_n:-n} %{_datadir}/mime &> /dev/null || : %endif %files %{_docdir}/p7zip %exclude %{_docdir}/p7zip/MANUAL %if 0%{?doc_license} %license %{license_files} %else %doc %{license_files} %endif %{_bindir}/7za %dir %{_libexecdir}/p7zip/ %{_libexecdir}/p7zip/7za %{_libexecdir}/p7zip/7zCon.sfx %{_mandir}/man1/7za.1* %exclude %{_mandir}/man1/7zr.1* %files plugins %doc contrib/ %{_bindir}/7z %dir %{_libexecdir}/p7zip/ %{_libexecdir}/p7zip/7z %{_libexecdir}/p7zip/7z.so #{_libexecdir}/p7zip/Codecs/ #{_libexecdir}/p7zip/Formats/ %if %{?without_unrar} %else %{_libexecdir}/p7zip/Codecs/ %endif %{_mandir}/man1/7z.1* %if %{with gui} %files gui %{_bindir}/7zG %if 0%{?enable_7zfm} %{_bindir}/7zFM %endif %{_bindir}/p7zipForFilemanager %{_libexecdir}/p7zip/7zG %if 0%{?enable_7zfm} %{_libexecdir}/p7zip/7zFM %endif %{_libexecdir}/p7zip/Lang %{_kde4_datadir}/kde4/services/ServiceMenus/*.desktop %if 0%{?enable_7zfm} %{_datadir}/applications/%{basename:%{SOURCE1}} %endif %{_datadir}/icons/hicolor/*/apps/* %endif %files doc %{_docdir}/p7zip/MANUAL %doc contrib/ %changelog * Fri Mar 02 2018 Tomasz Tomasik - 16.02-11 - Backport changes from: - Wed Jan 24 2018 Tomas Hoger - 16.02-7 - Wed Jan 24 2018 Sérgio Basto - 16.02-8 - Sat Jan 27 2018 Sérgio Basto - 16.02-9 - Tue Feb 06 2018 Sérgio Basto - 16.02-10 - Rebuilt for EL7 * Thu Nov 02 2017 Tomasz Tomasik - 16.02-10 - Add post, postun and posttrans sections - Add icons - Rebuilt for EL7 * Wed Nov 01 2017 Tomasz Tomasik - 16.02-9 - Return to wxGTK 2.8 - Add 7zFM desktop file - Add option to build with unrar (disabled) - Rebuilt for EL7 (without unrar) * Wed Nov 01 2017 Tomasz Tomasik - 16.02-8 - Rebuilt against wxGTK 3.0 (instead of wxGTK 2.8) - Rebuilt for EL7 * Wed Nov 01 2017 Tomasz Tomasik - 16.02-7 - Add a few changes to the SPEC file - Enable 7zFM - Set wxWidgets_CONFIG_EXECUTABLE in each CMakeLists.txt file that requires wxWidgets - Fix makefiles - Rebuilt for EL7 * Sun Sep 10 2017 Vasiliy N. Glazov - 16.02-6 - Cleanup spec * Thu Aug 03 2017 Fedora Release Engineering - 16.02-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild * Thu Jul 27 2017 Fedora Release Engineering - 16.02-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Sat Feb 11 2017 Fedora Release Engineering - 16.02-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Mon Nov 21 2016 Sérgio Basto - 16.02-2 - Security fix for CVE-2016-9296 * Mon Jul 18 2016 Sérgio Basto - 16.02-1 - Update p7zip to 16.02 and fix security issues * Sun Mar 27 2016 Sérgio Basto - 15.14.1-1 - Update to 15.14.1 - Revert 7zFM build, upstream recomends not build it http://sourceforge.net/p/p7zip/bugs/175/ * Thu Mar 17 2016 Sérgio Basto - 15.14-2 - Fix non-executable-in-bin for p7zipForFilemanager. - Remove p7zip_compress2.desktop to not duplicate the menu entries. - Also build 7zFM, rebuild p7zip_15.14_src_all-norar.tar.bz2, to build 7zFM instead 7zFM_do_not_use. * Tue Mar 15 2016 Sérgio Basto - 15.14-1 - Update to 15.14 . - Rebase norar_cmake.patch - Minor improvement in snippet of documentation. - Drop patch1, from changelog build on s390 is fixed. - Drop p7zip-15.09-CVE-2015-1038.patch, from changelog if fixed. - Drop upstreamed p7zip_15.09-incorrect-fsf-address.patch . - Drop p7zip_15.09-no7zG_and_7zFM.patch, p7zip build is fixed. - Add sub-package p7zip-gui with 7zG. * Thu Feb 04 2016 Fedora Release Engineering - 15.09-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Mon Jan 25 2016 Sérgio Basto - 15.09-9 - Add 02_man.patch from Debian * Fri Jan 22 2016 Sérgio Basto - 15.09-8 - Revert better solutions for "create unowned directory" * Fri Jan 22 2016 Sérgio Basto - 15.09-7 - Split incorrect-fsf-address.patch and do not pack backup files * Fri Jan 22 2016 Sérgio Basto - 15.09-6 - Stating in License.txt file that we removed non-Free unrar code from sources (#190277) - Fix incorrect fsf address in the license files. - Add p7zip_15.09-no7zG_and_7zFM.patch in a diferent patch. * Fri Jan 22 2016 Sérgio Basto - 15.09-5 - Add license tag - better solutions for "create unowned directory" (#917366) * Thu Dec 03 2015 Sérgio Basto - 15.09-4 - Fix CVE-2015-1038 (#1179505) * Wed Dec 02 2015 Sérgio Basto - 15.09-3 - Fix build on s390 architecture (#1286992) * Thu Nov 12 2015 Sérgio Basto - 15.09-2 - fix rhbz #917366 * Thu Nov 05 2015 Sérgio Basto - 15.09-1 - Update to p7zip_15.09 - Use cmake. - Refactor norar patch. - Deleted: p7zip_9.20.1-execstack.patch (upstreamed) - Deleted: p7zip_9.20.1-install.patch (upstreamed) - Deleted: p7zip_9.20.1-nostrip.patch (upstreamed) * Thu Jun 18 2015 Fedora Release Engineering - 9.20.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Sat May 02 2015 Kalev Lember - 9.20.1-9 - Rebuilt for GCC 5 C++11 ABI change * Sun Aug 17 2014 Fedora Release Engineering - 9.20.1-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild * Fri Jun 06 2014 Fedora Release Engineering - 9.20.1-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Sat Aug 03 2013 Fedora Release Engineering - 9.20.1-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Thu Feb 14 2013 Fedora Release Engineering - 9.20.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Fri Jul 20 2012 Fedora Release Engineering - 9.20.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Fri Jan 13 2012 Fedora Release Engineering - 9.20.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Tue Jul 26 2011 Matthias Saou 9.20.1-2 - Execstack patch to fix what's wanted by the yasm code (#718778). * Tue Jul 26 2011 Matthias Saou 9.20.1-1 - Update to 9.20.1 (#688564). - Update norar, nostrip and install patches. - Minor clean ups : Don't use trivial macros + new email address. - Don't require the main package from the plugins package (#690551). - Use the any_cpu_gcc_4.X makefile for ppc* since the ppc specific one is gone. * Tue Feb 08 2011 Fedora Release Engineering - 9.13-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Thu Jul 8 2010 Matthias Saou 9.13-1 - Update to 9.13. - Update norar and nostrip patches. * Tue Dec 8 2009 Matthias Saou 9.04-1 - Update to 9.04. - Update norar patch. * Sat Jul 25 2009 Fedora Release Engineering - 4.65-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild * Sun Apr 12 2009 Matthias Saou 4.65-1 - Update to 4.65. - Update norar patch. * Thu Feb 26 2009 Fedora Release Engineering - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild * Tue Dec 23 2008 Matthias Saou 4.61-1 - Update to 4.61. - Update norar patch. - Use asm for x86 too (nasm). * Wed Jun 18 2008 Matthias Saou 4.58-1 - Update to 4.58. - Update norar patch. - Update install patch. * Tue Feb 19 2008 Fedora Release Engineering - Autorebuild for GCC 4.3 * Wed Aug 22 2007 Matthias Saou 4.51-3 - Rebuild for new BuildID feature. * Thu Aug 9 2007 Matthias Saou 4.51-2 - Update License field some more (LGPL+ to LGPLv2+). * Sun Aug 5 2007 Matthias Saou 4.51-1 - Update to 4.51. - Update License field. * Tue Jun 19 2007 Matthias Saou 4.47-1 - Update to 4.47. - Include now required patch to exclude removed Rar bits from makefiles. - Switch to using "make install" for installation... so patch and hack. - Use the asm makefile for x86_64, so build require yasm for it too. - Add ppc64 to the main %%ifarch. - Remove no longer included Codecs and Formats dirs (7z.so replaces them?). - Remove our wrapper scripts, since the install script creates its own. * Thu Mar 1 2007 Matthias Saou 4.44-2 - Remove _smp_mflags since some builds fail with suspicious errors. * Thu Mar 1 2007 Matthias Saou 4.44-1 - Update to 4.44. * Mon Aug 28 2006 Matthias Saou 4.42-2 - FC6 rebuild. * Thu Jun 29 2006 Matthias Saou 4.42-1 - Update to 4.42. * Tue May 2 2006 Matthias Saou 4.39-1 - Update to 4.39. - Remove no longer needed gcc 4.1 patch. - Use the gcc_4.X makefile. - Remove RAR licensed files and RAR license itself (#190277). * Mon Mar 6 2006 Matthias Saou 4.30-3 - FC5 rebuild. * Thu Feb 9 2006 Matthias Saou 4.30-2 - Rebuild for new gcc/glibc. - Include gcc 4.1 patch for extra qualification errors. * Mon Nov 28 2005 Matthias Saou 4.30-1 - Update to 4.30. * Thu Oct 27 2005 Matthias Saou 4.29-3 - Double quote args passed inside the shell scripts, to fix #171480. * Mon Oct 10 2005 Matthias Saou 4.29-2 - Update to 4.29. * Sun Jun 05 2005 Dag Wieers - 4.20-1 - Updated to release 4.20. * Sun Apr 10 2005 Dag Wieers - 4.16-1 - Moved inline scripts to %%prep stage. - Removed quotes for $@ as it should not be necessary. * Thu Mar 17 2005 Matthias Saou 4.14.01-1 - Spec file cleanup. - Fix wrapper scripts : Double quote $@ for filenames with spaces to work. - Move files from /usr/share to /usr/libexec. - Various other minor changes. * Mon Jan 24 2005 Marcin Zajączkowski - upgraded to 4.14.01 * Sun Jan 16 2005 Marcin Zajączkowski - upgraded to 4.14 * Mon Dec 20 2004 Marcin Zajączkowski - added 7za script and moved SFX module to _datadir/name/ to allow 7za & 7z use it simultaneously - returned to plugins in separate package * Sat Dec 18 2004 Charles Duffy - upgraded to 4.13 - added 7z (not just 7za) with a shell wrapper - added gcc-c++ to the BuildRequires list * Sat Nov 20 2004 Marcin Zajączkowski - upgraded to 4.12 - added virtual file system for Midnight Commander * Thu Nov 11 2004 Marcin Zajączkowski - upgraded to 4.10 - plugins support was dropped out from p7zip * Sun Aug 29 2004 Marcin Zajączkowski - initial release