Merge bitcoin/bitcoin#25838: build, qt: Use mkspecs/bitcoin-linux-g++ for all Linux hosts

59f2cc23e0 build, qt: Use `mkspecs/bitcoin-linux-g++` for all Linux hosts (Hennadii Stepanov)
d61f6677e3 build: Add objcopy host tool (Hennadii Stepanov)
a2e733b946 doc: Remove no longer needed comments (Hennadii Stepanov)
968ea66537 build: Adjust `qt/guix_cross_lib_path.patch` (Hennadii Stepanov)

Pull request description:

  This PR is an alternative to bitcoin/bitcoin#25822.

  Fixes bitcoin/bitcoin#22184.

  Also added some minor patch and comment improvements.

  Guix build on `x86_64`:
  ```
  e5d3e7963339085fce3074c610613f9b6f2daf4f94ca86585c2ef276ac451c2f  guix-build-59f2cc23e0d3/output/aarch64-linux-gnu/SHA256SUMS.part
  43bc602bf372996069ba18dfbd6a5615b60c259a26639f59cb86b25457578b2b  guix-build-59f2cc23e0d3/output/aarch64-linux-gnu/bitcoin-59f2cc23e0d3-aarch64-linux-gnu-debug.tar.gz
  ec894ba0c4036e09e93fbbbf2473992154b73de6f3a2beb22c69ae9dc48337bb  guix-build-59f2cc23e0d3/output/aarch64-linux-gnu/bitcoin-59f2cc23e0d3-aarch64-linux-gnu.tar.gz
  0b2edbb8465da7bec04b7ee9856a43bf6b06714dedabe24df0e63b56d6cb6f30  guix-build-59f2cc23e0d3/output/arm-linux-gnueabihf/SHA256SUMS.part
  7131d53947ea70a900727342e34a53d6dd6c32cff032e2e68d783ce1ed25bc97  guix-build-59f2cc23e0d3/output/arm-linux-gnueabihf/bitcoin-59f2cc23e0d3-arm-linux-gnueabihf-debug.tar.gz
  0c22e7459c26edf3c503a7cb3de6e727aa98b2950c93f6558f0befcc42391d13  guix-build-59f2cc23e0d3/output/arm-linux-gnueabihf/bitcoin-59f2cc23e0d3-arm-linux-gnueabihf.tar.gz
  4b95d4a4f159aae8fbe0c842280872908da399f95ea9d3abb8c8889015e56c18  guix-build-59f2cc23e0d3/output/arm64-apple-darwin/SHA256SUMS.part
  d1e343dbb089d4747fdbed278b4234974861bd35a7a7d74c03b6fe9267e280a2  guix-build-59f2cc23e0d3/output/arm64-apple-darwin/bitcoin-59f2cc23e0d3-arm64-apple-darwin-unsigned.dmg
  dc8851cad1e5d8e5538f93c42184fc11cac3320ef423425aa37567f6911527f8  guix-build-59f2cc23e0d3/output/arm64-apple-darwin/bitcoin-59f2cc23e0d3-arm64-apple-darwin-unsigned.tar.gz
  5fbeb911e207467a96ac0559c5f62bead6d1d382a8808bfd170c2475ebfe78e2  guix-build-59f2cc23e0d3/output/arm64-apple-darwin/bitcoin-59f2cc23e0d3-arm64-apple-darwin.tar.gz
  b96183a15be11717dc5b250e1c9921c118d26c613de2e5bee1bf3f70f2d1d3fe  guix-build-59f2cc23e0d3/output/dist-archive/bitcoin-59f2cc23e0d3.tar.gz
  90ee33b1013e30d3679f96c2496767b47493125329b5ff93c91bcf94e5e6ffcd  guix-build-59f2cc23e0d3/output/powerpc64-linux-gnu/SHA256SUMS.part
  7e52a6a8f4f739a7ab276c50bb42f7803856c8a15b5fdde47ed2d076492102f8  guix-build-59f2cc23e0d3/output/powerpc64-linux-gnu/bitcoin-59f2cc23e0d3-powerpc64-linux-gnu-debug.tar.gz
  21d59e074f9a89c6bbb6f6eb58084eddd1c1e24fe338b25c6d58080efd17d0bb  guix-build-59f2cc23e0d3/output/powerpc64-linux-gnu/bitcoin-59f2cc23e0d3-powerpc64-linux-gnu.tar.gz
  64375860ca1ca30951f3b4b68e5fc56421437486caccd6d18a6c63c104a1dc04  guix-build-59f2cc23e0d3/output/powerpc64le-linux-gnu/SHA256SUMS.part
  0f568e92a14f849c5cd36b09628ba79537c2421227b43979ed743bbd543d1e82  guix-build-59f2cc23e0d3/output/powerpc64le-linux-gnu/bitcoin-59f2cc23e0d3-powerpc64le-linux-gnu-debug.tar.gz
  8dbe29a4620fc07c70e2748927adfe32604900977d5fe9689930024dfae5350b  guix-build-59f2cc23e0d3/output/powerpc64le-linux-gnu/bitcoin-59f2cc23e0d3-powerpc64le-linux-gnu.tar.gz
  022644aabcd458f3c24931dab4c34db5bdf96209585eb82739c4b88536a09e58  guix-build-59f2cc23e0d3/output/riscv64-linux-gnu/SHA256SUMS.part
  5a0d54f8837a3132b42926f4c8bb45127fd2ef3d49cd238cd1889ca1255c79b1  guix-build-59f2cc23e0d3/output/riscv64-linux-gnu/bitcoin-59f2cc23e0d3-riscv64-linux-gnu-debug.tar.gz
  da3d43ec2cb1624503fc3bae2c4099b608fdd6d9a47cd3dd3c0c7e35b6031cff  guix-build-59f2cc23e0d3/output/riscv64-linux-gnu/bitcoin-59f2cc23e0d3-riscv64-linux-gnu.tar.gz
  bde0bc14ac320d91b7868dbe44ebb57cf8d74d35d21456d3ae71aced42d17922  guix-build-59f2cc23e0d3/output/x86_64-apple-darwin/SHA256SUMS.part
  95322c099de80d660350b383a10ca8a074fe80656b6917085e942c31696226ff  guix-build-59f2cc23e0d3/output/x86_64-apple-darwin/bitcoin-59f2cc23e0d3-x86_64-apple-darwin-unsigned.dmg
  78ad02298ccba816d03a929ad42570d2ed5af0942e1dd26d69e8f9b96112269f  guix-build-59f2cc23e0d3/output/x86_64-apple-darwin/bitcoin-59f2cc23e0d3-x86_64-apple-darwin-unsigned.tar.gz
  3fec9daf0bb52aba9218d3e62ef3970329757889a316a10708275e67d7930c8c  guix-build-59f2cc23e0d3/output/x86_64-apple-darwin/bitcoin-59f2cc23e0d3-x86_64-apple-darwin.tar.gz
  7790af2005756f737986da24da349e406e765af4300ee7e391660e4d1fe6025e  guix-build-59f2cc23e0d3/output/x86_64-linux-gnu/SHA256SUMS.part
  8b97e9f9a974beacfb6b9661b6fe562a850047d40589f4fa9d069eb1692548c3  guix-build-59f2cc23e0d3/output/x86_64-linux-gnu/bitcoin-59f2cc23e0d3-x86_64-linux-gnu-debug.tar.gz
  77bb105155a72f2cfa6160bdb8c02e0621381005db0569dc8df6045b65dac0f8  guix-build-59f2cc23e0d3/output/x86_64-linux-gnu/bitcoin-59f2cc23e0d3-x86_64-linux-gnu.tar.gz
  15fbbbe58a2632dabadfa145e4e55103589102e67ec483187275c522d98298bd  guix-build-59f2cc23e0d3/output/x86_64-w64-mingw32/SHA256SUMS.part
  d50afc0061812aadca68ac530e301937e69893881d184ba4c38b37e4ff1a74ba  guix-build-59f2cc23e0d3/output/x86_64-w64-mingw32/bitcoin-59f2cc23e0d3-win64-debug.zip
  a86a5cf85036bb45d2233b0d83bf21f5cd26f463a7a794077995622a47589940  guix-build-59f2cc23e0d3/output/x86_64-w64-mingw32/bitcoin-59f2cc23e0d3-win64-setup-unsigned.exe
  ca06c5ba64f0a0961c11c1573c04f142fdf369da29f4e8e54f89f3b98f6964ec  guix-build-59f2cc23e0d3/output/x86_64-w64-mingw32/bitcoin-59f2cc23e0d3-win64-unsigned.tar.gz
  b120fdcde18f330c462d6f7100abeb8cc6e26d9034f50c0957fa40067be3dea9  guix-build-59f2cc23e0d3/output/x86_64-w64-mingw32/bitcoin-59f2cc23e0d3-win64.zip
  ```

ACKs for top commit:
  fanquake:
    ACK 59f2cc23e0 - Making this more generic also fixes other Qt builds [that were previously failing](https://github.com/bitcoin/bitcoin/pull/25838#issuecomment-1214166251).

Tree-SHA512: 465f506964293429e55222b40a3927261aa5abd84ecb7bc1257e1b25a8d944967c4aa6e6d7d4afc25ea401d19e5c2d3eb093e073fc29478a8b1626d62cd53275
This commit is contained in:
fanquake 2022-08-15 10:31:31 +01:00
commit cc1efe909e
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1
3 changed files with 12 additions and 21 deletions

View File

@ -9,6 +9,7 @@ default_host_RANLIB = $(host_toolchain)ranlib
default_host_STRIP = $(host_toolchain)strip
default_host_LIBTOOL = $(host_toolchain)libtool
default_host_NM = $(host_toolchain)nm
default_host_OBJCOPY = $(host_toolchain)objcopy
define add_host_tool_func
ifneq ($(filter $(origin $1),undefined default),)
@ -33,5 +34,5 @@ host_$1 = $$($(host_arch)_$(host_os)_$1)
host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1)
endef
$(foreach tool,CC CXX AR RANLIB STRIP NM LIBTOOL OTOOL INSTALL_NAME_TOOL DSYMUTIL,$(eval $(call add_host_tool_func,$(tool))))
$(foreach tool,CC CXX AR RANLIB STRIP LIBTOOL NM OBJCOPY OTOOL INSTALL_NAME_TOOL DSYMUTIL,$(eval $(call add_host_tool_func,$(tool))))
$(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags))))

View File

@ -159,18 +159,10 @@ $(package)_config_opts_linux += -dbus-runtime
ifneq ($(LTO),)
$(package)_config_opts_linux += -ltcg
endif
$(package)_config_opts_arm_linux += -platform linux-g++ -xplatform bitcoin-linux-g++
$(package)_config_opts_i686_linux = -xplatform linux-g++-32
$(package)_config_opts_linux += -platform linux-g++ -xplatform bitcoin-linux-g++
ifneq (,$(findstring -stdlib=libc++,$($(1)_cxx)))
$(package)_config_opts_x86_64_linux = -xplatform linux-clang-libc++
else
$(package)_config_opts_x86_64_linux = -xplatform linux-g++-64
endif
$(package)_config_opts_aarch64_linux = -xplatform linux-aarch64-gnu-g++
$(package)_config_opts_powerpc64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++
$(package)_config_opts_powerpc64le_linux = -platform linux-g++ -xplatform bitcoin-linux-g++
$(package)_config_opts_riscv64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++
$(package)_config_opts_s390x_linux = -platform linux-g++ -xplatform bitcoin-linux-g++
$(package)_config_opts_mingw32 = -no-opengl
$(package)_config_opts_mingw32 += -no-dbus
@ -230,18 +222,11 @@ endef
# 2. Create a macOS-Clang-Linux mkspec using our mac-qmake.conf.
#
# 3. After making a copy of the mkspec for the linux-arm-gnueabi host, named
# bitcoin-linux-g++, replace instances of linux-arm-gnueabi with $(host). This
# way we can generically support hosts like riscv64-linux-gnu, which Qt doesn't
# ship a mkspec for. See it's usage in config_opts_* above.
# bitcoin-linux-g++, replace tool names with $($($(package)_type)_TOOL).
#
# 4. Put our C, CXX and LD FLAGS into gcc-base.conf. Only used for non-host builds.
#
# 5. Do similar for the win32-g++ mkspec.
#
# 6. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466.
#
# 7. Adjust a regex in toolchain.prf, to accommodate Guix's usage of
# CROSS_LIBRARY_PATH. See #15277.
# 5. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466.
define $(package)_preprocess_cmds
cp $($(package)_patch_dir)/qt.pro qt.pro && \
cp $($(package)_patch_dir)/qttools_src.pro qttools/src/src.pro && \
@ -261,7 +246,12 @@ define $(package)_preprocess_cmds
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \
sed -i.old "s/arm-linux-gnueabi-/$(host)-/g" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
sed -i.old "s|arm-linux-gnueabi-gcc|$($($(package)_type)_CC)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
sed -i.old "s|arm-linux-gnueabi-g++|$($($(package)_type)_CXX)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
sed -i.old "s|arm-linux-gnueabi-ar|$($($(package)_type)_AR)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
sed -i.old "s|arm-linux-gnueabi-objcopy|$($($(package)_type)_OBJCOPY)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
sed -i.old "s|arm-linux-gnueabi-nm|$($($(package)_type)_NM)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
sed -i.old "s|arm-linux-gnueabi-strip|$($($(package)_type)_STRIP)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \

View File

@ -4,7 +4,7 @@ See discussion in https://github.com/bitcoin/bitcoin/pull/15277.
--- a/qtbase/mkspecs/features/toolchain.prf
+++ b/qtbase/mkspecs/features/toolchain.prf
@@ -231,8 +231,8 @@ isEmpty($${target_prefix}.INCDIRS) {
@@ -236,8 +236,8 @@ isEmpty($${target_prefix}.INCDIRS) {
add_libraries = false
for (line, output) {
line ~= s/^[ \\t]*// # remove leading spaces