lol

Merge pull request #186689 from LunNova/lunnova/cura-upgrade

PyQt6: init at 6.4.0

authored by

Timothy DeHerrera and committed by
GitHub
2d387fb2 61c4c5a8

+669 -117
pkgs/development/libraries/qt-6/cmake.patch pkgs/development/libraries/qt-6/patches/cmake.patch
+11
pkgs/development/libraries/qt-6/default.nix
··· 49 49 withGtk3 = true; 50 50 inherit (srcs.qtbase) src version; 51 51 inherit bison cups harfbuzz libGL dconf gtk3 developerBuild cmake; 52 + patches = [ 53 + ./patches/qtbase-qmake-pkg-config.patch 54 + ]; 52 55 }; 53 56 54 57 qt3d = callPackage ./modules/qt3d.nix { }; ··· 90 93 wrapQtAppsHook = makeSetupHook { 91 94 deps = [ buildPackages.makeWrapper ]; 92 95 } ./hooks/wrap-qt-apps-hook.sh; 96 + 97 + qmake = makeSetupHook { 98 + deps = [ self.qtbase.dev ]; 99 + substitutions = { 100 + inherit debug; 101 + fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh; 102 + }; 103 + } ./hooks/qmake-hook.sh; 93 104 }; 94 105 95 106 self = lib.makeScope newScope addPackages;
+25
pkgs/development/libraries/qt-6/hooks/fix-qmake-libtool.sh
··· 1 + # Fix libtool libraries generated by qmake. 2 + # qmake started inserting filenames of shared objects instead of the appropriate 3 + # linker flags. fixQmakeLibtool searches for broken libtool libraries and 4 + # replaces the filenames with the linker flags that should have been there. 5 + fixQmakeLibtool() { 6 + if [ -d "$1" ]; then 7 + find "$1" -name '*.la' | while read la; do 8 + set +e 9 + framework_libs=$(grep '^dependency_libs' "$la" | grep -Eo -- '-framework +\w+' | tr '\n' ' ') 10 + set -e 11 + sed -i "$la" \ 12 + -e '/^dependency_libs/ s,\(/[^ ]\+\)/lib\([^/ ]\+\)\.so,-L\1 -l\2,g' \ 13 + -e '/^dependency_libs/ s,-framework \+\w\+,,g' 14 + if [ ! -z "$framework_libs" ]; then 15 + if grep '^inherited_linker_flags=' $la >/dev/null; then 16 + sed -i "$la" -e "s/^\(inherited_linker_flags='[^']*\)/\1 $framework_libs/" 17 + else 18 + echo "inherited_linker_flags='$framework_libs'" >>"$la" 19 + fi 20 + fi 21 + done 22 + fi 23 + } 24 + 25 + fixupOutputHooks+=('fixQmakeLibtool $prefix')
+66
pkgs/development/libraries/qt-6/hooks/fix-qt-builtin-paths.sh
··· 1 + # fixQtBuiltinPaths 2 + # 3 + # Usage: fixQtBuiltinPaths _dir_ _pattern_ 4 + # 5 + # Fix Qt builtin paths in files matching _pattern_ under _dir_. 6 + # 7 + fixQtBuiltinPaths() { 8 + local dir="$1" 9 + local pattern="$2" 10 + local bin="${!outputBin}" 11 + local dev="${!outputDev}" 12 + local doc="${!outputDoc}" 13 + local lib="${!outputLib}" 14 + 15 + if [ -d "$dir" ]; then 16 + find "$dir" -name "$pattern" | while read pr_; do 17 + if grep -q '\$\$\[QT_' "${pr_:?}"; then 18 + echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${pr_:?}'..." 19 + sed -i "${pr_:?}" \ 20 + -e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \ 21 + -e "s|\\\$\\\$\\[QT_HOST_LIBEXECS[^]]*\\]|$dev/libexec|g" \ 22 + -e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \ 23 + -e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \ 24 + -e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \ 25 + -e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \ 26 + -e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \ 27 + -e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \ 28 + -e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \ 29 + -e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \ 30 + -e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \ 31 + -e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \ 32 + -e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \ 33 + -e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \ 34 + -e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \ 35 + -e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \ 36 + -e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \ 37 + -e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g" 38 + fi 39 + done 40 + elif [ -e "$dir" ]; then 41 + if grep -q '\$\$\[QT_' "${dir:?}"; then 42 + echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${dir:?}'..." 43 + sed -i "${dir:?}" \ 44 + -e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \ 45 + -e "s|\\\$\\\$\\[QT_HOST_LIBEXECS[^]]*\\]|$dev/libexec|g" \ 46 + -e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \ 47 + -e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \ 48 + -e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \ 49 + -e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \ 50 + -e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \ 51 + -e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \ 52 + -e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \ 53 + -e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \ 54 + -e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \ 55 + -e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \ 56 + -e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \ 57 + -e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \ 58 + -e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \ 59 + -e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \ 60 + -e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \ 61 + -e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g" 62 + fi 63 + else 64 + echo "fixQtBuiltinPaths: Warning: \`$dir' does not exist" 65 + fi 66 + }
+36
pkgs/development/libraries/qt-6/hooks/fix-qt-module-paths.sh
··· 1 + # fixQtModulePaths 2 + # 3 + # Usage: fixQtModulePaths _dir_ 4 + # 5 + # Find Qt module definitions in directory _dir_ and patch the module paths. 6 + # 7 + fixQtModulePaths() { 8 + local dir="$1" 9 + local bin="${!outputBin}" 10 + local dev="${!outputDev}" 11 + local lib="${!outputLib}" 12 + 13 + if [ -d "$dir" ]; then 14 + find "$dir" -name 'qt_*.pri' | while read pr; do 15 + if grep -q '\$\$QT_MODULE_' "${pr:?}"; then 16 + echo "fixQtModulePaths: Fixing module paths in \`${pr:?}'..." 17 + sed -i "${pr:?}" \ 18 + -e "s|\\\$\\\$QT_MODULE_LIB_BASE|$lib/lib|g" \ 19 + -e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$lib/lib|g" \ 20 + -e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$dev/include|g" \ 21 + -e "s|\\\$\\\$QT_MODULE_BIN_BASE|$dev/bin|g" 22 + fi 23 + done 24 + elif [ -e "$dir" ]; then 25 + echo "fixQtModulePaths: Warning: \`$dir' is not a directory" 26 + else 27 + echo "fixQtModulePaths: Warning: \`$dir' does not exist" 28 + fi 29 + 30 + if [ "z$bin" != "z$dev" ]; then 31 + if [ -d "$bin/bin" ]; then 32 + mkdir -p "$dev/bin" 33 + lndir -silent "$bin/bin" "$dev/bin" 34 + fi 35 + fi 36 + }
+34
pkgs/development/libraries/qt-6/hooks/move-qt-dev-tools.sh
··· 1 + updateToolPath() { 2 + local tool="$1" 3 + local target="$2" 4 + local original="${!outputBin}/$tool" 5 + local actual="${!outputDev}/$tool" 6 + if grep -q "$original" "$target"; then 7 + echo "updateToolPath: Updating \`$original' in \`$target\'..." 8 + sed -i "$target" -e "s|$original|$actual|" 9 + fi 10 + } 11 + 12 + moveQtDevTools() { 13 + if [ -n "$devTools" ]; then 14 + for tool in $devTools; do 15 + moveToOutput "$tool" "${!outputDev}" 16 + done 17 + 18 + if [ -d "${!outputDev}/mkspecs" ]; then 19 + find "${!outputDev}/mkspecs" -name '*.pr?' | while read pr_; do 20 + for tool in $devTools; do 21 + updateToolPath "$tool" "$pr_" 22 + done 23 + done 24 + fi 25 + 26 + if [ -d "${!outputDev}/lib/cmake" ]; then 27 + find "${!outputDev}/lib/cmake" -name '*.cmake' | while read cmake; do 28 + for tool in $devTools; do 29 + updateToolPath "$tool" "$cmake" 30 + done 31 + done 32 + fi 33 + fi 34 + }
+48
pkgs/development/libraries/qt-6/hooks/qmake-hook.sh
··· 1 + . @fix_qmake_libtool@ 2 + 3 + qmakeFlags=(${qmakeFlags-}) 4 + 5 + qmakePrePhase() { 6 + qmakeFlags_orig=("${qmakeFlags[@]}") 7 + 8 + # These flags must be added _before_ the flags specified in the derivation. 9 + # TODO: these flags also need a patch which isn't applied 10 + # can we either remove these flags or update the qt5 patch? 11 + # "NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \ 12 + qmakeFlags=( 13 + "PREFIX=$out" 14 + "NIX_OUTPUT_OUT=$out" 15 + "NIX_OUTPUT_DEV=${!outputDev}" 16 + "NIX_OUTPUT_BIN=${!outputBin}" 17 + "NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" 18 + "NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" 19 + ) 20 + 21 + if [ -n "@debug@" ]; then 22 + qmakeFlags+=("CONFIG+=debug") 23 + else 24 + qmakeFlags+=("CONFIG+=release") 25 + fi 26 + 27 + qmakeFlags+=("${qmakeFlags_orig[@]}") 28 + } 29 + prePhases+=" qmakePrePhase" 30 + 31 + qmakeConfigurePhase() { 32 + runHook preConfigure 33 + 34 + echo "QMAKEPATH=$QMAKEPATH" 35 + echo qmake "${qmakeFlags[@]}" 36 + qmake "${qmakeFlags[@]}" 37 + 38 + if ! [[ -v enableParallelBuilding ]]; then 39 + enableParallelBuilding=1 40 + echo "qmake: enabled parallel building" 41 + fi 42 + 43 + runHook postConfigure 44 + } 45 + 46 + if [ -z "${dontUseQmakeConfigure-}" -a -z "${configurePhase-}" ]; then 47 + configurePhase=qmakeConfigurePhase 48 + fi
+76 -26
pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh
··· 7 7 exit 1 8 8 fi 9 9 else # Only set up Qt once. 10 - __nix_qtbase="@dev@" 10 + __nix_qtbase="@dev@" 11 11 12 - qtPluginPrefix=@qtPluginPrefix@ 13 - qtQmlPrefix=@qtQmlPrefix@ 12 + qtPluginPrefix=@qtPluginPrefix@ 13 + qtQmlPrefix=@qtQmlPrefix@ 14 14 15 - # Disable debug symbols if qtbase was built without debugging. 16 - # This stops -dev paths from leaking into other outputs. 17 - if [ -z "@debug@" ]; then 18 - NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE-}${NIX_CFLAGS_COMPILE:+ }-DQT_NO_DEBUG" 19 - fi 15 + . @fix_qt_builtin_paths@ 16 + . @fix_qt_module_paths@ 20 17 21 - # Integration with CMake: 22 - # Set the CMake build type corresponding to how qtbase was built. 23 - if [ -n "@debug@" ]; then 24 - cmakeBuildType="Debug" 25 - else 26 - cmakeBuildType="Release" 27 - fi 18 + # Disable debug symbols if qtbase was built without debugging. 19 + # This stops -dev paths from leaking into other outputs. 20 + if [ -z "@debug@" ]; then 21 + NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE-}${NIX_CFLAGS_COMPILE:+ }-DQT_NO_DEBUG" 22 + fi 28 23 29 - qtPreHook() { 30 - # Check that wrapQtAppsHook is used, or it is explicitly disabled. 31 - if [[ -z "$__nix_wrapQtAppsHook" && -z "$dontWrapQtApps" ]]; then 32 - echo >&2 "Error: wrapQtAppsHook is not used, and dontWrapQtApps is not set." 33 - exit 1 24 + # Integration with CMake: 25 + # Set the CMake build type corresponding to how qtbase was built. 26 + if [ -n "@debug@" ]; then 27 + cmakeBuildType="Debug" 28 + else 29 + cmakeBuildType="Release" 34 30 fi 35 - } 36 - prePhases+=" qtPreHook" 31 + 32 + # Build tools are often confused if QMAKE is unset. 33 + export QMAKE=@dev@/bin/qmake 37 34 38 - addQtModulePrefix () { 39 - addToSearchPath QT_ADDITIONAL_PACKAGES_PREFIX_PATH $1 40 - } 41 - addEnvHooks "$hostOffset" addQtModulePrefix 35 + export QMAKEPATH= 36 + 37 + export QMAKEMODULES= 38 + 39 + declare -Ag qmakePathSeen=() 40 + qmakePathHook() { 41 + # Skip this path if we have seen it before. 42 + # MUST use 'if' because 'qmakePathSeen[$]' may be unset. 43 + if [ -n "${qmakePathSeen[$1]-}" ]; then return; fi 44 + qmakePathSeen[$1]=1 45 + if [ -d "$1/mkspecs" ]; then 46 + QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs" 47 + QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1" 48 + fi 49 + } 50 + envBuildHostHooks+=(qmakePathHook) 51 + 52 + postPatchMkspecs() { 53 + # Prevent this hook from running multiple times 54 + dontPatchMkspecs=1 55 + 56 + local bin="${!outputBin}" 57 + local dev="${!outputDev}" 58 + local doc="${!outputDoc}" 59 + local lib="${!outputLib}" 60 + 61 + moveToOutput "mkspecs" "$dev" 62 + 63 + if [ -d "$dev/mkspecs/modules" ]; then 64 + fixQtModulePaths "$dev/mkspecs/modules" 65 + fi 66 + 67 + if [ -d "$dev/mkspecs" ]; then 68 + fixQtBuiltinPaths "$dev/mkspecs" '*.pr?' 69 + fi 70 + 71 + if [ -d "$lib" ]; then 72 + fixQtBuiltinPaths "$lib" '*.pr?' 73 + fi 74 + } 75 + if [ -z "${dontPatchMkspecs-}" ]; then 76 + postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs" 77 + fi 78 + 79 + qtPreHook() { 80 + # Check that wrapQtAppsHook is used, or it is explicitly disabled. 81 + if [[ -z "$__nix_wrapQtAppsHook" && -z "$dontWrapQtApps" ]]; then 82 + echo >&2 "Error: wrapQtAppsHook is not used, and dontWrapQtApps is not set." 83 + exit 1 84 + fi 85 + } 86 + prePhases+=" qtPreHook" 87 + 88 + addQtModulePrefix() { 89 + addToSearchPath QT_ADDITIONAL_PACKAGES_PREFIX_PATH $1 90 + } 91 + addEnvHooks "$hostOffset" addQtModulePrefix 42 92 43 93 fi
+75 -86
pkgs/development/libraries/qt-6/hooks/wrap-qt-apps-hook.sh
··· 1 1 if [[ -z "${__nix_wrapQtAppsHook-}" ]]; then 2 - __nix_wrapQtAppsHook=1 # Don't run this hook more than once. 2 + __nix_wrapQtAppsHook=1 # Don't run this hook more than once. 3 3 4 - # Inherit arguments given in mkDerivation 5 - qtWrapperArgs=( ${qtWrapperArgs-} ) 4 + # Inherit arguments given in mkDerivation 5 + qtWrapperArgs=(${qtWrapperArgs-}) 6 6 7 - qtHostPathSeen=() 7 + qtHostPathSeen=() 8 8 9 - qtUnseenHostPath() { 10 - for pkg in "${qtHostPathSeen[@]}" 11 - do 12 - if [ "${pkg:?}" == "$1" ] 13 - then 14 - return 1 15 - fi 16 - done 9 + qtUnseenHostPath() { 10 + for pkg in "${qtHostPathSeen[@]}"; do 11 + if [ "${pkg:?}" == "$1" ]; then 12 + return 1 13 + fi 14 + done 17 15 18 - qtHostPathSeen+=("$1") 19 - return 0 20 - } 16 + qtHostPathSeen+=("$1") 17 + return 0 18 + } 21 19 22 - qtHostPathHook() { 23 - qtUnseenHostPath "$1" || return 0 20 + qtHostPathHook() { 21 + qtUnseenHostPath "$1" || return 0 24 22 25 - if ! [ -v qtPluginPrefix ] 26 - then 27 - echo "wrapQtAppsHook qtHostPathHook: qtPluginPrefix is unset. hint: add qt6.qtbase to buildInputs" 28 - fi 23 + if ! [ -v qtPluginPrefix ]; then 24 + echo "wrapQtAppsHook qtHostPathHook: qtPluginPrefix is unset. hint: add qt6.qtbase to buildInputs" 25 + fi 29 26 30 - local pluginDir="$1/${qtPluginPrefix:?}" 31 - if [ -d "$pluginDir" ] 32 - then 33 - qtWrapperArgs+=(--prefix QT_PLUGIN_PATH : "$pluginDir") 34 - fi 27 + local pluginDir="$1/${qtPluginPrefix:?}" 28 + if [ -d "$pluginDir" ]; then 29 + qtWrapperArgs+=(--prefix QT_PLUGIN_PATH : "$pluginDir") 30 + fi 35 31 36 - local qmlDir="$1/${qtQmlPrefix:?}" 37 - if [ -d "$qmlDir" ] 38 - then 39 - qtWrapperArgs+=(--prefix QML2_IMPORT_PATH : "$qmlDir") 40 - fi 41 - } 42 - addEnvHooks "$targetOffset" qtHostPathHook 32 + local qmlDir="$1/${qtQmlPrefix:?}" 33 + if [ -d "$qmlDir" ]; then 34 + qtWrapperArgs+=(--prefix QML2_IMPORT_PATH : "$qmlDir") 35 + fi 36 + } 37 + addEnvHooks "$targetOffset" qtHostPathHook 43 38 44 - makeQtWrapper() { 45 - local original="$1" 46 - local wrapper="$2" 47 - shift 2 48 - makeWrapper "$original" "$wrapper" "${qtWrapperArgs[@]}" "$@" 49 - } 39 + makeQtWrapper() { 40 + local original="$1" 41 + local wrapper="$2" 42 + shift 2 43 + makeWrapper "$original" "$wrapper" "${qtWrapperArgs[@]}" "$@" 44 + } 50 45 51 - wrapQtApp() { 52 - local program="$1" 53 - shift 1 54 - wrapProgram "$program" "${qtWrapperArgs[@]}" "$@" 55 - } 46 + wrapQtApp() { 47 + local program="$1" 48 + shift 1 49 + wrapProgram "$program" "${qtWrapperArgs[@]}" "$@" 50 + } 56 51 57 - qtOwnPathsHook() { 58 - local xdgDataDir="${!outputBin}/share" 59 - if [ -d "$xdgDataDir" ] 60 - then 61 - qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$xdgDataDir") 62 - fi 52 + qtOwnPathsHook() { 53 + local xdgDataDir="${!outputBin}/share" 54 + if [ -d "$xdgDataDir" ]; then 55 + qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$xdgDataDir") 56 + fi 63 57 64 - local xdgConfigDir="${!outputBin}/etc/xdg" 65 - if [ -d "$xdgConfigDir" ] 66 - then 67 - qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir") 68 - fi 58 + local xdgConfigDir="${!outputBin}/etc/xdg" 59 + if [ -d "$xdgConfigDir" ]; then 60 + qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir") 61 + fi 69 62 70 - qtHostPathHook "${!outputBin}" 71 - } 63 + qtHostPathHook "${!outputBin}" 64 + } 72 65 73 - preFixupPhases+=" qtOwnPathsHook" 66 + preFixupPhases+=" qtOwnPathsHook" 74 67 75 - # Note: $qtWrapperArgs still gets defined even if ${dontWrapQtApps-} is set. 76 - wrapQtAppsHook() { 77 - # skip this hook when requested 78 - [ -z "${dontWrapQtApps-}" ] || return 0 68 + # Note: $qtWrapperArgs still gets defined even if ${dontWrapQtApps-} is set. 69 + wrapQtAppsHook() { 70 + # skip this hook when requested 71 + [ -z "${dontWrapQtApps-}" ] || return 0 79 72 80 - # guard against running multiple times (e.g. due to propagation) 81 - [ -z "$wrapQtAppsHookHasRun" ] || return 0 82 - wrapQtAppsHookHasRun=1 73 + # guard against running multiple times (e.g. due to propagation) 74 + [ -z "$wrapQtAppsHookHasRun" ] || return 0 75 + wrapQtAppsHookHasRun=1 83 76 84 - local targetDirs=( "$prefix/bin" "$prefix/sbin" "$prefix/libexec" "$prefix/Applications" "$prefix/"*.app ) 85 - echo "wrapping Qt applications in ${targetDirs[@]}" 77 + local targetDirs=("$prefix/bin" "$prefix/sbin" "$prefix/libexec" "$prefix/Applications" "$prefix/"*.app) 78 + echo "wrapping Qt applications in ${targetDirs[@]}" 86 79 87 - for targetDir in "${targetDirs[@]}" 88 - do 89 - [ -d "$targetDir" ] || continue 80 + for targetDir in "${targetDirs[@]}"; do 81 + [ -d "$targetDir" ] || continue 90 82 91 - find "$targetDir" ! -type d -executable -print0 | while IFS= read -r -d '' file 92 - do 93 - if [ -f "$file" ] 94 - then 95 - echo "wrapping $file" 96 - wrapQtApp "$file" 97 - elif [ -h "$file" ] 98 - then 99 - target="$(readlink -e "$file")" 100 - echo "wrapping $file -> $target" 101 - rm "$file" 102 - makeQtWrapper "$target" "$file" 103 - fi 83 + find "$targetDir" ! -type d -executable -print0 | while IFS= read -r -d '' file; do 84 + if [ -f "$file" ]; then 85 + echo "wrapping $file" 86 + wrapQtApp "$file" 87 + elif [ -h "$file" ]; then 88 + target="$(readlink -e "$file")" 89 + echo "wrapping $file -> $target" 90 + rm "$file" 91 + makeQtWrapper "$target" "$file" 92 + fi 93 + done 104 94 done 105 - done 106 - } 95 + } 107 96 108 - fixupOutputHooks+=(wrapQtAppsHook) 97 + fixupOutputHooks+=(wrapQtAppsHook) 109 98 110 99 fi
+50 -3
pkgs/development/libraries/qt-6/modules/qtbase.nix
··· 182 182 substituteInPlace src/corelib/CMakeLists.txt --replace /bin/ls ${coreutils}/bin/ls 183 183 ''; 184 184 185 + fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh; 186 + fix_qt_module_paths = ../hooks/fix-qt-module-paths.sh; 187 + preHook = '' 188 + . "$fix_qt_builtin_paths" 189 + . "$fix_qt_module_paths" 190 + . ${../hooks/move-qt-dev-tools.sh} 191 + . ${../hooks/fix-qmake-libtool.sh} 192 + ''; 193 + 185 194 qtPluginPrefix = "lib/qt-6/plugins"; 186 195 qtQmlPrefix = "lib/qt-6/qml"; 187 196 ··· 199 208 outputs = [ "out" "dev" ]; 200 209 201 210 postInstall = '' 202 - mkdir -p $dev 203 - mv $out/mkspecs $out/bin $out/libexec $dev/ 211 + moveToOutput "mkspecs" "$dev" 212 + ''; 213 + 214 + devTools = [ 215 + "libexec/moc" 216 + "libexec/rcc" 217 + "libexec/syncqt.pl" 218 + "libexec/qlalr" 219 + "libexec/ensure_pro_file.cmake" 220 + "libexec/cmake_automoc_parser" 221 + "libexec/qvkgen" 222 + "libexec/tracegen" 223 + "libexec/uic" 224 + "bin/fixqt4headers.pl" 225 + "bin/moc" 226 + "bin/qdbuscpp2xml" 227 + "bin/qdbusxml2cpp" 228 + "bin/qlalr" 229 + "bin/qmake" 230 + "bin/rcc" 231 + "bin/syncqt.pl" 232 + "bin/uic" 233 + ]; 234 + 235 + postFixup = '' 236 + # Don't retain build-time dependencies like gdb. 237 + sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $dev/mkspecs/qconfig.pri 238 + fixQtModulePaths "''${!outputDev}/mkspecs/modules" 239 + fixQtBuiltinPaths "''${!outputDev}" '*.pr?' 240 + 241 + # Move development tools to $dev 242 + moveQtDevTools 243 + moveToOutput bin "$dev" 244 + moveToOutput libexec "$dev" 245 + 246 + # fixup .pc file (where to find 'moc' etc.) 247 + sed -i "$dev/lib/pkgconfig/Qt6Core.pc" \ 248 + -e "/^bindir=/ c bindir=$dev/bin" 249 + 250 + patchShebangs $out $dev 204 251 ''; 205 252 206 253 dontStrip = debugSymbols; ··· 211 258 homepage = "https://www.qt.io/"; 212 259 description = "A cross-platform application framework for C++"; 213 260 license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ]; 214 - maintainers = with maintainers; [ milahu nickcao ]; 261 + maintainers = with maintainers; [ milahu nickcao LunNova ]; 215 262 platforms = platforms.linux; 216 263 }; 217 264 }
+17 -1
pkgs/development/libraries/qt-6/modules/qtdeclarative.nix
··· 12 12 preConfigure = '' 13 13 export LD_LIBRARY_PATH="$PWD/build/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" 14 14 ''; 15 + cmakeFlags = [ 16 + "-DQT6_INSTALL_PREFIX=${placeholder "out"}" 17 + "-DQT_INSTALL_PREFIX=${placeholder "out"}" 18 + ]; 15 19 postInstall = '' 16 20 substituteInPlace "$out/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake" \ 17 - --replace ''\'''${QT6_INSTALL_PREFIX}' "$out" 21 + --replace ''\'''${QT6_INSTALL_PREFIX}' "$dev" 18 22 ''; 23 + devTools = [ 24 + "bin/qml" 25 + "bin/qmlcachegen" 26 + "bin/qmleasing" 27 + "bin/qmlimportscanner" 28 + "bin/qmllint" 29 + "bin/qmlmin" 30 + "bin/qmlplugindump" 31 + "bin/qmlprofiler" 32 + "bin/qmlscene" 33 + "bin/qmltestrunner" 34 + ]; 19 35 }
+3
pkgs/development/libraries/qt-6/modules/qtlanguageserver.nix
··· 5 5 qtModule { 6 6 pname = "qtlanguageserver"; 7 7 qtInputs = [ qtbase ]; 8 + 9 + # Doesn't have version set 10 + dontCheckQtModuleVersion = true; 8 11 }
+14
pkgs/development/libraries/qt-6/patches/qtbase-qmake-pkg-config.patch
··· 1 + diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp 2 + --- a/qmake/generators/makefile.cpp 3 + +++ b/qmake/generators/makefile.cpp 4 + @@ -3390,8 +3390,7 @@ MakefileGenerator::writePkgConfigFile() 5 + << varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ") 6 + // << varGlue("DEFINES","-D"," -D"," ") 7 + ; 8 + - if (!project->values("QMAKE_DEFAULT_INCDIRS").contains(includeDir)) 9 + - t << "-I${includedir}"; 10 + + t << "-I${includedir}"; 11 + if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle") 12 + && libDir != QLatin1String("/Library/Frameworks")) { 13 + t << " -F${libdir}"; 14 +
+43
pkgs/development/libraries/qt-6/qtModule.nix
··· 18 18 perl 19 19 cmake 20 20 ninja 21 + self.qmake 21 22 ]; 22 23 propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or [ ]); 24 + 25 + preHook = '' 26 + . ${./hooks/move-qt-dev-tools.sh} 27 + . ${./hooks/fix-qt-builtin-paths.sh} 28 + ''; 23 29 24 30 outputs = args.outputs or [ "out" "dev" ]; 25 31 ··· 32 38 moveToOutput "$dir" "$dev" 33 39 done 34 40 fi 41 + fixQtBuiltinPaths $out/lib "*.pr?" 35 42 ${args.postInstall or ""} 36 43 ''; 44 + 45 + preConfigure = args.preConfigure or "" + '' 46 + fixQtBuiltinPaths . '*.pr?' 47 + '' + lib.optionalString (builtins.compareVersions "5.15.0" version <= 0) 48 + # Note: We use ${version%%-*} to remove any tag from the end of the version 49 + # string. Version tags are added by Nixpkgs maintainers and not reflected in 50 + # the source version. 51 + '' 52 + if [[ -z "$dontCheckQtModuleVersion" ]] \ 53 + && grep -q '^MODULE_VERSION' .qmake.conf 2>/dev/null \ 54 + && ! grep -q -F "''${version%%-*}" .qmake.conf 2>/dev/null 55 + then 56 + echo >&2 "error: could not find version ''${version%%-*} in .qmake.conf" 57 + echo >&2 "hint: check .qmake.conf and update the package version in Nixpkgs" 58 + exit 1 59 + fi 60 + 61 + if [[ -z "$dontSyncQt" && -f sync.profile ]]; then 62 + # FIXME: this probably breaks crosscompiling as it's not from nativeBuildInputs 63 + # I don't know how to get /libexec from nativeBuildInputs to work, it's not under /bin 64 + ${self.qtbase.dev.nativeDrv or self.qtbase.dev}/libexec/syncqt.pl -version "''${version%%-*}" 65 + fi 66 + ''; 67 + 68 + postFixup = '' 69 + if [ -d "''${!outputDev}/lib/pkgconfig" ]; then 70 + find "''${!outputDev}/lib/pkgconfig" -name '*.pc' | while read pc; do 71 + sed -i "$pc" \ 72 + -e "/^prefix=/ c prefix=''${!outputLib}" \ 73 + -e "/^exec_prefix=/ c exec_prefix=''${!outputBin}" \ 74 + -e "/^includedir=/ c includedir=''${!outputDev}/include" 75 + done 76 + fi 77 + 78 + moveQtDevTools 79 + '' + args.postFixup or ""; 37 80 38 81 meta = with lib; { 39 82 homepage = "https://www.qt.io/";
+138
pkgs/development/python-modules/pyqt/6.x.nix
··· 1 + { lib 2 + , buildPythonPackage 3 + , isPy27 4 + , fetchPypi 5 + , pkg-config 6 + , dbus 7 + , lndir 8 + , setuptools 9 + , dbus-python 10 + , sip 11 + , pyqt6-sip 12 + , pyqt-builder 13 + , qt6Packages 14 + , pythonOlder 15 + , withMultimedia ? true 16 + , withWebSockets ? true 17 + # FIXME: Once QtLocation is available for Qt6 enable this 18 + # https://bugreports.qt.io/browse/QTBUG-96795 19 + #, withLocation ? true 20 + # Not currently part of PyQt6 21 + #, withConnectivity ? true 22 + }: 23 + 24 + buildPythonPackage rec { 25 + pname = "PyQt6"; 26 + version = "6.4.0"; 27 + format = "pyproject"; 28 + 29 + disabled = pythonOlder "3.6"; 30 + 31 + src = fetchPypi { 32 + inherit pname version; 33 + sha256 = "sha256-kTkkab4fSRkF+p54+k5AWaiathbd8uz9UlvB1lwmu5M="; 34 + }; 35 + 36 + patches = [ 37 + # Fix some wrong assumptions by ./project.py 38 + # TODO: figure out how to send this upstream 39 + # FIXME: make a version for PyQt6? 40 + # ./pyqt5-fix-dbus-mainloop-support.patch 41 + # confirm license when installing via pyqt6_sip 42 + ./pyqt5-confirm-license.patch 43 + ]; 44 + 45 + # be more verbose 46 + postPatch = '' 47 + cat >> pyproject.toml <<EOF 48 + [tool.sip.project] 49 + verbose = true 50 + EOF 51 + ''; 52 + 53 + enableParallelBuilding = true; 54 + # HACK: paralellize compilation of make calls within pyqt's setup.py 55 + # pkgs/stdenv/generic/setup.sh doesn't set this for us because 56 + # make gets called by python code and not its build phase 57 + # format=pyproject means the pip-build-hook hook gets used to build this project 58 + # pkgs/development/interpreters/python/hooks/pip-build-hook.sh 59 + # does not use the enableParallelBuilding flag 60 + postUnpack = '' 61 + export MAKEFLAGS+=" -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES" 62 + ''; 63 + 64 + outputs = [ "out" "dev" ]; 65 + 66 + dontWrapQtApps = true; 67 + 68 + nativeBuildInputs = with qt6Packages; [ 69 + pkg-config 70 + lndir 71 + sip 72 + qtbase 73 + qtsvg 74 + qtdeclarative 75 + qtwebchannel 76 + qmake 77 + qtquick3d 78 + qtquicktimeline 79 + ] 80 + # ++ lib.optional withConnectivity qtconnectivity 81 + ++ lib.optional withMultimedia qtmultimedia 82 + ++ lib.optional withWebSockets qtwebsockets 83 + # ++ lib.optional withLocation qtlocation 84 + ; 85 + 86 + buildInputs = with qt6Packages; [ 87 + dbus 88 + qtbase 89 + qtsvg 90 + qtdeclarative 91 + pyqt-builder 92 + qtquick3d 93 + qtquicktimeline 94 + ] 95 + # ++ lib.optional withConnectivity qtconnectivity 96 + ++ lib.optional withWebSockets qtwebsockets 97 + # ++ lib.optional withLocation qtlocation 98 + ; 99 + 100 + propagatedBuildInputs = [ 101 + dbus-python 102 + pyqt6-sip 103 + setuptools 104 + ]; 105 + 106 + passthru = { 107 + inherit sip pyqt6-sip; 108 + multimediaEnabled = withMultimedia; 109 + WebSocketsEnabled = withWebSockets; 110 + }; 111 + 112 + dontConfigure = true; 113 + 114 + # Checked using pythonImportsCheck, has no tests 115 + doCheck = true; 116 + 117 + pythonImportsCheck = [ 118 + "PyQt6" 119 + "PyQt6.QtCore" 120 + "PyQt6.QtQml" 121 + "PyQt6.QtWidgets" 122 + "PyQt6.QtGui" 123 + "PyQt6.QtQuick" 124 + ] 125 + ++ lib.optional withWebSockets "PyQt6.QtWebSockets" 126 + ++ lib.optional withMultimedia "PyQt6.QtMultimedia" 127 + # ++ lib.optional withConnectivity "PyQt6.QtConnectivity" 128 + # ++ lib.optional withLocation "PyQt6.QtPositioning" 129 + ; 130 + 131 + meta = with lib; { 132 + description = "Python bindings for Qt6"; 133 + homepage = "https://riverbankcomputing.com/"; 134 + license = licenses.gpl3Only; 135 + platforms = platforms.mesaPlatforms; 136 + maintainers = with maintainers; [ LunNova ]; 137 + }; 138 + }
+28
pkgs/development/python-modules/pyqt/pyqt6-sip.nix
··· 1 + { lib 2 + , buildPythonPackage 3 + , fetchPypi 4 + }: 5 + 6 + buildPythonPackage rec { 7 + pname = "pyqt6-sip"; 8 + version = "13.4.0"; 9 + 10 + src = fetchPypi { 11 + pname = "PyQt6_sip"; 12 + inherit version; 13 + sha256 = "sha256-bYej7lhy11EbdpV9aKMhCTUsrzt6QqAdnuIAMrNQ2Xk="; 14 + }; 15 + 16 + # There is no test code and the check phase fails with: 17 + # > error: could not create 'PyQt5/sip.cpython-38-x86_64-linux-gnu.so': No such file or directory 18 + doCheck = false; 19 + pythonImportsCheck = [ "PyQt6.sip" ]; 20 + 21 + meta = with lib; { 22 + description = "Python bindings for Qt5"; 23 + homepage = "https://www.riverbankcomputing.com/software/sip/"; 24 + license = licenses.gpl3Only; 25 + platforms = platforms.mesaPlatforms; 26 + maintainers = with maintainers; [ LunNova ]; 27 + }; 28 + }
+1 -1
pkgs/top-level/all-packages.nix
··· 21556 21556 inherit buildPackages; 21557 21557 cmake = cmake.overrideAttrs (attrs: { 21558 21558 patches = attrs.patches ++ [ 21559 - ../development/libraries/qt-6/cmake.patch 21559 + ../development/libraries/qt-6/patches/cmake.patch 21560 21560 ]; 21561 21561 }); 21562 21562 });
+4
pkgs/top-level/python-packages.nix
··· 8367 8367 withWebKit = true; 8368 8368 }; 8369 8369 8370 + pyqt6 = callPackage ../development/python-modules/pyqt/6.x.nix { }; 8371 + 8372 + pyqt6-sip = callPackage ../development/python-modules/pyqt/pyqt6-sip.nix { }; 8373 + 8370 8374 pyqtgraph = callPackage ../development/python-modules/pyqtgraph { }; 8371 8375 8372 8376 pyqtwebengine = pkgs.libsForQt5.callPackage ../development/python-modules/pyqtwebengine {