summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/util-linux/util-linux_2.39.3.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/util-linux/util-linux_2.39.3.bb')
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.39.3.bb348
1 files changed, 348 insertions, 0 deletions
diff --git a/meta/recipes-core/util-linux/util-linux_2.39.3.bb b/meta/recipes-core/util-linux/util-linux_2.39.3.bb
new file mode 100644
index 0000000000..2cd7750afc
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux_2.39.3.bb
@@ -0,0 +1,348 @@
1require util-linux.inc
2
3inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest gtk-doc
4DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid"
5
6PACKAGES =+ "${PN}-swaponoff"
7PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}"
8
9python util_linux_binpackages () {
10 def pkg_hook(f, pkg, file_regex, output_pattern, modulename):
11 pn = d.getVar('PN')
12 d.appendVar('RRECOMMENDS:%s' % pn, ' %s' % pkg)
13
14 if d.getVar('ALTERNATIVE:' + pkg):
15 return
16 if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename):
17 d.setVar('ALTERNATIVE:' + pkg, modulename)
18
19 bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split())))
20 for dir in bindirs:
21 do_split_packages(d, root=dir,
22 file_regex=r'(.*)', output_pattern='${PN}-%s',
23 description='${PN} %s',
24 hook=pkg_hook, extra_depends='')
25
26 # There are some symlinks for some binaries which we have ignored
27 # above. Add them to the package owning the binary they are
28 # pointing to
29 extras = {}
30 dvar = d.getVar('PKGD')
31 for root in bindirs:
32 for walkroot, dirs, files in os.walk(dvar + root):
33 for f in files:
34 file = os.path.join(walkroot, f)
35 if not os.path.islink(file):
36 continue
37
38 pkg = os.path.basename(os.readlink(file))
39 extras.setdefault(pkg, [])
40 extras[pkg].append(file.replace(dvar, '', 1))
41
42 pn = d.getVar('PN')
43 for pkg, links in extras.items():
44 of = d.getVar('FILES:' + pn + '-' + pkg)
45 links = of + " " + " ".join(sorted(links))
46 d.setVar('FILES:' + pn + '-' + pkg, links)
47}
48
49# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS
50PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages "
51
52# skip libuuid as it will be packaged by the util-linux-libuuid recipe
53python util_linux_libpackages() {
54 do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(?!uuid)(.*)\.so\..*$',
55 output_pattern='${PN}-lib%s',
56 description='${PN} lib%s',
57 extra_depends='', prepend=True, allow_links=True)
58}
59
60PACKAGESPLITFUNCS =+ "util_linux_libpackages"
61
62PACKAGES_DYNAMIC = "^${PN}-.*"
63
64UTIL_LINUX_LIBDIR = "${libdir}"
65UTIL_LINUX_LIBDIR:class-target = "${base_libdir}"
66EXTRA_OECONF = "\
67 --enable-libuuid --enable-libblkid \
68 \
69 --enable-fsck --enable-kill --enable-last --enable-mesg \
70 --enable-mount --enable-partx --enable-rfkill \
71 --enable-unshare --enable-write \
72 \
73 --disable-bfs --disable-login \
74 --disable-makeinstall-chown --disable-minix --disable-newgrp \
75 --disable-use-tty-group --disable-vipw --disable-raw \
76 \
77 --without-udev \
78 \
79 usrsbin_execdir='${sbindir}' \
80 --libdir='${UTIL_LINUX_LIBDIR}' \
81"
82
83EXTRA_OECONF:append:class-target = " --enable-setpriv"
84EXTRA_OECONF:append:class-native = " --without-cap-ng --disable-setpriv"
85EXTRA_OECONF:append:class-nativesdk = " --without-cap-ng --disable-setpriv"
86EXTRA_OECONF:append = " --disable-hwclock-gplv3"
87
88# enable pcre2 for native/nativesdk to match host distros
89# this helps to keep same expectations when using the SDK or
90# build host versions during development
91#
92PACKAGECONFIG ?= "pcre2"
93PACKAGECONFIG:class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam', '', d)}"
94# inherit manpages requires this to be present, however util-linux does not have
95# configuration options, and installs manpages always
96PACKAGECONFIG[manpages] = ""
97PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
98# Respect the systemd feature for uuidd
99PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd"
100# Build python bindings for libmount
101PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3"
102# Readline support
103PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
104# PCRE support in hardlink
105PACKAGECONFIG[pcre2] = ",,libpcre2"
106PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup"
107PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh,"
108PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
109
110EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
111
112ALLOW_EMPTY:${PN} = "1"
113FILES:${PN} = ""
114FILES:${PN}-doc += "${datadir}/getopt/getopt-*.*"
115FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
116FILES:${PN}-mount = "${sysconfdir}/default/mountall"
117FILES:${PN}-runuser = "${sysconfdir}/pam.d/runuser*"
118FILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
119CONFFILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
120FILES:${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
121 ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
122 ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
123
124# Util-linux' blkid replaces the e2fsprogs one
125RCONFLICTS:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
126RREPLACES:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
127
128RRECOMMENDS:${PN}:class-native = ""
129RRECOMMENDS:${PN}:class-nativesdk = ""
130RDEPENDS:${PN}:class-native = ""
131RDEPENDS:${PN}:class-nativesdk = ""
132
133RDEPENDS:${PN} += " util-linux-libuuid"
134RDEPENDS:${PN}-dev += " util-linux-libuuid-dev"
135
136RPROVIDES:${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev"
137
138RDEPENDS:${PN}-bash-completion += "${PN}-lsblk"
139RDEPENDS:${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod procps sed socat which xz"
140RRECOMMENDS:${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop kernel-module-algif-hash"
141RDEPENDS:${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
142ALLOW_EMPTY:${PN}-swaponoff = "1"
143
144#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
145SYSTEMD_SERVICE:${PN}-uuidd = "uuidd.socket uuidd.service"
146SYSTEMD_AUTO_ENABLE:${PN}-uuidd = "disable"
147SYSTEMD_SERVICE:${PN}-fstrim = "fstrim.timer fstrim.service"
148SYSTEMD_AUTO_ENABLE:${PN}-fstrim = "disable"
149
150do_compile:append () {
151 cp ${UNPACKDIR}/fcntl-lock.c ${S}/fcntl-lock.c
152 ${CC} ${CFLAGS} ${LDFLAGS} ${S}/fcntl-lock.c -o ${B}/fcntl-lock
153}
154
155do_install () {
156 # with ccache the timestamps on compiled files may
157 # end up earlier than on their inputs, this allows
158 # for the resultant compilation in the install step.
159 oe_runmake 'CC=${CC}' 'LD=${LD}' \
160 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install
161
162 mkdir -p ${D}${base_bindir}
163
164 sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
165 sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin"
166 binprogs_a="dmesg getopt kill more umount mount login su mountpoint"
167
168 if [ "${base_sbindir}" != "${sbindir}" ]; then
169 mkdir -p ${D}${base_sbindir}
170 for p in $sbinprogs $sbinprogs_a; do
171 if [ -f "${D}${sbindir}/$p" ]; then
172 mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
173 fi
174 done
175 fi
176
177 if [ "${base_bindir}" != "${bindir}" ]; then
178 mkdir -p ${D}${base_bindir}
179 for p in $binprogs_a; do
180 if [ -f "${D}${bindir}/$p" ]; then
181 mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
182 fi
183 done
184 fi
185
186 install -d ${D}${sysconfdir}/default/
187 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
188
189 rm -f ${D}${bindir}/chkdupexe
190
191 install -m 0755 ${B}/fcntl-lock ${D}${bindir}
192}
193
194do_install:append:class-target () {
195 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
196 install -d ${D}${sysconfdir}/pam.d
197 install -m 0644 ${UNPACKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
198 install -m 0644 ${UNPACKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
199 # Required for "su -" aka "su --login" because
200 # otherwise it uses "other", which has "auth pam_deny.so"
201 # and thus prevents the operation.
202 ln -s su ${D}${sysconfdir}/pam.d/su-l
203 fi
204}
205# nologin causes a conflict with shadow-native
206# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir})
207do_install:append:class-native () {
208 rm -f ${D}${base_sbindir}/nologin
209 rm -f ${D}${base_bindir}/kill
210}
211
212# dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds
213# Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it
214do_install:append () {
215 rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid*
216}
217
218ALTERNATIVE_PRIORITY = "80"
219
220ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
221ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
222ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
223ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn"
224ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh"
225ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
226ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
227ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
228ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate"
229ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
230ALTERNATIVE_LINK_NAME[findfs] = "${sbindir}/findfs"
231ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock"
232ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
233ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
234ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim"
235ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
236ALTERNATIVE:${PN}-agetty = "getty"
237ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
238ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
239ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump"
240ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
241ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice"
242ALTERNATIVE_LINK_NAME[ipcrm] = "${bindir}/ipcrm"
243ALTERNATIVE_LINK_NAME[ipcs] = "${bindir}/ipcs"
244ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
245ALTERNATIVE:${PN}-last = "last lastb"
246ALTERNATIVE_LINK_NAME[last] = "${bindir}/last"
247ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb"
248ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger"
249ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
250ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg"
251ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
252ALTERNATIVE_LINK_NAME[mcookie] = "${bindir}/mcookie"
253ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
254ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
255ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
256ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
257ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter"
258ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
259ALTERNATIVE_LINK_NAME[prlimit] = "${bindir}/prlimit"
260ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
261ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice"
262ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev"
263ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill"
264ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake"
265ALTERNATIVE_LINK_NAME[scriptreplay] = "${bindir}/scriptreplay"
266ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv"
267ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid"
268ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
269ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
270ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
271ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
272ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
273ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset"
274ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
275ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare"
276ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump"
277ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen"
278ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall"
279
280ALTERNATIVE:${PN}-doc = "\
281blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \
282mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\
283"
284ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
285ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'chfn-chsh', 'chfn.1 chsh.1', '', d)}"
286
287ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
288ALTERNATIVE_LINK_NAME[chfn.1] = "${mandir}/man1/chfn.1"
289ALTERNATIVE_LINK_NAME[chsh.1] = "${mandir}/man1/chsh.1"
290ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
291ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
292ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
293ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
294ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
295ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
296ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3"
297ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
298ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
299ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
300ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
301ALTERNATIVE_LINK_NAME[rfkill.8] = "${mandir}/man8/rfkill.8"
302ALTERNATIVE_LINK_NAME[setpriv.1] = "${mandir}/man1/setpriv.1"
303ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
304ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
305ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
306ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
307ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
308
309BBCLASSEXTEND = "native nativesdk"
310
311PTEST_BINDIR = "1"
312do_compile_ptest() {
313 oe_runmake buildtest-TESTS
314}
315
316do_install_ptest() {
317 mkdir -p ${D}${PTEST_PATH}/tests/ts
318 find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
319 find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
320 find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
321
322 cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/
323 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
324 cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
325 cp ${B}/config.h ${D}${PTEST_PATH}
326
327 sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
328
329 # chfn needs PAM
330 if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then
331 rm -rf ${D}${PTEST_PATH}/tests/ts/chfn
332 fi
333 # remove raid tests, known failures and avoid dependency on mdadm therefore
334 # See https://github.com/util-linux/util-linux/commit/7519c3edab120b14623931d5ddb16fdc6e7cad5d
335 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid0-whole
336 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-part
337 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-whole
338 rm -rf ${D}${PTEST_PATH}/tests/ts/fdisk/align-512-4K-md
339}
340
341# Delete tests not working on musl
342do_install_ptest:append:libc-musl() {
343 for t in tests/ts/col/multibyte \
344 tests/ts/lib/timeutils \
345 tests/ts/dmesg/limit; do
346 rm -rf ${D}${PTEST_PATH}/$t
347 done
348}