1{
2 stdenv,
3 fetchurl,
4 undmg,
5 cpio,
6 xar,
7 lib,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "fpc-binary";
12 version = "3.2.2";
13
14 src =
15 if stdenv.hostPlatform.system == "i686-linux" then
16 fetchurl {
17 url = "mirror://sourceforge/project/freepascal/Linux/${version}/fpc-${version}.i386-linux.tar";
18 sha256 = "f62980ac0b2861221f79fdbff67836aa6912a4256d4192cfa4dfa0ac5b419958";
19 }
20 else if stdenv.hostPlatform.system == "x86_64-linux" then
21 fetchurl {
22 url = "mirror://sourceforge/project/freepascal/Linux/${version}/fpc-${version}.x86_64-linux.tar";
23 sha256 = "5adac308a5534b6a76446d8311fc340747cbb7edeaacfe6b651493ff3fe31e83";
24 }
25 else if stdenv.hostPlatform.system == "aarch64-linux" then
26 fetchurl {
27 url = "mirror://sourceforge/project/freepascal/Linux/${version}/fpc-${version}.aarch64-linux.tar";
28 sha256 = "b39470f9b6b5b82f50fc8680a5da37d2834f2129c65c24c5628a80894d565451";
29 }
30 else if stdenv.hostPlatform.isDarwin then
31 fetchurl {
32 url = "mirror://sourceforge/project/freepascal/Mac%20OS%20X/${version}/fpc-${version}.intelarm64-macosx.dmg";
33 sha256 = "05d4510c8c887e3c68de20272abf62171aa5b2ef1eba6bce25e4c0bc41ba8b7d";
34 }
35 else
36 throw "Not supported on ${stdenv.hostPlatform.system}.";
37
38 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
39 undmg
40 xar
41 cpio
42 ];
43
44 builder =
45 if stdenv.hostPlatform.isLinux then
46 ./binary-builder.sh
47 else if stdenv.hostPlatform.isDarwin then
48 ./binary-builder-darwin.sh
49 else
50 throw "Not supported on ${stdenv.hostPlatform}.";
51
52 meta = {
53 description = "Free Pascal Compiler from a binary distribution";
54 };
55}