aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/dpkg/dpkg.inc
blob: 648f34ac6803e4df3f97cd941564f13f7c77bd8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
SUMMARY = "Package maintenance system from Debian"
SECTION = "base"
LICENSE = "GPLv2+"
DEPENDS = "perl"
DEPENDS_append_class-native = " bzip2-replacement-native ${@bb.utils.contains('PACKAGECONFIG', 'update-alternatives', '', 'virtual/update-alternatives-native', d)}"
PROVIDES = "${@bb.utils.contains('PACKAGECONFIG', 'update-alternatives', 'virtual/update-alternatives', '', d)}"

UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/d/dpkg/"

inherit autotools gettext perlnative pkgconfig systemd perl-version

python () {
    if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
        pn = d.getVar('PN')
        d.setVar('SYSTEMD_SERVICE_%s' % (pn), 'dpkg-configure.service')
}

export PERL = "${bindir}/perl"
PERL_class-native = "${STAGING_BINDIR_NATIVE}/perl-native/perl"

export PERL_LIBDIR = "${libdir}/perl/${@get_perl_version(d)}"
PERL_LIBDIR_class-native = "${libdir}/perl-native/perl/${@get_perl_version(d)}"

UA = "update-alternatives"
UA_native = "${@['', 'update-alternatives'][d.getVar('PREFERRED_PROVIDER_virtual/update-alternatives-native', True) == 'dpkg-native']}"

PACKAGECONFIG ??= "bzip2 gzip start-stop-daemon ${UA}"
PACKAGECONFIG[bzip2] = "--with-libbz2,--without-libbz2,bzip2"
PACKAGECONFIG[dselect] = "--enable-dselect,--disable-dselect,ncurses"
PACKAGECONFIG[gzip] = "--with-libz,--without-libz,zlib"
PACKAGECONFIG[selinux] = "--with-libselinux,--without-libselinux,libselinux"
PACKAGECONFIG[start-stop-daemon] = "--enable-start-stop-daemon,--disable-start-stop-daemon"
PACKAGECONFIG[update-alternatives] = "--enable-update-alternatives,--disable-update-alternatives"
PACKAGECONFIG[xz] = "--with-liblzma,--without-liblzma,xz"

DPKG_DEB_COMPRESSOR ?= "${@bb.utils.contains('PACKAGECONFIG', 'xz', 'xz', 'gzip', d)}"

EXTRA_OECONF += "--sbindir=${base_sbindir} --with-dpkg-deb-compressor=${DPKG_DEB_COMPRESSOR}"

PACKAGECONFIG = "liblzma"
PACKAGECONFIG[liblzma] = "--with-liblzma,--without-liblzma, xz"

EXTRA_OECONF += "TAR=tar"
EXTRA_OECONF_append_class-target = " DEB_HOST_ARCH=${DPKG_ARCH}"

do_configure_prepend_class-native() {
    sed -i -e 's|SYSCONFDIR|"${sysconfdir_native}"|' ${S}/utils/update-alternatives.c
}

do_install_append_class-native() {
    sed -i -e 's|^#!${PERL}|#!/usr/bin/env nativeperl|' ${D}${bindir}/dpkg-*
}

do_install_append () {
	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)};then
		install -d ${D}${systemd_unitdir}/system
		install -m 0644 ${WORKDIR}/dpkg-configure.service ${D}${systemd_unitdir}/system/
		sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
			-e 's,@SYSCONFDIR@,${sysconfdir},g' \
			-e 's,@BINDIR@,${bindir},g' \
			-e 's,@SYSTEMD_UNITDIR@,${systemd_unitdir},g' \
			${D}${systemd_unitdir}/system/dpkg-configure.service
	fi
}

PACKAGES =+ "dpkg-perl dselect libdpkg-perl start-stop-daemon update-alternatives-dpkg"

RDEPENDS_${PN} = "${VIRTUAL-RUNTIME_update-alternatives}"
RDEPENDS_${PN}_class-native = ""
RRECOMMENDS_${PN} = "start-stop-daemon"
RRECOMMENDS_${PN}_class-native = ""
RSUGGESTS_${PN} = "apt"

RDEPENDS_dpkg-perl = "binutils libdpkg-perl make xz"
RRECOMMENDS_dpkg-perl = "gnupg"

RDEPENDS_dselect = "dpkg"
RSUGGESTS_dselect = "perl"

RDEPENDS_libdpkg-perl = "dpkg libtimedate-perl perl"
RRECOMMENDS_libdpkg-perl = "xz"
RSUGGESTS_libdpkg-perl = "binutils gnupg"

RPROVIDES_update-alternatives-dpkg = "update-alternatives"
RCONFLICTS_update-alternatives-dpkg = "update-alternatives"

RDEPENDS_libdpkg-perl += "perl-module-carp perl-module-constant \
                        perl-module-cwd perl-module-digest \
                        perl-module-digest-md5 perl-module-errno \
                        perl-module-exporter perl-module-fcntl \
                        perl-module-feature perl-module-file-basename \
                        perl-module-file-compare perl-module-file-copy \
                        perl-module-file-find perl-module-file-path \
                        perl-module-file-spec perl-module-file-temp \
                        perl-module-list-util perl-module-overload \
                        perl-module-parent perl-module-storable \
                        perl-module-filehandle perl-module-io \
                        perl-module-io-handle perl-module-io-seekable \
                        perl-module-posix perl-module-scalar-util \
                        perl-module-selectsaver perl-module-symbol \
                        perl-module-term-ansicolor perl-module-tie-handle \
                        perl-module-tie-hash perl-module-storable \
                        perl-module-time-hires perl-module-time-piece \
                        perl-module-xsloader"

FILES_dpkg-perl = " \
    ${bindir}/dpkg-architecture \
    ${bindir}/dpkg-buildflags \
    ${bindir}/dpkg-buildpackage \
    ${bindir}/dpkg-checkbuilddeps \
    ${bindir}/dpkg-distaddfile \
    ${bindir}/dpkg-genchanges \
    ${bindir}/dpkg-gencontrol \
    ${bindir}/dpkg-gensymbols \
    ${bindir}/dpkg-mergechangelogs \
    ${bindir}/dpkg-name \
    ${bindir}/dpkg-parsechangelog \
    ${bindir}/dpkg-scanpackages \
    ${bindir}/dpkg-scansources \
    ${bindir}/dpkg-shlibdeps \
    ${bindir}/dpkg-source \
    ${bindir}/dpkg-vendor \
    ${datadir}/dpkg/*.mk \
"

FILES_dselect = "${bindir}/dselect"

FILES_libdpkg-perl = " \
    ${libdir}/dpkg/parsechangelog \
    ${libdir}/perl/${@get_perl_version(d)} \
"

FILES_start-stop-daemon = "${base_sbindir}/start-stop-daemon"

FILES_update-alternatives-dpkg = " \
    ${sysconfdir}/alternatives \
    ${bindir}/update-alternatives \
    ${localstatedir}/lib/dpkg/alternatives \
"

PKG_dpkg-dev = "libdpkg-dev"
PKG_dpkg-perl = "dpkg-dev"

BBCLASSEXTEND = "native"