diff --git a/depends/Makefile b/depends/Makefile index f03db29eb30..9eb00a425a5 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -157,6 +157,7 @@ libevent_packages_$(NO_LIBEVENT) = $(libevent_packages) qrencode_packages_$(NO_QR) = $(qrencode_$(host_os)_packages) qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) $(qrencode_packages_) +qt_native_packages_$(NO_QT) = $(qt_native_packages) bdb_packages_$(NO_BDB) = $(bdb_packages) wallet_packages_$(NO_WALLET) = $(bdb_packages_) $(sqlite_packages) @@ -166,7 +167,7 @@ multiprocess_packages_$(MULTIPROCESS) = $(multiprocess_packages) usdt_packages_$(NO_USDT) = $(usdt_$(host_os)_packages) packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(boost_packages_) $(libevent_packages_) $(qt_packages_) $(wallet_packages_) $(usdt_packages_) -native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) +native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) $(qt_native_packages_) ifneq ($(zmq_packages_),) packages += $(zmq_packages) diff --git a/depends/packages/native_qt.mk b/depends/packages/native_qt.mk new file mode 100644 index 00000000000..d4f41bf58f1 --- /dev/null +++ b/depends/packages/native_qt.mk @@ -0,0 +1,152 @@ +package=native_qt +include packages/qt_details.mk +$(package)_version=$(qt_details_version) +$(package)_download_path=$(qt_details_download_path) +$(package)_file_name=$(qt_details_qtbase_file_name) +$(package)_sha256_hash=$(qt_details_qtbase_sha256_hash) +$(package)_patches_path := $(qt_details_patches_path) +$(package)_patches := dont_hardcode_pwd.patch +$(package)_patches += qtbase-moc-ignore-gcc-macro.patch +$(package)_patches += qtbase_skip_tools.patch +$(package)_patches += rcc_hardcode_timestamp.patch +$(package)_patches += qttools_skip_dependencies.patch + +$(package)_qttranslations_file_name=$(qt_details_qttranslations_file_name) +$(package)_qttranslations_sha256_hash=$(qt_details_qttranslations_sha256_hash) + +$(package)_qttools_file_name=$(qt_details_qttools_file_name) +$(package)_qttools_sha256_hash=$(qt_details_qttools_sha256_hash) + +$(package)_extra_sources := $($(package)_qttranslations_file_name) +$(package)_extra_sources += $($(package)_qttools_file_name) + +$(package)_top_download_path=$(qt_details_top_download_path) +$(package)_top_cmakelists_file_name=$(qt_details_top_cmakelists_file_name) +$(package)_top_cmakelists_download_file=$(qt_details_top_cmakelists_download_file) +$(package)_top_cmakelists_sha256_hash=$(qt_details_top_cmakelists_sha256_hash) +$(package)_top_cmake_download_path=$(qt_details_top_cmake_download_path) +$(package)_top_cmake_ecmoptionaladdsubdirectory_file_name=$(qt_details_top_cmake_ecmoptionaladdsubdirectory_file_name) +$(package)_top_cmake_ecmoptionaladdsubdirectory_download_file=$(qt_details_top_cmake_ecmoptionaladdsubdirectory_download_file) +$(package)_top_cmake_ecmoptionaladdsubdirectory_sha256_hash=$(qt_details_top_cmake_ecmoptionaladdsubdirectory_sha256_hash) +$(package)_top_cmake_qttoplevelhelpers_file_name=$(qt_details_top_cmake_qttoplevelhelpers_file_name) +$(package)_top_cmake_qttoplevelhelpers_download_file=$(qt_details_top_cmake_qttoplevelhelpers_download_file) +$(package)_top_cmake_qttoplevelhelpers_sha256_hash=$(qt_details_top_cmake_qttoplevelhelpers_sha256_hash) + +$(package)_extra_sources += $($(package)_top_cmakelists_file_name)-$($(package)_version) +$(package)_extra_sources += $($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version) +$(package)_extra_sources += $($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version) + +define $(package)_set_vars +# Build options. +$(package)_config_opts := -release +$(package)_config_opts += -make tools +$(package)_config_opts += -no-pkg-config +$(package)_config_opts += -no-reduce-relocations +$(package)_config_opts += -no-use-gold-linker +$(package)_config_opts += -prefix $(host_prefix) +$(package)_config_opts += -static + +# Modules. +$(package)_config_opts += -no-feature-concurrent +$(package)_config_opts += -no-feature-network +$(package)_config_opts += -no-feature-printsupport +$(package)_config_opts += -no-feature-sql +$(package)_config_opts += -no-feature-testlib +$(package)_config_opts += -no-feature-xml +$(package)_config_opts += -no-gui +$(package)_config_opts += -no-widgets + +$(package)_config_opts += -no-glib +$(package)_config_opts += -no-icu +$(package)_config_opts += -no-libudev +$(package)_config_opts += -no-openssl +$(package)_config_opts += -no-zstd +$(package)_config_opts += -qt-pcre +$(package)_config_opts += -qt-zlib +$(package)_config_opts += -no-feature-backtrace +$(package)_config_opts += -no-feature-permissions +$(package)_config_opts += -no-feature-process +$(package)_config_opts += -no-feature-settings + +# Core tools. +$(package)_config_opts += -no-feature-androiddeployqt +$(package)_config_opts += -no-feature-macdeployqt +$(package)_config_opts += -no-feature-windeployqt +$(package)_config_opts += -no-feature-qmake + +# Qt Tools module. +$(package)_config_opts += -feature-linguist +$(package)_config_opts += -no-feature-assistant +$(package)_config_opts += -no-feature-clang +$(package)_config_opts += -no-feature-clangcpp +$(package)_config_opts += -no-feature-designer +$(package)_config_opts += -no-feature-pixeltool +$(package)_config_opts += -no-feature-qdoc +$(package)_config_opts += -no-feature-qtattributionsscanner +$(package)_config_opts += -no-feature-qtdiag +$(package)_config_opts += -no-feature-qtplugininfo + +$(package)_config_env := CC="$$(build_CC)" +$(package)_config_env += CXX="$$(build_CXX)" + +$(package)_cmake_opts := -DCMAKE_EXE_LINKER_FLAGS="$$(build_LDFLAGS)" +ifneq ($(V),) +$(package)_cmake_opts += --log-level=STATUS +endif +endef + +define $(package)_fetch_cmds +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttranslations_file_name),$($(package)_qttranslations_file_name),$($(package)_qttranslations_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_top_download_path),$($(package)_top_cmakelists_download_file),$($(package)_top_cmakelists_file_name)-$($(package)_version),$($(package)_top_cmakelists_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_top_cmake_download_path),$($(package)_top_cmake_ecmoptionaladdsubdirectory_download_file),$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version),$($(package)_top_cmake_ecmoptionaladdsubdirectory_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_top_cmake_download_path),$($(package)_top_cmake_qttoplevelhelpers_download_file),$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version),$($(package)_top_cmake_qttoplevelhelpers_sha256_hash)) +endef + +define $(package)_extract_cmds + mkdir -p $($(package)_extract_dir) && \ + echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qttranslations_sha256_hash) $($(package)_source_dir)/$($(package)_qttranslations_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_top_cmakelists_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmakelists_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_top_cmake_ecmoptionaladdsubdirectory_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_top_cmake_qttoplevelhelpers_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + mkdir qtbase && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \ + mkdir qttranslations && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \ + mkdir qttools && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools && \ + cp $($(package)_source_dir)/$($(package)_top_cmakelists_file_name)-$($(package)_version) ./$($(package)_top_cmakelists_file_name) && \ + mkdir cmake && \ + cp $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name) && \ + cp $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_qttoplevelhelpers_file_name) +endef + +define $(package)_preprocess_cmds + patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \ + patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \ + patch -p1 -i $($(package)_patch_dir)/qtbase_skip_tools.patch && \ + patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \ + patch -p1 -i $($(package)_patch_dir)/qttools_skip_dependencies.patch +endef + +define $(package)_config_cmds + cd qtbase && \ + ./configure -top-level $($(package)_config_opts) -- $($(package)_cmake_opts) +endef + +define $(package)_build_cmds + cmake --build . -- $$(filter -j%,$$(MAKEFLAGS)) +endef + +define $(package)_stage_cmds + cmake --install . --prefix $($(package)_staging_prefix_dir) +endef + +define $(package)_postprocess_cmds + rm -rf doc/ && \ + mv -t .. translations/ +endef diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index e24829481e3..7a3699fedb3 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -11,6 +11,9 @@ qrencode_mingw32_packages = qrencode qt_linux_packages:=qt expat libxcb xcb_proto libXau xproto freetype fontconfig libxkbcommon libxcb_util libxcb_util_cursor libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm qt_darwin_packages=qt qt_mingw32_packages=qt +ifneq ($(host),$(build)) +qt_native_packages := native_qt +endif bdb_packages=bdb sqlite_packages=sqlite diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 1dd94784439..a0354a427ea 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -4,7 +4,11 @@ $(package)_version=$(qt_details_version) $(package)_download_path=$(qt_details_download_path) $(package)_file_name=$(qt_details_qtbase_file_name) $(package)_sha256_hash=$(qt_details_qtbase_sha256_hash) +ifneq ($(host),$(build)) +$(package)_dependencies := native_$(package) +endif $(package)_linux_dependencies=freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_cursor libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm +$(package)_patches_path := $(qt_details_patches_path) $(package)_patches := dont_hardcode_pwd.patch $(package)_patches += qtbase-moc-ignore-gcc-macro.patch $(package)_patches += qtbase_avoid_native_float16.patch @@ -71,6 +75,9 @@ $(package)_config_opts += -nomake tests $(package)_config_opts += -prefix $(host_prefix) $(package)_config_opts += -qt-doubleconversion $(package)_config_opts += -qt-harfbuzz +ifneq ($(host),$(build)) +$(package)_config_opts += -qt-host-path $(build_prefix) +endif $(package)_config_opts += -qt-libpng $(package)_config_opts += -qt-pcre $(package)_config_opts += -qt-zlib @@ -109,6 +116,7 @@ $(package)_config_opts += -no-feature-macdeployqt $(package)_config_opts += -no-feature-qmake $(package)_config_opts += -no-feature-windeployqt +ifeq ($(host),$(build)) # Qt Tools module. $(package)_config_opts += -feature-linguist $(package)_config_opts += -no-feature-assistant @@ -120,25 +128,12 @@ $(package)_config_opts += -no-feature-qdoc $(package)_config_opts += -no-feature-qtattributionsscanner $(package)_config_opts += -no-feature-qtdiag $(package)_config_opts += -no-feature-qtplugininfo +endif -$(package)_config_opts_darwin = -no-pkg-config -$(package)_config_opts_darwin += -no-dbus +$(package)_config_opts_darwin := -no-dbus +$(package)_config_opts_darwin += -no-feature-printsupport $(package)_config_opts_darwin += -no-freetype -$(package)_config_opts_darwin += QMAKE_MACOSX_DEPLOYMENT_TARGET=$(OSX_MIN_VERSION) - -ifneq ($(build_os),darwin) -$(package)_config_opts_darwin += -xplatform macx-clang-linux -$(package)_config_opts_darwin += -device-option MAC_SDK_PATH=$(OSX_SDK) -$(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSION) -$(package)_config_opts_darwin += -device-option CROSS_COMPILE="llvm-" -$(package)_config_opts_darwin += -device-option MAC_TARGET=$(host) -$(package)_config_opts_darwin += -device-option XCODE_VERSION=$(XCODE_VERSION) -endif - -ifneq ($(build_arch),$(host_arch)) -$(package)_config_opts_aarch64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS=arm64 -$(package)_config_opts_x86_64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS=x86_64 -endif +$(package)_config_opts_darwin += -no-pkg-config $(package)_config_opts_linux := -dbus-runtime $(package)_config_opts_linux += -fontconfig @@ -162,6 +157,8 @@ endif # CMake build options. $(package)_config_env := CC="$$($(package)_cc)" $(package)_config_env += CXX="$$($(package)_cxx)" +$(package)_config_env_darwin := OBJC="$$($(package)_cc)" +$(package)_config_env_darwin += OBJCXX="$$($(package)_cxx)" $(package)_cmake_opts := -DCMAKE_PREFIX_PATH=$(host_prefix) $(package)_cmake_opts += -DQT_FEATURE_cxx20=ON @@ -177,9 +174,30 @@ $(package)_cmake_opts += -DCMAKE_C_FLAGS_DEBUG="$$($$($(package)_type)_debug_CFL $(package)_cmake_opts += -DCMAKE_CXX_FLAGS="$$($(package)_cppflags) $$($$($(package)_type)_CXXFLAGS) -ffile-prefix-map=$$($(package)_extract_dir)=/usr" $(package)_cmake_opts += -DCMAKE_CXX_FLAGS_RELEASE="$$($$($(package)_type)_release_CXXFLAGS)" $(package)_cmake_opts += -DCMAKE_CXX_FLAGS_DEBUG="$$($$($(package)_type)_debug_CXXFLAGS)" +ifeq ($(host_os),darwin) +$(package)_cmake_opts += -DCMAKE_OBJC_FLAGS="$$($(package)_cppflags) $$($$($(package)_type)_CFLAGS) -ffile-prefix-map=$$($(package)_extract_dir)=/usr" +$(package)_cmake_opts += -DCMAKE_OBJC_FLAGS_RELEASE="$$($$($(package)_type)_release_CFLAGS)" +$(package)_cmake_opts += -DCMAKE_OBJC_FLAGS_DEBUG="$$($$($(package)_type)_debug_CFLAGS)" +$(package)_cmake_opts += -DCMAKE_OBJCXX_FLAGS="$$($(package)_cppflags) $$($$($(package)_type)_CXXFLAGS) -ffile-prefix-map=$$($(package)_extract_dir)=/usr" +$(package)_cmake_opts += -DCMAKE_OBJCXX_FLAGS_RELEASE="$$($$($(package)_type)_release_CXXFLAGS)" +$(package)_cmake_opts += -DCMAKE_OBJCXX_FLAGS_DEBUG="$$($$($(package)_type)_debug_CXXFLAGS)" +endif $(package)_cmake_opts += -DCMAKE_EXE_LINKER_FLAGS="$$($$($(package)_type)_LDFLAGS)" $(package)_cmake_opts += -DCMAKE_EXE_LINKER_FLAGS_RELEASE="$$($$($(package)_type)_release_LDFLAGS)" $(package)_cmake_opts += -DCMAKE_EXE_LINKER_FLAGS_DEBUG="$$($$($(package)_type)_debug_LDFLAGS)" + +ifneq ($(host),$(build)) +$(package)_cmake_opts += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system_name) +$(package)_cmake_opts += -DCMAKE_SYSTEM_VERSION=$($(host_os)_cmake_system_version) +$(package)_cmake_opts += -DCMAKE_SYSTEM_PROCESSOR=$(host_arch) +endif +ifeq ($(host_os),darwin) +$(package)_cmake_opts += -DCMAKE_INSTALL_NAME_TOOL=true +$(package)_cmake_opts += -DCMAKE_FRAMEWORK_PATH=$(OSX_SDK)/System/Library/Frameworks +$(package)_cmake_opts += -DQT_INTERNAL_APPLE_SDK_VERSION=$(OSX_SDK_VERSION) +$(package)_cmake_opts += -DQT_INTERNAL_XCODE_VERSION=$(XCODE_VERSION) +$(package)_cmake_opts += -DQT_NO_APPLE_SDK_MAX_VERSION_CHECK=ON +endif endef define $(package)_fetch_cmds @@ -191,6 +209,7 @@ $(call fetch_file,$(package),$($(package)_top_cmake_download_path),$($(package)_ $(call fetch_file,$(package),$($(package)_top_cmake_download_path),$($(package)_top_cmake_qttoplevelhelpers_download_file),$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version),$($(package)_top_cmake_qttoplevelhelpers_sha256_hash)) endef +ifeq ($(host),$(build)) define $(package)_extract_cmds mkdir -p $($(package)_extract_dir) && \ echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \ @@ -211,6 +230,22 @@ define $(package)_extract_cmds cp $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name) && \ cp $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_qttoplevelhelpers_file_name) endef +else +define $(package)_extract_cmds + mkdir -p $($(package)_extract_dir) && \ + echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_top_cmakelists_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmakelists_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_top_cmake_ecmoptionaladdsubdirectory_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_top_cmake_qttoplevelhelpers_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + mkdir qtbase && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \ + cp $($(package)_source_dir)/$($(package)_top_cmakelists_file_name)-$($(package)_version) ./$($(package)_top_cmakelists_file_name) && \ + mkdir cmake && \ + cp $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name) && \ + cp $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_qttoplevelhelpers_file_name) +endef +endif define $(package)_preprocess_cmds patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \ @@ -220,9 +255,11 @@ define $(package)_preprocess_cmds patch -p1 -i $($(package)_patch_dir)/qtbase_platformsupport.patch && \ patch -p1 -i $($(package)_patch_dir)/qtbase_plugins_cocoa.patch && \ patch -p1 -i $($(package)_patch_dir)/qtbase_skip_tools.patch && \ - patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \ - patch -p1 -i $($(package)_patch_dir)/qttools_skip_dependencies.patch + patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch endef +ifeq ($(host),$(build)) + $(package)_preprocess_cmds += && patch -p1 -i $($(package)_patch_dir)/qttools_skip_dependencies.patch +endif define $(package)_config_cmds cd qtbase && \ diff --git a/depends/packages/qt_details.mk b/depends/packages/qt_details.mk index 0f1148f7d9d..341448149e3 100644 --- a/depends/packages/qt_details.mk +++ b/depends/packages/qt_details.mk @@ -11,6 +11,8 @@ qt_details_qttranslations_sha256_hash := dcc762acac043b9bb5e4d369b6d6f53e0ecfcf7 qt_details_qttools_file_name := qttools-$(qt_details_suffix) qt_details_qttools_sha256_hash := f03bb7df619cd9ac9dba110e30b7bcab5dd88eb8bdc9cc752563b4367233203f +qt_details_patches_path := $(PATCHES_PATH)/qt + qt_details_top_download_path := https://code.qt.io/cgit/qt/qt5.git/plain qt_details_top_cmakelists_file_name := CMakeLists.txt qt_details_top_cmakelists_download_file := $(qt_details_top_cmakelists_file_name)?h=$(qt_details_version)