Merge pull request #226018 from NickCao/qt6-rework
qt6: rework packaging of qt modules (part 2)
This commit is contained in:
commit
5de5912954
|
@ -5,7 +5,6 @@
|
|||
, fetchpatch
|
||||
, makeSetupHook
|
||||
, makeWrapper
|
||||
, cmake
|
||||
, gst_all_1
|
||||
, libglvnd
|
||||
, darwin
|
||||
|
@ -27,11 +26,6 @@ let
|
|||
callPackage = self.newScope ({
|
||||
inherit qtModule srcs;
|
||||
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
|
||||
cmake = cmake.overrideAttrs (attrs: {
|
||||
patches = attrs.patches ++ [
|
||||
./patches/cmake.patch
|
||||
];
|
||||
});
|
||||
});
|
||||
in
|
||||
{
|
||||
|
@ -46,10 +40,12 @@ let
|
|||
inherit developerBuild;
|
||||
inherit (darwin.apple_sdk_11_0.frameworks) AGL AVFoundation AppKit GSS MetalKit;
|
||||
patches = [
|
||||
./patches/qtbase-qmake-mkspecs-mac.patch
|
||||
./patches/qtbase-qmake-pkg-config.patch
|
||||
./patches/qtbase-tzdir.patch
|
||||
./patches/qtbase-variable-fonts.patch
|
||||
./patches/0001-qtbase-qmake-always-use-libname-instead-of-absolute-.patch
|
||||
./patches/0002-qtbase-qmake-fix-mkspecs-for-darwin.patch
|
||||
./patches/0003-qtbase-qmake-fix-includedir-in-generated-pkg-config.patch
|
||||
./patches/0004-qtbase-fix-locating-tzdir-on-NixOS.patch
|
||||
./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
|
||||
# Remove symlink check causing build to bail out and fail.
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/23251
|
||||
(fetchpatch {
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
fixQtBuiltinPaths() {
|
||||
local dir="$1"
|
||||
local pattern="$2"
|
||||
local bin="${!outputBin}"
|
||||
local dev="${!outputDev}"
|
||||
local doc="${!outputDoc}"
|
||||
local lib="${!outputLib}"
|
||||
|
||||
if [ -d "$dir" ]; then
|
||||
|
@ -17,48 +14,48 @@ fixQtBuiltinPaths() {
|
|||
if grep -q '\$\$\[QT_' "${pr_:?}"; then
|
||||
echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${pr_:?}'..."
|
||||
sed -i "${pr_:?}" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_LIBEXECS[^]]*\\]|$dev/libexec|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$lib/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_LIBEXECS[^]]*\\]|$lib/libexec|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$lib/mkspecs|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$lib/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$lib/share/doc|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$lib/examples|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$lib/include|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$lib/$qtPluginPrefix|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$lib/tests|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g"
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$lib/$qtQmlPrefix|g"
|
||||
fi
|
||||
done
|
||||
elif [ -e "$dir" ]; then
|
||||
if grep -q '\$\$\[QT_' "${dir:?}"; then
|
||||
echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${dir:?}'..."
|
||||
sed -i "${dir:?}" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_LIBEXECS[^]]*\\]|$dev/libexec|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$lib/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_LIBEXECS[^]]*\\]|$lib/libexec|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$lib/mkspecs|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$lib/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$lib/share/doc|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$lib/examples|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$lib/include|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$lib/$qtPluginPrefix|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$lib/tests|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g"
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$lib/$qtQmlPrefix|g"
|
||||
fi
|
||||
else
|
||||
echo "fixQtBuiltinPaths: Warning: \`$dir' does not exist"
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#
|
||||
fixQtModulePaths() {
|
||||
local dir="$1"
|
||||
local bin="${!outputBin}"
|
||||
local dev="${!outputDev}"
|
||||
local lib="${!outputLib}"
|
||||
|
||||
if [ -d "$dir" ]; then
|
||||
|
@ -17,8 +15,8 @@ fixQtModulePaths() {
|
|||
sed -i "${pr:?}" \
|
||||
-e "s|\\\$\\\$QT_MODULE_LIB_BASE|$lib/lib|g" \
|
||||
-e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$lib/lib|g" \
|
||||
-e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$dev/include|g" \
|
||||
-e "s|\\\$\\\$QT_MODULE_BIN_BASE|$dev/bin|g"
|
||||
-e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$lib/include|g" \
|
||||
-e "s|\\\$\\\$QT_MODULE_BIN_BASE|$lib/bin|g"
|
||||
fi
|
||||
done
|
||||
elif [ -e "$dir" ]; then
|
||||
|
@ -26,11 +24,4 @@ fixQtModulePaths() {
|
|||
else
|
||||
echo "fixQtModulePaths: Warning: \`$dir' does not exist"
|
||||
fi
|
||||
|
||||
if [ "z$bin" != "z$dev" ]; then
|
||||
if [ -d "$bin/bin" ]; then
|
||||
mkdir -p "$dev/bin"
|
||||
lndir -silent "$bin/bin" "$dev/bin"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
updateToolPath() {
|
||||
local tool="$1"
|
||||
local target="$2"
|
||||
local original="${!outputBin}/$tool"
|
||||
local actual="${!outputDev}/$tool"
|
||||
if grep -q "$original" "$target"; then
|
||||
echo "updateToolPath: Updating \`$original' in \`$target\'..."
|
||||
sed -i "$target" -e "s|$original|$actual|"
|
||||
fi
|
||||
}
|
||||
|
||||
moveQtDevTools() {
|
||||
if [ -n "$devTools" ]; then
|
||||
for tool in $devTools; do
|
||||
moveToOutput "$tool" "${!outputDev}"
|
||||
done
|
||||
|
||||
if [ -d "${!outputDev}/mkspecs" ]; then
|
||||
find "${!outputDev}/mkspecs" -name '*.pr?' | while read pr_; do
|
||||
for tool in $devTools; do
|
||||
updateToolPath "$tool" "$pr_"
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -d "${!outputDev}/lib/cmake" ]; then
|
||||
find "${!outputDev}/lib/cmake" -name '*.cmake' | while read cmake; do
|
||||
for tool in $devTools; do
|
||||
updateToolPath "$tool" "$cmake"
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
if [[ -n "${__nix_qtbase-}" ]]; then
|
||||
# Throw an error if a different version of Qt was already set up.
|
||||
if [[ "$__nix_qtbase" != "@dev@" ]]; then
|
||||
if [[ "$__nix_qtbase" != "@out@" ]]; then
|
||||
echo >&2 "Error: detected mismatched Qt dependencies:"
|
||||
echo >&2 " @dev@"
|
||||
echo >&2 " @out@"
|
||||
echo >&2 " $__nix_qtbase"
|
||||
exit 1
|
||||
fi
|
||||
else # Only set up Qt once.
|
||||
__nix_qtbase="@dev@"
|
||||
__nix_qtbase="@out@"
|
||||
|
||||
qtPluginPrefix=@qtPluginPrefix@
|
||||
qtQmlPrefix=@qtQmlPrefix@
|
||||
|
@ -30,7 +30,7 @@ else # Only set up Qt once.
|
|||
fi
|
||||
|
||||
# Build tools are often confused if QMAKE is unset.
|
||||
export QMAKE=@dev@/bin/qmake
|
||||
export QMAKE=@out@/bin/qmake
|
||||
|
||||
export QMAKEPATH=
|
||||
|
||||
|
@ -53,25 +53,18 @@ else # Only set up Qt once.
|
|||
# Prevent this hook from running multiple times
|
||||
dontPatchMkspecs=1
|
||||
|
||||
local bin="${!outputBin}"
|
||||
local dev="${!outputDev}"
|
||||
local doc="${!outputDoc}"
|
||||
local lib="${!outputLib}"
|
||||
|
||||
moveToOutput "mkspecs" "$dev"
|
||||
moveToOutput "modules" "$dev"
|
||||
moveToOutput "lib/*.prl" "$dev"
|
||||
|
||||
if [ -d "$dev/mkspecs/modules" ]; then
|
||||
fixQtModulePaths "$dev/mkspecs/modules"
|
||||
if [ -d "$lib/mkspecs/modules" ]; then
|
||||
fixQtModulePaths "$lib/mkspecs/modules"
|
||||
fi
|
||||
|
||||
if [ -d "$dev/mkspecs" ]; then
|
||||
fixQtBuiltinPaths "$dev/mkspecs" '*.pr?'
|
||||
if [ -d "$lib/mkspecs" ]; then
|
||||
fixQtBuiltinPaths "$lib/mkspecs" '*.pr?'
|
||||
fi
|
||||
|
||||
if [ -d "$dev/lib" ]; then
|
||||
fixQtBuiltinPaths "$dev/lib" '*.pr?'
|
||||
if [ -d "$lib/lib" ]; then
|
||||
fixQtBuiltinPaths "$lib/lib" '*.pr?'
|
||||
fi
|
||||
}
|
||||
if [ -z "${dontPatchMkspecs-}" ]; then
|
||||
|
|
|
@ -204,14 +204,13 @@ stdenv.mkDerivation rec {
|
|||
preHook = ''
|
||||
. "$fix_qt_builtin_paths"
|
||||
. "$fix_qt_module_paths"
|
||||
. ${../hooks/move-qt-dev-tools.sh}
|
||||
. ${../hooks/fix-qmake-libtool.sh}
|
||||
'';
|
||||
|
||||
qtPluginPrefix = "lib/qt-6/plugins";
|
||||
qtQmlPrefix = "lib/qt-6/qml";
|
||||
|
||||
cmakeFlags = [
|
||||
"-DQT_EMBED_TOOLCHAIN_COMPILER=OFF"
|
||||
"-DINSTALL_PLUGINSDIR=${qtPluginPrefix}"
|
||||
"-DINSTALL_QMLDIR=${qtQmlPrefix}"
|
||||
"-DQT_FEATURE_libproxy=ON"
|
||||
|
@ -233,57 +232,11 @@ stdenv.mkDerivation rec {
|
|||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
devTools = [
|
||||
"libexec/moc"
|
||||
"libexec/rcc"
|
||||
"libexec/syncqt.pl"
|
||||
"libexec/qlalr"
|
||||
"libexec/ensure_pro_file.cmake"
|
||||
"libexec/cmake_automoc_parser"
|
||||
"libexec/qvkgen"
|
||||
"libexec/tracegen"
|
||||
"libexec/uic"
|
||||
"bin/fixqt4headers.pl"
|
||||
"bin/moc"
|
||||
"bin/qdbuscpp2xml"
|
||||
"bin/qdbusxml2cpp"
|
||||
"bin/qlalr"
|
||||
"bin/qmake"
|
||||
"bin/qmake6"
|
||||
"bin/qt-cmake"
|
||||
"bin/qt-cmake-private"
|
||||
"bin/qt-cmake-private-install.cmake"
|
||||
"bin/qt-cmake-standalone-test"
|
||||
"bin/rcc"
|
||||
"bin/syncqt.pl"
|
||||
"bin/uic"
|
||||
];
|
||||
moveToDev = false;
|
||||
|
||||
postFixup = ''
|
||||
moveToOutput "mkspecs" "$dev"
|
||||
moveToOutput "modules" "$dev"
|
||||
moveToOutput "lib/*.prl" "$dev"
|
||||
|
||||
fixQtModulePaths "$dev/mkspecs/modules"
|
||||
fixQtBuiltinPaths "$dev" '*.pr?'
|
||||
|
||||
# Move development tools to $dev
|
||||
moveQtDevTools
|
||||
moveToOutput libexec "$dev"
|
||||
|
||||
# fixup .pc file (where to find 'moc' etc.)
|
||||
if [ -f "$dev/lib/pkgconfig/Qt6Core.pc" ]; then
|
||||
sed -i "$dev/lib/pkgconfig/Qt6Core.pc" \
|
||||
-e "/^bindir=/ c bindir=$dev/bin" \
|
||||
-e "/^libexecdir=/ c libexecdir=$dev/libexec"
|
||||
fi
|
||||
|
||||
patchShebangs $out $dev
|
||||
|
||||
# QTEST_ASSERT and other macros keeps runtime reference to qtbase.dev
|
||||
if [ -f "$dev/include/QtTest/qtestassert.h" ]; then
|
||||
substituteInPlace "$dev/include/QtTest/qtestassert.h" --replace "__FILE__" "__BASE_FILE__"
|
||||
fi
|
||||
fixQtModulePaths "$out/mkspecs/modules"
|
||||
fixQtBuiltinPaths "$out" '*.pr?'
|
||||
'';
|
||||
|
||||
dontStrip = debugSymbols;
|
||||
|
|
|
@ -10,31 +10,8 @@ qtModule {
|
|||
pname = "qtdeclarative";
|
||||
qtInputs = [ qtbase qtlanguageserver qtshadertools ];
|
||||
propagatedBuildInputs = [ openssl python3 ];
|
||||
preConfigure = ''
|
||||
export LD_LIBRARY_PATH="$PWD/build/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
|
||||
'';
|
||||
cmakeFlags = [
|
||||
"-DQT6_INSTALL_PREFIX=${placeholder "out"}"
|
||||
"-DQT_INSTALL_PREFIX=${placeholder "out"}"
|
||||
];
|
||||
patches = [
|
||||
# prevent headaches from stale qmlcache data
|
||||
../patches/qtdeclarative-default-disable-qmlcache.patch
|
||||
];
|
||||
postInstall = ''
|
||||
substituteInPlace "$out/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake" \
|
||||
--replace ''\'''${QT6_INSTALL_PREFIX}' "$dev"
|
||||
'';
|
||||
devTools = [
|
||||
"bin/qml"
|
||||
"bin/qmlcachegen"
|
||||
"bin/qmleasing"
|
||||
"bin/qmlimportscanner"
|
||||
"bin/qmllint"
|
||||
"bin/qmlmin"
|
||||
"bin/qmlplugindump"
|
||||
"bin/qmlprofiler"
|
||||
"bin/qmlscene"
|
||||
"bin/qmltestrunner"
|
||||
];
|
||||
}
|
||||
|
|
|
@ -15,30 +15,10 @@ qtModule {
|
|||
../patches/qttools-paths.patch
|
||||
];
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-DNIX_OUTPUT_DEV=\"${placeholder "dev"}\""
|
||||
"-DNIX_OUTPUT_OUT=\"${placeholder "out"}\""
|
||||
];
|
||||
|
||||
devTools = [
|
||||
"bin/qcollectiongenerator"
|
||||
"bin/linguist"
|
||||
"bin/assistant"
|
||||
"bin/qdoc"
|
||||
"bin/lconvert"
|
||||
"bin/designer"
|
||||
"bin/qtattributionsscanner"
|
||||
"bin/lrelease"
|
||||
"bin/lrelease-pro"
|
||||
"bin/pixeltool"
|
||||
"bin/lupdate"
|
||||
"bin/lupdate-pro"
|
||||
"bin/qtdiag"
|
||||
"bin/qhelpgenerator"
|
||||
"bin/qtplugininfo"
|
||||
"bin/qthelpconverter"
|
||||
"bin/lprodump"
|
||||
"bin/qdistancefieldgenerator"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
"bin/macdeployqt"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$dev"
|
||||
ln -s "$out/bin" "$dev/bin"
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -226,12 +226,6 @@ qtModule {
|
|||
export NINJAFLAGS="-j$NIX_BUILD_CORES"
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
# This is required at runtime
|
||||
mkdir -p $out/libexec
|
||||
mv $dev/libexec/QtWebEngineProcess $out/libexec
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A web engine based on the Chromium web browser";
|
||||
platforms = platforms.linux;
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
From 8880bc263a366aeb82056f0bf3f1b17b6ec26900 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Cao <nickcao@nichi.co>
|
||||
Date: Thu, 13 Apr 2023 23:42:29 +0800
|
||||
Subject: [PATCH 1/6] qtbase: qmake: always use libname instead of absolute
|
||||
path in qmake files
|
||||
|
||||
In generated qmake files, absolute paths to qt libraries are embedded
|
||||
and then used in linker flags. However as the libraries can be provided
|
||||
by qt modules other than the one currently being built, the ebedded
|
||||
paths can be incorrect.
|
||||
---
|
||||
cmake/QtFinishPrlFile.cmake | 7 ++++---
|
||||
cmake/QtGenerateLibHelpers.cmake | 3 ---
|
||||
2 files changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/cmake/QtFinishPrlFile.cmake b/cmake/QtFinishPrlFile.cmake
|
||||
index 32169e418c..4e754af367 100644
|
||||
--- a/cmake/QtFinishPrlFile.cmake
|
||||
+++ b/cmake/QtFinishPrlFile.cmake
|
||||
@@ -61,9 +61,10 @@ foreach(line ${lines})
|
||||
endif()
|
||||
list(APPEND adjusted_libs "-framework" "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
- # Not a framework, transform the Qt module into relocatable relative path.
|
||||
- qt_strip_library_version_suffix(relative_lib "${relative_lib}")
|
||||
- list(APPEND adjusted_libs "$$[QT_INSTALL_LIBS]/${relative_lib}")
|
||||
+ # Not a framework, extract the library name and prepend an -l to make
|
||||
+ # it relocatable.
|
||||
+ qt_transform_absolute_library_paths_to_link_flags(lib_with_link_flag "${lib}")
|
||||
+ list(APPEND adjusted_libs "${lib_with_link_flag}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
diff --git a/cmake/QtGenerateLibHelpers.cmake b/cmake/QtGenerateLibHelpers.cmake
|
||||
index e3f4bbf881..f8bd26acc7 100644
|
||||
--- a/cmake/QtGenerateLibHelpers.cmake
|
||||
+++ b/cmake/QtGenerateLibHelpers.cmake
|
||||
@@ -70,9 +70,6 @@ function(qt_transform_absolute_library_paths_to_link_flags out_var library_path_
|
||||
string(TOLOWER "${dir}" dir_lower)
|
||||
# If library_path isn't in default link directories, we should add it to link flags.
|
||||
list(FIND IMPLICIT_LINK_DIRECTORIES_LOWER "${dir_lower}" index)
|
||||
- if(${index} EQUAL -1)
|
||||
- list(APPEND out_list "-L\"${dir}\"")
|
||||
- endif()
|
||||
list(APPEND out_list "${lib_name_with_link_flag}")
|
||||
else()
|
||||
list(APPEND out_list "${library_path}")
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -1,5 +1,19 @@
|
|||
From 034db4e75ec749ac78fcf8235fa659b0eca83c30 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Cao <nickcao@nichi.co>
|
||||
Date: Fri, 14 Apr 2023 09:34:08 +0800
|
||||
Subject: [PATCH 2/6] qtbase: qmake: fix mkspecs for darwin
|
||||
|
||||
---
|
||||
mkspecs/common/mac.conf | 2 +-
|
||||
mkspecs/features/mac/default_post.prf | 263 --------------------------
|
||||
mkspecs/features/mac/default_pre.prf | 58 ------
|
||||
mkspecs/features/mac/sdk.mk | 27 ---
|
||||
mkspecs/features/mac/sdk.prf | 61 ------
|
||||
mkspecs/features/mac/toolchain.prf | 5 -
|
||||
6 files changed, 1 insertion(+), 415 deletions(-)
|
||||
|
||||
diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
|
||||
index 61bea952..9909dae7 100644
|
||||
index 61bea952b2..9909dae726 100644
|
||||
--- a/mkspecs/common/mac.conf
|
||||
+++ b/mkspecs/common/mac.conf
|
||||
@@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL = \
|
||||
|
@ -12,7 +26,7 @@ index 61bea952..9909dae7 100644
|
|||
|
||||
QMAKE_LFLAGS_REL_RPATH =
|
||||
diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
|
||||
index 09db1764..aadfce87 100644
|
||||
index 09db1764b1..aadfce875e 100644
|
||||
--- a/mkspecs/features/mac/default_post.prf
|
||||
+++ b/mkspecs/features/mac/default_post.prf
|
||||
@@ -1,9 +1,5 @@
|
||||
|
@ -299,7 +313,7 @@ index 09db1764..aadfce87 100644
|
|||
generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
|
||||
generate_xcode_project.target = xcodeproj
|
||||
diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
|
||||
index e3534561..3b01424e 100644
|
||||
index e3534561a5..3b01424e67 100644
|
||||
--- a/mkspecs/features/mac/default_pre.prf
|
||||
+++ b/mkspecs/features/mac/default_pre.prf
|
||||
@@ -1,60 +1,2 @@
|
||||
|
@ -364,7 +378,7 @@ index e3534561..3b01424e 100644
|
|||
-xcode_copy_phase_strip_setting.value = NO
|
||||
-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
|
||||
diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
|
||||
index a32ceacb..e69de29b 100644
|
||||
index a32ceacb6c..e69de29bb2 100644
|
||||
--- a/mkspecs/features/mac/sdk.mk
|
||||
+++ b/mkspecs/features/mac/sdk.mk
|
||||
@@ -1,27 +0,0 @@
|
||||
|
@ -396,7 +410,7 @@ index a32ceacb..e69de29b 100644
|
|||
- endif
|
||||
-endif
|
||||
diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
|
||||
index 3a9c2778..e69de29b 100644
|
||||
index 3a9c2778bb..e69de29bb2 100644
|
||||
--- a/mkspecs/features/mac/sdk.prf
|
||||
+++ b/mkspecs/features/mac/sdk.prf
|
||||
@@ -1,61 +0,0 @@
|
||||
|
@ -462,7 +476,7 @@ index 3a9c2778..e69de29b 100644
|
|||
- cache($$tool_variable, set stash, $$tool)
|
||||
-}
|
||||
diff --git a/mkspecs/features/mac/toolchain.prf b/mkspecs/features/mac/toolchain.prf
|
||||
index df191eb1..e69de29b 100644
|
||||
index df191eb13c..e69de29bb2 100644
|
||||
--- a/mkspecs/features/mac/toolchain.prf
|
||||
+++ b/mkspecs/features/mac/toolchain.prf
|
||||
@@ -1,5 +0,0 @@
|
||||
|
@ -471,3 +485,6 @@ index df191eb1..e69de29b 100644
|
|||
-sdk: load(sdk)
|
||||
-
|
||||
-load(toolchain)
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -1,7 +1,17 @@
|
|||
From bc91f05db85b774f26d6bce86e2e618dfc7a6883 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Cao <nickcao@nichi.co>
|
||||
Date: Fri, 14 Apr 2023 09:34:46 +0800
|
||||
Subject: [PATCH 3/6] qtbase: qmake: fix includedir in generated pkg-config
|
||||
|
||||
---
|
||||
qmake/generators/makefile.cpp | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
|
||||
index da585bd9b2..3abf9cee83 100644
|
||||
--- a/qmake/generators/makefile.cpp
|
||||
+++ b/qmake/generators/makefile.cpp
|
||||
@@ -3390,8 +3390,7 @@ MakefileGenerator::writePkgConfigFile()
|
||||
@@ -3402,8 +3402,7 @@ MakefileGenerator::writePkgConfigFile()
|
||||
<< varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ")
|
||||
// << varGlue("DEFINES","-D"," -D"," ")
|
||||
;
|
||||
|
@ -11,4 +21,6 @@ diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
|
|||
if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")
|
||||
&& libDir != QLatin1String("/Library/Frameworks")) {
|
||||
t << " -F${libdir}";
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
From d612c1d7161f95864b9383df84b16d8c24fbcc9b Mon Sep 17 00:00:00 2001
|
||||
From: Nick Cao <nickcao@nichi.co>
|
||||
Date: Fri, 14 Apr 2023 09:35:25 +0800
|
||||
Subject: [PATCH 4/6] qtbase: fix locating tzdir on NixOS
|
||||
|
||||
---
|
||||
src/corelib/time/qtimezoneprivate_tz.cpp | 27 +++++++++++++++---------
|
||||
1 file changed, 17 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp
|
||||
index 627a4a81..a5f50acc 100644
|
||||
index e87e34f76d..39bd79d4a4 100644
|
||||
--- a/src/corelib/time/qtimezoneprivate_tz.cpp
|
||||
+++ b/src/corelib/time/qtimezoneprivate_tz.cpp
|
||||
@@ -51,7 +51,11 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
|
||||
|
@ -15,7 +24,7 @@ index 627a4a81..a5f50acc 100644
|
|||
if (!QFile::exists(path))
|
||||
path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
|
||||
|
||||
@@ -727,18 +731,21 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId)
|
||||
@@ -729,18 +733,21 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId)
|
||||
if (!tzif.open(QIODevice::ReadOnly))
|
||||
return ret;
|
||||
} else {
|
||||
|
@ -46,3 +55,6 @@ index 627a4a81..a5f50acc 100644
|
|||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
From 9ba9c690fb16188ff524b53def104e68e45cf5c3 Mon Sep 17 00:00:00 2001
|
||||
From 5bd3672c7870b2e46e2a734dc9a9cb1837375a1c Mon Sep 17 00:00:00 2001
|
||||
From: Nick Cao <nickcao@nichi.co>
|
||||
Date: Tue, 21 Mar 2023 15:48:49 +0800
|
||||
Subject: [PATCH] Deal with a font face at index 0 as Regular for Variable
|
||||
fonts
|
||||
Subject: [PATCH 5/6] qtbase: deal with a font face at index 0 as Regular for
|
||||
Variable fonts
|
||||
|
||||
Reference: https://bugreports.qt.io/browse/QTBUG-111994
|
||||
---
|
|
@ -0,0 +1,32 @@
|
|||
From f0017e872297168ab616096180891c7f312ef1a1 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Cao <nickcao@nichi.co>
|
||||
Date: Wed, 12 Apr 2023 10:13:50 +0800
|
||||
Subject: [PATCH 6/6] qtbase: qt-cmake: always use cmake from path
|
||||
|
||||
The generated qt-cmake scripts embeds the absolute path of cmake used
|
||||
during the build of qtbase, bloating the runtime closure of qtbase.
|
||||
---
|
||||
bin/qt-cmake.in | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/bin/qt-cmake.in b/bin/qt-cmake.in
|
||||
index f719257f60..571ffe788f 100755
|
||||
--- a/bin/qt-cmake.in
|
||||
+++ b/bin/qt-cmake.in
|
||||
@@ -4,12 +4,7 @@
|
||||
script_dir_path=`dirname $0`
|
||||
script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
|
||||
|
||||
-# Try to use original cmake, otherwise to make it relocatable, use any cmake found in PATH.
|
||||
-original_cmake_path="@CMAKE_COMMAND@"
|
||||
-cmake_path=$original_cmake_path
|
||||
-if ! test -f "$cmake_path"; then
|
||||
- cmake_path="cmake"
|
||||
-fi
|
||||
+cmake_path="cmake"
|
||||
|
||||
toolchain_path="$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake"
|
||||
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
commit bd8f6ecea0663bdd150aa48941cbd47d25874396
|
||||
Author: Nick Cao <nickcao@nichi.co>
|
||||
Date: Tue Apr 19 13:49:59 2022 +0800
|
||||
|
||||
patch cmake file generation for nixpkgs packaging
|
||||
|
||||
As of qt 6.3.0, installing components into different prefixes is not
|
||||
supported. To workaround that, we move files to their designated in the
|
||||
postInstall hook. However the generated cmake files still have
|
||||
references to the original prefix, and would cause issues when using
|
||||
said components as the dependency of other packages. The purpose of this
|
||||
patch is to closely match the output layout of qt, and rewrite the
|
||||
generated cmake files to point to the corrected pathes.
|
||||
|
||||
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
|
||||
index 5a33349b19..677a6084d6 100644
|
||||
--- a/Source/cmExportFileGenerator.cxx
|
||||
+++ b/Source/cmExportFileGenerator.cxx
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
+#include <cstdlib>
|
||||
|
||||
#include <cm/memory>
|
||||
|
||||
@@ -330,9 +331,21 @@ static void prefixItems(std::string& exportDirs)
|
||||
for (std::string const& e : entries) {
|
||||
exportDirs += sep;
|
||||
sep = ";";
|
||||
- if (!cmSystemTools::FileIsFullPath(e) &&
|
||||
- e.find("${_IMPORT_PREFIX}") == std::string::npos) {
|
||||
- exportDirs += "${_IMPORT_PREFIX}/";
|
||||
+ if (!cmSystemTools::FileIsFullPath(e)) {
|
||||
+ if (std::getenv("dev")) {
|
||||
+ if (cmHasLiteralPrefix(e, "include") || cmHasLiteralPrefix(e, "./include")) {
|
||||
+ exportDirs += std::getenv("dev");
|
||||
+ } else if (cmHasLiteralPrefix(e, "mkspecs") || cmHasLiteralPrefix(e, "./mkspecs")) {
|
||||
+ exportDirs += std::getenv("dev");
|
||||
+ } else if (cmHasLiteralPrefix(e, "libexec") || cmHasLiteralPrefix(e, "./libexec")) {
|
||||
+ exportDirs += std::getenv("dev");
|
||||
+ } else {
|
||||
+ exportDirs += std::getenv("out");
|
||||
+ }
|
||||
+ } else {
|
||||
+ exportDirs += std::getenv("out");
|
||||
+ }
|
||||
+ exportDirs += "/";
|
||||
}
|
||||
exportDirs += e;
|
||||
}
|
||||
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
|
||||
index adccdfeece..ba248305bd 100644
|
||||
--- a/Source/cmExportInstallFileGenerator.cxx
|
||||
+++ b/Source/cmExportInstallFileGenerator.cxx
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
+#include <cstdlib>
|
||||
|
||||
#include "cmExportSet.h"
|
||||
#include "cmFileSet.h"
|
||||
@@ -266,7 +267,7 @@ void cmExportInstallFileGenerator::LoadConfigFiles(std::ostream& os)
|
||||
|
||||
void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
|
||||
{
|
||||
- cmGeneratorExpression::ReplaceInstallPrefix(input, "${_IMPORT_PREFIX}");
|
||||
+ cmGeneratorExpression::ReplaceInstallPrefix(input, std::getenv("out"));
|
||||
}
|
||||
|
||||
bool cmExportInstallFileGenerator::GenerateImportFileConfig(
|
||||
@@ -382,9 +383,22 @@ void cmExportInstallFileGenerator::SetImportLocationProperty(
|
||||
// Construct the installed location of the target.
|
||||
std::string dest = itgen->GetDestination(config);
|
||||
std::string value;
|
||||
+
|
||||
if (!cmSystemTools::FileIsFullPath(dest)) {
|
||||
- // The target is installed relative to the installation prefix.
|
||||
- value = "${_IMPORT_PREFIX}/";
|
||||
+ if (std::getenv("dev")) {
|
||||
+ if (cmHasLiteralPrefix(dest, "include") || cmHasLiteralPrefix(dest, "./include")) {
|
||||
+ value = std::getenv("dev");
|
||||
+ } else if (cmHasLiteralPrefix(dest, "mkspecs") || cmHasLiteralPrefix(dest, "./mkspecs")) {
|
||||
+ value = std::getenv("dev");
|
||||
+ } else if (cmHasLiteralPrefix(dest, "libexec") || cmHasLiteralPrefix(dest, "./libexec")) {
|
||||
+ value = std::getenv("dev");
|
||||
+ } else {
|
||||
+ value = std::getenv("out");
|
||||
+ }
|
||||
+ } else {
|
||||
+ value = std::getenv("out");
|
||||
+ }
|
||||
+ value += "/";
|
||||
}
|
||||
value += dest;
|
||||
value += "/";
|
||||
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
|
||||
index f988e54a19..cc5c7ac9fd 100644
|
||||
--- a/Source/cmGeneratorExpression.cxx
|
||||
+++ b/Source/cmGeneratorExpression.cxx
|
||||
@@ -192,7 +192,20 @@ static void prefixItems(const std::string& content, std::string& result,
|
||||
sep = ";";
|
||||
if (!cmSystemTools::FileIsFullPath(e) &&
|
||||
cmGeneratorExpression::Find(e) != 0) {
|
||||
- result += prefix;
|
||||
+ if (std::getenv("dev")) {
|
||||
+ if (cmHasLiteralPrefix(e, "include") || cmHasLiteralPrefix(e, "./include")) {
|
||||
+ result += std::getenv("dev");
|
||||
+ } else if (cmHasLiteralPrefix(e, "mkspecs") || cmHasLiteralPrefix(e, "./mkspecs")) {
|
||||
+ result += std::getenv("dev");
|
||||
+ } else if (cmHasLiteralPrefix(e, "libexec") || cmHasLiteralPrefix(e, "./libexec")) {
|
||||
+ result += std::getenv("dev");
|
||||
+ } else {
|
||||
+ result += std::getenv("out");
|
||||
+ }
|
||||
+ } else {
|
||||
+ result += std::getenv("out");
|
||||
+ }
|
||||
+ result += "/";
|
||||
}
|
||||
result += e;
|
||||
}
|
|
@ -10,9 +10,9 @@ index d355b9dc..94fef33f 100644
|
|||
+{
|
||||
+ switch (location) {
|
||||
+ case QLibraryInfo::BinariesPath:
|
||||
+ return QLatin1String(NIX_OUTPUT_DEV) + QLatin1String("/bin");
|
||||
+ return QLatin1String(NIX_OUTPUT_OUT) + QLatin1String("/bin");
|
||||
+ case QLibraryInfo::LibraryExecutablesPath:
|
||||
+ return QLatin1String(NIX_OUTPUT_DEV) + QLatin1String("/libexec");
|
||||
+ return QLatin1String(NIX_OUTPUT_OUT) + QLatin1String("/libexec");
|
||||
+ default:
|
||||
+ return QLibraryInfo::path(location);
|
||||
+ }
|
||||
|
|
|
@ -9,7 +9,7 @@ buildEnv {
|
|||
|
||||
postBuild = ''
|
||||
rm "$out/bin/qmake"
|
||||
cp "${qtbase.dev}/bin/qmake" "$out/bin"
|
||||
cp "${qtbase}/bin/qmake" "$out/bin"
|
||||
cat >"$out/bin/qt.conf" <<EOF
|
||||
[Paths]
|
||||
Prefix = $out
|
||||
|
|
|
@ -18,23 +18,16 @@ stdenv.mkDerivation (args // {
|
|||
inherit pname version src;
|
||||
patches = args.patches or patches.${pname} or [ ];
|
||||
|
||||
preHook = ''
|
||||
. ${./hooks/move-qt-dev-tools.sh}
|
||||
'';
|
||||
|
||||
buildInputs = args.buildInputs or [ ];
|
||||
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cmake ninja perl ];
|
||||
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or [ ]);
|
||||
|
||||
moveToDev = false;
|
||||
|
||||
outputs = args.outputs or [ "out" "dev" ];
|
||||
|
||||
dontWrapQtApps = args.dontWrapQtApps or true;
|
||||
|
||||
postFixup = ''
|
||||
moveToOutput "libexec" "''${!outputDev}"
|
||||
moveQtDevTools
|
||||
'' + args.postFixup or "";
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.qt.io/";
|
||||
description = "A cross-platform application framework for C++";
|
||||
|
|
|
@ -31,7 +31,7 @@ mkDerivation rec {
|
|||
|
||||
cmakeFlags = [
|
||||
# adding qt6 to buildInputs would result in error: detected mismatched Qt dependencies
|
||||
"-DCMAKE_PREFIX_PATH=${qt6.qtbase.dev}"
|
||||
"-DCMAKE_PREFIX_PATH=${qt6.qtbase}"
|
||||
"-DENABLE_QT4=0"
|
||||
"-DENABLE_QT6=1"
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue
Block a user