uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,14 @@
source $stdenv/setup
tar xf $src
cd */
tarballdir=$(pwd)
for i in *.tar; do tar xvf $i; done
echo "Deploying binaries.."
mkdir $out
cd $out
for i in $tarballdir/*.gz; do tar xvf $i; done
echo 'Creating ppc* symlink..'
for i in $out/lib/fpc/*/ppc*; do
ln -fs $i $out/bin/$(basename $i)
done

View file

@ -0,0 +1,30 @@
{ stdenv, fetchurl }:
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/${version}/fpc-${version}.i386-linux.tar";
sha256 = "0y0510b2fbxbqz28967xx8b023k6q9fv5yclfrc1yc9mg8fyn411";
}
else if stdenv.hostPlatform.system == "x86_64-linux" then
fetchurl {
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}.";
builder = ./binary-builder.sh;
meta = {
description = "Free Pascal Compiler from a binary distribution";
};
}

View file

@ -0,0 +1,57 @@
{ lib, stdenv, fetchurl, gawk, fetchpatch }:
let startFPC = import ./binary.nix { inherit stdenv fetchurl; }; in
stdenv.mkDerivation rec {
version = "3.2.0";
pname = "fpc";
src = fetchurl {
url = "mirror://sourceforge/freepascal/fpcbuild-${version}.tar.gz";
sha256 = "0f38glyn3ffmqww432snhx2b8wyrq0yj1njkp4zh56lqrvm19fgr";
};
buildInputs = [ startFPC gawk ];
glibc = stdenv.cc.libc.out;
# Patch paths for linux systems. Other platforms will need their own patches.
patches = [
./mark-paths.patch # mark paths for later substitution in postPatch
] ++ 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/";
});
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" ];
installFlags = [ "INSTALL_PREFIX=\${out}" ];
postInstall = ''
for i in $out/lib/fpc/*/ppc*; do
ln -fs $i $out/bin/$(basename $i)
done
mkdir -p $out/lib/fpc/etc/
$out/lib/fpc/*/samplecfg $out/lib/fpc/${version} $out/lib/fpc/etc/
'';
passthru = {
bootstrap = startFPC;
};
meta = with lib; {
description = "Free Pascal Compiler from a source distribution";
homepage = "https://www.freepascal.org";
maintainers = [ maintainers.raskin ];
license = with licenses; [ gpl2 lgpl2 ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,111 @@
{ stdenv, lib, fetchurl, makeWrapper, writeText
, fpc, gtk2, glib, pango, atk, gdk-pixbuf
, libXi, xorgproto, libX11, libXext
, gdb, gnumake, binutils
, withQt ? false, qtbase ? null, libqt5pas ? null, wrapQtAppsHook ? null
}:
# TODO:
# 1. the build date is embedded in the binary through `$I %DATE%` - we should dump that
let
version = "2.0.12";
# as of 2.0.10 a suffix is being added. That may or may not disappear and then
# come back, so just leave this here.
majorMinorPatch = v:
builtins.concatStringsSep "." (lib.take 3 (lib.splitVersion v));
overrides = writeText "revision.inc" (lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v:
"const ${k} = '${v}';") {
# this is technically the SVN revision but as we don't have that replace
# it with the version instead of showing "Unknown"
RevisionStr = version;
}));
in
stdenv.mkDerivation rec {
pname = "lazarus-${LCL_PLATFORM}";
inherit version;
src = fetchurl {
url = "mirror://sourceforge/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20${majorMinorPatch version}/lazarus-${version}.tar.gz";
sha256 = "sha256-umzvf4I6LSgWYimYLvySYDnUIxPEDiL+DGd2wT0AFbI=";
};
postPatch = ''
cp ${overrides} ide/${overrides.name}
'';
buildInputs = [
# we need gtk2 unconditionally as that is the default target when building applications with lazarus
fpc gtk2 glib libXi xorgproto
libX11 libXext pango atk
stdenv.cc gdk-pixbuf
]
++ lib.optionals withQt [ libqt5pas qtbase ];
# Disable parallel build, errors:
# Fatal: (1018) Compilation aborted
enableParallelBuilding = false;
nativeBuildInputs = [
makeWrapper
] ++ lib.optional withQt wrapQtAppsHook;
makeFlags = [
"FPC=fpc"
"PP=fpc"
"LAZARUS_INSTALL_DIR=${placeholder "out"}/share/lazarus/"
"INSTALL_PREFIX=${placeholder "out"}/"
"REQUIRE_PACKAGES+=tachartlazaruspkg"
"bigide"
];
LCL_PLATFORM = if withQt then "qt5" else "gtk2";
NIX_LDFLAGS = lib.concatStringsSep " " ([
"-L${stdenv.cc.cc.lib}/lib"
"-lX11"
"-lXext"
"-lXi"
"-latk-1.0"
"-lc"
"-lcairo"
"-lgcc_s"
"-lgdk-x11-2.0"
"-lgdk_pixbuf-2.0"
"-lglib-2.0"
"-lgtk-x11-2.0"
"-lpango-1.0"
]
++ lib.optionals withQt [
"-L${lib.getLib libqt5pas}/lib"
"-lQt5Pas"
]);
preBuild = ''
mkdir -p $out/share "$out/lazarus"
tar xf ${fpc.src} --strip-components=1 -C $out/share -m
substituteInPlace ide/include/unix/lazbaseconf.inc \
--replace '/usr/fpcsrc' "$out/share/fpcsrc"
'';
postInstall = let
ldFlags = ''$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')'';
in ''
wrapProgram $out/bin/startlazarus \
--prefix NIX_LDFLAGS ' ' "${ldFlags}" \
--prefix NIX_LDFLAGS_${binutils.suffixSalt} ' ' "${ldFlags}" \
--prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \
--prefix PATH ':' "${lib.makeBinPath [ fpc gdb gnumake binutils ]}"
'';
meta = with lib; {
description = "Graphical IDE for the FreePascal language";
homepage = "https://www.lazarus.freepascal.org";
license = licenses.gpl2Plus ;
maintainers = with maintainers; [ raskin ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,24 @@
{ mkDerivation, lib, lazarus, qmake, qtbase, qtx11extras }:
mkDerivation {
pname = "libqt5pas";
inherit (lazarus) version src;
sourceRoot = "lazarus/lcl/interfaces/qt5/cbindings";
postPatch = ''
substituteInPlace Qt5Pas.pro \
--replace 'target.path = $$[QT_INSTALL_LIBS]' "target.path = $out/lib"
'';
nativeBuildInputs = [ qmake ];
buildInputs = [ qtbase qtx11extras ];
meta = with lib; {
description = "Free Pascal Qt5 binding library";
homepage = "https://wiki.freepascal.org/Qt5_Interface#libqt5pas";
maintainers = with maintainers; [ sikmir ];
inherit (lazarus.meta) license platforms;
};
}

View file

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