recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / perl / uri / recipe
blob682241d567110539efcf4e28c2eb5826511f6202
1 # Build recipe for uri.
3 # Copyright (c) 2018-2019, 2021-2022 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 # Exit immediately on any error
18 set -e
20 program=URI
21 version=5.10
22 release=1
24 pkgname=perl-uri
26 # Define a category for the output of the package name
27 pkgcategory=perl
29 description="
30 Uniform Resource Identifiers.
32 This module implements the URI class.  Objects of this class represent
33 \"Uniform Resource Identifier references\" as specified in RFC 2396
34 (and updated by RFC 2732).
37 homepage=https://metacpan.org/release/URI
38 license="The Perl 5 License"
40 tarname=${program}-${version}.tar.gz
42 # Remote source(s)
43 fetch=https://cpan.metacpan.org/authors/id/O/OA/OALDERS/$tarname
45 # Source documentation
46 docs="CONTRIBUTING.md Changes LICENSE"
47 docsdir="${docdir}/${pkgname}-${version}"
49 build() {
50     unpack "${tardir}/$tarname"
52     cd "$srcdir"
54     # Set sane permissions
55     chmod -R u+w,go-w,a+rX-s .
57     perl Makefile.PL INSTALLDIRS=vendor
59     make -j${jobs} V=1 docdir=$docsdir
60     make -j${jobs} DESTDIR="$destdir" install
62     # Strip remaining binaries and libraries
63     find "$destdir" -type f | xargs file | \
64      awk '/ELF/ && /executable/ || /shared object/' | \
65       cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
67     # Clean up inventory file for Perl
69     # This line removes 'destdir' adding the suffix '.lz' for manpages
70     find "${destdir}/" -type f -name '.packlist' | while read -r file
71     do
72          sed -i \
73           -e "s|${destdir}||g" \
74           -e "s|\.[0-9][a-z]*|&.lz|g" \
75           $file
76     done
78     find "${destdir}/" -type f -name 'perllocal.pod' -exec rm -f {} +
80     # Compress manual pages
81     if [ -d "${destdir}/$mandir" ] ; then
82         (
83             cd "${destdir}/$mandir"
84             find . -type f -exec lzip -9 {} +
85             find . -type l | while read -r file
86             do
87                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
88                 rm -- "$file"
89             done
90         )
91     fi
93     # Copy documentation
94     mkdir -p "${destdir}/$docsdir"
95     cp -p $docs "${destdir}/$docsdir"