commit:     3901a6f4b767074586f5f2cc4583285296ff1b25
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Thu Nov 12 02:00:00 2020 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Nov 12 21:54:34 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3901a6f4

dev-libs/marisa: Update code for selection of CPU instructions.

https://github.com/s-yata/marisa-trie/commit/bbcff46114eaf306ed26ec9e55ee3f3e1dc54f16

Unconditionally passing --enable-sse2, --enable-sse3 etc. no longer works.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 dev-libs/marisa/marisa-9999.ebuild | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/dev-libs/marisa/marisa-9999.ebuild 
b/dev-libs/marisa/marisa-9999.ebuild
index 0450f64682a..2458eb10f41 100644
--- a/dev-libs/marisa/marisa-9999.ebuild
+++ b/dev-libs/marisa/marisa-9999.ebuild
@@ -55,16 +55,30 @@ src_prepare() {
 src_configure() {
        local -x CPPFLAGS="${CPPFLAGS} ${CXXFLAGS}"
 
+       cpu_instructions_option() {
+               local option="${1}"
+               local macros="${2}"
+               local result="--enable-${option}"
+               local macro
+               for macro in ${macros}; do
+                       if ! $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P -dM - < 
/dev/null 2> /dev/null | grep -Eq "^#define ${macro}([[:space:]]|$)"; then
+                               result="--disable-${option}"
+                       fi
+               done
+               echo "${result}"
+       }
+
        local options=(
-               # Preprocessor macros dependent on CPPFLAGS are checked.
-               --enable-sse2
-               --enable-sse3
-               --enable-ssse3
-               --enable-sse4.1
-               --enable-sse4.2
-               --enable-sse4
-               --enable-sse4a
-               --enable-popcnt
+               $(cpu_instructions_option sse2 __SSE2__)
+               $(cpu_instructions_option sse3 __SSE3__)
+               $(cpu_instructions_option ssse3 __SSSE3__)
+               $(cpu_instructions_option sse4.1 __SSE4_1__)
+               $(cpu_instructions_option sse4.2 __SSE4_2__)
+               $(cpu_instructions_option sse4 __POPCNT__ __SSE4_2__)
+               $(cpu_instructions_option sse4a __SSE4A__)
+               $(cpu_instructions_option popcnt __POPCNT__)
+               $(cpu_instructions_option bmi __BMI__)
+               $(cpu_instructions_option bmi2 __BMI2__)
                $(use_enable static-libs static)
        )
 
@@ -90,7 +104,7 @@ src_compile() {
 
 src_install() {
        default
-       find "${D}" -name "*.la" -type f -delete || die
+       find "${ED}" -name "*.la" -delete || die
 
        (
                docinto html

Reply via email to