commit:     6de834d0aba32a86de1aee8806f8c03a815ad98e
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  3 18:13:02 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Apr  3 19:06:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6de834d0

sys-libs/musl: fix ld-musl.so symlink with merged-usr

To create a symlink relative to /lib/ld-musl.so, we must know if ${ROOT}
will have /lib symlinked to /usr/lib. We rely on the split-usr USE flag to
determine this.

Closes: https://bugs.gentoo.org/903703
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../musl/{musl-9999.ebuild => musl-1.2.3-r8.ebuild}    | 18 +++++++++++-------
 sys-libs/musl/musl-9999.ebuild                         | 18 +++++++++++-------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-1.2.3-r8.ebuild
similarity index 92%
copy from sys-libs/musl/musl-9999.ebuild
copy to sys-libs/musl/musl-1.2.3-r8.ebuild
index 9cd55f813a6c..cc84710e0176 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-1.2.3-r8.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit eapi8-dosym flag-o-matic toolchain-funcs prefix
+inherit flag-o-matic toolchain-funcs prefix
 if [[ ${PV} == "9999" ]] ; then
        EGIT_REPO_URI="git://git.musl-libc.org/musl"
        inherit git-r3
@@ -38,7 +38,7 @@ HOMEPAGE="https://musl.libc.org";
 
 LICENSE="MIT LGPL-2 GPL-2"
 SLOT="0"
-IUSE="crypt headers-only"
+IUSE="crypt headers-only split-usr"
 
 QA_SONAME="usr/lib/libc.so"
 QA_DT_NEEDED="usr/lib/libc.so"
@@ -164,11 +164,15 @@ src_install() {
                # During cross or within prefix, there's no guarantee that the 
host is
                # using musl so that file may not exist. Use a relative symlink 
within
                # ${D} instead.
-               rm -f "${ED}"/lib/ld-musl-${arch}.so.1 || die
-               dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
-
-               # If it's still a dead symlnk, OK, we really do need to abort.
-               [[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+               rm "${ED}"/lib/ld-musl-${arch}.so.1 || die
+               if use split-usr; then
+                       dosym ../usr/lib/libc.so /lib/ld-musl-${arch}.so.1
+                       # If it's still a dead symlnk, OK, we really do need to 
abort.
+                       [[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+               else
+                       dosym libc.so /usr/lib/ld-musl-${arch}.so.1
+                       [[ -e "${ED}"/usr/lib/ld-musl-${arch}.so.1 ]] || die
+               fi
 
                cp "${FILESDIR}"/ldconfig.in-r3 "${T}"/ldconfig.in || die
                sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > 
"${T}"/ldconfig || die

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild
index 9cd55f813a6c..cc84710e0176 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit eapi8-dosym flag-o-matic toolchain-funcs prefix
+inherit flag-o-matic toolchain-funcs prefix
 if [[ ${PV} == "9999" ]] ; then
        EGIT_REPO_URI="git://git.musl-libc.org/musl"
        inherit git-r3
@@ -38,7 +38,7 @@ HOMEPAGE="https://musl.libc.org";
 
 LICENSE="MIT LGPL-2 GPL-2"
 SLOT="0"
-IUSE="crypt headers-only"
+IUSE="crypt headers-only split-usr"
 
 QA_SONAME="usr/lib/libc.so"
 QA_DT_NEEDED="usr/lib/libc.so"
@@ -164,11 +164,15 @@ src_install() {
                # During cross or within prefix, there's no guarantee that the 
host is
                # using musl so that file may not exist. Use a relative symlink 
within
                # ${D} instead.
-               rm -f "${ED}"/lib/ld-musl-${arch}.so.1 || die
-               dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
-
-               # If it's still a dead symlnk, OK, we really do need to abort.
-               [[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+               rm "${ED}"/lib/ld-musl-${arch}.so.1 || die
+               if use split-usr; then
+                       dosym ../usr/lib/libc.so /lib/ld-musl-${arch}.so.1
+                       # If it's still a dead symlnk, OK, we really do need to 
abort.
+                       [[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+               else
+                       dosym libc.so /usr/lib/ld-musl-${arch}.so.1
+                       [[ -e "${ED}"/usr/lib/ld-musl-${arch}.so.1 ]] || die
+               fi
 
                cp "${FILESDIR}"/ldconfig.in-r3 "${T}"/ldconfig.in || die
                sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > 
"${T}"/ldconfig || die

Reply via email to