qt6: include qttranslations properly

This commit is contained in:
K900 2023-07-29 13:52:02 +03:00
parent 68cc02588d
commit 0597d865ef
5 changed files with 30 additions and 6 deletions

View file

@ -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

View file

@ -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"

View file

@ -4,5 +4,6 @@
qtModule {
pname = "qttranslations";
qtInputs = [ qttools ];
nativeBuildInputs = [ qttools ];
outputs = [ "out" ];
}

View file

@ -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()

View file

@ -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;