recipe 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # Build recipe for bzip2.
  2. #
  3. # Copyright (c) 2016-2018 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=bzip2
  19. version=1.0.6
  20. release=2
  21. # Define a category for the output of the package name
  22. pkgcategory=compressors
  23. tarname=${program}-${version}.tar.gz
  24. # Remote source(s)
  25. fetch="
  26. http://mirror.fsf.org/dragora/v3/sources/$tarname
  27. http://www.bzip.org/${version}/$tarname
  28. "
  29. description="
  30. A high-quality data compressor program.
  31. Bzip2 is a high quality compressor that uses the best compression
  32. techniques (from the PPM family of statistical compressors).
  33. In general, the compression is considerabily better than other
  34. compressors, based on LZ77/LZ78 algorithm.
  35. The author of bzip2 is Julian Seward.
  36. "
  37. homepage=http://www.bzip.org
  38. license=Custom
  39. # Source documentation
  40. docs="CHANGES LICENSE README"
  41. docsdir="${docdir}/${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 a patch to install the documentation (thanks to LFS)
  49. patch -Np1 -i "${worktree}/patches/bzip2/bzip2-1.0.6-install_docs-1.patch"
  50. # Ensure installation of relative symbolic links (thanks to LFS)
  51. sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
  52. # Ensure the man pages are installed into the correct location
  53. sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
  54. # Ensure location for libraries
  55. sed -i "s@(PREFIX)/lib@(PREFIX)/lib${libSuffix}@g" Makefile
  56. # Build bzip2.
  57. #
  58. # Provide shared libraries for third party programs
  59. make -f Makefile-libbz2_so
  60. make clean
  61. # Recompile program for static linking
  62. make LDFLAGS="$QILDFLAGS -static"
  63. make PREFIX="${destdir}/usr" install
  64. # Copy shared libraries into package destination
  65. cp -f -p libbz2.so* "${destdir}/usr/lib${libSuffix}"
  66. # Library measurement
  67. strip -s "${destdir}/usr/lib${libSuffix}/libbz2.so.1.0.6"
  68. # Make soft links providing compatibility
  69. (
  70. cd "${destdir}/usr/lib${libSuffix}" || exit 1
  71. ln -sf libbz2.so.1.0.6 libbz2.so.1.0
  72. ln -sf libbz2.so.1.0.6 libbz2.so
  73. )
  74. # Compress and link man pages (if needed)
  75. if test -d "${destdir}/$mandir"
  76. then
  77. (
  78. cd "${destdir}/$mandir"
  79. find . -type f -exec lzip -9 {} +
  80. find . -type l | while read -r file
  81. do
  82. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  83. rm -- "$file"
  84. done
  85. )
  86. fi
  87. # Copy the rest of the documentation
  88. mkdir -p "${destdir}${docsdir}"
  89. for file in $docs
  90. do
  91. cp -p $file "${destdir}${docsdir}"
  92. done
  93. }