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