recipe 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Build recipe for xml-parser.
  2. #
  3. # Copyright (c) 2017 Mateus P. Rodrigues, <mprodrigues@dragora.org>.
  4. # Copyright (c) 2017 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=XML-Parser
  18. version=2.44_01
  19. release=1
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/modules"
  22. description="
  23. A perl module for parsing XML documents.
  24. This is a Perl interface to the expat library.
  25. "
  26. homepage=http://search.cpan.org/~toddr/XML-Parser/
  27. license="The Perl 5 License"
  28. tarname=${program}-${version}.tar.gz
  29. # Remote source(s)
  30. fetch=http://search.cpan.org/CPAN/authors/id/T/TO/TODDR/$tarname
  31. pkgname=xml-parser
  32. # Source documentation
  33. docs="Changes README"
  34. docsdir="${docdir}/${program}-${version}"
  35. build() {
  36. set -e
  37. unpack "${tardir}/$tarname"
  38. cd "$srcdir"
  39. # Set sane permissions
  40. chmod -R u+w,go-w,a+rX-s .
  41. perl Makefile.PL INSTALLDIRS=vendor
  42. make -j${jobs} V=1 docdir=$docsdir
  43. make -j${jobs} DESTDIR="$destdir" install
  44. # Strip remaining binaries and libraries
  45. find "$destdir" -type f | xargs file | \
  46. awk '/ELF/ && /executable/ || /shared object/' | \
  47. cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  48. # Clean up inventory file for Perl
  49. # This line removes 'destdir' adding the suffix '.lz' for manpages
  50. find "${destdir}/" -type f -name '.packlist' | while read -r file
  51. do
  52. sed -i \
  53. -e "s|${destdir}||g" \
  54. -e "s|\.[0-9][a-z]*|&.lz|g" \
  55. $file
  56. done
  57. find "${destdir}/" -type f -name 'perllocal.pod' -exec rm -f {} +
  58. # Compress manual pages
  59. if [ -d "${destdir}/$mandir" ] ; then
  60. (
  61. cd "${destdir}/$mandir"
  62. find . -type f -exec lzip -9 '{}' +
  63. find . -type l | while read -r file
  64. do
  65. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  66. rm -- "$file"
  67. done
  68. )
  69. fi
  70. # Copy documentation
  71. mkdir -p "${destdir}${docsdir}"
  72. cp -p $docs "${destdir}${docsdir}/"
  73. }