recipes: Replace 'outdir' with package hash tags
[dragora.git] / recipes / networking / ca-certificates / recipe
blobee86ab85190dd24b061ee114493bac08f8ad26b2
1 # Build recipe for ca-certificates (a version from Alpine Linux).
3 # Copyright (c) 2018-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=ca-certificates
18 version=20190108_431b3fc
19 release=1
21 # Define hash tag to categorize the package name output
22 pkghashtag=networking
24 tarname=${program}-${version}.tar.lz
26 # Remote source(s)
27 fetch="
28  http://rsync.dragora.org/current/sources/$tarname
29  http://mirror.cedia.org.ec/dragora/current/sources/$tarname
32 description="
33 Common CA certificates PEM files.
35 This package comes from the CA certificates version found in
36 \"Alpine Linux\".
39 homepage=http://git.alpinelinux.org/cgit/ca-certificates/
40 license="GPLv2+ | MPLv2.0"
42 # Source documentation
43 docs="VERSION"
44 docsdir="${docdir}/${program}-${version}"
46 # Limit parallel jobs for this build
47 jobs=1
49 build()
51     set -e
53     unpack "${tardir}/$tarname"
55     cd "$srcdir"
57     # Add updated source file with the included root certificates
58     # http://mxr.mozilla.org/mozilla-central/source/security/nss/lib/ckfw/builtins/certdata.txt
59     cat "${worktree}/archive/ca-certificates/certdata.txt" > certdata.txt
61     # Set sane permissions
62     chmod -R u+w,go-w,a+rX-s .
64     make -j${jobs} V=1
65     make -j${jobs} V=1 DESTDIR="$destdir" install
66     strip --strip-unneeded \
67      "${destdir}/usr/bin/c_rehash" \
68      "${destdir}/usr/sbin/update-ca-certificates"
70     # Clean up broken symlinks, if any
71     find "$destdir" -print | while read -r file
72     do
73         if test -L "$file" && test ! -e "$file"
74         then
75             echo "Deleting dangling symlink: $file"
76             rm -f -- "$file"
77         fi
78     done
80     mkdir -p "${destdir}"/etc/ca-certificates/update.d
82     # To populate config file
83     (
84         echo "# Automatically generated by $full_pkgname"
85         cd "${destdir}/usr/share/ca-certificates"
86         find . -name '*.crt' | sort | cut -b3-
87     ) > "${destdir}/etc/ca-certificates.conf"
89     # Make run-parts script
91 cat << "EOF" > "${destdir}/etc/ca-certificates/update.d/certhash"
92 #! /bin/sh -
93 exec /usr/bin/c_rehash /etc/ssl/certs
95 EOF
96     chmod 755 "${destdir}/etc/ca-certificates/update.d/certhash"
98     # Compress and link man pages (if needed)
99     if test -d "${destdir}/$mandir"
100     then
101         (
102             cd "${destdir}/$mandir"
103             find . -type f -exec lzip -9 '{}' +
104             find . -type l | while read -r file
105             do
106                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
107                 rm -- "$file"
108             done
109         )
110     fi
112     # Copy documentation
113     mkdir -p "${destdir}${docsdir}"
114     cp -p $docs "${destdir}${docsdir}"