summaryrefslogtreecommitdiff
path: root/p7zip.spec
blob: ed5c4b5cf8e56d12c034a394073030bfbc3dd38f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Name:    p7zip
Version: 16.02
Release: 7
Summary: Very high compression ratio file archiver
License: LGPLv2 and (LGPLv2+ or CPL)
URL:	 https://sourceforge.net/projects/p7zip/
Source0: https://sourceforge.net/projects/p7zip/files/p7zip/%{version}/%{name}_%{version}_src_all.tar.bz2
Patch0:  CVE-2017-17969.patch
Patch1:  CVE-2016-9296.patch
Patch2:  CVE-2018-5996.patch
Patch3:  CVE-2018-10115.patch
Patch4:  fix-build-failed-with-gcc-10.patch
Patch5:  0001-add-PIE-compiler-options.patch

BuildRequires: gcc-c++
%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/.

%prep
%autosetup -n %{name}_%{version} -p1

# move license files
mv DOC/License.txt DOC/copying.txt .

%build
%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 \
    OPTFLAGS="%{build_cxxflags}" \
    LDFLAGS="%{build_ldflags}" \
    DEST_HOME=%{_prefix} \
    DEST_BIN=%{_bindir} \
    DEST_SHARE=%{_libexecdir}/p7zip \
    DEST_MAN=%{_mandir}

%check
%make_build test OPTFLAGS="%{build_cxxflags}" LDFLAGS="%{build_ldflags}"

%install
make install \
    DEST_DIR=%{buildroot} \
    DEST_HOME=%{_prefix} \
    DEST_BIN=%{_bindir} \
    DEST_SHARE=%{_libexecdir}/p7zip \
    DEST_MAN=%{_mandir}
 
# remove redundant DOC dir
mv %{buildroot}%{_docdir}/p7zip/DOC/* %{buildroot}%{_docdir}/p7zip
rmdir %{buildroot}%{_docdir}/p7zip/DOC/

%files
%{_docdir}/p7zip
%doc contrib/
%license copying.txt License.txt
%{_bindir}/7za
%{_bindir}/7z
%dir %{_libexecdir}/p7zip/
%{_libexecdir}/p7zip/7za
%{_libexecdir}/p7zip/7z
%{_libexecdir}/p7zip/7z.so
%{_libexecdir}/p7zip/7zCon.sfx
%{_libexecdir}/p7zip/Codecs
#{_libexecdir}/p7zip/Formats/
%{_mandir}/man1/7za.1*
%{_mandir}/man1/7z.1*
%exclude %{_mandir}/man1/7zr.1*

%changelog
* Sun Jan 05 2025 Liu Fushou <liufushou@live.cn> - 16.02-7
- Add 7z binary for extracting rar files

* Sat Aug 31 2024 Funda Wang <fundawang@yeah.net> - 16.02-6
- use correct build flags

* Tue Jun 06 2023 chenchen <chen_aka_jan@163.com> - 16.02-5
- add PIE compiler options

* Fri Jul 30 2021 sunguoshuai <sunguoshuai@huawei.com> - 16.02-4
- fix build failed with gcc 10

* Sat Jul 10 2021 wangyue <wangyue92@huawei.com> - 16.02-3
- Add gcc-c++ to build dependency

* Tue Jun 08 2021 wangyue <wangyue92@huawei.com> - 16.02-2
- Fix CVE-2016-9296 CVE-2017-17969 CVE-2018-10115 CVE-2018-5996

* Tue Jan 26 2021 Wei Xiong <myeuler@163.com>
- Package init