recipe 4.0 KB

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