recipe 2.5 KB

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