Merge pull request #97006 from timokau/fpc-3.2.0-aarch64

fpc: 3.0.4 -> 3.2.0, add support for aarch64-linux
This commit is contained in:
Timo Kaufmann 2020-09-03 18:44:17 +02:00 committed by GitHub
commit c25a7cd846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 185 additions and 33 deletions

@ -1,18 +1,24 @@
{ 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 if stdenv.hostPlatform.system == "aarch64-linux" then
fetchurl {
url = "mirror://sourceforge/project/freepascal/Linux/${version}/fpc-${version}.aarch64-linux.tar";
sha256 = "1h481ngg3m8nlsg9mw7rr1bn2c4sj4wzqny9bxyq3xvcral12r71";
}
else throw "Not supported on ${stdenv.hostPlatform.system}.";
@ -21,4 +27,4 @@ stdenv.mkDerivation {
meta = {
description = "Free Pascal Compiler from a binary distribution";
};
}
}

@ -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" ];

@ -0,0 +1,109 @@
diff --git a/fpcsrc/compiler/systems/t_linux.pas b/fpcsrc/compiler/systems/t_linux.pas
index a7398fb9..8e46fec0 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}
@@ -164,7 +164,7 @@ begin
LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib/i386-linux-gnu',true);
{$endif i386}
{$ifdef aarch64}
- LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib/aarch64-linux-gnu',true);
+ LibrarySearchPath.AddLibraryPath(sysrootpath,'=@syslibpath@',true);
{$endif aarch64}
{$ifdef powerpc}
LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib/powerpc-linux-gnu',true);
@@ -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}

@ -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 \

@ -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 = [
@ -12,17 +31,25 @@ let
in stdenv.mkDerivation rec {
pname = "ultrastardx";
version = "unstable-2019-01-07";
version = "2020.4.0";
src = fetchFromGitHub {
owner = "UltraStar-Deluxe";
repo = "USDX";
rev = "3df142590f29db1505cc58746af9f8cf7cb4a6a5";
sha256 = "0853rg7vppkmw37wm9xm0m0wab3r09ws6w04xs2wgwj1mwl0d70j";
rev = "v${version}";
sha256 = "0vmfv8zpyf8ymx3rjydpd7iqis080lni94vb316vfxkgvjmqbhym";
};
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

@ -1,20 +1,24 @@
{ stdenv, lib, fetchurl, fpc, lazarus, atk, cairo, gdk-pixbuf, glib, gtk2, libX11, pango }:
stdenv.mkDerivation rec {
name = "ddrescueview-0.4alpha3";
let
versionBase = "0.4";
versionSuffix = "alpha4";
in stdenv.mkDerivation rec {
pname = "ddrescueview";
version = "${versionBase}${versionSuffix}";
name = "ddrescueview-0.4alpha4";
src = fetchurl {
name = "${name}.tar.xz";
url = "mirror://sourceforge/ddrescueview/ddrescueview-source-0.4%7Ealpha3.tar.xz";
sha256 = "0603jisxkswfyh93s3i20f8ns4yf83dmgmy0lg5001rvaw9mkw9j";
name = "ddrescueview-${versionBase}${versionSuffix}.tar.xz";
url = "mirror://sourceforge/ddrescueview/ddrescueview-source-${versionBase}~${versionSuffix}.tar.xz";
sha256 = "0v159nlc0lrqznbbwi7zda619is5h2rjk55gz6cl807j0kd19ycc";
};
sourceRoot = "ddrescueview-source-${versionBase}~${versionSuffix}/source";
nativeBuildInputs = [ fpc lazarus ];
buildInputs = [ atk cairo gdk-pixbuf glib gtk2 libX11 pango ];
sourceRoot = "source";
NIX_LDFLAGS = "--as-needed -rpath ${lib.makeLibraryPath buildInputs}";
buildPhase = ''
@ -24,9 +28,8 @@ stdenv.mkDerivation rec {
installPhase = ''
install -Dt $out/bin ddrescueview
cd ../resources/linux
install -Dt $out/share/applications ddrescueview.desktop
install -Dt $out/share/icons/hicolor/32x32/apps ddrescueview.xpm
install -Dt $out/share/man/man1 ddrescueview.1
mkdir -p "$out/share"
cp -ar applications icons man $out/share
'';
meta = with lib; {