dev-libs/openssl: don't destroy user flags
authorThomas Deutschmann <whissi@gentoo.org>
Fri, 23 Aug 2019 17:44:30 +0000 (19:44 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Fri, 23 Aug 2019 18:10:20 +0000 (20:10 +0200)
Thanks-to: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Closes: https://bugs.gentoo.org/671016
Package-Manager: Portage-2.3.72, Repoman-2.3.17
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
dev-libs/openssl/openssl-1.0.2s-r1.ebuild
dev-libs/openssl/openssl-1.0.2s-r200.ebuild
dev-libs/openssl/openssl-1.1.0k-r1.ebuild
dev-libs/openssl/openssl-1.1.1c-r1.ebuild

index a2cb9f7917edca272968f29325118fc26b7fa998..b4902db7e537d9b727eda80cf8aa6e91b5e6ce5c 100644 (file)
@@ -187,7 +187,9 @@ multilib_src_configure() {
        [[ -z ${sslout} ]] && config="config"
 
        # Fedora hobbled-EC needs 'no-ec2m', 'no-srp'
-       echoit \
+       # Make sure user flags don't get added *yet* to avoid duplicated
+       # flags.
+       CFLAGS= LDFLAGS= echoit \
        ./${config} \
                ${sslout} \
                $(use cpu_flags_x86_sse2 || echo "no-sse2") \
@@ -216,17 +218,23 @@ multilib_src_configure() {
                || die
 
        # Clean out hardcoded flags that openssl uses
-       local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
+       local DEFAULT_CFLAGS=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
                -e 's:^CFLAG=::' \
-               -e 's:-fomit-frame-pointer ::g' \
-               -e 's:-O[0-9] ::g' \
-               -e 's:-march=[-a-z0-9]* ::g' \
-               -e 's:-mcpu=[-a-z0-9]* ::g' \
-               -e 's:-m[a-z0-9]* ::g' \
+               -e 's:\(^\| \)-fomit-frame-pointer::g' \
+               -e 's:\(^\| \)-O[^ ]*::g' \
+               -e 's:\(^\| \)-march=[^ ]*::g' \
+               -e 's:\(^\| \)-mcpu=[^ ]*::g' \
+               -e 's:\(^\| \)-m[^ ]*::g' \
+               -e 's:^ *::' \
+               -e 's: *$::' \
+               -e 's: \+: :g' \
+               -e 's:\\:\\\\:g'
        )
+
+       # Now insert clean default flags with user flags
        sed -i \
-               -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
-               -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
+               -e "/^CFLAG/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
+               -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
                Makefile || die
 }
 
index 281b169b64b09eb3bf343c136ee99f0e61be44a5..24f2b3a5663fbe316244c4d3166c7d52639842c6 100644 (file)
@@ -191,7 +191,9 @@ multilib_src_configure() {
        [[ -z ${sslout} ]] && config="config"
 
        # Fedora hobbled-EC needs 'no-ec2m', 'no-srp'
-       echoit \
+       # Make sure user flags don't get added *yet* to avoid duplicated
+       # flags.
+       CFLAGS= LDFLAGS= echoit \
        ./${config} \
                ${sslout} \
                $(use cpu_flags_x86_sse2 || echo "no-sse2") \
@@ -220,17 +222,23 @@ multilib_src_configure() {
                || die
 
        # Clean out hardcoded flags that openssl uses
-       local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
+       local DEFAULT_CFLAGS=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
                -e 's:^CFLAG=::' \
-               -e 's:-fomit-frame-pointer ::g' \
-               -e 's:-O[0-9] ::g' \
-               -e 's:-march=[-a-z0-9]* ::g' \
-               -e 's:-mcpu=[-a-z0-9]* ::g' \
-               -e 's:-m[a-z0-9]* ::g' \
+               -e 's:\(^\| \)-fomit-frame-pointer::g' \
+               -e 's:\(^\| \)-O[^ ]*::g' \
+               -e 's:\(^\| \)-march=[^ ]*::g' \
+               -e 's:\(^\| \)-mcpu=[^ ]*::g' \
+               -e 's:\(^\| \)-m[^ ]*::g' \
+               -e 's:^ *::' \
+               -e 's: *$::' \
+               -e 's: \+: :g' \
+               -e 's:\\:\\\\:g'
        )
+
+       # Now insert clean default flags with user flags
        sed -i \
-               -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
-               -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
+               -e "/^CFLAG/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
+               -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
                Makefile || die
 }
 
index 937d3b7ed11fc5bad4dbdff70913fb8d876df0d2..7bcd5d03e7e3b40c0e3777afd4cde3e8ec1b7b06 100644 (file)
@@ -176,7 +176,9 @@ multilib_src_configure() {
        # 'srp' was restricted until early 2017 as well.
        # "disable-deprecated" option breaks too many consumers.
        # Don't set it without thorough revdeps testing.
-       echoit \
+       # Make sure user flags don't get added *yet* to avoid duplicated
+       # flags.
+       CFLAGS= LDFLAGS= echoit \
        ./${config} \
                ${sslout} \
                $(use cpu_flags_x86_sse2 || echo "no-sse2") \
@@ -203,16 +205,20 @@ multilib_src_configure() {
                || die
 
        # Clean out hardcoded flags that openssl uses
-       # Fix quoting for sed
        local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
                -e 's:^CFLAGS=::' \
-               -e 's:-fomit-frame-pointer ::g' \
-               -e 's:-O[0-9] ::g' \
-               -e 's:-march=[-a-z0-9]* ::g' \
-               -e 's:-mcpu=[-a-z0-9]* ::g' \
-               -e 's:-m[a-z0-9]* ::g' \
-               -e 's:\\:\\\\:g' \
+               -e 's:\(^\| \)-fomit-frame-pointer::g' \
+               -e 's:\(^\| \)-O[^ ]*::g' \
+               -e 's:\(^\| \)-march=[^ ]*::g' \
+               -e 's:\(^\| \)-mcpu=[^ ]*::g' \
+               -e 's:\(^\| \)-m[^ ]*::g' \
+               -e 's:^ *::' \
+               -e 's: *$::' \
+               -e 's: \+: :g' \
+               -e 's:\\:\\\\:g'
        )
+
+       # Now insert clean default flags with user flags
        sed -i \
                -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
                -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
index 683c57075663fd8165130bbeb7a77250661ec012..a3a0f2a2c06e386f34a6726211c3e331dd7ee858 100644 (file)
@@ -172,7 +172,9 @@ multilib_src_configure() {
        # 'srp' was restricted until early 2017 as well.
        # "disable-deprecated" option breaks too many consumers.
        # Don't set it without thorough revdeps testing.
-       echoit \
+       # Make sure user flags don't get added *yet* to avoid duplicated
+       # flags.
+       CFLAGS= LDFLAGS= echoit \
        ./${config} \
                ${sslout} \
                $(use cpu_flags_x86_sse2 || echo "no-sse2") \
@@ -199,16 +201,20 @@ multilib_src_configure() {
                || die
 
        # Clean out hardcoded flags that openssl uses
-       # Fix quoting for sed
        local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
                -e 's:^CFLAGS=::' \
-               -e 's:-fomit-frame-pointer ::g' \
-               -e 's:-O[0-9] ::g' \
-               -e 's:-march=[-a-z0-9]* ::g' \
-               -e 's:-mcpu=[-a-z0-9]* ::g' \
-               -e 's:-m[a-z0-9]* ::g' \
-               -e 's:\\:\\\\:g' \
+               -e 's:\(^\| \)-fomit-frame-pointer::g' \
+               -e 's:\(^\| \)-O[^ ]*::g' \
+               -e 's:\(^\| \)-march=[^ ]*::g' \
+               -e 's:\(^\| \)-mcpu=[^ ]*::g' \
+               -e 's:\(^\| \)-m[^ ]*::g' \
+               -e 's:^ *::' \
+               -e 's: *$::' \
+               -e 's: \+: :g' \
+               -e 's:\\:\\\\:g'
        )
+
+       # Now insert clean default flags with user flags
        sed -i \
                -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
                -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \