qt5: include qttranslations properly

Qt loads its own translations from a hardcoded path, and those are used
(among other things) for determining RTL layout preferences in applications,
so they are definitely something we want to have.

This adds a qtbase/qttools rebuild to the chain, but it's fast enough that it's
probably fine.

Another approach would be to load translation paths from the environment,
and inject it in wrapQtAppsHook, but that seems like more complexity
for very questionable build time savings.
This commit is contained in:
K900 2023-07-29 13:10:16 +03:00
parent c1460d70aa
commit 68cc02588d
5 changed files with 18 additions and 4 deletions

View File

@ -331,4 +331,14 @@ let
} ../hooks/wrap-qt-apps-hook.sh;
};
in makeScopeWithSplicing (generateSplicesForMkScope "qt5") (_: {}) (_: {}) addPackages
baseScope = makeScopeWithSplicing (generateSplicesForMkScope "qt5") (_: {}) (_: {}) 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

@ -15,6 +15,7 @@
# optional dependencies
, cups ? null, postgresql ? null
, withGtk3 ? false, dconf, gtk3
, qttranslations ? null
# options
, libGLSupported ? !stdenv.isDarwin
@ -310,6 +311,8 @@ stdenv.mkDerivation (finalAttrs: {
] ++ lib.optionals (mysqlSupport) [
"-L" "${libmysqlclient}/lib"
"-I" "${libmysqlclient}/include"
] ++ lib.optional (qttranslations != null) [
"-translationdir" "${qttranslations}/translations"
]
);

View File

@ -36,7 +36,7 @@ qtModule {
"bin/macdeployqt"
];
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin ''-DNIXPKGS_QMLIMPORTSCANNER="${qtdeclarative.dev}/bin/qmlimportscanner"'';
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && qtdeclarative != null) ''-DNIXPKGS_QMLIMPORTSCANNER="${qtdeclarative.dev}/bin/qmlimportscanner"'';
setupHook = ../hooks/qttools-setup-hook.sh;
}

View File

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

View File

@ -17,7 +17,7 @@ mkDerivation (args // {
patches = (args.patches or []) ++ (patches.${pname} or []);
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ perl self.qmake ];
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
propagatedBuildInputs = (args.qtInputs or []) ++ (args.propagatedBuildInputs or []);
outputs = args.outputs or [ "out" "dev" ];
setOutputFlags = args.setOutputFlags or false;