diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index 5208379f9a..92fe29a0ac 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL = \ QMAKE_FIX_RPATH = install_name_tool -id -QMAKE_LFLAGS_RPATH = -Wl,-rpath, +QMAKE_LFLAGS_RPATH = QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip QMAKE_LFLAGS_REL_RPATH = diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index bb5083c925..da8e2cb386 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -21,7 +21,7 @@ load(cmake_functions) # at cmake time whether package has been found via a symlink, and correct # that to an absolute path. This is only done for installations to # the /usr or / prefix. -CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS]) +CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$NIX_OUTPUT_OUT/lib/) contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake @@ -47,47 +47,22 @@ split_incpath { $$cmake_extra_source_includes.output } -CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX]) -contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") { - CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/ - CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True -} +CMAKE_INCLUDE_DIR = $$NIX_OUTPUT_DEV/include/ +CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True !exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true -CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX]) -contains(CMAKE_LIB_DIR,"^\\.\\./.*") { - CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/ - CMAKE_LIB_DIR_IS_ABSOLUTE = True -} else { - CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS]) - # We need to go up another two levels because the CMake files are - # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME} - CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../" -} +CMAKE_LIB_DIR = $$NIX_OUTPUT_DEV/lib/ +CMAKE_LIB_DIR_IS_ABSOLUTE = True -CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX]) -contains(CMAKE_BIN_DIR, "^\\.\\./.*") { - CMAKE_BIN_DIR = $$[QT_HOST_BINS]/ - CMAKE_BIN_DIR_IS_ABSOLUTE = True -} +CMAKE_BIN_DIR = $$NIX_OUTPUT_BIN/bin/ +CMAKE_BIN_DIR_IS_ABSOLUTE = True -CMAKE_PLUGIN_DIR = $$cmakeRelativePath($$[QT_INSTALL_PLUGINS], $$[QT_INSTALL_PREFIX]) -contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") { - CMAKE_PLUGIN_DIR = $$[QT_INSTALL_PLUGINS]/ - CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True -} +CMAKE_PLUGIN_DIR = $$NIX_OUTPUT_PLUGIN/ +CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True -win32:!static:!staticlib { - CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX]) - contains(CMAKE_DLL_DIR, "^\\.\\./.*") { - CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/ - CMAKE_DLL_DIR_IS_ABSOLUTE = True - } -} else { - CMAKE_DLL_DIR = $$CMAKE_LIB_DIR - CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE -} +CMAKE_DLL_DIR = $$NIX_OUTPUT_DEV/lib/ +CMAKE_DLL_DIR_IS_ABSOLUTE = True static|staticlib:CMAKE_STATIC_TYPE = true @@ -167,7 +142,7 @@ contains(CONFIG, plugin) { cmake_target_file cmake_qt5_plugin_file.files = $$cmake_target_file.output - cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME} + cmake_qt5_plugin_file.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME} INSTALLS += cmake_qt5_plugin_file return() @@ -314,7 +289,7 @@ exists($$cmake_macros_file.input) { cmake_qt5_module_files.files += $$cmake_macros_file.output } -cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME} +cmake_qt5_module_files.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME} # We are generating cmake files. Most developers of Qt are not aware of cmake, # so we require automatic tests to be available. The only module which should diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 55c74aad66..0bbc8718eb 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -9,30 +9,6 @@ if (CMAKE_VERSION VERSION_LESS 3.0.0) endif() !!ENDIF -!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND) -!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) -set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\") -!!ELSE -get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH) -# Use original install prefix when loaded through a -# cross-prefix symbolic link such as /lib -> /usr/lib. -get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH) -get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH) -if(_realCurr STREQUAL _realOrig) - get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE) -else() - get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) -endif() -unset(_realOrig) -unset(_realCurr) -unset(_IMPORT_PREFIX) -!!ENDIF -!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) -get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) -!!ELSE -set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\") -!!ENDIF - !!IF !equals(TEMPLATE, aux) # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead. set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.VERSION)") @@ -58,11 +34,7 @@ endmacro() macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration}) -!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\") -!!ELSE set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\") -!!ENDIF _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location}) set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\" @@ -75,11 +47,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI ) !!IF !isEmpty(CMAKE_WINDOWS_BUILD) -!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\") -!!ELSE set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\") -!!ENDIF _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib}) if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\") set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES @@ -95,24 +63,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!IF !no_module_headers !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK) set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\" - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\" + \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\" + \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\" ) !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES) set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\" - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\" - ) -!!ELSE - set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\") -!!ENDIF -!!ELSE -!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE) - set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\") -!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES) - set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\" - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\" + \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\" + \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\" ) !!ELSE set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\") @@ -128,7 +85,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\") !!ENDIF !!ENDIF -!!ENDIF !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS) include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL) !!ENDIF @@ -280,25 +236,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD) !!IF isEmpty(CMAKE_DEBUG_TYPE) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) -!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) -!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) -!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) !!ELSE // CMAKE_STATIC_WINDOWS_BUILD if (EXISTS -!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE) - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" -!!ELSE \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" -!!ENDIF AND EXISTS -!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) -!!ELSE \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) -!!ENDIF _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD endif() @@ -317,25 +261,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD) !!IF isEmpty(CMAKE_RELEASE_TYPE) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) -!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) -!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) -!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) !!ELSE // CMAKE_STATIC_WINDOWS_BUILD if (EXISTS -!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE) - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" -!!ELSE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" -!!ENDIF AND EXISTS -!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) -!!ELSE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) -!!ENDIF _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD endif() @@ -354,11 +286,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION) set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration}) -!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\") -!!ELSE set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\") -!!ENDIF _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location}) set_target_properties(Qt5::${Plugin} PROPERTIES \"IMPORTED_LOCATION_${Configuration}\" ${imported_location} diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index e645ba5803..a0e5c68b7e 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -24,166 +24,3 @@ qt { } } } - -# Add the same default rpaths as Xcode does for new projects. -# This is especially important for iOS/tvOS/watchOS where no other option is possible. -!no_default_rpath { - QMAKE_RPATHDIR += @executable_path/Frameworks - equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks -} - -# Don't pass -headerpad_max_install_names when using Bitcode. -# In that case the linker emits a warning stating that the flag is ignored when -# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962). -# Using this flag is also unnecessary in practice on UIKit platforms since they -# are sandboxed, and only UIKit platforms support bitcode to begin with. -!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD - -app_extension_api_only { - QMAKE_CFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION - QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION - QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION - QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION -} - -macx-xcode { - !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) { - debug_information_format.name = DEBUG_INFORMATION_FORMAT - debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT - debug_information_format.build = debug - QMAKE_MAC_XCODE_SETTINGS += debug_information_format - } - - QMAKE_XCODE_ARCHS = - - arch_device.name = "ARCHS[sdk=$${device.sdk}*]" - arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS - QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS - QMAKE_MAC_XCODE_SETTINGS += arch_device - - simulator { - arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]" - arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS - QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS - QMAKE_MAC_XCODE_SETTINGS += arch_simulator - } - - only_active_arch.name = ONLY_ACTIVE_ARCH - only_active_arch.value = YES - only_active_arch.build = debug - QMAKE_MAC_XCODE_SETTINGS += only_active_arch -} else { - device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS - simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS - VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS - - isEmpty(VALID_ARCHS): \ - error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture") - - single_arch: VALID_ARCHS = $$first(VALID_ARCHS) - - ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS)) - ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch)) - - QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS - - arch_flags = $(EXPORT_ARCH_ARGS) - - QMAKE_CFLAGS += $$arch_flags - QMAKE_CXXFLAGS += $$arch_flags - QMAKE_LFLAGS += $$arch_flags - - QMAKE_PCH_ARCHS = $$VALID_ARCHS - - macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET - ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET - tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET - watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET - - # If we're doing a simulator and device build, device and simulator - # architectures use different paths and flags for the sysroot and - # deployment target switch, so we must multiplex them across multiple - # architectures using -Xarch. Otherwise we fall back to the simple path. - # This is not strictly necessary, but results in cleaner command lines - # and makes it easier for people to override EXPORT_VALID_ARCHS to limit - # individual rules to a different set of architecture(s) from the overall - # build (such as machtest in QtCore). - simulator:device { - QMAKE_XARCH_CFLAGS = - QMAKE_XARCH_LFLAGS = - QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS - - for (arch, VALID_ARCHS) { - contains(VALID_SIMULATOR_ARCHS, $$arch) { - sdk = $$simulator.sdk - version_identifier = $$simulator.deployment_identifier - } else { - sdk = $$device.sdk - version_identifier = $$device.deployment_identifier - } - - version_min_flags = \ - -Xarch_$${arch} \ - -m$${version_identifier}-version-min=$$deployment_target - QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \ - -Xarch_$${arch} \ - -isysroot$$xcodeSDKInfo(Path, $$sdk) - QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \ - -Xarch_$${arch} \ - -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk) - - QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch}) - QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch}) - - QMAKE_EXTRA_VARIABLES += \ - QMAKE_XARCH_CFLAGS_$${arch} \ - QMAKE_XARCH_LFLAGS_$${arch} - } - - QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS) - QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS) - QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS) - } else { - simulator: \ - version_identifier = $$simulator.deployment_identifier - else: \ - version_identifier = $$device.deployment_identifier - version_min_flag = -m$${version_identifier}-version-min=$$deployment_target - QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag - QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag - QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag - } - - # Enable precompiled headers for multiple architectures - QMAKE_CFLAGS_USE_PRECOMPILE = - for (arch, VALID_ARCHS) { - icc_pch_style: \ - use_flag = "-pch-use " - else: \ - use_flag = -include - - # Only use Xarch with multi-arch, as the option confuses ccache - count(VALID_ARCHS, 1, greaterThan): \ - QMAKE_CFLAGS_USE_PRECOMPILE += \ - -Xarch_$${arch} - - QMAKE_CFLAGS_USE_PRECOMPILE += \ - $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}} - } - icc_pch_style { - QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT} - QMAKE_CFLAGS_USE_PRECOMPILE = - } else { - QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - } - - QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT} -} - -cache(QMAKE_XCODE_DEVELOPER_PATH, stash) -!isEmpty(QMAKE_XCODE_VERSION): \ - cache(QMAKE_XCODE_VERSION, stash) - -QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index 44636f2288..61ed486a76 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -1,56 +1,3 @@ CONFIG = asset_catalogs rez $$CONFIG load(default_pre) -isEmpty(QMAKE_XCODE_DEVELOPER_PATH) { - # Get path of Xcode's Developer directory - QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null") - isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \ - error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.") - - # Make sure Xcode path is valid - !exists($$QMAKE_XCODE_DEVELOPER_PATH): \ - error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.") -} - -isEmpty(QMAKE_XCODEBUILD_PATH): \ - QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null") - -!isEmpty(QMAKE_XCODEBUILD_PATH) { - # Make sure Xcode is set up properly - !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \ - error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.") - - isEmpty(QMAKE_XCODE_VERSION) { - # Extract Xcode version using xcodebuild - xcode_version = $$system("/usr/bin/xcrun xcodebuild -version") - QMAKE_XCODE_VERSION = $$member(xcode_version, 1) - isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.") - unset(xcode_version) - } -} - -isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) { - QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist - exists($$QMAKE_XCODE_PREFERENCES_FILE): \ - QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null") - - !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \ - cache(QMAKE_TARGET_BUNDLE_PREFIX) -} - -QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon - -# Make the default debug info format for static debug builds -# DWARF instead of DWARF with dSYM. This cuts down build times -# for application debug builds significantly, as Xcode doesn't -# have to pull out all the DWARF info from the Qt static libs -# and put it into a dSYM file. We don't need that dSYM file in -# the first place, since the information is available in the -# object files inside the archives (static libraries). -macx-xcode:qtConfig(static): \ - QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf - -# This variable is used by the xcode_dynamic_library_suffix -# feature, which allows Xcode to choose the Qt libraries to link to -# at build time, depending on the current Xcode SDK and configuration. -QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 3f6dc076ca..8b13789179 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -1,58 +1 @@ -isEmpty(QMAKE_MAC_SDK): \ - error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.") - -contains(QMAKE_MAC_SDK, .*/.*): \ - error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)") - -defineReplace(xcodeSDKInfo) { - info = $$1 - equals(info, "Path"): \ - info = --show-sdk-path - equals(info, "PlatformPath"): \ - info = --show-sdk-platform-path - equals(info, "SDKVersion"): \ - info = --show-sdk-version - sdk = $$2 - isEmpty(sdk): \ - sdk = $$QMAKE_MAC_SDK - - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) { - QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null") - # --show-sdk-platform-path won't work for Command Line Tools; this is fine - # only used by the XCTest backend to testlib - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \ - error("Could not resolve SDK $$info for \'$$sdk\'") - cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info}) - } - - return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info})) -} - -QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path) -QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath) -QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion) - -sysrootified = -for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val -QMAKE_INCDIR_OPENGL = $$sysrootified - -QMAKESPEC_NAME = $$basename(QMAKESPEC) - -# Resolve SDK version of various tools -for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL)) { - tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool} - !isEmpty($$tool_variable) { - $$tool = $$eval($$tool_variable) - next() - } - - value = $$eval($$tool) - isEmpty(value): next() - - sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null") - isEmpty(sysrooted): next() - - $$tool = $$sysrooted $$member(value, 1, -1) - cache($$tool_variable, set stash, $$tool) -} diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index 4db0040dc5..65d6da1f4d 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -23,13 +23,8 @@ for(qmlf, AUX_QML_FILES): fq_aux_qml_files += $$absolute_path($$qmlf, $$_PRO_FIL load(qt_build_paths) -qml1_target { - DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH - instbase = $$[QT_INSTALL_IMPORTS] -} else { - DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH - instbase = $$[QT_INSTALL_QML] -} +DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH +instbase = $$NIX_OUTPUT_QML !qml1_target:static: CONFIG += builtin_resources diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf index d49f4c49c1..097dcd7d39 100644 --- a/mkspecs/features/qml_plugin.prf +++ b/mkspecs/features/qml_plugin.prf @@ -48,13 +48,8 @@ exists($$QMLTYPEFILE): AUX_QML_FILES += $$QMLTYPEFILE load(qt_build_paths) -qml1_target { - DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH - instbase = $$[QT_INSTALL_IMPORTS] -} else { - DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH - instbase = $$[QT_INSTALL_QML] -} +DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH +instbase = $$NIX_OUTPUT_QML target.path = $$instbase/$$TARGETPATH INSTALLS += target diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf index 883f8ca215..81db8eb2d4 100644 --- a/mkspecs/features/qt_app.prf +++ b/mkspecs/features/qt_app.prf @@ -33,7 +33,7 @@ host_build:force_bootstrap { target.path = $$[QT_HOST_BINS] } else { !build_pass:qtConfig(debug_and_release): CONFIG += release - target.path = $$[QT_INSTALL_BINS] + target.path = $$NIX_OUTPUT_BIN/bin CONFIG += relative_qt_rpath # Qt's tools and apps should be relocatable } INSTALLS += target diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf index 1848f00e90..2af93675c5 100644 --- a/mkspecs/features/qt_build_paths.prf +++ b/mkspecs/features/qt_build_paths.prf @@ -23,6 +23,6 @@ exists($$MODULE_BASE_INDIR/.git): \ !force_independent { # If the module is not built independently, everything ends up in qtbase. # This is the case in non-prefix builds, except for selected modules. - MODULE_BASE_OUTDIR = $$[QT_HOST_PREFIX] - MODULE_QMAKE_OUTDIR = $$[QT_HOST_PREFIX] + MODULE_BASE_OUTDIR = $$NIX_OUTPUT_OUT + MODULE_QMAKE_OUTDIR = $$NIX_OUTPUT_OUT } diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index fb96d1b6a0..508ed17d30 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -32,8 +32,8 @@ contains(TEMPLATE, .*lib) { qqt_libdir = \$\$\$\$[QT_HOST_LIBS] qt_libdir = $$[QT_HOST_LIBS] } else { - qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS] - qt_libdir = $$[QT_INSTALL_LIBS] + qqt_libdir = \$\$\$\$NIX_OUTPUT_OUT/lib + qt_libdir = $$NIX_OUTPUT_OUT/lib } contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) { lib_replace.match = "[^ ']*$$rplbase/lib" diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf index 72dde61a40..f891a2baed 100644 --- a/mkspecs/features/qt_docs.prf +++ b/mkspecs/features/qt_docs.prf @@ -45,7 +45,7 @@ QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR) !build_online_docs: \ - QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS]) + QDOC += -installdir $$shell_quote($$NIX_OUTPUT_DOC) PREP_DOC_INDEXES = DOC_INDEXES = !isEmpty(QTREPOS) { @@ -64,8 +64,8 @@ DOC_INDEXES = DOC_INDEXES += -indexdir $$shell_quote($$qrep/doc) } else { prepare_docs: \ - PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get]) - DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get]) + PREP_DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC) + DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC) } qtattributionsscanner.target = qtattributionsscanner @@ -88,12 +88,12 @@ prepare_docs { qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch) inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR - inst_html_docs.path = $$[QT_INSTALL_DOCS] + inst_html_docs.path = $$NIX_OUTPUT_DOC inst_html_docs.CONFIG += no_check_exist directory no_default_install no_build INSTALLS += inst_html_docs inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch - inst_qch_docs.path = $$[QT_INSTALL_DOCS] + inst_qch_docs.path = $$NIX_OUTPUT_DOC inst_qch_docs.CONFIG += no_check_exist no_default_install no_build INSTALLS += inst_qch_docs diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf index 668669e4cd..30f7fbac41 100644 --- a/mkspecs/features/qt_example_installs.prf +++ b/mkspecs/features/qt_example_installs.prf @@ -77,13 +77,13 @@ for(extra, extras): \ # Just for Qt Creator OTHER_FILES += $$sourcefiles -sourcefiles += \ - $$_PRO_FILE_ $$RC_FILE $$DEF_FILE \ - $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \ - $$DBUS_ADAPTORS $$DBUS_INTERFACES -addInstallFiles(sources.files, $$sourcefiles) -sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase -INSTALLS += sources + sourcefiles += \ + $$_PRO_FILE_ $$RC_FILE $$DEF_FILE \ + $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \ + $$DBUS_ADAPTORS $$DBUS_INTERFACES + addInstallFiles(sources.files, $$sourcefiles) + sources.path = $$NIX_OUTPUT_DEV/share/examples/$$probase + INSTALLS += sources check_examples { srcfiles = $$sources.files diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 1903e509c8..ae7b585989 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -69,7 +69,7 @@ defineTest(qtHaveModule) { defineTest(qtPrepareTool) { cmd = $$eval(QT_TOOL.$${2}.binary) isEmpty(cmd) { - cmd = $$[QT_HOST_BINS]/$$2 + cmd = $$system("command -v $$2") exists($${cmd}.pl) { $${1}_EXE = $${cmd}.pl cmd = perl -w $$system_path($${cmd}.pl) diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf index 0d3dfb6b93..5f935b4424 100644 --- a/mkspecs/features/qt_installs.prf +++ b/mkspecs/features/qt_installs.prf @@ -12,16 +12,10 @@ #library !qt_no_install_library { win32 { - host_build: \ - dlltarget.path = $$[QT_HOST_BINS] - else: \ - dlltarget.path = $$[QT_INSTALL_BINS] + dlltarget.path = $$NIX_OUTPUT_BIN/bin INSTALLS += dlltarget } - host_build: \ - target.path = $$[QT_HOST_LIBS] - else: \ - target.path = $$[QT_INSTALL_LIBS] + target.path = $$NIX_OUTPUT_OUT/lib !static: target.CONFIG = no_dll INSTALLS += target } @@ -29,33 +23,33 @@ #headers qt_install_headers { class_headers.files = $$SYNCQT.HEADER_CLASSES - class_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME + class_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME INSTALLS += class_headers targ_headers.files = $$SYNCQT.HEADER_FILES - targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME + targ_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME INSTALLS += targ_headers private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES - private_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private + private_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private INSTALLS += private_headers qpa_headers.files = $$SYNCQT.QPA_HEADER_FILES - qpa_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa + qpa_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa INSTALLS += qpa_headers } #module qt_install_module { !isEmpty(MODULE_PRI) { - pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules + pritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules pritarget.files = $$MODULE_PRI INSTALLS += pritarget } else: isEmpty(MODULE_PRIVATE_PRI) { warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.") } !isEmpty(MODULE_PRIVATE_PRI) { - privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules + privpritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules privpritarget.files = $$MODULE_PRIVATE_PRI INSTALLS += privpritarget } diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 62e1b69fde..abd63123f9 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -88,7 +88,7 @@ CONFIG(static, static|shared)|prefix_build { } } -target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE +target.path = $$NIX_OUTPUT_PLUGIN/$$PLUGIN_TYPE INSTALLS += target TARGET = $$qt5LibraryTarget($$TARGET) diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 545b9a3d1e..6ac0cdefe4 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake) add_executable(Qt5::qmake IMPORTED) !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\") + set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\") !!ELSE set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\") !!ENDIF @@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc) add_executable(Qt5::moc IMPORTED) !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\") + set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\") !!ELSE set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\") !!ENDIF @@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc) add_executable(Qt5::rcc IMPORTED) !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\") + set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\") !!ELSE set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\") !!ENDIF @@ -133,7 +133,7 @@ if (NOT TARGET Qt5::WinMain) !!IF !isEmpty(CMAKE_RELEASE_TYPE) set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\") + set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\") !!ELSE set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\") !!ENDIF @@ -147,7 +147,7 @@ if (NOT TARGET Qt5::WinMain) set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\") + set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\") !!ELSE set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\") !!ENDIF diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in index c357237d0e..6f0c75de3c 100644 --- a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in +++ b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in @@ -1,6 +1,6 @@ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE) -set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\") +set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\") !!ELSE set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\") !!ENDIF diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in index 706304cf34..546420f6ad 100644 --- a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in +++ b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in @@ -1,6 +1,6 @@ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE) -set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\") +set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\") !!ELSE set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\") !!ENDIF diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index cba279c184..5ae3fd62e5 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPaths() QStringList *app_libpaths = new QStringList; coreappdata()->app_libpaths.reset(app_libpaths); + // Add library paths derived from PATH + const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':'); + const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX); + for (const QString &path: paths) { + if (!path.isEmpty()) { + app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir)); + } + } + const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH"); if (!libPathEnv.isEmpty()) { QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts); diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index 4fdc2e36ac..d3ec222543 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -70,7 +70,11 @@ typedef QHash QTzTimeZoneHash; // Parse zone.tab table, assume lists all installed zones, if not will need to read directories static QTzTimeZoneHash loadTzTimeZones() { - QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab"); + // Try TZDIR first, in case we're running on NixOS. + QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab"); + // Fallback to traditional paths in case we are not on NixOS. + if (!QFile::exists(path)) + path = QStringLiteral("/usr/share/zoneinfo/zone.tab"); if (!QFile::exists(path)) path = QStringLiteral("/usr/lib/zoneinfo/zone.tab"); @@ -645,12 +649,16 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId) if (!tzif.open(QIODevice::ReadOnly)) return; } else { - // Open named tz, try modern path first, if fails try legacy path - tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId)); + // Try TZDIR first, in case we're running on NixOS + tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId)); if (!tzif.open(QIODevice::ReadOnly)) { - tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId)); - if (!tzif.open(QIODevice::ReadOnly)) - return; + // Open named tz, try modern path first, if fails try legacy path + tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId)); + if (!tzif.open(QIODevice::ReadOnly)) { + tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId)); + if (!tzif.open(QIODevice::ReadOnly)) + return; + } } } diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in index 1d947159e2..b36865fc48 100644 --- a/src/dbus/Qt5DBusConfigExtras.cmake.in +++ b/src/dbus/Qt5DBusConfigExtras.cmake.in @@ -2,11 +2,7 @@ if (NOT TARGET Qt5::qdbuscpp2xml) add_executable(Qt5::qdbuscpp2xml IMPORTED) -!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\") -!!ELSE - set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\") -!!ENDIF + set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\") _qt5_DBus_check_file_exists(${imported_location}) set_target_properties(Qt5::qdbuscpp2xml PROPERTIES @@ -17,11 +13,7 @@ endif() if (NOT TARGET Qt5::qdbusxml2cpp) add_executable(Qt5::qdbusxml2cpp IMPORTED) -!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\") -!!ELSE - set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\") -!!ENDIF + set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\") _qt5_DBus_check_file_exists(${imported_location}) set_target_properties(Qt5::qdbusxml2cpp PROPERTIES diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in index 07869efd7d..37b95d1b6b 100644 --- a/src/gui/Qt5GuiConfigExtras.cmake.in +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -2,7 +2,7 @@ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE) !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE) -set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\") +set(Qt5Gui_EGL_INCLUDE_DIRS \"$$NIX_OUTPUT_DEV/$$CMAKE_INCLUDE_DIR/QtANGLE\") !!ELSE set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\") !!ENDIF @@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATIO set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration}) !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\") + set(imported_location \"$$NIX_OUTPUT_OUT/$${CMAKE_DLL_DIR}${LIB_LOCATION}\") !!ELSE set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\") !!ENDIF !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\") + set(imported_implib \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\") !!ELSE set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\") !!ENDIF diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp index 1da00813ce..0bf877afcb 100644 --- a/src/network/kernel/qdnslookup_unix.cpp +++ b/src/network/kernel/qdnslookup_unix.cpp @@ -92,7 +92,7 @@ static bool resolveLibraryInternal() if (!lib.load()) #endif { - lib.setFileName(QLatin1String("resolv")); + lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV)); if (!lib.load()) return false; } diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index 9a24938284..74962b4ae2 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -102,7 +102,7 @@ static bool resolveLibraryInternal() if (!lib.load()) #endif { - lib.setFileName(QLatin1String("resolv")); + lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV)); if (!lib.load()) return false; } diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index c92d8fc3f8..6008063bcf 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -351,7 +351,7 @@ init_context: const QVector qcurves = sslContext->sslConfiguration.ellipticCurves(); if (!qcurves.isEmpty()) { -#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) +#if OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC) // Set the curves to be used if (q_SSLeay() >= 0x10002000L) { // SSL_CTX_ctrl wants a non-const pointer as last argument, @@ -364,7 +364,7 @@ init_context: sslContext->errorCode = QSslError::UnspecifiedError; } } else -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) +#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC) { // specific curves requested, but not possible to set -> error sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2")); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 341d3bccf2..3368234c26 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -287,7 +287,7 @@ void QScanThread::getUserConfigurations() QMacAutoReleasePool pool; userProfiles.clear(); - NSArray *wifiInterfaces = [CWWiFiClient interfaceNames]; + NSArray *wifiInterfaces = [CWWiFiClient interfaceNames]; for (NSString *ifName in wifiInterfaces) { CWInterface *wifiInterface = [[CWWiFiClient sharedWiFiClient] interfaceWithName:ifName]; @@ -602,7 +602,7 @@ void QCoreWlanEngine::doRequestUpdate() QMacAutoReleasePool pool; - NSArray *wifiInterfaces = [CWWiFiClient interfaceNames]; + NSArray *wifiInterfaces = [CWWiFiClient interfaceNames]; for (NSString *ifName in wifiInterfaces) { scanThread->interfaceName = QString::fromNSString(ifName); scanThread->start(); diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index b5a0a5bbeb..6c20305f4d 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -265,12 +265,9 @@ void TableGenerator::initPossibleLocations() m_possibleLocations.reserve(7); if (qEnvironmentVariableIsSet("QTCOMPOSE")) m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE"))); - m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale")); - m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale")); - m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale")); - m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale")); m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale")); m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale")); + m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE)); } QString TableGenerator::findComposeFile() diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 5cd4beb4f0..84919e6d6a 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -320,7 +320,7 @@ static void qt_closePopups() + (void)applicationActivationChanged:(NSNotification*)notification { const id sender = self; - NSEnumerator *windowEnumerator = nullptr; + NSEnumerator *windowEnumerator = nullptr; NSApplication *application = [NSApplication sharedApplication]; #if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index e2e573f0e1..1c8289f81e 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -580,7 +580,14 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName) #if QT_CONFIG(library) extern const QString qt_gl_library_name(); // QLibrary lib(qt_gl_library_name()); + // Check system library paths first QLibrary lib(QLatin1String("GL")); +#ifdef NIXPKGS_MESA_GL + if (!lib.load()) { + // Fallback to Mesa driver + lib.setFileName(QLatin1String(NIXPKGS_MESA_GL)); + } +#endif // NIXPKGS_MESA_GL glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); #endif } diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 7c62c2e2b3..fefa40e0f6 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -311,10 +311,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen) #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static bool function_ptrs_not_initialized = true; if (function_ptrs_not_initialized) { - QLibrary xcursorLib(QLatin1String("Xcursor"), 1); + QLibrary xcursorLib(QLatin1String(NIXPKGS_LIBXCURSOR), 1); bool xcursorFound = xcursorLib.load(); if (!xcursorFound) { // try without the version number - xcursorLib.setFileName(QLatin1String("Xcursor")); + xcursorLib.setFileName(QLatin1String(NIXPKGS_LIBXCURSOR)); xcursorFound = xcursorLib.load(); } if (xcursorFound) { diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp index c4cd66c33b..b6f2691587 100644 --- a/src/plugins/platformthemes/gtk3/main.cpp +++ b/src/plugins/platformthemes/gtk3/main.cpp @@ -39,6 +39,7 @@ #include #include "qgtk3theme.h" +#include QT_BEGIN_NAMESPACE @@ -54,8 +55,22 @@ public: QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList ¶ms) { Q_UNUSED(params); - if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) + if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) { + +#ifdef NIXPKGS_QGTK3_XDG_DATA_DIRS + QStringList XDG_DATA_DIRS = QFile::decodeName(qgetenv("XDG_DATA_DIRS")).split(':'); + XDG_DATA_DIRS << QLatin1String(NIXPKGS_QGTK3_XDG_DATA_DIRS); + qputenv("XDG_DATA_DIRS", QFile::encodeName(XDG_DATA_DIRS.join(':'))); +#endif + +#ifdef NIXPKGS_QGTK3_GIO_EXTRA_MODULES + QStringList GIO_EXTRA_MODULES = QFile::decodeName(qgetenv("GIO_EXTRA_MODULES")).split(':'); + GIO_EXTRA_MODULES << QLatin1String(NIXPKGS_QGTK3_GIO_EXTRA_MODULES); + qputenv("GIO_EXTRA_MODULES", QFile::encodeName(GIO_EXTRA_MODULES.join(':'))); +#endif + return new QGtk3Theme; + } return 0; } diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in index 99d87e2e46..a4eab2aa72 100644 --- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in +++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in @@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic) add_executable(Qt5::uic IMPORTED) !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\") + set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\") !!ELSE set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\") !!ENDIF