git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #99702 from peterhoeg/u/lazarus_2_0_10

lazarus-qt5: init at 2.0.10

commit4214f76baabadda2fd0c13cb145ee022ef3af691 authorMichael Raskin <7c6f434c@mail.ru> dateTue 6 Oct 2020, 09:18 (6 years ago) parentdcd2c25c084efb
3 files changed+86−27
pkgs/development/compilers/fpc/lazarus.nix+74−20 pkgs/development/compilers/fpc/libqt5pas.nix+6−6 pkgs/top-level/all-packages.nix+6−1
pkgs/development/compilers/fpc/lazarus.nix+74−20
@@ -1,53 +1,107 @@
1−{ stdenv, fetchurl, makeWrapper
1+{ stdenv, lib, fetchurl, makeWrapper, writeText
22, fpc, gtk2, glib, pango, atk, gdk-pixbuf
33, libXi, xorgproto, libX11, libXext
44, gdb, gnumake, binutils
5+, withQt ? false, qtbase ? null, libqt5pas ? null, wrapQtAppsHook ? null
56}:
7+
8+# TODO:
9+# 1. the build date is embedded in the binary through `$I %DATE%` - we should dump that
10+
11+let
12+ version = "2.0.10-2";
13+
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.
16+ majorMinorPatch = v:
17+ builtins.concatStringsSep "." (lib.take 3 (lib.splitVersion v));
18+
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;
24+ }));
25+
26+in
627stdenv.mkDerivation rec {
7− pname = "lazarus";
8− version = "2.0.8";
28+ pname = "lazarus-${LCL_PLATFORM}";
29+ inherit version;
930
1031 src = fetchurl {
11− url = "mirror://sourceforge/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20${version}/lazarus-${version}.tar.gz";
12− sha256 = "1iciqydb0miqdrh89aj59gy7kfcwikkycqssq9djcqsw1ql3gc4h";
32+ url = "mirror://sourceforge/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20${majorMinorPatch version}/lazarus-${version}.tar.gz";
33+ sha256 = "sha256-ZNViZGjdJKMzKyBfOr0KWBq33hsGCi1X4hhkBmz9Q7c=";
1334 };
1435
36+ postPatch = ''
37+ cp ${overrides} ide/${overrides.name}
38+ '';
39+
1540 buildInputs = [
41+ # we need gtk2 unconditionally as that is the default target when building applications with lazarus
1642 fpc gtk2 glib libXi xorgproto
1743 libX11 libXext pango atk
18− stdenv.cc makeWrapper gdk-pixbuf
19− ];
44+ stdenv.cc gdk-pixbuf
45+ ]
46+ ++ lib.optionals withQt [ libqt5pas qtbase ];
47+
48+ nativeBuildInputs = [
49+ makeWrapper
50+ ] ++ lib.optional withQt wrapQtAppsHook;
2051
2152 makeFlags = [
2253 "FPC=fpc"
2354 "PP=fpc"
55+ "LAZARUS_INSTALL_DIR=${placeholder "out"}/share/lazarus/"
56+ "INSTALL_PREFIX=${placeholder "out"}/"
2457 "REQUIRE_PACKAGES+=tachartlazaruspkg"
2558 "bigide"
2659 ];
2760
61+ LCL_PLATFORM = if withQt then "qt5" else "gtk2";
62+
63+ NIX_LDFLAGS = lib.concatStringsSep " " ([
64+ "-L${stdenv.cc.cc.lib}/lib"
65+ "-lX11"
66+ "-lXext"
67+ "-lXi"
68+ "-latk-1.0"
69+ "-lc"
70+ "-lcairo"
71+ "-lgcc_s"
72+ "-lgdk-x11-2.0"
73+ "-lgdk_pixbuf-2.0"
74+ "-lglib-2.0"
75+ "-lgtk-x11-2.0"
76+ "-lpango-1.0"
77+ ]
78+ ++ lib.optionals withQt [
79+ "-L${lib.getLib libqt5pas}/lib"
80+ "-lQt5Pas"
81+ ]);
82+
2883 preBuild = ''
29− export makeFlags="$makeFlags LAZARUS_INSTALL_DIR=$out/share/lazarus/ INSTALL_PREFIX=$out/"
30− export NIX_LDFLAGS="$NIX_LDFLAGS -L${stdenv.cc.cc.lib}/lib -lXi -lX11 -lglib-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lc -lXext -lpango-1.0 -latk-1.0 -lgdk_pixbuf-2.0 -lcairo -lgcc_s"
31− export LCL_PLATFORM=gtk2
3284 mkdir -p $out/share "$out/lazarus"
3385 tar xf ${fpc.src} --strip-components=1 -C $out/share -m
34− sed -e 's@/usr/fpcsrc@'"$out/share/fpcsrc@" -i ide/include/unix/lazbaseconf.inc
86+ substituteInPlace ide/include/unix/lazbaseconf.inc \
87+ --replace '/usr/fpcsrc' "$out/share/fpcsrc"
3588 '';
3689
37− postInstall = ''
38− wrapProgram $out/bin/startlazarus --prefix NIX_LDFLAGS ' ' \
39− "$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \
40− --prefix NIX_LDFLAGS_${binutils.suffixSalt} ' ' \
41− "$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \
90+ postInstall = let
91+ ldFlags = ''$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')'';
92+ in ''
93+ wrapProgram $out/bin/startlazarus \
94+ --prefix NIX_LDFLAGS ' ' "${ldFlags}" \
95+ --prefix NIX_LDFLAGS_${binutils.suffixSalt} ' ' "${ldFlags}" \
4296 --prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \
43− --prefix PATH ':' "${fpc}/bin:${gdb}/bin:${gnumake}/bin:${binutils}/bin"
97+ --prefix PATH ':' "${lib.makeBinPath [ fpc gdb gnumake binutils ]}"
4498 '';
4599
46100 meta = with stdenv.lib; {
47− description = "Lazarus graphical IDE for FreePascal language";
48− homepage = "http://www.lazarus.freepascal.org";
101+ description = "Lazarus graphical IDE for the FreePascal language";
102+ homepage = "https://www.lazarus.freepascal.org";
49103 license = licenses.gpl2Plus ;
104+ maintainers = with maintainers; [ raskin ];
50105 platforms = platforms.linux;
51− maintainers = [ maintainers.raskin ];
52106 };
53107}
pkgs/development/compilers/fpc/libqt5pas.nix+6−6
@@ -1,6 +1,6 @@
1−{ stdenv, lazarus, qt5 }:
1+{ mkDerivation, lib, lazarus, qmake, qtbase, qtx11extras }:
22
3−stdenv.mkDerivation {
3+mkDerivation {
44 pname = "libqt5pas";
55 inherit (lazarus) version src;
66
@@ -8,14 +8,14 @@ stdenv.mkDerivation {
88
99 postPatch = ''
1010 substituteInPlace Qt5Pas.pro \
11− --replace "target.path = \$\$[QT_INSTALL_LIBS]" "target.path = $out/lib"
11+ --replace 'target.path = $$[QT_INSTALL_LIBS]' "target.path = $out/lib"
1212 '';
1313
14− nativeBuildInputs = with qt5; [ qmake ];
14+ nativeBuildInputs = [ qmake ];
1515
16− buildInputs = with qt5; [ qtbase qtx11extras ];
16+ buildInputs = [ qtbase qtx11extras ];
1717
18− meta = with stdenv.lib; {
18+ meta = with lib; {
1919 description = "Free Pascal Qt5 binding library";
2020 homepage = "https://wiki.freepascal.org/Qt5_Interface#libqt5pas";
2121 maintainers = with maintainers; [ sikmir ];
pkgs/top-level/all-packages.nix+6−1
@@ -9353,6 +9353,11 @@ in
93539353 fpc = fpc;
93549354 };
93559355
9356+ lazarus-qt = libsForQt5.callPackage ../development/compilers/fpc/lazarus.nix {
9357+ fpc = fpc;
9358+ withQt = true;
9359+ };
9360+
93569361 lessc = nodePackages.less;
93579362
93589363 liquibase = callPackage ../development/tools/database/liquibase { };
@@ -14071,7 +14076,7 @@ in
1407114076
1407214077 libqalculate = callPackage ../development/libraries/libqalculate { };
1407314078
14074− libqt5pas = callPackage ../development/compilers/fpc/libqt5pas.nix { };
14079+ libqt5pas = libsForQt5.callPackage ../development/compilers/fpc/libqt5pas.nix { };
1407514080
1407614081 libroxml = callPackage ../development/libraries/libroxml { };
1407714082