sys-libs/glibc: tweak riscv preconfigure mangling
authorSergei Trofimovich <slyfox@gentoo.org>
Fri, 6 Apr 2018 19:13:27 +0000 (20:13 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Fri, 6 Apr 2018 19:13:38 +0000 (20:13 +0100)
Changed 'preconfigure' mangling from using sed to using CPPFLAGS.
While at it move the hack closer to ./configure call.

Package-Manager: Portage-2.3.28, Repoman-2.3.9

sys-libs/glibc/glibc-2.27-r1.ebuild
sys-libs/glibc/glibc-9999.ebuild

index c61cf3e292927e9959f41175a2d697d746ed59c3..3cc1a137ada336034fb2b2f6e695e94d65ce8d8f 100644 (file)
@@ -754,26 +754,6 @@ src_prepare() {
                einfo "Done."
        fi
 
-       if just_headers ; then
-               if [[ -e sysdeps/riscv/preconfigure ]] ; then
-                       # RISC-V interrogates the compiler to determine which target to
-                       # build.  If building the headers then we don't strictly need a
-                       # RISC-V compiler, so the built-in definitions that are provided
-                       # along with all RISC-V compiler might not exist.  This causes
-                       # glibc's RISC-V preconfigure script to blow up.  Since we're just
-                       # building the headers any value will actually work here, so just
-                       # pick the standard one (rv64g/lp64d) to make the build scripts
-                       # happy for now -- the headers are all the same anyway so it
-                       # doesn't matter.
-                       sed -i 's/^    xlen=.*/    xlen=64/g' sysdeps/riscv/preconfigure || die
-                       sed -i 's/^    flen=.*/    flen=64/g' sysdeps/riscv/preconfigure || die
-                       sed -i 's/^    float_abi=.*/    float_abi=double/g' sysdeps/riscv/preconfigure || die
-                       sed -i 's/^    atomic=.*/    atomic=__riscv_atomic/g' sysdeps/riscv/preconfigure || die
-                       sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure.ac || die
-                       sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure || die
-               fi
-       fi
-
        default
 
        gnuconfig_update
@@ -1009,6 +989,8 @@ glibc_headers_configure() {
                export ${v}
        done
 
+       local headers_only_arch_CPPFLAGS=()
+
        # Blow away some random CC settings that screw things up. #550192
        if [[ -d ${S}/sysdeps/mips ]]; then
                pushd "${S}"/sysdeps/mips >/dev/null
@@ -1025,6 +1007,25 @@ glibc_headers_configure() {
                popd >/dev/null
        fi
 
+       case ${CTARGET} in
+       riscv*)
+               # RISC-V interrogates the compiler to determine which target to
+               # build.  If building the headers then we don't strictly need a
+               # RISC-V compiler, so the built-in definitions that are provided
+               # along with all RISC-V compiler might not exist.  This causes
+               # glibc's RISC-V preconfigure script to blow up.  Since we're just
+               # building the headers any value will actually work here, so just
+               # pick the standard one (rv64g/lp64d) to make the build scripts
+               # happy for now -- the headers are all the same anyway so it
+               # doesn't matter.
+               headers_only_arch_CPPFLAGS+=(
+                       -D__riscv_xlen=64
+                       -D__riscv_flen=64
+                       -D__riscv_float_abi_double=1
+                       -D__riscv_atomic=1
+               ) ;;
+       esac
+
        local myconf=()
        myconf+=(
                --disable-sanity-checks
@@ -1043,7 +1044,7 @@ glibc_headers_configure() {
        # So forcing CC/CFLAGS is sane.
        local headers_only_CC=$(tc-getBUILD_CC)
        local headers_only_CFLAGS="-O1 -pipe"
-       local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
+       local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
        local headers_only_LDFLAGS=""
        set -- "${S}"/configure "${myconf[@]}"
        echo \
index 12272c31f35d5d9b5ff919360afb375d0538fe84..519bc28c95461bba288f25eccc7c4515409881f2 100644 (file)
@@ -754,26 +754,6 @@ src_prepare() {
                einfo "Done."
        fi
 
-       if just_headers ; then
-               if [[ -e sysdeps/riscv/preconfigure ]] ; then
-                       # RISC-V interrogates the compiler to determine which target to
-                       # build.  If building the headers then we don't strictly need a
-                       # RISC-V compiler, so the built-in definitions that are provided
-                       # along with all RISC-V compiler might not exist.  This causes
-                       # glibc's RISC-V preconfigure script to blow up.  Since we're just
-                       # building the headers any value will actually work here, so just
-                       # pick the standard one (rv64g/lp64d) to make the build scripts
-                       # happy for now -- the headers are all the same anyway so it
-                       # doesn't matter.
-                       sed -i 's/^    xlen=.*/    xlen=64/g' sysdeps/riscv/preconfigure || die
-                       sed -i 's/^    flen=.*/    flen=64/g' sysdeps/riscv/preconfigure || die
-                       sed -i 's/^    float_abi=.*/    float_abi=double/g' sysdeps/riscv/preconfigure || die
-                       sed -i 's/^    atomic=.*/    atomic=__riscv_atomic/g' sysdeps/riscv/preconfigure || die
-                       sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure.ac || die
-                       sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure || die
-               fi
-       fi
-
        default
 
        gnuconfig_update
@@ -1009,6 +989,8 @@ glibc_headers_configure() {
                export ${v}
        done
 
+       local headers_only_arch_CPPFLAGS=()
+
        # Blow away some random CC settings that screw things up. #550192
        if [[ -d ${S}/sysdeps/mips ]]; then
                pushd "${S}"/sysdeps/mips >/dev/null
@@ -1025,6 +1007,25 @@ glibc_headers_configure() {
                popd >/dev/null
        fi
 
+       case ${CTARGET} in
+       riscv*)
+               # RISC-V interrogates the compiler to determine which target to
+               # build.  If building the headers then we don't strictly need a
+               # RISC-V compiler, so the built-in definitions that are provided
+               # along with all RISC-V compiler might not exist.  This causes
+               # glibc's RISC-V preconfigure script to blow up.  Since we're just
+               # building the headers any value will actually work here, so just
+               # pick the standard one (rv64g/lp64d) to make the build scripts
+               # happy for now -- the headers are all the same anyway so it
+               # doesn't matter.
+               headers_only_arch_CPPFLAGS+=(
+                       -D__riscv_xlen=64
+                       -D__riscv_flen=64
+                       -D__riscv_float_abi_double=1
+                       -D__riscv_atomic=1
+               ) ;;
+       esac
+
        local myconf=()
        myconf+=(
                --disable-sanity-checks
@@ -1043,7 +1044,7 @@ glibc_headers_configure() {
        # So forcing CC/CFLAGS is sane.
        local headers_only_CC=$(tc-getBUILD_CC)
        local headers_only_CFLAGS="-O1 -pipe"
-       local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
+       local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
        local headers_only_LDFLAGS=""
        set -- "${S}"/configure "${myconf[@]}"
        echo \
@@ -1101,6 +1102,7 @@ src_test() {
        if just_headers ; then
                return
        fi
+
        # Give tests more time to complete.
        export TIMEOUTFACTOR=5