commit:     73d3426b9af66c84b32ea0631205a0546049d9f3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  6 08:49:02 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Apr  6 11:43:23 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73d3426b

sys-apps/util-linux: Support library-only build for *BSD

Closes: https://bugs.gentoo.org/651398

 sys-apps/util-linux/util-linux-9999.ebuild | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/sys-apps/util-linux/util-linux-9999.ebuild 
b/sys-apps/util-linux/util-linux-9999.ebuild
index 2bf922e742b..76ee8160737 100644
--- a/sys-apps/util-linux/util-linux-9999.ebuild
+++ b/sys-apps/util-linux/util-linux-9999.ebuild
@@ -25,7 +25,7 @@ HOMEPAGE="https://www.kernel.org/pub/linux/utils/util-linux/";
 
 LICENSE="GPL-2 LGPL-2.1 BSD-4 MIT public-domain"
 SLOT="0"
-IUSE="build caps +cramfs fdformat kill ncurses nls pam python +readline 
selinux slang static-libs +suid systemd test tty-helpers udev unicode"
+IUSE="build caps +cramfs fdformat kill ncurses nls pam python +readline 
selinux slang static-libs +suid systemd test tty-helpers udev unicode 
userland_GNU"
 
 # Most lib deps here are related to programs rather than our libs,
 # so we rarely need to specify ${MULTILIB_USEDEP}.
@@ -73,6 +73,13 @@ src_prepare() {
                -e "s|UUIDD_SOCKET=\"\$(mktemp -u 
\"\${TS_OUTDIR}/uuiddXXXXXXXXXXXXX\")\"|UUIDD_SOCKET=\"\$(mktemp -u 
\"${T}/uuiddXXXXXXXXXXXXX.sock\")\"|g" \
                tests/ts/uuid/uuidd || die "Failed to fix uuidd test"
 
+       if ! use userland_GNU; then
+               # test runner is using GNU-specific xargs call
+               sed -i -e 's:xargs:gxargs:' tests/run.sh || die
+               # test requires util-linux uuidgen (which we don't build)
+               rm tests/ts/uuid/oids || die
+       fi
+
        if [[ ${PV} == 9999 ]] ; then
                po/update-potfiles
                eautoreconf
@@ -128,7 +135,8 @@ multilib_src_configure() {
                $(use_with selinux)
                $(usex ncurses '' '--without-tinfo')
        )
-       if multilib_is_native_abi; then
+       # build programs only on GNU, on *BSD we want libraries only
+       if multilib_is_native_abi && use userland_GNU; then
                myeconfargs+=(
                        --disable-chfn-chsh
                        --disable-login
@@ -156,13 +164,18 @@ multilib_src_configure() {
                        --disable-all-programs
                        --disable-bash-completion
                        --without-systemdsystemunitdir
-                       # build all libraries
+                       # build libraries
                        --enable-libuuid
                        --enable-libblkid
-                       --enable-libmount
                        --enable-libsmartcols
                        --enable-libfdisk
                )
+               if use userland_GNU; then
+                       # those libraries don't work on *BSD
+                       myeconfargs+=(
+                               --enable-libmount
+                       )
+               fi
        fi
        ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
 }
@@ -174,7 +187,7 @@ multilib_src_test() {
 multilib_src_install() {
        emake DESTDIR="${D}" install
 
-       if multilib_is_native_abi; then
+       if multilib_is_native_abi && use userland_GNU; then
                # need the libs in /
                gen_usr_ldscript -a blkid mount smartcols uuid
 
@@ -188,6 +201,12 @@ multilib_src_install_all() {
        # e2fsprogs-libs didnt install .la files, and .pc work fine
        find "${ED}" -name "*.la" -delete || die
 
+       if ! use userland_GNU; then
+               # manpage collisions
+               # TODO: figure out a good way to keep them
+               rm "${ED%/}"/usr/share/man/man3/uuid* || die
+       fi
+
        if use pam; then
                newpamd "${FILESDIR}/runuser.pamd" runuser
                newpamd "${FILESDIR}/runuser-l.pamd" runuser-l

Reply via email to