From 0afb45d5747d812d434e687ce8bfc78e40a54060 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Mon, 7 May 2018 23:52:05 -0400 Subject: [PATCH 1/3] Set the C standard when building GHC Should this be in cc-wrapper? --- pkgs/development/compilers/ghc/8.4.2.nix | 2 ++ pkgs/development/compilers/ghc/head.nix | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pkgs/development/compilers/ghc/8.4.2.nix b/pkgs/development/compilers/ghc/8.4.2.nix index cf4e5772719..bbe82354c8c 100644 --- a/pkgs/development/compilers/ghc/8.4.2.nix +++ b/pkgs/development/compilers/ghc/8.4.2.nix @@ -50,6 +50,8 @@ let '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' GhcLibHcOpts += -fPIC GhcRtsHcOpts += -fPIC + '' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt '' + EXTRA_CC_OPTS += -std=gnu99 ''; # Splicer will pull out correct variations diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 51497e0d9ce..f0e21b0cf5b 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -50,6 +50,8 @@ let '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' GhcLibHcOpts += -fPIC GhcRtsHcOpts += -fPIC + '' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt '' + EXTRA_CC_OPTS += -std=gnu99 ''; # Splicer will pull out correct variations From 8012aee0a7d9fe14fe77d20b6fdd8d2e6120bcc1 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Mon, 7 May 2018 23:52:34 -0400 Subject: [PATCH 2/3] Don't enableShared in GHC when using android prebuilt --- pkgs/development/compilers/ghc/8.4.2.nix | 2 +- pkgs/development/compilers/ghc/head.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.4.2.nix b/pkgs/development/compilers/ghc/8.4.2.nix index bbe82354c8c..b588592a71c 100644 --- a/pkgs/development/compilers/ghc/8.4.2.nix +++ b/pkgs/development/compilers/ghc/8.4.2.nix @@ -22,7 +22,7 @@ , # Whether to build dynamic libs for the standard library (on the target # platform). Static libs are always built. - enableShared ? true + enableShared ? !targetPlatform.useAndroidPrebuilt , version ? "8.4.2" }: diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index f0e21b0cf5b..7e1c73d166a 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -22,7 +22,7 @@ , # Whether to build dynamic libs for the standard library (on the target # platform). Static libs are always built. - enableShared ? true + enableShared ? !targetPlatform.useAndroidPrebuilt , version ? "8.5.20180118" }: From 9dadb9e3cb20003d2510d1911a44f93a60cdf87a Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Wed, 9 May 2018 03:40:34 -0400 Subject: [PATCH 3/3] Fix hsc2hs cross compiler build --- pkgs/development/compilers/ghc/8.4.2.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/8.4.2.nix b/pkgs/development/compilers/ghc/8.4.2.nix index b588592a71c..94555482d28 100644 --- a/pkgs/development/compilers/ghc/8.4.2.nix +++ b/pkgs/development/compilers/ghc/8.4.2.nix @@ -3,7 +3,7 @@ # build-tools , bootPkgs, alex, happy -, autoconf, automake, coreutils, fetchurl, perl, python3 +, autoconf, automake, coreutils, fetchurl, fetchpatch, perl, python3 , libffi, libiconv ? null, ncurses @@ -81,6 +81,13 @@ stdenv.mkDerivation rec { outputs = [ "out" "doc" ]; + patches = [(fetchpatch { + url = "https://git.haskell.org/hsc2hs.git/patch/738f3666c878ee9e79c3d5e819ef8b3460288edf"; + sha256 = "0plzsbfaq6vb1023lsarrjglwgr9chld4q3m99rcfzx0yx5mibp3"; + extraPrefix = "utils/hsc2hs/"; + stripLen = 1; + })]; + postPatch = "patchShebangs ."; # GHC is a bit confused on its cross terminology.