recipe 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Build recipe for libxml2.
  2. #
  3. # Copyright (C) 2018, MMPG <mmpg@vp.pl>
  4. # Copyright (C) 2018, Matias Fonzo, <selk@dragora.org>.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. program=libxml2
  18. version=2.9.8
  19. release=1
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/libs"
  22. tarname=${program}-${version}.tar.gz
  23. # Remote source(s)
  24. fetch=ftp://xmlsoft.org/libxml2/$tarname
  25. description="
  26. A XML C parser library and toolkit.
  27. XML itself is a meta language to design markup languages. HTML is the
  28. most well-known markup language. Though the library is written in C,
  29. a variety of language bindings make it available in other environments.
  30. "
  31. homepage=http://xmlsoft.org
  32. license=MIT
  33. docs="AUTHORS ChangeLog Copyright NEWS README TODO"
  34. docsdir="${docdir}/${program}-${version}"
  35. build()
  36. {
  37. set -e
  38. unpack "${tardir}/$tarname"
  39. cd "$srcdir"
  40. # Set sane permissions
  41. chmod -R u+w,go-w,a+rX-s .
  42. # Recommended patch to prevent a segfault when using Python v3
  43. # (Thanks to Beyond of Linux From Scratch!)
  44. patch -p1 < "${worktree}/patches/libxml2/libxml2-2.9.8-python3_hack-1.patch"
  45. # To ensure that the Python module can be built by python-3.6
  46. sed -i '/_PyVerify_fd/,+1d' python/types.c
  47. ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  48. $configure_args \
  49. --libdir=/usr/lib${libSuffix} \
  50. --infodir=$infodir \
  51. --mandir=$mandir \
  52. --docdir=$docsdir \
  53. --enable-static=no \
  54. --enable-shared=yes \
  55. --with-python=/usr/bin/python3 \
  56. --with-history \
  57. --without-lzma \
  58. --build="$(cc -dumpmachine)"
  59. make -j${jobs} V=1
  60. make -j${jobs} DESTDIR="$destdir" install-strip
  61. # Compress info documents deleting index file for the package
  62. if test -d "${destdir}/$infodir"
  63. then
  64. rm -f "${destdir}/${infodir}/dir"
  65. lzip -9 "${destdir}/${infodir}"/*
  66. fi
  67. # Compress and link man pages (if needed)
  68. if test -d "${destdir}/$mandir"
  69. then
  70. (
  71. cd "${destdir}/$mandir"
  72. find . -type f -exec lzip -9 '{}' +
  73. find . -type l | while read -r file
  74. do
  75. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  76. rm -- "$file"
  77. done
  78. )
  79. fi
  80. # Copy documentation
  81. mkdir -p "${destdir}${docsdir}"
  82. for file in $docs
  83. do
  84. cp -p $file "${destdir}${docsdir}"
  85. done
  86. }