recipe 4.1 KB

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