summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Kaufmann <timokau@zoho.com>2020-09-03 12:49:11 +0200
committerTimo Kaufmann <timokau@zoho.com>2020-09-03 14:52:18 +0200
commitf928b91f349403090d055a613abc527bb442254e (patch)
tree5441b118d7369c63139bf551a8645afe57dd22d5
parent596de92ca7458e47b991472e3da59d30baf8d9c5 (diff)
fpc: 3.0.4 -> 3.2.0
There was no 3.1 for some reason. The old sed-based path patching was broken and resulted in syntax errors since it was a bit over-eager. Instead of fixing it, I decided to replace it with a patch file which is easier to inspect and will fail in a more obvious way next time. The patch is now applied unconditionally, since it actually applies to all linux platforms. The changes are localized to linux-specific code, so it does not hurt to apply it on non-linux platforms as well. Hedgewars needs a small fix to work with the new version. Done in the same commit to avoid a broken commit.
-rw-r--r--pkgs/development/compilers/fpc/binary.nix15
-rw-r--r--pkgs/development/compilers/fpc/default.nix19
-rw-r--r--pkgs/development/compilers/fpc/mark-paths.patch100
-rw-r--r--pkgs/games/hedgewars/default.nix6
-rw-r--r--pkgs/games/ultrastardx/default.nix35
5 files changed, 155 insertions, 20 deletions
diff --git a/pkgs/development/compilers/fpc/binary.nix b/pkgs/development/compilers/fpc/binary.nix
index f160150d8b53..8441c91b09f2 100644
--- a/pkgs/development/compilers/fpc/binary.nix
+++ b/pkgs/development/compilers/fpc/binary.nix
@@ -1,18 +1,19 @@
{ stdenv, fetchurl }:
-stdenv.mkDerivation {
- name = "fpc-3.0.0-binary";
+stdenv.mkDerivation rec {
+ pname = "fpc-binary";
+ version = "3.2.0";
src =
if stdenv.hostPlatform.system == "i686-linux" then
fetchurl {
- url = "mirror://sourceforge/project/freepascal/Linux/3.0.0/fpc-3.0.0.i386-linux.tar";
- sha256 = "0h3f1dgs1zsx7vvk9kg67anjvgw5sslfbmjblif7ishbcp3k3g5k";
+ url = "mirror://sourceforge/project/freepascal/Linux/${version}/fpc-${version}.i386-linux.tar";
+ sha256 = "0y0510b2fbxbqz28967xx8b023k6q9fv5yclfrc1yc9mg8fyn411";
}
else if stdenv.hostPlatform.system == "x86_64-linux" then
fetchurl {
- url = "mirror://sourceforge/project/freepascal/Linux/3.0.0/fpc-3.0.0.x86_64-linux.tar";
- sha256 = "1m2xx3nda45cb3zidbjgdr8kddd19zk0khvp7xxdlclszkqscln9";
+ url = "mirror://sourceforge/project/freepascal/Linux/${version}/fpc-${version}-x86_64-linux.tar";
+ sha256 = "0gfbwjvjqlx0562ayyl08khagslrws758al2yhbi4bz5rzk554ni";
}
else throw "Not supported on ${stdenv.hostPlatform.system}.";
@@ -21,4 +22,4 @@ stdenv.mkDerivation {
meta = {
description = "Free Pascal Compiler from a binary distribution";
};
-}
+}
diff --git a/pkgs/development/compilers/fpc/default.nix b/pkgs/development/compilers/fpc/default.nix
index 42804677dc08..6e7ffefca21f 100644
--- a/pkgs/development/compilers/fpc/default.nix
+++ b/pkgs/development/compilers/fpc/default.nix
@@ -3,23 +3,26 @@
let startFPC = import ./binary.nix { inherit stdenv fetchurl; }; in
stdenv.mkDerivation rec {
- version = "3.0.4";
+ version = "3.2.0";
pname = "fpc";
src = fetchurl {
url = "mirror://sourceforge/freepascal/fpcbuild-${version}.tar.gz";
- sha256 = "0xjyhlhz846jbnp12y68c7nq4xmp4i65akfbrjyf3r62ybk18rgn";
+ sha256 = "0f38glyn3ffmqww432snhx2b8wyrq0yj1njkp4zh56lqrvm19fgr";
};
buildInputs = [ startFPC gawk ];
glibc = stdenv.cc.libc.out;
- preConfigure =
- if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then ''
- sed -e "s@'/lib/ld-linux[^']*'@'''@" -i fpcsrc/compiler/systems/t_linux.pas
- sed -e "s@'/lib64/ld-linux[^']*'@'''@" -i fpcsrc/compiler/systems/t_linux.pas
- sed -e "s@/lib64[^']*@${glibc}/lib@" -i fpcsrc/compiler/systems/t_linux.pas
- '' else "";
+ # Patch paths for linux systems. Other platforms will need their own patches.
+ patches = [
+ ./mark-paths.patch # mark paths for later substitution in postPatch
+ ];
+ 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"
+ '';
makeFlags = [ "NOGDB=1" "FPC=${startFPC}/bin/fpc" ];
diff --git a/pkgs/development/compilers/fpc/mark-paths.patch b/pkgs/development/compilers/fpc/mark-paths.patch
new file mode 100644
index 000000000000..e8844ad7cfe7
--- /dev/null
+++ b/pkgs/development/compilers/fpc/mark-paths.patch
@@ -0,0 +1,100 @@
+diff --git a/fpcsrc/compiler/systems/t_linux.pas b/fpcsrc/compiler/systems/t_linux.pas
+index a7398fb9..a1e41ecb 100644
+--- a/fpcsrc/compiler/systems/t_linux.pas
++++ b/fpcsrc/compiler/systems/t_linux.pas
+@@ -135,13 +135,13 @@ begin
+ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib64',true);
+ { /lib64 should be the really first, so add it before everything else }
+ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib',true);
+- LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib64',true);
++ LibrarySearchPath.AddLibraryPath(sysrootpath,'=@syslibpath@',true);
+ {$else}
+ {$ifdef powerpc64}
+ if target_info.abi<>abi_powerpc_elfv2 then
+- LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib64;=/usr/lib64;=/usr/X11R6/lib64',true)
++ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/@syslibpath@;=/usr/lib64;=/usr/X11R6/lib64',true)
+ else
+- LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib64;=/usr/lib/powerpc64le-linux-gnu;=/usr/X11R6/powerpc64le-linux-gnu',true);
++ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/@syslibpath@;=/usr/lib/powerpc64le-linux-gnu;=/usr/X11R6/powerpc64le-linux-gnu',true);
+ {$else powerpc64}
+ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib;=/usr/lib;=/usr/X11R6/lib',true);
+ {$endif powerpc64}
+@@ -185,53 +185,53 @@ begin
+ end;
+
+ {$ifdef m68k}
+- const defdynlinker='/lib/ld.so.1';
++ const defdynlinker='@dynlinker-prefix@/lib/ld.so.1';
+ {$endif m68k}
+
+ {$ifdef i386}
+- const defdynlinker='/lib/ld-linux.so.2';
++ const defdynlinker='@dynlinker-prefix@/lib/ld-linux.so.2';
+ {$endif}
+
+ {$ifdef x86_64}
+- const defdynlinker='/lib64/ld-linux-x86-64.so.2';
++ const defdynlinker='@dynlinker-prefix@/lib64/ld-linux-x86-64.so.2';
+ {$endif x86_64}
+
+ {$ifdef sparc}
+- const defdynlinker='/lib/ld-linux.so.2';
++ const defdynlinker='@dynlinker-prefix@/lib/ld-linux.so.2';
+ {$endif sparc}
+
+ {$ifdef powerpc}
+- const defdynlinker='/lib/ld.so.1';
++ const defdynlinker='@dynlinker-prefix@/lib/ld.so.1';
+ {$endif powerpc}
+
+ {$ifdef powerpc64}
+- const defdynlinkerv1='/lib64/ld64.so.1';
+- const defdynlinkerv2='/lib64/ld64.so.2';
++ const defdynlinkerv1='@dynlinker-prefix@/lib64/ld64.so.1';
++ const defdynlinkerv2='@dynlinker-prefix@/lib64/ld64.so.2';
+ var defdynlinker: string;
+ {$endif powerpc64}
+
+ {$ifdef arm}
+ {$ifdef FPC_ARMHF}
+- const defdynlinker='/lib/ld-linux-armhf.so.3';
++ const defdynlinker='@dynlinker-prefix@/lib/ld-linux-armhf.so.3';
+ {$else FPC_ARMHF}
+ {$ifdef FPC_ARMEL}
+- const defdynlinker='/lib/ld-linux.so.3';
++ const defdynlinker='@dynlinker-prefix@/lib/ld-linux.so.3';
+ {$else FPC_ARMEL}
+- const defdynlinker='/lib/ld-linux.so.2';
++ const defdynlinker='@dynlinker-prefix@/lib/ld-linux.so.2';
+ {$endif FPC_ARMEL}
+ {$endif FPC_ARMHF}
+ {$endif arm}
+
+ {$ifdef aarch64}
+-const defdynlinker='/lib/ld-linux-aarch64.so.1';
++const defdynlinker='@dynlinker-prefix@/lib/ld-linux-aarch64.so.1';
+ {$endif aarch64}
+
+ {$ifdef mips}
+- const defdynlinker='/lib/ld.so.1';
++ const defdynlinker='@dynlinker-prefix@/lib/ld.so.1';
+ {$endif mips}
+
+ {$ifdef sparc64}
+- const defdynlinker='/lib64/ld-linux.so.2';
++ const defdynlinker='@dynlinker-prefix@/lib64/ld-linux.so.2';
+ {$endif sparc64}
+
+
+@@ -266,9 +266,9 @@ begin
+ libctype:=uclibc;
+ end
+ {$ifdef i386}
+- else if FileExists(sysrootpath+'/lib/ld-linux.so.1',false) then
++ else if FileExists(sysrootpath+'@dynlinker-prefix@/lib/ld-linux.so.1',false) then
+ begin
+- DynamicLinker:='/lib/ld-linux.so.1';
++ DynamicLinker:='@dynlinker-prefix@/lib/ld-linux.so.1';
+ libctype:=glibc2;
+ end
+ {$endif i386}
diff --git a/pkgs/games/hedgewars/default.nix b/pkgs/games/hedgewars/default.nix
index 00df6f338210..adc6506c6157 100644
--- a/pkgs/games/hedgewars/default.nix
+++ b/pkgs/games/hedgewars/default.nix
@@ -34,6 +34,10 @@ mkDerivation rec {
postPatch = ''
substituteInPlace gameServer/CMakeLists.txt \
--replace mask evaluate
+
+ # compile with fpc >= 3.2.0
+ # https://github.com/archlinux/svntogit-community/blob/75a1b3900fb3dd553d5114bbc8474d85fd6abb02/trunk/PKGBUILD#L26
+ sed -i 's/procedure ShiftWorld(Dir: LongInt); inline;/procedure ShiftWorld(Dir: LongInt);/' hedgewars/uWorld.pas
'';
cmakeFlags = [
@@ -42,7 +46,7 @@ mkDerivation rec {
];
- # hslogger brings network-3 and network-bsd which conflict with
+ # hslogger brings network-3 and network-bsd which conflict with
# network-2.6.3.1
preConfigure = ''
substituteInPlace gameServer/CMakeLists.txt \
diff --git a/pkgs/games/ultrastardx/default.nix b/pkgs/games/ultrastardx/default.nix
index 7c5f4949d941..b6e1da204edf 100644
--- a/pkgs/games/ultrastardx/default.nix
+++ b/pkgs/games/ultrastardx/default.nix
@@ -1,7 +1,26 @@
-{ stdenv, autoreconfHook, fetchFromGitHub, pkgconfig
-, lua, fpc, pcre, portaudio, freetype, libpng
-, SDL2, SDL2_image, SDL2_gfx, SDL2_mixer, SDL2_net, SDL2_ttf
-, ffmpeg, sqlite, zlib, libX11, libGLU, libGL }:
+{ stdenv
+, autoreconfHook
+, fetchFromGitHub
+, fetchpatch
+, pkgconfig
+, lua
+, fpc
+, pcre
+, portaudio
+, freetype
+, libpng
+, SDL2
+, SDL2_image
+, SDL2_gfx
+, SDL2_mixer
+, SDL2_net, SDL2_ttf
+, ffmpeg
+, sqlite
+, zlib
+, libX11
+, libGLU
+, libGL
+}:
let
sharedLibs = [
@@ -23,6 +42,14 @@ in stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig autoreconfHook ];
buildInputs = [ fpc libpng ] ++ sharedLibs;
+ patches = [
+ (fetchpatch {
+ name = "fpc-3.2-support.patch";
+ url = "https://github.com/UltraStar-Deluxe/USDX/commit/1b8e8714c1523ef49c2fd689a1545d097a3d76d7.patch";
+ sha256 = "02zmjymj9w1mkpf7armdpf067byvml6lprs1ca4lhpkv45abddp4";
+ })
+ ];
+
postPatch = ''
substituteInPlace src/config.inc.in \
--subst-var-by libpcre_LIBNAME libpcre.so.1