ca-certificates_20170717: hacks for old oe
[openembedded.git] / recipes / ca-certificates / ca-certificates_20170717.bb
1 SUMMARY = "Common CA certificates"
2 DESCRIPTION = "This package includes PEM files of CA certificates to allow \
3 SSL-based applications to check for the authenticity of SSL connections. \
4 This derived from Debian's CA Certificates."
5 HOMEPAGE = "http://packages.debian.org/sid/ca-certificates"
6 SECTION = "misc"
7 LICENSE = "GPL-2.0+ MPL-2.0"
8 LIC_FILES_CHKSUM = "file://debian/copyright;md5=e7358b9541ccf3029e9705ed8de57968"
9
10 # This is needed to ensure we can run the postinst at image creation time
11 DEPENDS = ""
12 DEPENDS_virtclass-native = "openssl-native"
13 DEPENDS_virtclass-nativesdk = "openssl-native"
14 # Need c_rehash from openssl and run-parts from debianutils
15 PACKAGE_WRITE_DEPS += "openssl-native debianutils-native"
16
17 SRCREV = "34b8e19e541b8af4076616b2e170c7a70cdaded0"
18
19 SRC_URI = "git://anonscm.debian.org/collab-maint/ca-certificates.git;protocol=git \
20            file://0002-update-ca-certificates-use-SYSROOT.patch;patch=1 \
21            file://0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch;patch=1 \
22            file://update-ca-certificates-support-Toybox.patch;patch=1 \
23            file://default-sysroot.patch;patch=1 \
24            file://sbindir.patch;patch=1"
25
26 S = "${WORKDIR}/git"
27
28 # inherit allarch
29 PACKAGE_ARCH = "all"
30
31 EXTRA_OEMAKE = "\
32     'CERTSDIR=${datadir}/ca-certificates' \
33     'SBINDIR=${sbindir}' \
34 "
35
36 do_compile_prepend() {
37     oe_runmake clean
38 }
39
40 do_install () {
41     install -d ${D}${datadir}/ca-certificates \
42                ${D}${sysconfdir}/ssl/certs \
43                ${D}${sysconfdir}/ca-certificates/update.d
44     oe_runmake 'DESTDIR=${D}' install
45
46     install -d ${D}${mandir}/man8
47     install -m 0644 sbin/update-ca-certificates.8 ${D}${mandir}/man8/
48
49     install -d ${D}${sysconfdir}
50     {
51         echo "# Lines starting with # will be ignored"
52         echo "# Lines starting with ! will remove certificate on next update"
53         echo "#"
54         find ${D}${datadir}/ca-certificates -type f -name '*.crt' | \
55             sed 's,^${D}${datadir}/ca-certificates/,,'
56     } >${D}${sysconfdir}/ca-certificates.conf
57 }
58
59 do_install_append_virtclass-target () {
60     sed -i -e 's,/etc/,${sysconfdir}/,' \
61            -e 's,/usr/share/,${datadir}/,' \
62            -e 's,/usr/local,${prefix}/local,' \
63         ${D}${sbindir}/update-ca-certificates \
64         ${D}${mandir}/man8/update-ca-certificates.8
65 }
66
67 pkg_postinst_${PN} () {
68     SYSROOT="$D" $D${sbindir}/update-ca-certificates
69 }
70
71 CONFFILES_${PN} += "${sysconfdir}/ca-certificates.conf"
72
73 # Postinsts don't seem to be run for nativesdk packages when populating SDKs.
74 CONFFILES_${PN}_append_virtclass-nativesdk = " ${sysconfdir}/ssl/certs/ca-certificates.crt"
75 do_install_append_virtclass-nativesdk () {
76     SYSROOT="${D}${SDKPATHNATIVE}" ${D}${sbindir}/update-ca-certificates
77 }
78
79 do_install_append_virtclass-native () {
80     SYSROOT="${D}${base_prefix}" ${D}${sbindir}/update-ca-certificates
81     # older ca-certificates did not run c_rehash, so run manually
82     if [ ! -h /etc/ssl/certs/00673b5b.0 -a -x /usr/bin/c_rehash ]; then
83         cd /etc/ssl/certs
84         /usr/bin/c_rehash .
85     fi
86 }
87
88 RDEPENDS_${PN} += "openssl"
89
90 BBCLASSEXTEND = "native nativesdk"
91 NATIVE_INSTALL_WORKS = "1"