dev-haskell/cryptonite: pass -msse2 for blake2, bug #696220
authorSergei Trofimovich <slyfox@gentoo.org>
Sun, 13 Oct 2019 14:12:41 +0000 (15:12 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Sun, 13 Oct 2019 14:12:55 +0000 (15:12 +0100)
Fixed two problems here:
- blake2 code assumes SSE2, not just SSE
- x86 needs -msse2 to be passed explicitly (as opposed to amd64)

Otherwise compiler does not attempt to emit sse2 primitives
and build fails as:
```
cbits/blake2/sse/blake2-config.h:68:2: error:
     error: #error "This code requires at least SSE2."
     #error "This code requires at least SSE2."
      ^~~~~
```

Reported-by: Thomas Kahle
Closes: https://bugs.gentoo.org/696220
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
dev-haskell/cryptonite/cryptonite-0.21.ebuild
dev-haskell/cryptonite/files/cryptonite-0.21-sse2.patch [new file with mode: 0644]

index ee4e621ff8f72c7edea453375605a4e3fddc2123..c7d05d15f68bf9a9aa98b5d819d79618f414f38f 100644 (file)
@@ -4,7 +4,7 @@
 EAPI=7
 
 # ebuild generated by hackport 0.6.9999
-#hackport: flags: -check_alignment,-old_toolchain_inliner,+support_deepseq,support_aesni:cpu_flags_x86_aes,support_pclmuldq:cpu_flags_x86_sse4_1,support_sse:cpu_flags_x86_sse,support_rdrand:cpu-flags-x86-rdrand,support_blake2_sse:cpu_flags_x86_sse
+#hackport: flags: -check_alignment,-old_toolchain_inliner,+support_deepseq,support_aesni:cpu_flags_x86_aes,support_pclmuldq:cpu_flags_x86_sse4_1,support_rdrand:cpu-flags-x86-rdrand,support_blake2_sse:cpu_flags_x86_sse2
 
 CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
 inherit haskell-cabal
@@ -16,7 +16,7 @@ SRC_URI="mirror://hackage/packages/archive/${PN}/${PV}/${P}.tar.gz"
 LICENSE="BSD"
 SLOT="0/${PV}"
 KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
-IUSE="cpu-flags-x86-rdrand cpu_flags_x86_aes cpu_flags_x86_sse cpu_flags_x86_sse4_1 +integer-gmp"
+IUSE="cpu-flags-x86-rdrand cpu_flags_x86_aes cpu_flags_x86_sse2 cpu_flags_x86_sse4_1 +integer-gmp"
 
 RDEPEND=">=dev-haskell/memory-0.8:=[profile?]
        >=dev-lang/ghc-7.4.1:=
@@ -30,13 +30,17 @@ DEPEND="${RDEPEND}
                dev-haskell/tasty-quickcheck )
 "
 
+PATCHES=(
+       "${FILESDIR}"/${P}-sse2.patch
+)
+
 src_configure() {
        haskell-cabal_src_configure \
                --flag=-check_alignment \
                $(cabal_flag integer-gmp integer-gmp) \
                --flag=-old_toolchain_inliner \
                $(cabal_flag cpu_flags_x86_aes support_aesni) \
-               $(cabal_flag cpu_flags_x86_sse support_blake2_sse) \
+               $(cabal_flag cpu_flags_x86_sse2 support_blake2_sse) \
                --flag=support_deepseq \
                $(cabal_flag cpu_flags_x86_sse4_1 support_pclmuldq) \
                $(cabal_flag cpu-flags-x86-rdrand support_rdrand)
diff --git a/dev-haskell/cryptonite/files/cryptonite-0.21-sse2.patch b/dev-haskell/cryptonite/files/cryptonite-0.21-sse2.patch
new file mode 100644 (file)
index 0000000..02d2069
--- /dev/null
@@ -0,0 +1,11 @@
+https://bugs.gentoo.org/696220
+--- a/cryptonite.cabal
++++ b/cryptonite.cabal
+@@ -276,6 +276,7 @@ Library
+                    , cbits/cryptonite_aes.c
+   if arch(x86_64) || flag(support_blake2_sse)
++    CC-options:     -msse2
+     C-sources:      cbits/blake2/sse/blake2s.c
+                   , cbits/blake2/sse/blake2sp.c
+                   , cbits/blake2/sse/blake2b.c