2017-01-24 00:35:03 +01:00
|
|
|
{ runCommand, cctools }:
|
|
|
|
{ haskellPackages, src, deps ? p : [], name }: let
|
|
|
|
inherit (haskellPackages) ghc ghcWithPackages;
|
|
|
|
with-env = ghcWithPackages deps;
|
2017-09-10 21:36:48 +02:00
|
|
|
ghcName = "${ghc.targetPrefix}ghc";
|
2017-01-24 00:35:03 +01:00
|
|
|
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
|
|
|
|
''
|