2022-05-12 19:15:20 +00:00
|
|
|
{ lib, stdenv, fetchurl, gawk, fetchpatch }:
|
2009-03-03 13:27:40 +00:00
|
|
|
|
2010-07-28 11:55:54 +00:00
|
|
|
let startFPC = import ./binary.nix { inherit stdenv fetchurl; }; in
|
2009-03-03 13:27:40 +00:00
|
|
|
|
2009-07-14 09:08:05 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2022-06-18 10:55:05 +00:00
|
|
|
version = "3.2.2";
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "fpc";
|
2007-08-11 20:55:40 +00:00
|
|
|
|
2008-01-30 17:20:48 +00:00
|
|
|
src = fetchurl {
|
2013-07-14 00:09:34 +00:00
|
|
|
url = "mirror://sourceforge/freepascal/fpcbuild-${version}.tar.gz";
|
2022-06-18 10:55:05 +00:00
|
|
|
sha256 = "85ef993043bb83f999e2212f1bca766eb71f6f973d362e2290475dbaaf50161f";
|
2009-03-03 13:27:40 +00:00
|
|
|
};
|
2007-08-11 20:55:40 +00:00
|
|
|
|
2010-07-28 11:55:54 +00:00
|
|
|
buildInputs = [ startFPC gawk ];
|
2020-04-01 20:39:28 +00:00
|
|
|
glibc = stdenv.cc.libc.out;
|
2007-08-11 20:55:40 +00:00
|
|
|
|
2020-09-03 10:49:11 +00:00
|
|
|
# Patch paths for linux systems. Other platforms will need their own patches.
|
|
|
|
patches = [
|
|
|
|
./mark-paths.patch # mark paths for later substitution in postPatch
|
2022-05-12 19:15:20 +00:00
|
|
|
] ++ lib.optional stdenv.isAarch64 (fetchpatch {
|
|
|
|
# backport upstream patch for aarch64 glibc 2.34
|
|
|
|
url = "https://gitlab.com/freepascal.org/fpc/source/-/commit/a20a7e3497bccf3415bf47ccc55f133eb9d6d6a0.patch";
|
|
|
|
hash = "sha256-xKTBwuOxOwX9KCazQbBNLhMXCqkuJgIFvlXewHY63GM=";
|
|
|
|
stripLen = 1;
|
|
|
|
extraPrefix = "fpcsrc/";
|
|
|
|
});
|
|
|
|
|
2020-09-03 10:49:11 +00:00
|
|
|
postPatch = ''
|
|
|
|
# substitute the markers set by the mark-paths patch
|
|
|
|
substituteInPlace fpcsrc/compiler/systems/t_linux.pas --subst-var-by dynlinker-prefix "${glibc}"
|
|
|
|
substituteInPlace fpcsrc/compiler/systems/t_linux.pas --subst-var-by syslibpath "${glibc}/lib"
|
|
|
|
'';
|
2008-04-08 15:10:09 +00:00
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
makeFlags = [ "NOGDB=1" "FPC=${startFPC}/bin/fpc" ];
|
2009-02-26 15:14:17 +00:00
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
installFlags = [ "INSTALL_PREFIX=\${out}" ];
|
2018-08-19 22:20:07 +00:00
|
|
|
|
2009-03-03 13:27:40 +00:00
|
|
|
postInstall = ''
|
2010-01-15 10:43:21 +00:00
|
|
|
for i in $out/lib/fpc/*/ppc*; do
|
|
|
|
ln -fs $i $out/bin/$(basename $i)
|
|
|
|
done
|
2009-03-03 13:27:40 +00:00
|
|
|
mkdir -p $out/lib/fpc/etc/
|
2009-07-14 09:08:05 +00:00
|
|
|
$out/lib/fpc/*/samplecfg $out/lib/fpc/${version} $out/lib/fpc/etc/
|
2009-03-03 13:27:40 +00:00
|
|
|
'';
|
2007-08-11 20:55:40 +00:00
|
|
|
|
2014-08-31 18:47:45 +00:00
|
|
|
passthru = {
|
|
|
|
bootstrap = startFPC;
|
|
|
|
};
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2009-03-03 13:27:40 +00:00
|
|
|
description = "Free Pascal Compiler from a source distribution";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.freepascal.org";
|
2018-08-19 22:20:07 +00:00
|
|
|
maintainers = [ maintainers.raskin ];
|
|
|
|
license = with licenses; [ gpl2 lgpl2 ];
|
|
|
|
platforms = platforms.linux;
|
2007-08-11 20:55:40 +00:00
|
|
|
};
|
2009-03-03 13:27:40 +00:00
|
|
|
}
|