1# Temporaririly avoid dependency on dotnetbuildhelpers to avoid rebuilding many times while working on it
2
3{ stdenv, fetchurl, mono, pkgconfig, dotnetbuildhelpers, autoconf, automake, which }:
4
5stdenv.mkDerivation rec {
6 name = "fsharp-${version}";
7 version = "4.0.0.4";
8
9 src = fetchurl {
10 url = "https://github.com/fsharp/fsharp/archive/${version}.tar.gz";
11 sha256 = "1m9pwr4xjl3ikaf3pzsa4pb3pr533xa0v34y2cy4pjcc6j0f71av";
12 };
13
14 buildInputs = [ mono pkgconfig dotnetbuildhelpers autoconf automake which ];
15
16 configurePhase = ''
17 sed -i '988d' src/FSharpSource.targets
18 substituteInPlace ./autogen.sh --replace "/usr/bin/env sh" "/bin/sh"
19 ./autogen.sh --prefix $out
20 '';
21
22 # Make sure the executables use the right mono binary,
23 # and set up some symlinks for backwards compatibility.
24 postInstall = ''
25 substituteInPlace $out/bin/fsharpc --replace " mono " " ${mono}/bin/mono "
26 substituteInPlace $out/bin/fsharpi --replace " mono " " ${mono}/bin/mono "
27 substituteInPlace $out/bin/fsharpiAnyCpu --replace " mono " " ${mono}/bin/mono "
28 ln -s $out/bin/fsharpc $out/bin/fsc
29 ln -s $out/bin/fsharpi $out/bin/fsi
30 for dll in "$out/lib/mono/4.5"/FSharp*.dll
31 do
32 create-pkg-config-for-dll.sh "$out/lib/pkgconfig" "$dll"
33 done
34 '';
35
36 # To fix this error when running:
37 # The file "/nix/store/path/whatever.exe" is an not a valid CIL image
38 dontStrip = true;
39
40 meta = {
41 description = "A functional CLI language";
42 homepage = "http://fsharp.org/";
43 license = stdenv.lib.licenses.asl20;
44 maintainers = with stdenv.lib.maintainers; [ thoughtpolice raskin ];
45 platforms = with stdenv.lib.platforms; linux;
46 };
47}