recipe 3.1 KB

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