From 8b551e46cf028456e559493883f9f624cfa84b81 Mon Sep 17 00:00:00 2001 From: Anton Iakimov Date: Fri, 19 Jan 2024 16:23:26 +0100 Subject: [PATCH] ci: ammend qt derivation to run on 20.09 --- Makefile | 2 +- nix/overlay.nix | 36 ++++++++++++++++++++++---- nix/pkgs/qt-5/5.15/default.nix | 26 +++++++------------ nix/pkgs/qt-5/5.15/srcs.nix | 3 +-- nix/pkgs/qt-5/modules/qt3d.nix | 2 +- nix/pkgs/qt-5/modules/qtbase.nix | 28 +++----------------- nix/pkgs/qt-5/modules/qtserialport.nix | 2 +- nix/pkgs/qt-5/modules/qttools.nix | 2 +- nix/pkgs/qt-5/modules/qtwebengine.nix | 2 +- nix/pkgs/qt-5/modules/qtwebkit.nix | 2 +- shell.nix | 31 ++++------------------ 11 files changed, 57 insertions(+), 79 deletions(-) diff --git a/Makefile b/Makefile index 5e0e5006d1..cc8c3115fe 100644 --- a/Makefile +++ b/Makefile @@ -582,7 +582,7 @@ ifndef IN_NIX_SHELL rm -rf tmp/linux mkdir -p tmp/linux/tools wget -nv https://github.com/AppImage/AppImageKit/releases/download/continuous/$(_APPIMAGE_TOOL) - mv $(_APPIMAGE_TOOL) tmp/linux/tools/appimagetool + mv $(_APPIMAGE_TOOL) $(APPIMAGE_TOOL) chmod +x $(APPIMAGE_TOOL) endif diff --git a/nix/overlay.nix b/nix/overlay.nix index a3724d1ed7..78ecdf811a 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -6,20 +6,22 @@ # - 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 { }; # Copyied from d9424d2191d6439a276b69ae1fd0a800586135ca # 2018-07-27 -> 2020-12-31 + # TODO: override and upgrade + # Copy is uses because of initial complexity of package override (probably due to fuse override) appimagekit = callPackage ./pkgs/appimagekit/default.nix { }; # Requirement from Makefile - 3.19 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="; }; @@ -28,10 +30,34 @@ in rec { # Copyied from bootstrap121 from 0e2a36815d2310886458ac1aab14350160e6b12a # autoPatchelfHook is disabled # TODO: compile, not binary + # Binary is used because of initial complexity of both package override and copy from newer nixpkgs 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" '' + # Fix for linuxdeployqt running ldd from nix with system shell + # ERROR: findDependencyInfo: "/bin/sh: /nix/store/HASH-glibc-2.31-74/lib/libc.so.6: version `GLIBC_2.33' not found (required by /bin/sh)\n/bin/sh: /nix/store/0c7c96gikmzv87i7lv3vq5s1cmfjd6zf-glibc-2.31-74/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/sh)" + # $ head $(which ldd) + # #! /bin/sh + 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; } diff --git a/nix/pkgs/qt-5/5.15/default.nix b/nix/pkgs/qt-5/5.15/default.nix index 46a60f5403..385335e212 100644 --- a/nix/pkgs/qt-5/5.15/default.nix +++ b/nix/pkgs/qt-5/5.15/default.nix @@ -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 @@ -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 @@ -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 {}; @@ -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; @@ -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 diff --git a/nix/pkgs/qt-5/5.15/srcs.nix b/nix/pkgs/qt-5/5.15/srcs.nix index 0603ae077e..5cb74e7b7f 100644 --- a/nix/pkgs/qt-5/5.15/srcs.nix +++ b/nix/pkgs/qt-5/5.15/srcs.nix @@ -13,7 +13,6 @@ let src = override.src or fetchgit { inherit (args) url rev sha256; - fetchLFS = false; fetchSubmodules = true; deepClone = false; leaveDotGit = false; @@ -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 = diff --git a/nix/pkgs/qt-5/modules/qt3d.nix b/nix/pkgs/qt-5/modules/qt3d.nix index 98d11864e4..918eba5b71 100644 --- a/nix/pkgs/qt-5/modules/qt3d.nix +++ b/nix/pkgs/qt-5/modules/qt3d.nix @@ -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"; } diff --git a/nix/pkgs/qt-5/modules/qtbase.nix b/nix/pkgs/qt-5/modules/qtbase.nix index 8b5d497c5e..b0a25334e5 100644 --- a/nix/pkgs/qt-5/modules/qtbase.nix +++ b/nix/pkgs/qt-5/modules/qtbase.nix @@ -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 @@ -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; @@ -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 @@ -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 ]; @@ -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|" \ @@ -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"'' @@ -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++"; @@ -372,4 +352,4 @@ stdenv.mkDerivation (finalAttrs: { platforms = platforms.unix; }; -}) +} diff --git a/nix/pkgs/qt-5/modules/qtserialport.nix b/nix/pkgs/qt-5/modules/qtserialport.nix index 93f3e130ee..89d96eb291 100644 --- a/nix/pkgs/qt-5/modules/qtserialport.nix +++ b/nix/pkgs/qt-5/modules/qtserialport.nix @@ -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\""; } diff --git a/nix/pkgs/qt-5/modules/qttools.nix b/nix/pkgs/qt-5/modules/qttools.nix index be96236d72..df00c95ef8 100644 --- a/nix/pkgs/qt-5/modules/qttools.nix +++ b/nix/pkgs/qt-5/modules/qttools.nix @@ -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; } diff --git a/nix/pkgs/qt-5/modules/qtwebengine.nix b/nix/pkgs/qt-5/modules/qtwebengine.nix index 60899e5053..c71a89cdce 100644 --- a/nix/pkgs/qt-5/modules/qtwebengine.nix +++ b/nix/pkgs/qt-5/modules/qtwebengine.nix @@ -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") [ diff --git a/nix/pkgs/qt-5/modules/qtwebkit.nix b/nix/pkgs/qt-5/modules/qtwebkit.nix index a70ebd3fb7..c9bc22a5ec 100644 --- a/nix/pkgs/qt-5/modules/qtwebkit.nix +++ b/nix/pkgs/qt-5/modules/qtwebkit.nix @@ -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" ] diff --git a/shell.nix b/shell.nix index 2c10883e9d..9721cdb346 100644 --- a/shell.nix +++ b/shell.nix @@ -3,8 +3,8 @@ }: let - qtCustom = (with pkgs.qt515; - # TODO:check the required modules after Qt upgrade + qtCustom = (with pkgs.qt515_8; + # TODO:check the required modules env "qt-custom-${qtbase.version}" ([ qtbase qtdeclarative @@ -18,13 +18,12 @@ let qtgraphicaleffects qtwebengine qtlocation -# qtlottie # TODO: was missing in 5.15.2, review after upgrade ])); in pkgs.mkShell { name = "status-desktop-build-shell"; - # TODO:check the required packages after Qt upgrade + # TODO:check the required packages buildInputs = with pkgs; [ bash curl wget git file unzip jq lsb-release which cacert gnupg linuxdeployqt appimagekit @@ -53,20 +52,8 @@ in pkgs.mkShell { export PATH="${pkgs.lddWrapped}/bin:$PATH" ''; - # Used to workaround missing lib links in qt-custom - # TODO:check if it's still needed after Qt upgrade - LIBRARY_PATH = with pkgs.qt515; pkgs.lib.makeLibraryPath [ - qtdeclarative - qtmultimedia - qtquickcontrols - qtquickcontrols2 - qtsvg - qtwebchannel - qtwebview - ]; - # Used for linuxdeployqt - # TODO:check if qt modules are still needed here after Qt upgrade + # TODO:check which deps are needed LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath ( [ alsaLib @@ -84,15 +71,7 @@ in pkgs.mkShell { libxkbcommon p11-kit zlib - ] ++ (with qt515; [ - qtbase - qtdeclarative - qtlocation - qtmultimedia - qtquickcontrols2 - qtsvg - qtwebengine - ]) ++ (with xorg; [ + ] ++ (with xorg; [ libICE libSM libX11