recipe 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # Build recipe for unzip.
  2. #
  3. # Copyright (c) 2017 Matias Fonzo, <selk@dragora.org>.
  4. #
  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
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  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.
  16. program=unzip
  17. version=60
  18. pkgversion=6.0
  19. release=1
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/compressors"
  22. tarname=${program}${version}.tar.gz
  23. # Remote source(s)
  24. fetch=http://downloads.sourceforge.net/infozip/$tarname
  25. description="
  26. A utility for extracting ZIP files.
  27. UnZip is an extraction utility for archives compressed in .zip format
  28. (also called \"zipfiles\"). Although highly compatible both with
  29. PKWARE's PKZIP and PKUNZIP utilities for MS-DOS and with Info-ZIP's own
  30. Zip program, our primary objectives have been portability and non-MSDOS
  31. functionality.
  32. "
  33. homepage=http://www.info-zip.org/UnZip.html
  34. license="Custom, Info-Zip"
  35. # Source documentation
  36. docs="BUGS LICENSE README ToDo WHERE"
  37. docsdir="${docdir}/${program}-${pkgversion}"
  38. # Source directory for this software
  39. srcdir=${program}${version}
  40. build()
  41. {
  42. set -e
  43. unpack "${tardir}/$tarname"
  44. cd "$srcdir"
  45. # Set sane permissions
  46. chmod -R u+w,go-w,a+rX-s .
  47. # Apply patches from the Fedora project, thanks!
  48. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-bzip2-configure.patch"
  49. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-exec-shield.patch"
  50. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-close.patch"
  51. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-attribs-overflow.patch"
  52. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-configure.patch"
  53. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-manpage-fix.patch"
  54. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-fix-recmatch.patch"
  55. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-symlink.patch"
  56. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-caseinsensitive.patch"
  57. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-format-secure.patch"
  58. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-valgrind.patch"
  59. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-x-option.patch"
  60. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-overflow.patch"
  61. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-cve-2014-8139.patch"
  62. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-cve-2014-8140.patch"
  63. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-cve-2014-8141.patch"
  64. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-overflow-long-fsize.patch"
  65. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-heap-overflow-infloop.patch"
  66. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-alt-iconv-utf8.patch"
  67. patch -p1 < "${worktree}/patches/unzip/unzip-6.0-alt-iconv-utf8-print.patch"
  68. patch -p1 < "${worktree}/patches/unzip/0001-Fix-CVE-2016-9844-rhbz-1404283.patch"
  69. make -f unix/Makefile \
  70. CF_NOOPT="-I. -DUNIX -DNOMEMCPY -DIZ_HAVE_UXUIDGID -DNO_LCHMOD" \
  71. LFLAGS2="$QILDFLAGS -static" generic_gcc
  72. make -f unix/Makefile \
  73. prefix="${destdir}/usr" \
  74. MANDIR="${destdir}/${mandir}/man1" \
  75. INSTALL="cp -p" \
  76. install
  77. # Reinclude zipgrep fixing its ownerships
  78. rm -f "${destdir}/usr/bin/zipgrep"
  79. cat unix/zipgrep > "${destdir}/usr/bin/zipgrep"
  80. chmod 755 "${destdir}/usr/bin/zipgrep"
  81. # Compress and link man pages (if needed)
  82. if test -d "${destdir}/$mandir"
  83. then
  84. (
  85. cd "${destdir}/$mandir"
  86. find . -type f -exec lzip -9 '{}' +
  87. find . -type l | while read -r file
  88. do
  89. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  90. rm -- "$file"
  91. done
  92. )
  93. fi
  94. # Copy documentation
  95. mkdir -p "${destdir}${docsdir}"
  96. for file in $docs
  97. do
  98. cp -p $file "${destdir}${docsdir}"
  99. done
  100. }