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