2020-10-05 12:19:08 +01:00
|
|
|
{ stdenv, lib, fetchurl, makeWrapper, writeText
|
2019-05-22 12:03:39 +01:00
|
|
|
, fpc, gtk2, glib, pango, atk, gdk-pixbuf
|
2018-12-31 03:40:47 +00:00
|
|
|
, libXi, xorgproto, libX11, libXext
|
2020-05-25 01:21:51 +01:00
|
|
|
, gdb, gnumake, binutils
|
2020-10-05 12:19:08 +01:00
|
|
|
, withQt ? false, qtbase ? null, libqt5pas ? null, wrapQtAppsHook ? null
|
2014-11-07 08:40:55 +00:00
|
|
|
}:
|
2020-10-05 12:19:08 +01:00
|
|
|
|
|
|
|
# TODO:
|
|
|
|
# 1. the build date is embedded in the binary through `$I %DATE%` - we should dump that
|
|
|
|
|
|
|
|
let
|
|
|
|
version = "2.0.10-2";
|
|
|
|
|
|
|
|
# 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
|
2019-02-14 04:35:45 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-10-05 12:19:08 +01:00
|
|
|
pname = "lazarus-${LCL_PLATFORM}";
|
|
|
|
inherit version;
|
2019-02-14 04:35:45 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2020-10-05 12:19:08 +01:00
|
|
|
url = "mirror://sourceforge/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20${majorMinorPatch version}/lazarus-${version}.tar.gz";
|
|
|
|
sha256 = "sha256-ZNViZGjdJKMzKyBfOr0KWBq33hsGCi1X4hhkBmz9Q7c=";
|
2008-04-08 16:10:09 +01:00
|
|
|
};
|
2019-02-14 04:35:45 +00:00
|
|
|
|
2020-10-05 12:19:08 +01:00
|
|
|
postPatch = ''
|
|
|
|
cp ${overrides} ide/${overrides.name}
|
|
|
|
'';
|
|
|
|
|
2014-11-07 08:40:55 +00:00
|
|
|
buildInputs = [
|
2020-10-05 12:19:08 +01:00
|
|
|
# we need gtk2 unconditionally as that is the default target when building applications with lazarus
|
2018-12-31 03:40:47 +00:00
|
|
|
fpc gtk2 glib libXi xorgproto
|
|
|
|
libX11 libXext pango atk
|
2020-10-05 12:19:08 +01:00
|
|
|
stdenv.cc gdk-pixbuf
|
|
|
|
]
|
|
|
|
++ lib.optionals withQt [ libqt5pas qtbase ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
] ++ lib.optional withQt wrapQtAppsHook;
|
2019-02-14 04:35:45 +00:00
|
|
|
|
2008-04-08 16:10:09 +01:00
|
|
|
makeFlags = [
|
|
|
|
"FPC=fpc"
|
|
|
|
"PP=fpc"
|
2020-10-05 12:19:08 +01:00
|
|
|
"LAZARUS_INSTALL_DIR=${placeholder "out"}/share/lazarus/"
|
|
|
|
"INSTALL_PREFIX=${placeholder "out"}/"
|
2014-11-07 08:40:55 +00:00
|
|
|
"REQUIRE_PACKAGES+=tachartlazaruspkg"
|
|
|
|
"bigide"
|
2008-04-08 16:10:09 +01:00
|
|
|
];
|
2019-02-14 04:35:45 +00:00
|
|
|
|
2020-10-05 12:19:08 +01:00
|
|
|
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"
|
|
|
|
]);
|
|
|
|
|
2014-11-07 08:40:55 +00:00
|
|
|
preBuild = ''
|
2014-12-03 17:19:31 +00:00
|
|
|
mkdir -p $out/share "$out/lazarus"
|
2010-11-17 12:45:14 +00:00
|
|
|
tar xf ${fpc.src} --strip-components=1 -C $out/share -m
|
2020-10-05 12:19:08 +01:00
|
|
|
substituteInPlace ide/include/unix/lazbaseconf.inc \
|
|
|
|
--replace '/usr/fpcsrc' "$out/share/fpcsrc"
|
2014-11-07 08:40:55 +00:00
|
|
|
'';
|
2019-02-14 04:35:45 +00:00
|
|
|
|
2020-10-05 12:19:08 +01:00
|
|
|
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}" \
|
2020-05-25 01:21:51 +01:00
|
|
|
--prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \
|
2020-10-05 12:19:08 +01:00
|
|
|
--prefix PATH ':' "${lib.makeBinPath [ fpc gdb gnumake binutils ]}"
|
2014-11-07 08:40:55 +00:00
|
|
|
'';
|
2019-02-14 04:35:45 +00:00
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-10-26 04:08:40 +00:00
|
|
|
description = "Graphical IDE for the FreePascal language";
|
2020-10-05 12:19:08 +01:00
|
|
|
homepage = "https://www.lazarus.freepascal.org";
|
2019-02-14 04:35:45 +00:00
|
|
|
license = licenses.gpl2Plus ;
|
2020-10-05 12:19:08 +01:00
|
|
|
maintainers = with maintainers; [ raskin ];
|
2019-02-14 04:35:45 +00:00
|
|
|
platforms = platforms.linux;
|
2008-04-08 16:10:09 +01:00
|
|
|
};
|
|
|
|
}
|