1SUMMARY = "Package maintenance system from Debian"
2LICENSE = "GPLv2.0+"
3SECTION = "base"
4
5DEPENDS = "zlib bzip2 perl ncurses"
6DEPENDS_class-native = "bzip2-replacement-native zlib-native virtual/update-alternatives-native gettext-native perl-native"
7RDEPENDS_${PN} = "${VIRTUAL-RUNTIME_update-alternatives} perl"
8RDEPENDS_${PN}_class-native = ""
9
10UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/d/dpkg/"
11
12inherit autotools gettext perlnative pkgconfig systemd perl-version
13
14python () {
15    if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
16        pn = d.getVar('PN')
17        d.setVar('SYSTEMD_SERVICE_%s' % (pn), 'dpkg-configure.service')
18}
19
20export PERL = "${bindir}/perl"
21PERL_class-native = "${STAGING_BINDIR_NATIVE}/perl-native/perl"
22
23export PERL_LIBDIR = "${libdir}/perl/${@get_perl_version(d)}"
24PERL_LIBDIR_class-native = "${libdir}/perl-native/perl/${@get_perl_version(d)}"
25
26EXTRA_OECONF = "\
27		--disable-dselect \
28		--enable-start-stop-daemon \
29		--with-libz \
30		--with-libbz2 \
31		--without-libselinux \
32		"
33
34PACKAGECONFIG = "liblzma"
35PACKAGECONFIG[liblzma] = "--with-liblzma,--without-liblzma, xz"
36
37EXTRA_OECONF += "TAR=tar"
38EXTRA_OECONF_append_class-target = " DEB_HOST_ARCH=${DPKG_ARCH}"
39
40do_install_append () {
41	if [ "${PN}" = "dpkg-native" ]; then
42		# update-alternatives doesn't have an offline mode
43		rm ${D}${bindir}/update-alternatives
44		sed -i -e 's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env nativeperl|' ${D}${bindir}/dpkg-*
45	else
46		sed -i -e 's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env perl|' ${D}${bindir}/dpkg-*
47	fi
48
49	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)};then
50		install -d ${D}${systemd_unitdir}/system
51		install -m 0644 ${WORKDIR}/dpkg-configure.service ${D}${systemd_unitdir}/system/
52		sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
53			-e 's,@SYSCONFDIR@,${sysconfdir},g' \
54			-e 's,@BINDIR@,${bindir},g' \
55			-e 's,@SYSTEMD_UNITDIR@,${systemd_unitdir},g' \
56			${D}${systemd_unitdir}/system/dpkg-configure.service
57	fi
58}
59
60PROV = "virtual/update-alternatives"
61PROV_class-native = ""
62
63PROVIDES += "${PROV}"
64
65PACKAGES =+ "update-alternatives-dpkg"
66FILES_update-alternatives-dpkg = "${bindir}/update-alternatives ${localstatedir}/lib/dpkg/alternatives ${sysconfdir}/alternatives"
67RPROVIDES_update-alternatives-dpkg += "update-alternatives"
68
69PACKAGES += "${PN}-perl"
70FILES_${PN}-perl = "${libdir}/perl/${@get_perl_version(d)}"
71
72RDEPENDS_${PN}-perl += "perl-module-carp perl-module-constant \
73                        perl-module-cwd perl-module-digest \
74                        perl-module-digest-md5 perl-module-errno \
75                        perl-module-exporter perl-module-fcntl \
76                        perl-module-feature perl-module-file-basename \
77                        perl-module-file-compare perl-module-file-copy \
78                        perl-module-file-find perl-module-file-path \
79                        perl-module-file-spec perl-module-file-temp \
80                        perl-module-list-util perl-module-overload \
81                        perl-module-parent perl-module-storable \
82                        perl-module-filehandle perl-module-io \
83                        perl-module-io-handle perl-module-io-seekable \
84                        perl-module-posix perl-module-scalar-util \
85                        perl-module-selectsaver perl-module-symbol \
86                        perl-module-term-ansicolor perl-module-tie-handle \
87                        perl-module-tie-hash perl-module-storable \
88                        perl-module-time-hires perl-module-time-piece \
89                        perl-module-xsloader"
90
91# Split out start-stop-daemon to its own package.  Note that it
92# is installed in a different directory than the one used for
93# the bitbake version.
94#
95PACKAGES =+ "${PN}-start-stop"
96FILES_${PN}-start-stop = "${sbindir}/start-stop-daemon"
97
98RDEPENDS_${PN} += "${PN}-start-stop"
99
100
101BBCLASSEXTEND = "native"
102