Skip to content

Commit

Permalink
qt6: include qttranslations properly
Browse files Browse the repository at this point in the history
  • Loading branch information
K900 committed Jul 29, 2023
1 parent e56dead commit af19b54
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
15 changes: 12 additions & 3 deletions pkgs/development/libraries/qt-6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion pkgs/development/libraries/qt-6/modules/qtbase.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
, libGL
, debug ? false
, developerBuild ? false
, qttranslations ? null
}:

let
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions pkgs/development/libraries/qt-6/modules/qttranslations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
qtModule {
pname = "qttranslations";
qtInputs = [ qttools ];
outputs = [ "out" ];

# FIXME: this should probably be lifted into qtModule
postFixup = ''
rm -rf $out/nix-support
'';
}
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit af19b54

Please sign in to comment.