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