1PACKAGE=qt 2$(package)_version=5.12.11 3$(package)_download_path=https://download.qt.io/official_releases/qt/5.12/$($(package)_version)/submodules 4$(package)_suffix=everywhere-src-$($(package)_version).tar.xz 5$(package)_file_name=qtbase-$($(package)_suffix) 6$(package)_sha256_hash=1c1b4e33137ca77881074c140d54c3c9747e845a31338cfe8680f171f0bc3a39 7$(package)_linux_dependencies=freetype fontconfig libxcb libxkbcommon 8$(package)_qt_libs=corelib network widgets gui plugins testlib 9$(package)_linguist_tools = lrelease lupdate lconvert 10$(package)_patches = qt.pro qttools_src.pro 11$(package)_patches += fix_qt_pkgconfig.patch mac-qmake.conf fix_no_printer.patch no-xlib.patch 12$(package)_patches+= fix_android_qmake_conf.patch fix_android_jni_static.patch dont_hardcode_pwd.patch 13$(package)_patches+= no_sdk_version_check.patch 14$(package)_patches+= fix_lib_paths.patch fix_android_pch.patch 15$(package)_patches+= qtbase-moc-ignore-gcc-macro.patch fix_limits_header.patch 16 17$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix) 18$(package)_qttranslations_sha256_hash=577b0668a777eb2b451c61e8d026d79285371597ce9df06b6dee6c814164b7c3 19 20$(package)_qttools_file_name=qttools-$($(package)_suffix) 21$(package)_qttools_sha256_hash=98b2aaca230458f65996f3534fd471d2ffd038dd58ac997c0589c06dc2385b4f 22 23$(package)_extra_sources = $($(package)_qttranslations_file_name) 24$(package)_extra_sources += $($(package)_qttools_file_name) 25 26define $(package)_set_vars 27$(package)_config_opts_release = -release 28$(package)_config_opts_release += -silent 29$(package)_config_opts_debug = -debug 30$(package)_config_opts_debug += -optimized-tools 31$(package)_config_opts += -bindir $(build_prefix)/bin 32$(package)_config_opts += -c++std c++1z 33$(package)_config_opts += -confirm-license 34$(package)_config_opts += -hostprefix $(build_prefix) 35$(package)_config_opts += -no-compile-examples 36$(package)_config_opts += -no-cups 37$(package)_config_opts += -no-egl 38$(package)_config_opts += -no-eglfs 39$(package)_config_opts += -no-freetype 40$(package)_config_opts += -no-gif 41$(package)_config_opts += -no-glib 42$(package)_config_opts += -no-icu 43$(package)_config_opts += -no-ico 44$(package)_config_opts += -no-iconv 45$(package)_config_opts += -no-kms 46$(package)_config_opts += -no-linuxfb 47$(package)_config_opts += -no-libjpeg 48$(package)_config_opts += -no-libproxy 49$(package)_config_opts += -no-libudev 50$(package)_config_opts += -no-mtdev 51$(package)_config_opts += -no-openssl 52$(package)_config_opts += -no-openvg 53$(package)_config_opts += -no-reduce-relocations 54$(package)_config_opts += -no-sctp 55$(package)_config_opts += -no-securetransport 56$(package)_config_opts += -no-sql-db2 57$(package)_config_opts += -no-sql-ibase 58$(package)_config_opts += -no-sql-oci 59$(package)_config_opts += -no-sql-tds 60$(package)_config_opts += -no-sql-mysql 61$(package)_config_opts += -no-sql-odbc 62$(package)_config_opts += -no-sql-psql 63$(package)_config_opts += -no-sql-sqlite 64$(package)_config_opts += -no-sql-sqlite2 65$(package)_config_opts += -no-system-proxies 66$(package)_config_opts += -no-use-gold-linker 67$(package)_config_opts += -nomake examples 68$(package)_config_opts += -nomake tests 69$(package)_config_opts += -nomake tools 70$(package)_config_opts += -opensource 71$(package)_config_opts += -pkg-config 72$(package)_config_opts += -prefix $(host_prefix) 73$(package)_config_opts += -qt-libpng 74$(package)_config_opts += -qt-pcre 75$(package)_config_opts += -qt-harfbuzz 76$(package)_config_opts += -qt-zlib 77$(package)_config_opts += -static 78$(package)_config_opts += -v 79$(package)_config_opts += -no-feature-bearermanagement 80$(package)_config_opts += -no-feature-colordialog 81$(package)_config_opts += -no-feature-commandlineparser 82$(package)_config_opts += -no-feature-concurrent 83$(package)_config_opts += -no-feature-dial 84$(package)_config_opts += -no-feature-fontcombobox 85$(package)_config_opts += -no-feature-ftp 86$(package)_config_opts += -no-feature-http 87$(package)_config_opts += -no-feature-image_heuristic_mask 88$(package)_config_opts += -no-feature-keysequenceedit 89$(package)_config_opts += -no-feature-lcdnumber 90$(package)_config_opts += -no-feature-networkdiskcache 91$(package)_config_opts += -no-feature-networkproxy 92$(package)_config_opts += -no-feature-pdf 93$(package)_config_opts += -no-feature-printdialog 94$(package)_config_opts += -no-feature-printer 95$(package)_config_opts += -no-feature-printpreviewdialog 96$(package)_config_opts += -no-feature-printpreviewwidget 97$(package)_config_opts += -no-feature-sessionmanager 98$(package)_config_opts += -no-feature-socks5 99$(package)_config_opts += -no-feature-sql 100$(package)_config_opts += -no-feature-sqlmodel 101$(package)_config_opts += -no-feature-statemachine 102$(package)_config_opts += -no-feature-syntaxhighlighter 103$(package)_config_opts += -no-feature-textbrowser 104$(package)_config_opts += -no-feature-textodfwriter 105$(package)_config_opts += -no-feature-topleveldomain 106$(package)_config_opts += -no-feature-udpsocket 107$(package)_config_opts += -no-feature-undocommand 108$(package)_config_opts += -no-feature-undogroup 109$(package)_config_opts += -no-feature-undostack 110$(package)_config_opts += -no-feature-undoview 111$(package)_config_opts += -no-feature-vnc 112$(package)_config_opts += -no-feature-wizard 113$(package)_config_opts += -no-feature-xml 114 115$(package)_config_opts_darwin = -no-dbus 116$(package)_config_opts_darwin += -no-opengl 117$(package)_config_opts_darwin += -pch 118$(package)_config_opts_darwin += -no-feature-corewlan 119$(package)_config_opts_darwin += QMAKE_MACOSX_DEPLOYMENT_TARGET=$(OSX_MIN_VERSION) 120 121ifneq ($(build_os),darwin) 122$(package)_config_opts_darwin += -xplatform macx-clang-linux 123$(package)_config_opts_darwin += -device-option MAC_SDK_PATH=$(OSX_SDK) 124$(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSION) 125$(package)_config_opts_darwin += -device-option CROSS_COMPILE="$(host)-" 126$(package)_config_opts_darwin += -device-option MAC_TARGET=$(host) 127$(package)_config_opts_darwin += -device-option XCODE_VERSION=$(XCODE_VERSION) 128endif 129 130# for macOS on Apple Silicon (ARM) see https://bugreports.qt.io/browse/QTBUG-85279 131$(package)_config_opts_aarch64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS=arm64 132 133$(package)_config_opts_linux = -qt-xcb 134$(package)_config_opts_linux += -no-xcb-xlib 135$(package)_config_opts_linux += -no-feature-xlib 136$(package)_config_opts_linux += -system-freetype 137$(package)_config_opts_linux += -fontconfig 138$(package)_config_opts_linux += -no-opengl 139$(package)_config_opts_linux += -no-feature-vulkan 140$(package)_config_opts_linux += -dbus-runtime 141$(package)_config_opts_arm_linux += -platform linux-g++ -xplatform bitcoin-linux-g++ 142$(package)_config_opts_i686_linux = -xplatform linux-g++-32 143$(package)_config_opts_x86_64_linux = -xplatform linux-g++-64 144$(package)_config_opts_aarch64_linux = -xplatform linux-aarch64-gnu-g++ 145$(package)_config_opts_powerpc64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ 146$(package)_config_opts_powerpc64le_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ 147$(package)_config_opts_riscv64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ 148$(package)_config_opts_s390x_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ 149 150$(package)_config_opts_mingw32 = -no-opengl 151$(package)_config_opts_mingw32 += -no-dbus 152$(package)_config_opts_mingw32 += -xplatform win32-g++ 153$(package)_config_opts_mingw32 += "QMAKE_CFLAGS = '$($(package)_cflags) $($(package)_cppflags)'" 154$(package)_config_opts_mingw32 += "QMAKE_CXXFLAGS = '$($(package)_cflags) $($(package)_cppflags)'" 155$(package)_config_opts_mingw32 += "QMAKE_LFLAGS = '$($(package)_ldflags)'" 156$(package)_config_opts_mingw32 += -device-option CROSS_COMPILE="$(host)-" 157$(package)_config_opts_mingw32 += -pch 158 159$(package)_config_opts_android = -xplatform android-clang 160$(package)_config_opts_android += -android-sdk $(ANDROID_SDK) 161$(package)_config_opts_android += -android-ndk $(ANDROID_NDK) 162$(package)_config_opts_android += -android-ndk-platform android-$(ANDROID_API_LEVEL) 163$(package)_config_opts_android += -device-option CROSS_COMPILE="$(host)-" 164$(package)_config_opts_android += -egl 165$(package)_config_opts_android += -qpa xcb 166$(package)_config_opts_android += -no-eglfs 167$(package)_config_opts_android += -no-dbus 168$(package)_config_opts_android += -opengl es2 169$(package)_config_opts_android += -qt-freetype 170$(package)_config_opts_android += -no-fontconfig 171$(package)_config_opts_android += -L $(host_prefix)/lib 172$(package)_config_opts_android += -I $(host_prefix)/include 173$(package)_config_opts_android += -pch 174$(package)_config_opts_android += -no-feature-vulkan 175 176$(package)_config_opts_aarch64_android += -android-arch arm64-v8a 177$(package)_config_opts_armv7a_android += -android-arch armeabi-v7a 178$(package)_config_opts_x86_64_android += -android-arch x86_64 179$(package)_config_opts_i686_android += -android-arch i686 180endef 181 182define $(package)_fetch_cmds 183$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \ 184$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttranslations_file_name),$($(package)_qttranslations_file_name),$($(package)_qttranslations_sha256_hash)) && \ 185$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash)) 186endef 187 188define $(package)_extract_cmds 189 mkdir -p $($(package)_extract_dir) && \ 190 echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \ 191 echo "$($(package)_qttranslations_sha256_hash) $($(package)_source_dir)/$($(package)_qttranslations_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ 192 echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ 193 $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ 194 mkdir qtbase && \ 195 tar --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \ 196 mkdir qttranslations && \ 197 tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \ 198 mkdir qttools && \ 199 tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools 200endef 201 202# Preprocessing steps work as follows: 203# 204# 1. Apply our patches to the extracted source. See each patch for more info. 205# 206# 2. Create a macOS-Clang-Linux mkspec using our mac-qmake.conf. 207# 208# 3. After making a copy of the mkspec for the linux-arm-gnueabi host, named 209# bitcoin-linux-g++, replace instances of linux-arm-gnueabi with $(host). This 210# way we can generically support hosts like riscv64-linux-gnu, which Qt doesn't 211# ship a mkspec for. See it's usage in config_opts_* above. 212# 213# 4. Put our C, CXX and LD FLAGS into gcc-base.conf. Only used for non-host builds. 214# 215# 5. Do similar for the win32-g++ mkspec. 216# 217# 6. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466. 218# 219# 7. Adjust a regex in toolchain.prf, to accommodate Guix's usage of 220# CROSS_LIBRARY_PATH. See #15277. 221define $(package)_preprocess_cmds 222 cp $($(package)_patch_dir)/qt.pro qt.pro && \ 223 cp $($(package)_patch_dir)/qttools_src.pro qttools/src/src.pro && \ 224 patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \ 225 patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \ 226 patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch && \ 227 patch -p1 -i $($(package)_patch_dir)/fix_android_qmake_conf.patch && \ 228 patch -p1 -i $($(package)_patch_dir)/fix_android_jni_static.patch && \ 229 patch -p1 -i $($(package)_patch_dir)/fix_android_pch.patch && \ 230 patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \ 231 patch -p1 -i $($(package)_patch_dir)/no_sdk_version_check.patch && \ 232 patch -p1 -i $($(package)_patch_dir)/fix_lib_paths.patch && \ 233 patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \ 234 patch -p1 -i $($(package)_patch_dir)/fix_limits_header.patch && \ 235 mkdir -p qtbase/mkspecs/macx-clang-linux &&\ 236 cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\ 237 cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \ 238 cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \ 239 sed -i.old "s/arm-linux-gnueabi-/$(host)-/g" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ 240 echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ 241 echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ 242 echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ 243 sed -i.old "s|QMAKE_CC = \$$$$\$$$${CROSS_COMPILE}clang|QMAKE_CC = $($(package)_cc)|" qtbase/mkspecs/common/clang.conf && \ 244 sed -i.old "s|QMAKE_CXX = \$$$$\$$$${CROSS_COMPILE}clang++|QMAKE_CXX = $($(package)_cxx)|" qtbase/mkspecs/common/clang.conf && \ 245 sed -i.old "s/LIBRARY_PATH/(CROSS_)?\0/g" qtbase/mkspecs/features/toolchain.prf 246endef 247 248define $(package)_config_cmds 249 export PKG_CONFIG_SYSROOT_DIR=/ && \ 250 export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \ 251 export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \ 252 cd qtbase && \ 253 ./configure -top-level $($(package)_config_opts) 254endef 255 256define $(package)_build_cmds 257 $(MAKE) 258endef 259 260define $(package)_stage_cmds 261 $(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \ 262 $(MAKE) -C qttools/src/linguist INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_linguist_tools))) && \ 263 $(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets 264endef 265 266define $(package)_postprocess_cmds 267 rm -rf native/mkspecs/ native/lib/ lib/cmake/ && \ 268 rm -f lib/lib*.la 269endef 270