diff options
Diffstat (limited to 'meta/recipes-core/util-linux/util-linux_2.37.bb')
-rw-r--r-- | meta/recipes-core/util-linux/util-linux_2.37.bb | 302 |
1 files changed, 302 insertions, 0 deletions
diff --git a/meta/recipes-core/util-linux/util-linux_2.37.bb b/meta/recipes-core/util-linux/util-linux_2.37.bb new file mode 100644 index 0000000000..9a50c75e77 --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux_2.37.bb | |||
@@ -0,0 +1,302 @@ | |||
1 | require util-linux.inc | ||
2 | |||
3 | #gtk-doc is not enabled as it requires xmlto which requires util-linux | ||
4 | inherit autotools gettext pkgconfig systemd update-alternatives python3-dir bash-completion ptest | ||
5 | DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid" | ||
6 | |||
7 | PACKAGES =+ "${PN}-swaponoff" | ||
8 | PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}" | ||
9 | |||
10 | python util_linux_binpackages () { | ||
11 | def pkg_hook(f, pkg, file_regex, output_pattern, modulename): | ||
12 | pn = d.getVar('PN') | ||
13 | d.appendVar('RRECOMMENDS_%s' % pn, ' %s' % pkg) | ||
14 | |||
15 | if d.getVar('ALTERNATIVE_' + pkg): | ||
16 | return | ||
17 | if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename): | ||
18 | d.setVar('ALTERNATIVE_' + pkg, modulename) | ||
19 | |||
20 | bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split()))) | ||
21 | for dir in bindirs: | ||
22 | do_split_packages(d, root=dir, | ||
23 | file_regex=r'(.*)', output_pattern='${PN}-%s', | ||
24 | description='${PN} %s', | ||
25 | hook=pkg_hook, extra_depends='') | ||
26 | |||
27 | # There are some symlinks for some binaries which we have ignored | ||
28 | # above. Add them to the package owning the binary they are | ||
29 | # pointing to | ||
30 | extras = {} | ||
31 | dvar = d.getVar('PKGD') | ||
32 | for root in bindirs: | ||
33 | for walkroot, dirs, files in os.walk(dvar + root): | ||
34 | for f in files: | ||
35 | file = os.path.join(walkroot, f) | ||
36 | if not os.path.islink(file): | ||
37 | continue | ||
38 | |||
39 | pkg = os.path.basename(os.readlink(file)) | ||
40 | extras[pkg] = extras.get(pkg, '') + ' ' + 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 + links | ||
46 | d.setVar('FILES_' + pn + '-' + pkg, links) | ||
47 | } | ||
48 | |||
49 | # we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS | ||
50 | PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages " | ||
51 | |||
52 | # skip libuuid as it will be packaged by the util-linux-libuuid recipe | ||
53 | python 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 | |||
60 | PACKAGESPLITFUNCS =+ "util_linux_libpackages" | ||
61 | |||
62 | PACKAGES_DYNAMIC = "^${PN}-.*" | ||
63 | |||
64 | CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms" | ||
65 | UTIL_LINUX_LIBDIR = "${libdir}" | ||
66 | UTIL_LINUX_LIBDIR_class-target = "${base_libdir}" | ||
67 | EXTRA_OECONF = "\ | ||
68 | --enable-libuuid --enable-libblkid \ | ||
69 | \ | ||
70 | --enable-fsck --enable-kill --enable-last --enable-mesg \ | ||
71 | --enable-mount --enable-partx --enable-raw --enable-rfkill \ | ||
72 | --enable-unshare --enable-write \ | ||
73 | \ | ||
74 | --disable-bfs --disable-chfn-chsh --disable-login \ | ||
75 | --disable-makeinstall-chown --disable-minix --disable-newgrp \ | ||
76 | --disable-use-tty-group --disable-vipw \ | ||
77 | \ | ||
78 | --without-udev \ | ||
79 | \ | ||
80 | usrsbin_execdir='${sbindir}' \ | ||
81 | --libdir='${UTIL_LINUX_LIBDIR}' \ | ||
82 | " | ||
83 | |||
84 | EXTRA_OECONF_append_class-target = " --enable-setpriv" | ||
85 | EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv" | ||
86 | EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv" | ||
87 | EXTRA_OECONF_append = " --disable-hwclock-gplv3" | ||
88 | |||
89 | # enable pcre2 for native/nativesdk to match host distros | ||
90 | # this helps to keep same expectations when using the SDK or | ||
91 | # build host versions during development | ||
92 | # | ||
93 | PACKAGECONFIG ?= "pcre2" | ||
94 | PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" | ||
95 | PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam," | ||
96 | # Respect the systemd feature for uuidd | ||
97 | PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd" | ||
98 | # Build python bindings for libmount | ||
99 | PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3" | ||
100 | # Readline support | ||
101 | PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" | ||
102 | # PCRE support in hardlink | ||
103 | PACKAGECONFIG[pcre2] = ",,libpcre2" | ||
104 | PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup" | ||
105 | |||
106 | EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'" | ||
107 | |||
108 | ALLOW_EMPTY_${PN} = "1" | ||
109 | FILES_${PN} = "" | ||
110 | FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*" | ||
111 | FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la" | ||
112 | FILES_${PN}-mount = "${sysconfdir}/default/mountall" | ||
113 | FILES_${PN}-runuser = "${sysconfdir}/pam.d/runuser*" | ||
114 | FILES_${PN}-su = "${sysconfdir}/pam.d/su-l" | ||
115 | CONFFILES_${PN}-su = "${sysconfdir}/pam.d/su-l" | ||
116 | FILES_${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \ | ||
117 | ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \ | ||
118 | ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*" | ||
119 | |||
120 | # Util-linux' blkid replaces the e2fsprogs one | ||
121 | RCONFLICTS_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" | ||
122 | RREPLACES_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" | ||
123 | |||
124 | RRECOMMENDS_${PN}_class-native = "" | ||
125 | RRECOMMENDS_${PN}_class-nativesdk = "" | ||
126 | RDEPENDS_${PN}_class-native = "" | ||
127 | RDEPENDS_${PN}_class-nativesdk = "" | ||
128 | |||
129 | RDEPENDS_${PN} += " util-linux-libuuid" | ||
130 | RDEPENDS_${PN}-dev += " util-linux-libuuid-dev" | ||
131 | |||
132 | RPROVIDES_${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev" | ||
133 | |||
134 | RDEPENDS_${PN}-bash-completion += "${PN}-lsblk" | ||
135 | RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs grep iproute2 kmod mdadm procps sed socat which xz" | ||
136 | RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug" | ||
137 | RDEPENDS_${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff" | ||
138 | ALLOW_EMPTY_${PN}-swaponoff = "1" | ||
139 | |||
140 | #SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim" | ||
141 | SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service" | ||
142 | SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable" | ||
143 | SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service" | ||
144 | SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable" | ||
145 | |||
146 | do_install () { | ||
147 | # with ccache the timestamps on compiled files may | ||
148 | # end up earlier than on their inputs, this allows | ||
149 | # for the resultant compilation in the install step. | ||
150 | oe_runmake 'CC=${CC}' 'LD=${LD}' \ | ||
151 | 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install | ||
152 | |||
153 | mkdir -p ${D}${base_bindir} | ||
154 | |||
155 | sbinprogs="agetty ctrlaltdel cfdisk vipw vigr" | ||
156 | sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin" | ||
157 | binprogs_a="dmesg getopt kill more umount mount login su mountpoint" | ||
158 | |||
159 | if [ "${base_sbindir}" != "${sbindir}" ]; then | ||
160 | mkdir -p ${D}${base_sbindir} | ||
161 | for p in $sbinprogs $sbinprogs_a; do | ||
162 | if [ -f "${D}${sbindir}/$p" ]; then | ||
163 | mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p" | ||
164 | fi | ||
165 | done | ||
166 | fi | ||
167 | |||
168 | if [ "${base_bindir}" != "${bindir}" ]; then | ||
169 | mkdir -p ${D}${base_bindir} | ||
170 | for p in $binprogs_a; do | ||
171 | if [ -f "${D}${bindir}/$p" ]; then | ||
172 | mv "${D}${bindir}/$p" "${D}${base_bindir}/$p" | ||
173 | fi | ||
174 | done | ||
175 | fi | ||
176 | |||
177 | install -d ${D}${sysconfdir}/default/ | ||
178 | echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall | ||
179 | |||
180 | rm -f ${D}${bindir}/chkdupexe | ||
181 | } | ||
182 | |||
183 | do_install_append_class-target () { | ||
184 | if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then | ||
185 | install -d ${D}${sysconfdir}/pam.d | ||
186 | install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser | ||
187 | install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l | ||
188 | # Required for "su -" aka "su --login" because | ||
189 | # otherwise it uses "other", which has "auth pam_deny.so" | ||
190 | # and thus prevents the operation. | ||
191 | ln -s su ${D}${sysconfdir}/pam.d/su-l | ||
192 | fi | ||
193 | } | ||
194 | # nologin causes a conflict with shadow-native | ||
195 | # kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir}) | ||
196 | do_install_append_class-native () { | ||
197 | rm -f ${D}${base_sbindir}/nologin | ||
198 | rm -f ${D}${base_bindir}/kill | ||
199 | } | ||
200 | |||
201 | # dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds | ||
202 | # Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it | ||
203 | do_install_append () { | ||
204 | rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid* | ||
205 | } | ||
206 | |||
207 | ALTERNATIVE_PRIORITY = "80" | ||
208 | |||
209 | ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid" | ||
210 | ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev" | ||
211 | ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal" | ||
212 | ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt" | ||
213 | ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg" | ||
214 | ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject" | ||
215 | ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate" | ||
216 | ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk" | ||
217 | ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock" | ||
218 | ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck" | ||
219 | ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze" | ||
220 | ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim" | ||
221 | ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt" | ||
222 | ALTERNATIVE_${PN}-agetty = "getty" | ||
223 | ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty" | ||
224 | ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty" | ||
225 | ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump" | ||
226 | ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock" | ||
227 | ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice" | ||
228 | ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill" | ||
229 | ALTERNATIVE_${PN}-last = "last lastb" | ||
230 | ALTERNATIVE_LINK_NAME[last] = "${bindir}/last" | ||
231 | ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb" | ||
232 | ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger" | ||
233 | ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup" | ||
234 | ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg" | ||
235 | ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap" | ||
236 | ALTERNATIVE_LINK_NAME[mcookie] = "${bindir}/mcookie" | ||
237 | ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more" | ||
238 | ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount" | ||
239 | ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint" | ||
240 | ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin" | ||
241 | ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter" | ||
242 | ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root" | ||
243 | ALTERNATIVE_LINK_NAME[prlimit] = "${bindir}/prlimit" | ||
244 | ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile" | ||
245 | ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice" | ||
246 | ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev" | ||
247 | ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill" | ||
248 | ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake" | ||
249 | ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv" | ||
250 | ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid" | ||
251 | ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" | ||
252 | ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin" | ||
253 | ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff" | ||
254 | ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon" | ||
255 | ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root" | ||
256 | ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset" | ||
257 | ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount" | ||
258 | ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare" | ||
259 | ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump" | ||
260 | ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen" | ||
261 | ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall" | ||
262 | |||
263 | BBCLASSEXTEND = "native nativesdk" | ||
264 | |||
265 | PTEST_BINDIR = "1" | ||
266 | do_compile_ptest() { | ||
267 | oe_runmake buildtest-TESTS | ||
268 | } | ||
269 | |||
270 | do_install_ptest() { | ||
271 | mkdir -p ${D}${PTEST_PATH}/tests/ts | ||
272 | find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; | ||
273 | find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; | ||
274 | find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; | ||
275 | |||
276 | cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/ | ||
277 | cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected | ||
278 | cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/ | ||
279 | cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH} | ||
280 | |||
281 | # The original paths of executables to be tested point to a local folder containing | ||
282 | # the executables. We want to test the installed executables, not the local copies. | ||
283 | # So strip the paths, the executables will be located via "which" | ||
284 | sed -i \ | ||
285 | -e '/^TS_CMD/ s|$top_builddir/||g' \ | ||
286 | -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \ | ||
287 | ${D}${PTEST_PATH}/tests/commands.sh | ||
288 | |||
289 | # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]' | ||
290 | sed -i -e \ | ||
291 | '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \ | ||
292 | ${D}${PTEST_PATH}/tests/functions.sh | ||
293 | |||
294 | # Running "kill" without the the complete path would use the shell's built-in kill | ||
295 | sed -i -e \ | ||
296 | '/^TS_CMD_KILL/ s|kill|${PTEST_PATH}/bin/kill|g' \ | ||
297 | ${D}${PTEST_PATH}/tests/commands.sh | ||
298 | |||
299 | |||
300 | sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest | ||
301 | |||
302 | } | ||