Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / compilers / fpc / default.nix
blob5c82938665152e4b153fb990c527833dcf528cc9
1 { lib, stdenv, fetchurl, gawk }:
3 let startFPC = import ./binary.nix { inherit stdenv fetchurl; }; in
5 stdenv.mkDerivation rec {
6   version = "3.2.0";
7   pname = "fpc";
9   src = fetchurl {
10     url = "mirror://sourceforge/freepascal/fpcbuild-${version}.tar.gz";
11     sha256 = "0f38glyn3ffmqww432snhx2b8wyrq0yj1njkp4zh56lqrvm19fgr";
12   };
14   buildInputs = [ startFPC gawk ];
15   glibc = stdenv.cc.libc.out;
17   # Patch paths for linux systems. Other platforms will need their own patches.
18   patches = [
19     ./mark-paths.patch # mark paths for later substitution in postPatch
20   ];
21   postPatch = ''
22     # substitute the markers set by the mark-paths patch
23     substituteInPlace fpcsrc/compiler/systems/t_linux.pas --subst-var-by dynlinker-prefix "${glibc}"
24     substituteInPlace fpcsrc/compiler/systems/t_linux.pas --subst-var-by syslibpath "${glibc}/lib"
25   '';
27   makeFlags = [ "NOGDB=1" "FPC=${startFPC}/bin/fpc" ];
29   installFlags = [ "INSTALL_PREFIX=\${out}" ];
31   postInstall = ''
32     for i in $out/lib/fpc/*/ppc*; do
33       ln -fs $i $out/bin/$(basename $i)
34     done
35     mkdir -p $out/lib/fpc/etc/
36     $out/lib/fpc/*/samplecfg $out/lib/fpc/${version} $out/lib/fpc/etc/
37   '';
39   passthru = {
40     bootstrap = startFPC;
41   };
43   meta = with lib; {
44     description = "Free Pascal Compiler from a source distribution";
45     homepage = "https://www.freepascal.org";
46     maintainers = [ maintainers.raskin ];
47     license = with licenses; [ gpl2 lgpl2 ];
48     platforms = platforms.linux;
49     inherit version;
50   };