summary refs log tree commit diff
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-07-29 13:52:02 +0300
committerK900 <me@0upti.me>2023-08-15 22:11:10 +0300
commit0597d865ef4f763f3fed54702b29ce328d28e2b4 (patch)
tree298cd6c1996e396003b7a1f546a8e4775ccdabd6
parent68cc02588d4659c77b9e5bfab7ff848c2b5248ca (diff)
downloadnixpkgs-0597d865ef4f763f3fed54702b29ce328d28e2b4.tar
nixpkgs-0597d865ef4f763f3fed54702b29ce328d28e2b4.tar.gz
nixpkgs-0597d865ef4f763f3fed54702b29ce328d28e2b4.tar.bz2
nixpkgs-0597d865ef4f763f3fed54702b29ce328d28e2b4.tar.lz
nixpkgs-0597d865ef4f763f3fed54702b29ce328d28e2b4.tar.xz
nixpkgs-0597d865ef4f763f3fed54702b29ce328d28e2b4.tar.zst
nixpkgs-0597d865ef4f763f3fed54702b29ce328d28e2b4.zip
qt6: include qttranslations properly
-rw-r--r--pkgs/development/libraries/qt-6/default.nix15
-rw-r--r--pkgs/development/libraries/qt-6/modules/qtbase.nix3
-rw-r--r--pkgs/development/libraries/qt-6/modules/qttranslations.nix3
-rw-r--r--pkgs/development/libraries/qt-6/patches/0008-qtbase-allow-translations-outside-prefix.patch13
-rw-r--r--pkgs/development/libraries/qt-6/qtModule.nix2
5 files changed, 30 insertions, 6 deletions
diff --git a/pkgs/development/libraries/qt-6/default.nix b/pkgs/development/libraries/qt-6/default.nix
index d9bc6ae15e1..09bd183cf54 100644
--- a/pkgs/development/libraries/qt-6/default.nix
+++ b/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
         ];
       };
       env = callPackage ./qt-env.nix { };
@@ -168,6 +169,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/pkgs/development/libraries/qt-6/modules/qtbase.nix b/pkgs/development/libraries/qt-6/modules/qtbase.nix
index 4a4ebb32075..c0a20503e64 100644
--- a/pkgs/development/libraries/qt-6/modules/qtbase.nix
+++ b/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/pkgs/development/libraries/qt-6/modules/qttranslations.nix b/pkgs/development/libraries/qt-6/modules/qttranslations.nix
index 4795cd9e1bf..61c642de108 100644
--- a/pkgs/development/libraries/qt-6/modules/qttranslations.nix
+++ b/pkgs/development/libraries/qt-6/modules/qttranslations.nix
@@ -4,5 +4,6 @@
 
 qtModule {
   pname = "qttranslations";
-  qtInputs = [ qttools ];
+  nativeBuildInputs = [ qttools ];
+  outputs = [ "out" ];
 }
diff --git a/pkgs/development/libraries/qt-6/patches/0008-qtbase-allow-translations-outside-prefix.patch b/pkgs/development/libraries/qt-6/patches/0008-qtbase-allow-translations-outside-prefix.patch
new file mode 100644
index 00000000000..e96cbdbef11
--- /dev/null
+++ b/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/pkgs/development/libraries/qt-6/qtModule.nix b/pkgs/development/libraries/qt-6/qtModule.nix
index 98606d24a96..ce917a27415 100644
--- a/pkgs/development/libraries/qt-6/qtModule.nix
+++ b/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;