recipe 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Build recipe for uri.
  2. #
  3. # Copyright (c) 2018-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=URI
  17. version=1.76
  18. release=1
  19. pkgname=uri
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/perl"
  22. description="
  23. Uniform Resource Identifiers.
  24. This module implements the URI class. Objects of this class represent
  25. \"Uniform Resource Identifier references\" as specified in RFC 2396
  26. (and updated by RFC 2732).
  27. "
  28. homepage=http://metacpan.org/release/URI
  29. license="The Perl 5 License"
  30. tarname=${program}-${version}.tar.gz
  31. # Remote source(s)
  32. fetch=http://cpan.metacpan.org/authors/id/O/OA/OALDERS/$tarname
  33. # Source documentation
  34. docs="CONTRIBUTING.md Changes LICENSE"
  35. docsdir="${docdir}/${pkgname}-${version}"
  36. build() {
  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. 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. }