recipe 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Build recipe for xml-simple.
  2. #
  3. # Copyright (c) 2019 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=XML-Simple
  17. version=2.25
  18. release=1
  19. pkgname=xml-simple
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/perl"
  22. description="
  23. An API for simple XML files.
  24. XML::Simple provides an easy API to read and write XML (especially
  25. config files). It is deprecated and its use is discouraged.
  26. "
  27. homepage=http://metacpan.org/release/XML-Simple
  28. license="GPLv1+ | Artistic License"
  29. tarname=${program}-${version}.tar.gz
  30. # Remote source(s)
  31. fetch=http://cpan.metacpan.org/authors/id/G/GR/GRANTM/$tarname
  32. # Source documentation
  33. docs="Changes LICENSE README"
  34. docsdir="${docdir}/${pkgname}-${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} DESTDIR="$destdir" install
  43. # Strip remaining binaries and libraries
  44. find "$destdir" -type f | xargs file | \
  45. awk '/ELF/ && /executable/ || /shared object/' | \
  46. cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  47. # Clean up inventory file for Perl
  48. # This line removes 'destdir' adding the suffix '.lz' for manpages
  49. find "${destdir}/" -type f -name '.packlist' | while read -r file
  50. do
  51. sed -i \
  52. -e "s|${destdir}||g" \
  53. -e "s|\.[0-9][a-z]*|&.lz|g" \
  54. $file
  55. done
  56. find "${destdir}/" -type f -name 'perllocal.pod' -exec rm -f {} +
  57. # Compress manual pages
  58. if [ -d "${destdir}/$mandir" ] ; then
  59. (
  60. cd "${destdir}/$mandir"
  61. find . -type f -exec lzip -9 '{}' +
  62. find . -type l | while read -r file
  63. do
  64. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  65. rm -- "$file"
  66. done
  67. )
  68. fi
  69. # Copy documentation
  70. mkdir -p "${destdir}${docsdir}"
  71. cp -p $docs "${destdir}${docsdir}/"
  72. }