about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/qt-6
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-09-01 11:51:02 +0000
committerAlyssa Ross <hi@alyssa.is>2023-09-01 11:51:02 +0000
commitaa4353b499e6950b7333578f936455a628145c31 (patch)
treec6332cedece2327a18d08794755b3fc0f9f1905b /nixpkgs/pkgs/development/libraries/qt-6
parentac456d475f4e50818499b804359355c0f3b4bbf7 (diff)
parent52185f4d76c18d8348f963795dfed1de018e8dfe (diff)
downloadnixlib-aa4353b499e6950b7333578f936455a628145c31.tar
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.gz
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.bz2
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.lz
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.xz
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.zst
nixlib-aa4353b499e6950b7333578f936455a628145c31.zip
Merge https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/qt-6')
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-6/default.nix15
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-6/modules/qtbase.nix3
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-6/modules/qttranslations.nix3
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-6/modules/qtwebengine.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-6/patches/0008-qtbase-allow-translations-outside-prefix.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-6/patches/qtwebengine-locales-path.patch28
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-6/qtModule.nix2
7 files changed, 62 insertions, 13 deletions
diff --git a/nixpkgs/pkgs/development/libraries/qt-6/default.nix b/nixpkgs/pkgs/development/libraries/qt-6/default.nix
index d90834e0b3e2..0a4fbe713ec0 100644
--- a/nixpkgs/pkgs/development/libraries/qt-6/default.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-6/default.nix
@@ -48,6 +48,7 @@ let
           ./patches/0005-qtbase-deal-with-a-font-face-at-index-0-as-Regular-f.patch
           ./patches/0006-qtbase-qt-cmake-always-use-cmake-from-path.patch
           ./patches/0007-qtbase-find-qt-tools-in-QTTOOLSPATH.patch
+          ./patches/0008-qtbase-allow-translations-outside-prefix.patch
           ./patches/0008-qtbase-find-qmlimportscanner-in-macdeployqt-via-environment.patch
           ./patches/0009-qtbase-check-in-the-QML-folder-of-this-library-does-actuall.patch
           ./patches/0010-qtbase-pass-to-qmlimportscanner-the-QML2_IMPORT_PATH.patch
@@ -171,6 +172,14 @@ let
 
   # TODO(@Artturin): convert to makeScopeWithSplicing'
   # simple example of how to do that in 5568a4d25ca406809530420996d57e0876ca1a01
-  self = lib.makeScope newScope addPackages;
-in
-self
+  baseScope = lib.makeScope newScope addPackages;
+
+  bootstrapScope = baseScope.overrideScope'(final: prev: {
+    qtbase = prev.qtbase.override { qttranslations = null; };
+    qtdeclarative = null;
+  });
+
+  finalScope = baseScope.overrideScope'(final: prev: {
+    qttranslations = bootstrapScope.qttranslations;
+  });
+in finalScope
diff --git a/nixpkgs/pkgs/development/libraries/qt-6/modules/qtbase.nix b/nixpkgs/pkgs/development/libraries/qt-6/modules/qtbase.nix
index 4a4ebb320757..c0a20503e64c 100644
--- a/nixpkgs/pkgs/development/libraries/qt-6/modules/qtbase.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-6/modules/qtbase.nix
@@ -93,6 +93,7 @@
 , libGL
 , debug ? false
 , developerBuild ? false
+, qttranslations ? null
 }:
 
 let
@@ -233,7 +234,7 @@ stdenv.mkDerivation rec {
   ] ++ lib.optionals stdenv.isDarwin [
     # error: 'path' is unavailable: introduced in macOS 10.15
     "-DQT_FEATURE_cxx17_filesystem=OFF"
-  ];
+  ] ++ lib.optional (qttranslations != null) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations";
 
   NIX_LDFLAGS = toString (lib.optionals stdenv.isDarwin [
     # Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc"
diff --git a/nixpkgs/pkgs/development/libraries/qt-6/modules/qttranslations.nix b/nixpkgs/pkgs/development/libraries/qt-6/modules/qttranslations.nix
index 4795cd9e1bfe..61c642de1085 100644
--- a/nixpkgs/pkgs/development/libraries/qt-6/modules/qttranslations.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-6/modules/qttranslations.nix
@@ -4,5 +4,6 @@
 
 qtModule {
   pname = "qttranslations";
-  qtInputs = [ qttools ];
+  nativeBuildInputs = [ qttools ];
+  outputs = [ "out" ];
 }
diff --git a/nixpkgs/pkgs/development/libraries/qt-6/modules/qtwebengine.nix b/nixpkgs/pkgs/development/libraries/qt-6/modules/qtwebengine.nix
index 0c243d4ba7a9..5d9aa71e8537 100644
--- a/nixpkgs/pkgs/development/libraries/qt-6/modules/qtwebengine.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-6/modules/qtwebengine.nix
@@ -14,8 +14,6 @@
 , python3
 , which
 , nodejs
-, qtbase
-, perl
 , xorg
 , libXcursor
 , libXScrnSaver
@@ -51,8 +49,6 @@
 , systemd
 , pipewire
 , gn
-, runCommand
-, writeScriptBin
 , ffmpeg_4
 , lib
 , stdenv
@@ -60,10 +56,8 @@
 , libxml2
 , libxslt
 , lcms2
-, re2
 , libkrb5
 , mesa
-, xkeyboard_config
 , enableProprietaryCodecs ? true
   # darwin
 , llvmPackages_14
@@ -135,7 +129,11 @@ qtModule {
     # environment variable, since NixOS relies on it working.
     # See https://github.com/NixOS/nixpkgs/issues/226484 for more context.
     ../patches/qtwebengine-xkb-includes.patch
+
     ../patches/qtwebengine-link-pulseaudio.patch
+
+    # Override locales install path so they go to QtWebEngine's $out
+    ../patches/qtwebengine-locales-path.patch
   ];
 
   postPatch = ''
@@ -225,7 +223,6 @@ qtModule {
     libxml2
     libxslt
     lcms2
-    re2
 
     libevent
     ffmpeg_4
diff --git a/nixpkgs/pkgs/development/libraries/qt-6/patches/0008-qtbase-allow-translations-outside-prefix.patch b/nixpkgs/pkgs/development/libraries/qt-6/patches/0008-qtbase-allow-translations-outside-prefix.patch
new file mode 100644
index 000000000000..e96cbdbef11d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-6/patches/0008-qtbase-allow-translations-outside-prefix.patch
@@ -0,0 +1,13 @@
+diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
+index b45ec1d208..05f69c131b 100644
+--- a/cmake/QtBuild.cmake
++++ b/cmake/QtBuild.cmake
+@@ -30,7 +30,7 @@ function(qt_configure_process_path name default docstring)
+             set(rel_path ".")
+         elseif(rel_path MATCHES "^\.\./")
+             # INSTALL_SYSCONFDIR is allowed to be outside the prefix.
+-            if(NOT name STREQUAL "INSTALL_SYSCONFDIR")
++            if(NOT (name STREQUAL "INSTALL_SYSCONFDIR" OR name STREQUAL "INSTALL_TRANSLATIONSDIR"))
+                 message(FATAL_ERROR
+                     "Path component '${name}' is outside computed install prefix: ${rel_path} ")
+                 return()
diff --git a/nixpkgs/pkgs/development/libraries/qt-6/patches/qtwebengine-locales-path.patch b/nixpkgs/pkgs/development/libraries/qt-6/patches/qtwebengine-locales-path.patch
new file mode 100644
index 000000000000..58f2d96f8097
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-6/patches/qtwebengine-locales-path.patch
@@ -0,0 +1,28 @@
+diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt
+index f860e0ba7..30e1a767a 100644
+--- a/src/core/api/CMakeLists.txt
++++ b/src/core/api/CMakeLists.txt
+@@ -193,7 +193,8 @@ if(QT_FEATURE_framework)
+ 
+ else()
+     install(FILES ${localeFiles}
+-        DESTINATION ${INSTALL_TRANSLATIONSDIR}/qtwebengine_locales
++        # Nixpkgs: INSTALL_TRANSLATIONSDIR points to Qt base translations store path
++        DESTINATION ${INSTALL_DATADIR}/qtwebengine_locales
+         CONFIGURATIONS ${config}
+     )
+     install(FILES ${resourceFiles}
+diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
+index c03c9a3b2..430fdfab2 100644
+--- a/src/core/web_engine_library_info.cpp
++++ b/src/core/web_engine_library_info.cpp
+@@ -203,7 +203,8 @@ QString localesPath()
+             candidatePaths << getResourcesPath(frameworkBundle()) % QDir::separator()
+                             % QLatin1String("qtwebengine_locales");
+ #endif
+-            candidatePaths << QLibraryInfo::path(QLibraryInfo::TranslationsPath) % QDir::separator()
++            // Nixpkgs: match the changes made in CMakeLists.txt
++            candidatePaths << QLibraryInfo::path(QLibraryInfo::DataPath) % QDir::separator()
+                             % QLatin1String("qtwebengine_locales");
+             candidatePaths << fallbackDir();
+         }
diff --git a/nixpkgs/pkgs/development/libraries/qt-6/qtModule.nix b/nixpkgs/pkgs/development/libraries/qt-6/qtModule.nix
index 98606d24a968..ce917a274159 100644
--- a/nixpkgs/pkgs/development/libraries/qt-6/qtModule.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-6/qtModule.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation (args // {
   buildInputs = args.buildInputs or [ ];
   nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cmake ninja perl ]
     ++ lib.optionals stdenv.isDarwin [ moveBuildTree ];
-  propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or [ ]);
+  propagatedBuildInputs = (args.qtInputs or [ ]) ++ (args.propagatedBuildInputs or [ ]);
 
   moveToDev = false;