about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix115
1 files changed, 54 insertions, 61 deletions
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
index 2dd9edcf5d23..8b5d497c5e9a 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
@@ -9,33 +9,32 @@
 
 , dbus, fontconfig, freetype, glib, harfbuzz, icu, libdrm, libX11, libXcomposite
 , libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng , libxcb
-, libxkbcommon, libxml2, libxslt, openssl, pcre16, pcre2, sqlite, udev, xcbutil
+, libxkbcommon, libxml2, libxslt, openssl, pcre2, sqlite, udev, xcbutil
 , xcbutilimage, xcbutilkeysyms, xcbutilrenderutil, xcbutilwm , zlib, at-spi2-core
 
   # optional dependencies
-, cups ? null, libmysqlclient ? null, postgresql ? null
-, withGtk3 ? false, dconf ? null, gtk3 ? null
+, cups ? null, postgresql ? null
+, withGtk3 ? false, dconf, gtk3
 
   # options
 , libGLSupported ? !stdenv.isDarwin
 , libGL
+  # qmake detection for libmysqlclient does not seem to work when cross compiling
+, mysqlSupport ? stdenv.hostPlatform == stdenv.buildPlatform
+, libmysqlclient
 , buildExamples ? false
 , buildTests ? false
 , debug ? false
 , developerBuild ? false
 , decryptSslTraffic ? false
+, testers
 }:
 
-assert withGtk3 -> dconf != null;
-assert withGtk3 -> gtk3 != null;
-
 let
-  compareVersion = v: builtins.compareVersions version v;
-  qmakeCacheName = if compareVersion "5.12.4" < 0 then ".qmake.cache" else ".qmake.stash";
   debugSymbols = debug || developerBuild;
 in
 
-stdenv.mkDerivation {
+stdenv.mkDerivation (finalAttrs: {
   pname = "qtbase";
   inherit qtCompatVersion src version;
   debug = debugSymbols;
@@ -48,7 +47,7 @@ stdenv.mkDerivation {
 
     # Image formats
     libjpeg libpng
-    (if compareVersion "5.9.0" < 0 then pcre16 else pcre2)
+    pcre2
   ] ++ (
     if stdenv.isDarwin then [
       # TODO: move to buildInputs, this should not be propagated.
@@ -77,7 +76,7 @@ stdenv.mkDerivation {
     )
     ++ lib.optional developerBuild gdb
     ++ lib.optional (cups != null) cups
-    ++ lib.optional (libmysqlclient != null) libmysqlclient
+    ++ lib.optional (mysqlSupport) libmysqlclient
     ++ lib.optional (postgresql != null) postgresql;
 
   nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which ]
@@ -119,7 +118,7 @@ stdenv.mkDerivation {
 
     # https://bugs.gentoo.org/803470
     sed -i 's/-lpthread/-pthread/' mkspecs/common/linux.conf src/corelib/configure.json
-  '' + lib.optionalString (compareVersion "5.15.0" >= 0) ''
+
     patchShebangs ./bin
   '' + (
     if stdenv.isDarwin then ''
@@ -149,22 +148,18 @@ stdenv.mkDerivation {
   setOutputFlags = false;
   preConfigure = ''
     export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
-    ${lib.optionalString (compareVersion "5.9.0" < 0) ''
-    # We need to set LD to CXX or otherwise we get nasty compile errors
-    export LD=$CXX
-    ''}
 
     NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
 
     # paralellize compilation of qtmake, which happens within ./configure
     export MAKEFLAGS+=" -j$NIX_BUILD_CORES"
-  '' + lib.optionalString (compareVersion "5.15.0" >= 0) ''
+
     ./bin/syncqt.pl -version $version
   '';
 
   postConfigure = ''
     qmakeCacheInjectNixOutputs() {
-        local cache="$1/${qmakeCacheName}"
+        local cache="$1/.qmake.stash"
         echo "qmakeCacheInjectNixOutputs: $cache"
         if ! [ -f "$cache" ]; then
             echo >&2 "qmakeCacheInjectNixOutputs: WARNING: $cache does not exist"
@@ -184,10 +179,10 @@ stdenv.mkDerivation {
     done
   '';
 
-  NIX_CFLAGS_COMPILE = toString ([
+  env.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"''
-    ''-D${if compareVersion "5.11.0" >= 0 then "LIBRESOLV_SO" else "NIXPKGS_LIBRESOLV"}="${stdenv.cc.libc.out}/lib/libresolv"''
+    ''-DLIBRESOLV_SO="${stdenv.cc.libc.out}/lib/libresolv"''
     ''-DNIXPKGS_LIBXCURSOR="${libXcursor.out}/lib/libXcursor"''
   ] ++ lib.optional libGLSupported ''-DNIXPKGS_MESA_GL="${libGL.out}/lib/libGL"''
     ++ lib.optional stdenv.isLinux "-DUSE_X11"
@@ -195,14 +190,10 @@ stdenv.mkDerivation {
       # ignore "is only available on macOS 10.12.2 or newer" in obj-c code
       "-Wno-error=unguarded-availability"
     ]
-    ++ lib.optionals ((compareVersion "5.15.0" >= 0) && stdenv.isDarwin) [
-      # .moc/moc_qprintdialog.cpp:96:31: error: no member named '_q_togglePageSetCombo' in 'QPrintDialogPrivate'
-      "-DQ_OS_MAC"
-    ] ++ lib.optionals withGtk3 [
+    ++ lib.optionals withGtk3 [
          ''-DNIXPKGS_QGTK3_XDG_DATA_DIRS="${gtk3}/share/gsettings-schemas/${gtk3.name}"''
          ''-DNIXPKGS_QGTK3_GIO_EXTRA_MODULES="${dconf.lib}/lib/gio/modules"''
-       ]
-    ++ lib.optional decryptSslTraffic "-DQT_DECRYPT_SSL_TRAFFIC");
+  ] ++ lib.optional decryptSslTraffic "-DQT_DECRYPT_SSL_TRAFFIC");
 
   prefixKey = "-prefix ";
 
@@ -225,7 +216,8 @@ stdenv.mkDerivation {
     "-shared"
     "-accessibility"
     "-optimized-qmake"
-    "-strip"
+    # for separateDebugInfo
+    "-no-strip"
     "-system-proxies"
     "-pkg-config"
 
@@ -236,18 +228,14 @@ stdenv.mkDerivation {
     "-L" "${icu.out}/lib"
     "-I" "${icu.dev}/include"
     "-pch"
-  ] ++ lib.optional debugSymbols "-debug"
-    ++ lib.optionals (compareVersion "5.11.0" < 0) [
-    "-qml-debug"
-  ] ++ lib.optionals (compareVersion "5.9.0" < 0) [
-    "-c++11"
-    "-no-reduce-relocations"
-  ] ++ lib.optionals developerBuild [
+  ]
+  ++ lib.optional debugSymbols "-debug"
+  ++ lib.optionals developerBuild [
     "-developer-build"
     "-no-warnings-are-errors"
   ] ++ (if (!stdenv.hostPlatform.isx86_64) then [
     "-no-sse2"
-  ] else lib.optionals (compareVersion "5.9.0" >= 0) [
+  ] else [
     "-sse2"
     "${lib.optionalString (!stdenv.hostPlatform.sse3Support)   "-no"}-sse3"
     "${lib.optionalString (!stdenv.hostPlatform.ssse3Support)  "-no"}-ssse3"
@@ -274,14 +262,14 @@ stdenv.mkDerivation {
     "-L" "${lib.getLib openssl}/lib"
     "-I" "${openssl.dev}/include"
     "-system-sqlite"
-    ''-${if libmysqlclient != null then "plugin" else "no"}-sql-mysql''
+    ''-${if mysqlSupport then "plugin" else "no"}-sql-mysql''
     ''-${if postgresql != null then "plugin" else "no"}-sql-psql''
 
     "-make libs"
     "-make tools"
     ''-${lib.optionalString (!buildExamples) "no"}make examples''
     ''-${lib.optionalString (!buildTests) "no"}make tests''
-  ] ++ lib.optional (compareVersion "5.15.0" < 0) "-v"
+  ]
     ++ (
       if stdenv.isDarwin then [
       "-no-fontconfig"
@@ -289,9 +277,8 @@ stdenv.mkDerivation {
       "-qt-libpng"
       "-no-framework"
     ] else [
-      "-${lib.optionalString (compareVersion "5.9.0" < 0) "no-"}rpath"
-    ] ++ lib.optional (compareVersion "5.15.0" < 0) "-system-xcb"
-      ++ [
+      "-rpath"
+    ] ++ [
       "-xcb"
       "-qpa xcb"
       "-L" "${libX11.out}/lib"
@@ -306,24 +293,15 @@ stdenv.mkDerivation {
       ''-${lib.optionalString (cups == null) "no-"}cups''
       "-dbus-linked"
       "-glib"
-    ] ++ lib.optional (compareVersion "5.15.0" < 0) "-system-libjpeg"
-      ++ [
+    ] ++ [
       "-system-libpng"
     ] ++ lib.optional withGtk3 "-gtk"
-      ++ lib.optional (compareVersion "5.9.0" >= 0) "-inotify"
-      ++ lib.optionals (compareVersion "5.10.0" >= 0) [
-      # Without these, Qt stops working on kernels < 3.17. See:
-      # https://github.com/NixOS/nixpkgs/issues/38832
-      "-no-feature-renameat2"
-      "-no-feature-getentropy"
-    ] ++ lib.optionals (compareVersion "5.12.1" < 0) [
-      # use -xkbcommon and -xkbcommon-evdev for versions before 5.12.1
-      "-system-xkbcommon"
-      "-xkbcommon-evdev"
+      ++ [
+        "-inotify"
     ] ++ lib.optionals (cups != null) [
       "-L" "${cups.lib}/lib"
       "-I" "${cups.dev}/include"
-    ] ++ lib.optionals (libmysqlclient != null) [
+    ] ++ lib.optionals (mysqlSupport) [
       "-L" "${libmysqlclient}/lib"
       "-I" "${libmysqlclient}/include"
     ]
@@ -365,18 +343,33 @@ stdenv.mkDerivation {
 
   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++";
-    license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
+    license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
     maintainers = with maintainers; [ qknight ttuegel periklis bkchr ];
+    pkgConfigModules = [
+      "Qt5Concurrent"
+      "Qt5Core"
+      "Qt5DBus"
+      "Qt5Gui"
+      "Qt5Network"
+      "Qt5OpenGL"
+      "Qt5OpenGLExtensions"
+      "Qt5PrintSupport"
+      #"Qt5Qml"
+      #"Qt5QmlModels"
+      #"Qt5Quick"
+      #"Qt5QuickTest"
+      #"Qt5QuickWidgets"
+      "Qt5Sql"
+      "Qt5Test"
+      "Qt5Widgets"
+      "Qt5Xml"
+    ];
     platforms = platforms.unix;
-    # Qt5 is broken on aarch64-darwin
-    # the build ends up with the following error:
-    #   error: unknown target CPU 'armv8.3-a+crypto+sha2+aes+crc+fp16+lse+simd+ras+rdm+rcpc'
-    #   note: valid target CPU values are: nocona, core2, penryn, ..., znver1, znver2, x86-64
-    # it seems the qmake/cmake passes x86_64 as preferred architecture somewhere
-    broken = stdenv.isDarwin && stdenv.isAarch64 && (compareVersion "5.15.3" < 0);
   };
 
-}
+})