version = "2.41" revision = 1 description = "Miscellaneous system utilities (agetty, mount, libblkid, libmount)" license = "GPL-2.0-or-later AND LGPL-2.1-or-later" url = "https://github.com/util-linux/util-linux" _series = "v" + ".".join(version.split(".")[:2]) source = tarball( url=f"https://www.kernel.org/pub/linux/utils/util-linux/{_series}/util-linux-{version}.tar.xz", sha256="81ee93b3cfdfeb7d7c4090cedeba1d7bbce9141fd0b501b686b3fe475ddca4c6", ) host_deps = ["binutils", "gcc", "pkgconf"] deps = [profile["libc"], "zlib"] configure, build, _ = autotools( configure_args=[ # We need agetty + the libs (blkid/mount/uuid); login/su come from shadow # to avoid a /usr/bin/login file conflict. "--disable-login", "--disable-su", "--disable-nologin", # liblastlog2 (new in 2.41) pulls in sqlite3; we don't need it. "--disable-liblastlog2", "--disable-pam-lastlog2", # We only need agetty + the libs; skip the curses TUI tools (irqtop, # cfdisk, ...) which otherwise trip over the ncurses termlib split. "--without-ncurses", "--without-ncursesw", "--without-systemd", "--without-systemdsystemunitdir", "--without-python", "--disable-bash-completion", "--disable-rpath", # These would chown/setuid during install, which fails unprivileged. "--disable-makeinstall-chown", "--disable-makeinstall-setuid", ], ) def install(self): autotools_install(self, [f"DESTDIR={self.dest_dir}"]) # libtool's install-time relink miscompiles libmount/libfdisk against the # build host's musl libc instead of the target glibc (the pre-relink # build-tree libs are correct). Restore the build-tree shared objects over # the relinked ones and strip their build-tree rpath. self.run( "sh", "-ec", "for real in /build/.libs/lib*.so.*.*.*; do " ' [ -e "$real" ] || continue; ' ' base=$(basename "$real"); ' f' dst="{self.dest_dir}/usr/lib/$base"; ' ' [ -e "$dst" ] || continue; ' ' cp -a "$real" "$dst"; ' ' patchelf --remove-rpath "$dst" 2>/dev/null || true; ' "done", )