recipes: Rename 'pkghashtag' variable to 'pkgcategory'
[dragora.git] / recipes / perl / xml-namespacesupport / recipe
blob1273cdf85b1b3eb168eec580903e6f7bcc29dd82
1 # Build recipe for xml-namespacesupport.
3 # Copyright (c) 2019 Matias Fonzo, <selk@dragora.org>.
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
9 #    http://www.apache.org/licenses/LICENSE-2.0
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.
17 program=XML-NamespaceSupport
18 version=1.12
19 release=1
21 pkgname=xml-namespacesupport
23 # Define a category for the output of the package name
24 pkgcategory=perl
26 description="
27 A simple generic namespace processor.
29 This module offers a simple way to process namespaced XML names
30 (unames) from within any application that may need them.
32 It also helps maintain a prefix to namespace URI map, and provides
33 a number of basic checks.
36 homepage=http://search.cpan.org/dist/XML-NamespaceSupport
37 license="GPLv1+ | Artistic License"
39 tarname=${program}-${version}.tar.gz
41 # Remote source(s)
42 fetch=http://cpan.metacpan.org/authors/id/P/PE/PERIGRIN/$tarname
44 # Source documentation
45 docs="Changes LICENSE README"
46 docsdir="${docdir}/${pkgname}-${version}"
48 build() {
49     set -e
51     unpack "${tardir}/$tarname"
53     cd "$srcdir"
55     # Set sane permissions
56     chmod -R u+w,go-w,a+rX-s .
58     perl Makefile.PL INSTALLDIRS=vendor
60     make -j${jobs} V=1 docdir=$docsdir
61     make -j${jobs} DESTDIR="$destdir" install
63     # Strip remaining binaries and libraries
64     find "$destdir" -type f | xargs file | \
65      awk '/ELF/ && /executable/ || /shared object/' | \
66       cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
68     # Clean up inventory file for Perl
70     # This line removes 'destdir' adding the suffix '.lz' for manpages
71     find "${destdir}/" -type f -name '.packlist' | while read -r file
72     do
73          sed -i \
74           -e "s|${destdir}||g" \
75           -e "s|\.[0-9][a-z]*|&.lz|g" \
76           $file
77     done
79     find "${destdir}/" -type f -name 'perllocal.pod' -exec rm -f {} +
81     # Compress manual pages
82     if [ -d "${destdir}/$mandir" ] ; then
83         (
84             cd "${destdir}/$mandir"
85             find . -type f -exec lzip -9 '{}' +
86             find . -type l | while read -r file
87             do
88                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
89                 rm -- "$file"
90             done
91         )
92     fi
94     # Copy documentation
95     mkdir -p "${destdir}${docsdir}"
96     cp -p $docs "${destdir}${docsdir}/"