Skip to content

Commit

Permalink
ci: ammend qt derivation to run on 20.09
Browse files Browse the repository at this point in the history
  • Loading branch information
yakimant committed Jan 19, 2024
1 parent de8d1cf commit 1fade39
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 52 deletions.
28 changes: 24 additions & 4 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# - https://nixos.org/nixos/nix-pills/callpackage-design-pattern.html

final: prev: let
inherit (prev) callPackage;
inherit (prev) config stdenv callPackage recurseIntoAttrs makeOverridable fetchurl lib writeShellScriptBin __splicedPackages;
in rec {
linuxdeployqt = callPackage ./pkgs/linuxdeployqt/default.nix { };

Expand All @@ -18,8 +18,8 @@ in rec {
cmake_3_19 = prev.cmake.overrideAttrs ( attrs : rec {
version = "3.19.7";

src = prev.fetchurl {
url = "${attrs.meta.homepage}files/v${prev.lib.versions.majorMinor version}/cmake-${version}.tar.gz";
src = fetchurl {
url = "${attrs.meta.homepage}files/v${lib.versions.majorMinor version}/cmake-${version}.tar.gz";
# compare with https://cmake.org/files/v${lib.versions.majorMinor version}/cmake-${version}-SHA-256.txt
sha256 = "sha256-WKFfDVagr8zDzFNxI0/Oc/zGyPnb13XYmOUQuDF1WI4=";
};
Expand All @@ -31,7 +31,27 @@ in rec {
go_1_20 = callPackage ./pkgs/go/bootstrap120.nix { };

# Fix for linuxdeployqt so it's not upset shell interpreter from host system
lddWrapped = prev.writeShellScriptBin "ldd" ''
lddWrapped = writeShellScriptBin "ldd" ''
"${final.bash}/bin/sh" "${final.glibc.bin}/bin/ldd" "$@"
'';

# Qt 5.15.8 copy from 76973ae3b30a88ea415f27ff53809ab8f452e2ec
# Edited:
# - temporary break Darwin support
# - remove unsupported testers, env., config.allowAliases
# - mkDerivation without finalAttrs
# - change fetch* parameter from hash to sha256, rmove fetchLFS
# - fix makeSetupHook
# - switch from makeScopeWithSplicing back to makeScope
# See diff for a full list of changes
qt515_8 = recurseIntoAttrs (makeOverridable
(import ./pkgs/qt-5/5.15) {
inherit (__splicedPackages)
newScope generateSplicesForMkScope lib fetchurl fetchpatch fetchgit fetchFromGitHub makeSetupHook makeWrapper
bison cups dconf harfbuzz libGL perl gtk3 python3
darwin buildPackages;
inherit (__splicedPackages.gst_all_1) gstreamer gst-plugins-base;
inherit config stdenv;
});
alsa-lib = prev.alsaLib;
}
26 changes: 10 additions & 16 deletions nix/pkgs/qt-5/5.15/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Check for any minor version changes.
*/

{ makeScopeWithSplicing, generateSplicesForMkScope
{ newScope, generateSplicesForMkScope
, lib, stdenv, fetchurl, fetchgit, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper
, bison, cups ? null, harfbuzz, libGL, perl, python3
, gstreamer, gst-plugins-base, gtk3, dconf
Expand Down Expand Up @@ -57,19 +57,19 @@ let
qtwebengine = [
(fetchpatch {
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/a6f16c6daea3b5a1f7bc9f175d1645922c131563/qt5/qt5-webengine-python3.patch";
hash = "sha256-rUSDwTucXVP3Obdck7LRTeKZ+JYQSNhQ7+W31uHZ9yM=";
sha256 = "sha256-rUSDwTucXVP3Obdck7LRTeKZ+JYQSNhQ7+W31uHZ9yM=";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/7ae178a617d1e0eceb742557e63721af949bd28a/qt5/qt5-webengine-chromium-python3.patch";
stripLen = 1;
extraPrefix = "src/3rdparty/";
hash = "sha256-MZGYeMdGzwypfKoSUaa56K3inbcGRx7he/+AFyk5ekA=";
sha256 = "sha256-MZGYeMdGzwypfKoSUaa56K3inbcGRx7he/+AFyk5ekA=";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/7ae178a617d1e0eceb742557e63721af949bd28a/qt5/qt5-webengine-gcc12.patch";
stripLen = 1;
extraPrefix = "src/3rdparty/";
hash = "sha256-s4GsGMJTBNWw2gTJuIEP3tqT82AmTsR2mbj59m2p6rM=";
sha256 = "sha256-s4GsGMJTBNWw2gTJuIEP3tqT82AmTsR2mbj59m2p6rM=";
})
] ++ lib.optionals stdenv.isDarwin [
./qtwebengine-darwin-no-platform-check.patch
Expand Down Expand Up @@ -134,10 +134,6 @@ let
inherit bison cups harfbuzz libGL;
withGtk3 = !stdenv.isDarwin; inherit dconf gtk3;
inherit developerBuild decryptSslTraffic;
inherit (darwin.apple_sdk_11_0.frameworks) AGL AppKit ApplicationServices AVFoundation Carbon Cocoa CoreAudio CoreBluetooth
CoreLocation CoreServices DiskArbitration Foundation OpenGL MetalKit IOKit;
libobjc = darwin.apple_sdk_11_0.objc4;
xcbuild = darwin.apple_sdk_11_0.xcodebuild;
};

qt3d = callPackage ../modules/qt3d.nix {};
Expand Down Expand Up @@ -212,7 +208,7 @@ let

qmake = makeSetupHook {
name = "qmake-hook";
propagatedBuildInputs = [ self.qtbase.dev ];
deps = [ self.qtbase.dev ];
substitutions = {
inherit debug;
fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
Expand All @@ -221,12 +217,10 @@ let

wrapQtAppsHook = makeSetupHook {
name = "wrap-qt5-apps-hook";
propagatedBuildInputs = [ self.qtbase.dev buildPackages.makeWrapper ]
++ lib.optional stdenv.isLinux self.qtwayland.dev;
deps =
[ self.qtbase.dev buildPackages.makeWrapper ]
++ optional stdenv.isLinux self.qtwayland.dev;
} ../hooks/wrap-qt-apps-hook.sh;
} // lib.optionalAttrs config.allowAliases {
# remove before 23.11
overrideScope' = lib.warn "qt5 now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
};

in makeScopeWithSplicing (generateSplicesForMkScope "qt5") (_: {}) (_: {}) addPackages
self = lib.makeScope newScope addPackages;
in self
3 changes: 1 addition & 2 deletions nix/pkgs/qt-5/5.15/srcs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ let
src = override.src or
fetchgit {
inherit (args) url rev sha256;
fetchLFS = false;
fetchSubmodules = true;
deepClone = false;
leaveDotGit = false;
Expand All @@ -37,7 +36,7 @@ lib.mapAttrs mk (lib.importJSON ./srcs-generated.json)
catapult = fetchgit {
url = "https://chromium.googlesource.com/catapult";
rev = "5eedfe23148a234211ba477f76fc2ea2e8529189";
hash = "sha256-LPfBCEB5tJOljXpptsNk0sHGtJf/wIRL7fccN79Nh6o=";
sha256 = "sha256-LPfBCEB5tJOljXpptsNk0sHGtJf/wIRL7fccN79Nh6o=";
};

qtwebengine =
Expand Down
2 changes: 1 addition & 1 deletion nix/pkgs/qt-5/modules/qt3d.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ qtModule {
qtInputs = [ qtbase qtdeclarative ];
outputs = [ "out" "dev" "bin" ];
# error: use of undeclared identifier 'stat64'
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) "-Dstat64=stat";
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) "-Dstat64=stat";
}
28 changes: 4 additions & 24 deletions nix/pkgs/qt-5/modules/qtbase.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

, coreutils, bison, flex, gdb, gperf, lndir, perl, pkg-config, python3
, which
# darwin support
, libiconv, libobjc, xcbuild, AGL, AppKit, ApplicationServices, AVFoundation, Carbon, Cocoa, CoreAudio, CoreBluetooth
, CoreLocation, CoreServices, DiskArbitration, Foundation, OpenGL, MetalKit, IOKit

, dbus, fontconfig, freetype, glib, harfbuzz, icu, libdrm, libX11, libXcomposite
, libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng , libxcb
Expand All @@ -27,14 +24,13 @@
, debug ? false
, developerBuild ? false
, decryptSslTraffic ? false
, testers
}:

let
debugSymbols = debug || developerBuild;
in

stdenv.mkDerivation (finalAttrs: {
stdenv.mkDerivation {
pname = "qtbase";
inherit qtCompatVersion src version;
debug = debugSymbols;
Expand All @@ -50,10 +46,6 @@ stdenv.mkDerivation (finalAttrs: {
pcre2
] ++ (
if stdenv.isDarwin then [
# TODO: move to buildInputs, this should not be propagated.
AGL AppKit ApplicationServices AVFoundation Carbon Cocoa CoreAudio CoreBluetooth
CoreLocation CoreServices DiskArbitration Foundation OpenGL
libobjc libiconv MetalKit IOKit
] else [
dbus glib udev

Expand All @@ -79,8 +71,7 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional (mysqlSupport) libmysqlclient
++ lib.optional (postgresql != null) postgresql;

nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which ]
++ lib.optionals stdenv.isDarwin [ xcbuild ];
nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which ];

propagatedNativeBuildInputs = [ lndir ];

Expand Down Expand Up @@ -122,15 +113,6 @@ stdenv.mkDerivation (finalAttrs: {
patchShebangs ./bin
'' + (
if stdenv.isDarwin then ''
sed -i \
-e 's|/usr/bin/xcode-select|xcode-select|' \
-e 's|/usr/bin/xcrun|xcrun|' \
-e 's|/usr/bin/xcodebuild|xcodebuild|' \
-e 's|QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`|QMAKE_CXX="clang++"\nQMAKE_CONF_COMPILER="clang++"|' \
./configure
substituteInPlace ./mkspecs/common/mac.conf \
--replace "/System/Library/Frameworks/OpenGL.framework/" "${OpenGL}/Library/Frameworks/OpenGL.framework/" \
--replace "/System/Library/Frameworks/AGL.framework/" "${AGL}/Library/Frameworks/AGL.framework/"
'' else lib.optionalString libGLSupported ''
sed -i mkspecs/common/linux.conf \
-e "/^QMAKE_INCDIR_OPENGL/ s|$|${libGL.dev or libGL}/include|" \
Expand Down Expand Up @@ -179,7 +161,7 @@ stdenv.mkDerivation (finalAttrs: {
done
'';

env.NIX_CFLAGS_COMPILE = toString ([
NIX_CFLAGS_COMPILE = toString ([
"-Wno-error=sign-compare" # freetype-2.5.4 changed signedness of some struct fields
''-DNIXPKGS_QTCOMPOSE="${libX11.out}/share/X11/locale"''
''-DLIBRESOLV_SO="${stdenv.cc.libc.out}/lib/libresolv"''
Expand Down Expand Up @@ -343,8 +325,6 @@ stdenv.mkDerivation (finalAttrs: {

setupHook = ../hooks/qtbase-setup-hook.sh;

passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;

meta = with lib; {
homepage = "https://www.qt.io/";
description = "A cross-platform application framework for C++";
Expand Down Expand Up @@ -372,4 +352,4 @@ stdenv.mkDerivation (finalAttrs: {
platforms = platforms.unix;
};

})
}
2 changes: 1 addition & 1 deletion nix/pkgs/qt-5/modules/qtserialport.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
qtModule {
pname = "qtserialport";
qtInputs = [ qtbase ];
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isLinux "-DNIXPKGS_LIBUDEV=\"${lib.getLib systemd}/lib/libudev\"";
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isLinux "-DNIXPKGS_LIBUDEV=\"${lib.getLib systemd}/lib/libudev\"";
}
2 changes: 1 addition & 1 deletion nix/pkgs/qt-5/modules/qttools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ qtModule {
"bin/macdeployqt"
];

env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin ''-DNIXPKGS_QMLIMPORTSCANNER="${qtdeclarative.dev}/bin/qmlimportscanner"'';
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin ''-DNIXPKGS_QMLIMPORTSCANNER="${qtdeclarative.dev}/bin/qmlimportscanner"'';

setupHook = ../hooks/qttools-setup-hook.sh;
}
2 changes: 1 addition & 1 deletion nix/pkgs/qt-5/modules/qtwebengine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ qtModule {
--replace "-Wl,-fatal_warnings" ""
'') + postPatch;

env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
# with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit
"-Wno-class-memaccess"
] ++ lib.optionals (stdenv.hostPlatform.gcc.arch or "" == "sandybridge") [
Expand Down
2 changes: 1 addition & 1 deletion nix/pkgs/qt-5/modules/qtwebkit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ qtModule {
"-DMACOS_FORCE_SYSTEM_XML_LIBRARIES=OFF"
];

env.NIX_CFLAGS_COMPILE = toString ([
NIX_CFLAGS_COMPILE = toString ([
# with gcc7 this warning blows the log over Hydra's limit
"-Wno-expansion-to-defined"
]
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}:

let
qtCustom = (with pkgs.qt515;
qtCustom = (with pkgs.qt515_8;
# TODO:check the required modules after Qt upgrade
env "qt-custom-${qtbase.version}" ([
qtbase
Expand Down

0 comments on commit 1fade39

Please sign in to comment.