1 # Build recipe for unzip.
3 # Copyright (c) 2017 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
22 # Set 'outdir' for a nice and well-organized output directory
23 outdir="${outdir}/${arch}/compressors"
25 tarname=${program}${version}.tar.gz
28 fetch=http://downloads.sourceforge.net/infozip/$tarname
31 A utility for extracting ZIP files.
33 UnZip is an extraction utility for archives compressed in .zip format
34 (also called \"zipfiles\"). Although highly compatible both with
35 PKWARE's PKZIP and PKUNZIP utilities for MS-DOS and with Info-ZIP's own
36 Zip program, our primary objectives have been portability and non-MSDOS
40 homepage=http://www.info-zip.org/UnZip.html
41 license="Custom, Info-Zip"
43 # Source documentation
44 docs="BUGS LICENSE README ToDo WHERE"
45 docsdir="${docdir}/${program}-${pkgversion}"
47 # Source directory for this software
48 srcdir=${program}${version}
54 unpack "${tardir}/$tarname"
58 # Set sane permissions
59 chmod -R u+w,go-w,a+rX-s .
61 # Apply patches from the Fedora project, thanks!
62 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-bzip2-configure.patch"
63 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-exec-shield.patch"
64 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-close.patch"
65 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-attribs-overflow.patch"
66 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-configure.patch"
67 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-manpage-fix.patch"
68 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-fix-recmatch.patch"
69 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-symlink.patch"
70 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-caseinsensitive.patch"
71 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-format-secure.patch"
72 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-valgrind.patch"
73 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-x-option.patch"
74 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-overflow.patch"
75 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-cve-2014-8139.patch"
76 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-cve-2014-8140.patch"
77 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-cve-2014-8141.patch"
78 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-overflow-long-fsize.patch"
79 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-heap-overflow-infloop.patch"
80 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-alt-iconv-utf8.patch"
81 patch -p1 < "${worktree}/patches/unzip/unzip-6.0-alt-iconv-utf8-print.patch"
82 patch -p1 < "${worktree}/patches/unzip/0001-Fix-CVE-2016-9844-rhbz-1404283.patch"
84 make -f unix/Makefile \
85 CF_NOOPT="-I. -DUNIX -DNOMEMCPY -DIZ_HAVE_UXUIDGID -DNO_LCHMOD" \
86 LFLAGS2="$QILDFLAGS -static" generic_gcc
88 make -f unix/Makefile \
89 prefix="${destdir}/usr" \
90 MANDIR="${destdir}/${mandir}/man1" \
94 # Reinclude zipgrep fixing its ownerships
95 rm -f "${destdir}/usr/bin/zipgrep"
96 cat unix/zipgrep > "${destdir}/usr/bin/zipgrep"
97 chmod 755 "${destdir}/usr/bin/zipgrep"
99 # Compress and link man pages (if needed)
100 if test -d "${destdir}/$mandir"
103 cd "${destdir}/$mandir"
104 find . -type f -exec lzip -9 '{}' +
105 find . -type l | while read -r file
107 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
114 mkdir -p "${destdir}${docsdir}"
118 cp -p $file "${destdir}${docsdir}"