summary refs log tree commit diff
path: root/pkgs/os-specific/darwin
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2017-01-23 18:35:03 -0500
committerShea Levy <shea@shealevy.com>2017-01-23 18:35:03 -0500
commit4f9f00fcc9ba5fce1bf476bf3e3200bdbed00f48 (patch)
tree2e31995431e83f07bf678de2b069c713f01ef874 /pkgs/os-specific/darwin
parente026568e6c7e387ec317f0e357cbd8c359fc177f (diff)
downloadnixlib-4f9f00fcc9ba5fce1bf476bf3e3200bdbed00f48.tar
nixlib-4f9f00fcc9ba5fce1bf476bf3e3200bdbed00f48.tar.gz
nixlib-4f9f00fcc9ba5fce1bf476bf3e3200bdbed00f48.tar.bz2
nixlib-4f9f00fcc9ba5fce1bf476bf3e3200bdbed00f48.tar.lz
nixlib-4f9f00fcc9ba5fce1bf476bf3e3200bdbed00f48.tar.xz
nixlib-4f9f00fcc9ba5fce1bf476bf3e3200bdbed00f48.tar.zst
nixlib-4f9f00fcc9ba5fce1bf476bf3e3200bdbed00f48.zip
Add function to build a ghc standalone archive (OSX/iOS only)
Diffstat (limited to 'pkgs/os-specific/darwin')
-rw-r--r--pkgs/os-specific/darwin/ghc-standalone-archive/default.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix b/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix
new file mode 100644
index 000000000000..d23328d362e0
--- /dev/null
+++ b/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix
@@ -0,0 +1,14 @@
+{ runCommand, cctools }:
+{ haskellPackages, src, deps ? p : [], name }: let
+  inherit (haskellPackages) ghc ghcWithPackages;
+  with-env = ghcWithPackages deps;
+  crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
+  ghcName = "${crossPrefix}ghc";
+in runCommand name { buildInputs = [ with-env cctools ]; } ''
+  mkdir -p $out/lib
+  mkdir -p $out/include
+  ${ghcName} ${src} -staticlib -outputdir . -o $out/lib/${name}.a -stubdir $out/include
+  for file in ${ghc}/lib/${ghcName}-${ghc.version}/include/*; do
+    ln -sv $file $out/include
+  done
+''