1 { stdenv, lib, fetchurl, makeWrapper, writeText
2 , fpc, gtk2, glib, pango, atk, gdk-pixbuf
3 , libXi, xorgproto, libX11, libXext
4 , gdb, gnumake, binutils
5 , withQt ? false, qtbase ? null, libqt5pas ? null, wrapQtAppsHook ? null
9 # 1. the build date is embedded in the binary through `$I %DATE%` - we should dump that
14 # as of 2.0.10 a suffix is being added. That may or may not disappear and then
15 # come back, so just leave this here.
17 builtins.concatStringsSep "." (lib.take 2 (lib.splitVersion v));
19 overrides = writeText "revision.inc" (lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v:
20 "const ${k} = '${v}';") {
21 # this is technically the SVN revision but as we don't have that replace
22 # it with the version instead of showing "Unknown"
23 RevisionStr = version;
27 stdenv.mkDerivation rec {
28 pname = "lazarus-${LCL_PLATFORM}";
32 url = "mirror://sourceforge/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20${majorMinorPatch version}/lazarus-${version}.tar.gz";
33 sha256 = "69f43f0a10b9e09deea5f35094c73b84464b82d3f40d8a2fcfcb5a5ab03c6edf";
37 cp ${overrides} ide/${overrides.name}
41 # we need gtk2 unconditionally as that is the default target when building applications with lazarus
42 fpc gtk2 glib libXi xorgproto
43 libX11 libXext pango atk
46 ++ lib.optionals withQt [ libqt5pas qtbase ];
48 # Disable parallel build, errors:
49 # Fatal: (1018) Compilation aborted
50 enableParallelBuilding = false;
54 ] ++ lib.optional withQt wrapQtAppsHook;
59 "LAZARUS_INSTALL_DIR=${placeholder "out"}/share/lazarus/"
60 "INSTALL_PREFIX=${placeholder "out"}/"
61 "REQUIRE_PACKAGES+=tachartlazaruspkg"
65 LCL_PLATFORM = if withQt then "qt5" else "gtk2";
67 NIX_LDFLAGS = lib.concatStringsSep " " ([
68 "-L${stdenv.cc.cc.lib}/lib"
82 ++ lib.optionals withQt [
83 "-L${lib.getLib libqt5pas}/lib"
88 mkdir -p $out/share "$out/lazarus"
89 tar xf ${fpc.src} --strip-components=1 -C $out/share -m
90 substituteInPlace ide/packages/ideconfig/include/unix/lazbaseconf.inc \
91 --replace '/usr/fpcsrc' "$out/share/fpcsrc"
95 ldFlags = ''$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')'';
97 wrapProgram $out/bin/startlazarus \
98 --prefix NIX_LDFLAGS ' ' "${ldFlags}" \
99 --prefix NIX_LDFLAGS_${binutils.suffixSalt} ' ' "${ldFlags}" \
100 --prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \
101 --prefix PATH ':' "${lib.makeBinPath [ fpc gdb gnumake binutils ]}"
105 description = "Graphical IDE for the FreePascal language";
106 homepage = "https://www.lazarus.freepascal.org";
107 license = licenses.gpl2Plus ;
108 maintainers = with maintainers; [ raskin ];
109 platforms = platforms.linux;