Merge pull request #99702 from peterhoeg/u/lazarus_2_0_10

lazarus-qt5: init at 2.0.10
This commit is contained in:
Michael Raskin 2020-10-06 09:18:21 +00:00 committed by GitHub
commit 4214f76baa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 27 deletions

View File

@ -1,53 +1,107 @@
{ stdenv, fetchurl, makeWrapper { stdenv, lib, fetchurl, makeWrapper, writeText
, fpc, gtk2, glib, pango, atk, gdk-pixbuf , fpc, gtk2, glib, pango, atk, gdk-pixbuf
, libXi, xorgproto, libX11, libXext , libXi, xorgproto, libX11, libXext
, gdb, gnumake, binutils , 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.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
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "lazarus"; pname = "lazarus-${LCL_PLATFORM}";
version = "2.0.8"; inherit version;
src = fetchurl { src = fetchurl {
url = "mirror://sourceforge/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20${version}/lazarus-${version}.tar.gz"; url = "mirror://sourceforge/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20${majorMinorPatch version}/lazarus-${version}.tar.gz";
sha256 = "1iciqydb0miqdrh89aj59gy7kfcwikkycqssq9djcqsw1ql3gc4h"; sha256 = "sha256-ZNViZGjdJKMzKyBfOr0KWBq33hsGCi1X4hhkBmz9Q7c=";
}; };
postPatch = ''
cp ${overrides} ide/${overrides.name}
'';
buildInputs = [ buildInputs = [
# we need gtk2 unconditionally as that is the default target when building applications with lazarus
fpc gtk2 glib libXi xorgproto fpc gtk2 glib libXi xorgproto
libX11 libXext pango atk libX11 libXext pango atk
stdenv.cc makeWrapper gdk-pixbuf stdenv.cc gdk-pixbuf
]; ]
++ lib.optionals withQt [ libqt5pas qtbase ];
nativeBuildInputs = [
makeWrapper
] ++ lib.optional withQt wrapQtAppsHook;
makeFlags = [ makeFlags = [
"FPC=fpc" "FPC=fpc"
"PP=fpc" "PP=fpc"
"LAZARUS_INSTALL_DIR=${placeholder "out"}/share/lazarus/"
"INSTALL_PREFIX=${placeholder "out"}/"
"REQUIRE_PACKAGES+=tachartlazaruspkg" "REQUIRE_PACKAGES+=tachartlazaruspkg"
"bigide" "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 = '' preBuild = ''
export makeFlags="$makeFlags LAZARUS_INSTALL_DIR=$out/share/lazarus/ INSTALL_PREFIX=$out/"
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"
export LCL_PLATFORM=gtk2
mkdir -p $out/share "$out/lazarus" mkdir -p $out/share "$out/lazarus"
tar xf ${fpc.src} --strip-components=1 -C $out/share -m tar xf ${fpc.src} --strip-components=1 -C $out/share -m
sed -e 's@/usr/fpcsrc@'"$out/share/fpcsrc@" -i ide/include/unix/lazbaseconf.inc substituteInPlace ide/include/unix/lazbaseconf.inc \
--replace '/usr/fpcsrc' "$out/share/fpcsrc"
''; '';
postInstall = '' postInstall = let
wrapProgram $out/bin/startlazarus --prefix NIX_LDFLAGS ' ' \ ldFlags = ''$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')'';
"$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \ in ''
--prefix NIX_LDFLAGS_${binutils.suffixSalt} ' ' \ wrapProgram $out/bin/startlazarus \
"$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \ --prefix NIX_LDFLAGS ' ' "${ldFlags}" \
--prefix NIX_LDFLAGS_${binutils.suffixSalt} ' ' "${ldFlags}" \
--prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \ --prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \
--prefix PATH ':' "${fpc}/bin:${gdb}/bin:${gnumake}/bin:${binutils}/bin" --prefix PATH ':' "${lib.makeBinPath [ fpc gdb gnumake binutils ]}"
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Lazarus graphical IDE for FreePascal language"; description = "Lazarus graphical IDE for the FreePascal language";
homepage = "http://www.lazarus.freepascal.org"; homepage = "https://www.lazarus.freepascal.org";
license = licenses.gpl2Plus ; license = licenses.gpl2Plus ;
maintainers = with maintainers; [ raskin ];
platforms = platforms.linux; platforms = platforms.linux;
maintainers = [ maintainers.raskin ];
}; };
} }

View File

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

View File

@ -9353,6 +9353,11 @@ in
fpc = fpc; fpc = fpc;
}; };
lazarus-qt = libsForQt5.callPackage ../development/compilers/fpc/lazarus.nix {
fpc = fpc;
withQt = true;
};
lessc = nodePackages.less; lessc = nodePackages.less;
liquibase = callPackage ../development/tools/database/liquibase { }; liquibase = callPackage ../development/tools/database/liquibase { };
@ -14071,7 +14076,7 @@ in
libqalculate = callPackage ../development/libraries/libqalculate { }; libqalculate = callPackage ../development/libraries/libqalculate { };
libqt5pas = callPackage ../development/compilers/fpc/libqt5pas.nix { }; libqt5pas = libsForQt5.callPackage ../development/compilers/fpc/libqt5pas.nix { };
libroxml = callPackage ../development/libraries/libroxml { }; libroxml = callPackage ../development/libraries/libroxml { };