commit:     e5779ed450cb40d944b013b1257a385714544d0c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 12 19:40:39 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jun 12 19:42:52 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5779ed4

sys-apps/baselayout: Add riscv compat symlink for 1-level libdir

Approved by williamh

Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...layout-9999.ebuild => baselayout-2.7-r3.ebuild} | 41 ++++++++++++++++++++++
 sys-apps/baselayout/baselayout-9999.ebuild         | 41 ++++++++++++++++++++++
 2 files changed, 82 insertions(+)

diff --git a/sys-apps/baselayout/baselayout-9999.ebuild 
b/sys-apps/baselayout/baselayout-2.7-r3.ebuild
similarity index 87%
copy from sys-apps/baselayout/baselayout-9999.ebuild
copy to sys-apps/baselayout/baselayout-2.7-r3.ebuild
index 9f4a53a1c18..c83d1da82dc 100644
--- a/sys-apps/baselayout/baselayout-9999.ebuild
+++ b/sys-apps/baselayout/baselayout-2.7-r3.ebuild
@@ -23,6 +23,34 @@ pkg_setup() {
        multilib_layout
 }
 
+riscv_compat_symlink() {
+       # Here we apply some special sauce for riscv.
+       # Two multilib layouts exist for now:
+       # 1) one level libdirs, (32bit) "lib" and (64bit) "lib64"
+       #    these are chosen by us to closely resemble other arches
+       # 2) two level libdirs, "lib64/lp64d" "lib64/lp64" "lib32/ilp32d" ...
+       #    this is the glibc/gcc default
+       # Unfortunately, the default has only one fallback, which is "lib"
+       # for both 32bit and 64bit. So things do not break in 1), we need
+       # to provide compatibility symlinks...
+
+       # This function has exactly two parameters:
+       # - the default libdir, to determine if 1) or 2) applies
+       # - the location of the symlink (which points to ".")
+
+       # Note: we call this only in the ${SYMLINK_LIB} = no codepath, since
+       # there never was a ${SYMLINK_LIB} = yes riscv profile.
+
+       case ${CHOST} in
+       riscv*)
+               # are we on a one level libdir profile? is there no symlink yet?
+               if [[ ${1} != */* && ! -L ${2} ]] ; then
+                       ln -s . $2 || die "Unable to make $2 riscv 
compatibility symlink"
+               fi
+               ;;
+       esac
+}
+
 # Create our multilib dirs - the Makefile has no knowledge of this
 multilib_layout() {
        local dir def_libdir libdir libdirs
@@ -52,6 +80,7 @@ multilib_layout() {
                                                die "Unable to create ${dir} 
directory"
                                fi
                        done
+                       riscv_compat_symlink "${def_libdir}" 
"${prefix}${def_libdir}/${DEFAULT_ABI}"
                done
                return 0
        fi
@@ -282,6 +311,18 @@ pkg_postinst() {
                fi
        fi
 
+       # https://bugs.gentoo.org/361349
+       if use kernel_linux; then
+               mkdir -p "${EROOT}"/run || die
+
+               local found fstype mountpoint
+               while read -r _ mountpoint fstype _; do
+               [[ ${mountpoint} = /run ]] && [[ ${fstype} = tmpfs ]] && found=1
+               done < "${ROOT}"/proc/mounts
+               [[ -z ${found} ]] &&
+                       ewarn "You should reboot now to get /run mounted with 
tmpfs!"
+       fi
+
        for x in ${REPLACING_VERSIONS}; do
                if ver_test 2.4 -lt ${x}; then
                        ewarn "After updating ${EROOT}/etc/profile, please run"

diff --git a/sys-apps/baselayout/baselayout-9999.ebuild 
b/sys-apps/baselayout/baselayout-9999.ebuild
index 9f4a53a1c18..c83d1da82dc 100644
--- a/sys-apps/baselayout/baselayout-9999.ebuild
+++ b/sys-apps/baselayout/baselayout-9999.ebuild
@@ -23,6 +23,34 @@ pkg_setup() {
        multilib_layout
 }
 
+riscv_compat_symlink() {
+       # Here we apply some special sauce for riscv.
+       # Two multilib layouts exist for now:
+       # 1) one level libdirs, (32bit) "lib" and (64bit) "lib64"
+       #    these are chosen by us to closely resemble other arches
+       # 2) two level libdirs, "lib64/lp64d" "lib64/lp64" "lib32/ilp32d" ...
+       #    this is the glibc/gcc default
+       # Unfortunately, the default has only one fallback, which is "lib"
+       # for both 32bit and 64bit. So things do not break in 1), we need
+       # to provide compatibility symlinks...
+
+       # This function has exactly two parameters:
+       # - the default libdir, to determine if 1) or 2) applies
+       # - the location of the symlink (which points to ".")
+
+       # Note: we call this only in the ${SYMLINK_LIB} = no codepath, since
+       # there never was a ${SYMLINK_LIB} = yes riscv profile.
+
+       case ${CHOST} in
+       riscv*)
+               # are we on a one level libdir profile? is there no symlink yet?
+               if [[ ${1} != */* && ! -L ${2} ]] ; then
+                       ln -s . $2 || die "Unable to make $2 riscv 
compatibility symlink"
+               fi
+               ;;
+       esac
+}
+
 # Create our multilib dirs - the Makefile has no knowledge of this
 multilib_layout() {
        local dir def_libdir libdir libdirs
@@ -52,6 +80,7 @@ multilib_layout() {
                                                die "Unable to create ${dir} 
directory"
                                fi
                        done
+                       riscv_compat_symlink "${def_libdir}" 
"${prefix}${def_libdir}/${DEFAULT_ABI}"
                done
                return 0
        fi
@@ -282,6 +311,18 @@ pkg_postinst() {
                fi
        fi
 
+       # https://bugs.gentoo.org/361349
+       if use kernel_linux; then
+               mkdir -p "${EROOT}"/run || die
+
+               local found fstype mountpoint
+               while read -r _ mountpoint fstype _; do
+               [[ ${mountpoint} = /run ]] && [[ ${fstype} = tmpfs ]] && found=1
+               done < "${ROOT}"/proc/mounts
+               [[ -z ${found} ]] &&
+                       ewarn "You should reboot now to get /run mounted with 
tmpfs!"
+       fi
+
        for x in ${REPLACING_VERSIONS}; do
                if ver_test 2.4 -lt ${x}; then
                        ewarn "After updating ${EROOT}/etc/profile, please run"

Reply via email to