on iko/ghcjs-patch-master help sign in
fix: use target libffi instead of build libffi (#538)

Co-authored-by: Michivi <webmaster@michvi.com>

commit1031e80d1ae1a58e00ba7fd20f80ed23050c6f71 authorLe Tuan <webmaster@michivi.com> dateMon 13 Apr 2020, 04:39 (7 years ago) parent2a03328
1 file changed+8−5
compiler/ghc/default.nix+8−5
compiler/ghc/default.nix+8−5
@@ -73,9 +73,12 @@ let
7373 inherit (bootPkgs) ghc;
7474
7575 # TODO check if this posible fix for segfaults works or not.
76− libffiStaticEnabled = if libffi == null || !stdenv.targetPlatform.isMusl
77− then libffi
78− else targetPackages.libffi.overrideAttrs (old: { dontDisableStatic = true; });
76+ targetLibffi =
77+ if stdenv.targetPlatform.isMusl
78+ then targetPackages.libffi.overrideAttrs (old: { dontDisableStatic = true; })
79+ else if targetPlatform != hostPlatform
80+ then targetPackages.libffi
81+ else libffi;
7982
8083 # TODO(@Ericson2314) Make unconditional
8184 targetPrefix = stdenv.lib.optionalString
@@ -116,7 +119,7 @@ let
116119
117120 # Splicer will pull out correct variations
118121 libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
119− ++ [libffiStaticEnabled]
122+ ++ [targetLibffi]
120123 ++ stdenv.lib.optional (!enableIntegerSimple) gmp
121124 ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
122125
@@ -208,7 +211,7 @@ in let configured-src = stdenv.mkDerivation (rec {
208211 configureFlags = [
209212 "--datadir=$doc/share/doc/ghc"
210213 "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
211− ] ++ stdenv.lib.optionals (libffiStaticEnabled != null) ["--with-system-libffi" "--with-ffi-includes=${libffiStaticEnabled.dev}/include" "--with-ffi-libraries=${libffiStaticEnabled.out}/lib"
214+ ] ++ stdenv.lib.optionals (targetLibffi != null) ["--with-system-libffi" "--with-ffi-includes=${targetLibffi.dev}/include" "--with-ffi-libraries=${targetLibffi.out}/lib"
212215 ] ++ stdenv.lib.optional (!enableIntegerSimple) [
213216 "--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib"
214217 ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [