Skip to content

Switch to enableNativeBignum = true when available #1784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/configuration-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,9 @@ in {
packages.ghc.flags.internal-interpreter = true;
packages.ghci.flags.ghci = true;
packages.ghci.flags.internal-interpreter = true;

# See https://github.com/Bodigrim/bitvec/pull/61
packages.bitvec.patches = [
(fromUntil "1.1.3.0" "1.1.3.0.1" ../patches/bitvec-gmp-fix.patch)
];
}
2 changes: 1 addition & 1 deletion overlays/ghc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ final: prev: with prev;
hasNativeBignum = name: !lib.hasPrefix "ghc8" name;

ghcPkgOverrides = name: { enableIntegerSimple = false; } // lib.optionalAttrs (hasNativeBignum name) {
enableNativeBignum = false;
enableNativeBignum = true;
};

ghcDrvOverrides = drv: {
Expand Down
33 changes: 33 additions & 0 deletions patches/bitvec-gmp-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 903561107640cdbe1fbb3669c58e006d8b658fb8 Mon Sep 17 00:00:00 2001
From: Mikaela Allan <mikaela@vitalbio.com>
Date: Sun, 31 Jul 2022 11:52:27 -0400
Subject: [PATCH] include Data.Bit.Gmp only if libgmp flag is set

if this module is linked into the library when libgmp is not enabled,
the foreign imports will lead to link failures when consuming the
library.
---
bitvec.cabal | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bitvec.cabal b/bitvec.cabal
index c6cb6c0..d4a28d6 100644
--- a/bitvec.cabal
+++ b/bitvec.cabal
@@ -78,7 +78,6 @@ library
other-modules:
Data.Bit.F2Poly
Data.Bit.F2PolyTS
- Data.Bit.Gmp
Data.Bit.Immutable
Data.Bit.ImmutableTS
Data.Bit.Internal
@@ -98,6 +97,8 @@ library
if flag(libgmp)
extra-libraries: gmp
cpp-options: -DUseLibGmp
+ other-modules:
+ Data.Bit.Gmp

test-suite bitvec-tests
type: exitcode-stdio-1.0
2 changes: 1 addition & 1 deletion test/cabal-22/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ in recurseIntoAttrs {
optionalString (!stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64) (''
printf "checking that executable is dynamically linked to system libraries... " >& 2
'' + optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) ''
ldd $exe | grep libgmp
ldd $exe | grep 'libc[.]so'
'' + optionalString stdenv.isDarwin ''
otool -L $exe | grep "libSystem.B"
'' + ''
Expand Down
2 changes: 1 addition & 1 deletion test/cabal-sublib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ in recurseIntoAttrs {
optionalString (!stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64 && !stdenv.hostPlatform.isMusl) (''
printf "checking that executable is dynamically linked to system libraries... " >& 2
'' + optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) ''
ldd $exe | grep libgmp
ldd $exe | grep 'libc[.]so'
'' + optionalString stdenv.isDarwin ''
otool -L $exe |grep .dylib
'') + ''
Expand Down
2 changes: 1 addition & 1 deletion test/sublib-docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ in recurseIntoAttrs {
optionalString (!stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64 && !stdenv.hostPlatform.isMusl) (''
printf "checking that executable is dynamically linked to system libraries... " >& 2
'' + optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) ''
ldd $exe | grep libgmp
ldd $exe | grep 'libc[.]so'
'' + optionalString stdenv.isDarwin ''
otool -L $exe |grep .dylib
'') + ''
Expand Down