Merge bitcoin/bitcoin#29890: deploy: remove some tools when cross-compiling for macOS

1a9aa8d4ee build: better scope usage of -Wl,-headerpad_max_install_names (fanquake)
3bee51427a build: don't use install_name_tool for macOS deploy when cross-compiling (fanquake)
78b6b5c485 build: don't pass strip to macOS deploy if cross-compiling (fanquake)

Pull request description:

  Neither of these tools are actually used when we are cross-compiling for macOS. They are used when we have to adjust non-static libs during a deploy after building on a macOS machine. Simplies #29739 (will be rebased on top).

  Guix (aarch64):
  ```bash
  8f29bce75d7f574306a0e38d793e0e4e145b547a4b9e5a755a54976121d8ac41  guix-build-5afd3c302051/output/arm64-apple-darwin/SHA256SUMS.part
  9ba01fe46be715adcbe80f39dc7dbe449f32ca9d9b660da698f933aef3e6d80b  guix-build-5afd3c302051/output/arm64-apple-darwin/bitcoin-5afd3c302051-arm64-apple-darwin-unsigned.tar.gz
  37719437e951449341d0e10dcc4afe93e955d59de5312ce6351e1fa01b4927ac  guix-build-5afd3c302051/output/arm64-apple-darwin/bitcoin-5afd3c302051-arm64-apple-darwin-unsigned.zip
  06a79fc871dcd4290f5f7e7e9de19a5a535203d20279f4555d1c319d07abe2d0  guix-build-5afd3c302051/output/arm64-apple-darwin/bitcoin-5afd3c302051-arm64-apple-darwin.tar.gz
  98d2b8b37197dcad36a04eb2f3ff2130b859220a17b83a4186a78dcf0af4eafd  guix-build-5afd3c302051/output/dist-archive/bitcoin-5afd3c302051.tar.gz
  df63ff44ef41565ff13ce6dde5485173a18d5866ebc316df86f9ebd91fda18f5  guix-build-5afd3c302051/output/x86_64-apple-darwin/SHA256SUMS.part
  28362ce9e80d5e78db198efa5f89434fbe76ca91df5fde7455da4d50ceb8523a  guix-build-5afd3c302051/output/x86_64-apple-darwin/bitcoin-5afd3c302051-x86_64-apple-darwin-unsigned.tar.gz
  534745b679eb9e8e408dd251a6bf0829e62e12f7a41772b8a57a044ded14208c  guix-build-5afd3c302051/output/x86_64-apple-darwin/bitcoin-5afd3c302051-x86_64-apple-darwin-unsigned.zip
  f53d0c9a1bb83d548c7d274c7d39653a3989fb1b4efec49e73dd1cac7c92074c  guix-build-5afd3c302051/output/x86_64-apple-darwin/bitcoin-5afd3c302051-x86_64-apple-darwin.tar.gz
  ```

ACKs for top commit:
  TheCharlatan:
    ACK 1a9aa8d4ee

Tree-SHA512: 0aa77ea4d6dc45c226806bb1758b6aa7e8ca17f91045bab4fc6891af7b9de476211cd5692c11cb9d5bcf59744fd86a2534812a77fe304ae10c3518e08fc412be
This commit is contained in:
merge-script 2024-04-25 21:21:42 +08:00
commit d48d55e0d3
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
9 changed files with 9 additions and 17 deletions

View file

@ -126,7 +126,7 @@ $(OSX_ZIP): deploydir
cd $(APP_DIST_DIR) && find . | sort | $(ZIP) -X@ $@ cd $(APP_DIST_DIR) && find . | sort | $(ZIP) -X@ $@
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING) $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
INSTALL_NAME_TOOL=$(INSTALL_NAME_TOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) OTOOL=$(OTOOL) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR)
deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
endif !BUILD_DARWIN endif !BUILD_DARWIN

View file

@ -696,6 +696,9 @@ case $host in
TARGET_OS=darwin TARGET_OS=darwin
if test $cross_compiling != "yes"; then if test $cross_compiling != "yes"; then
BUILD_OS=darwin BUILD_OS=darwin
AX_CHECK_LINK_FLAG([-Wl,-headerpad_max_install_names], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-headerpad_max_install_names"], [], [$LDFLAG_WERROR])
AC_CHECK_PROG([BREW], [brew], [brew]) AC_CHECK_PROG([BREW], [brew], [brew])
if test "$BREW" = "brew"; then if test "$BREW" = "brew"; then
dnl These Homebrew packages may be keg-only, meaning that they won't be found dnl These Homebrew packages may be keg-only, meaning that they won't be found
@ -759,7 +762,6 @@ case $host in
;; ;;
*) *)
AC_PATH_TOOL([DSYMUTIL], [dsymutil], [dsymutil]) AC_PATH_TOOL([DSYMUTIL], [dsymutil], [dsymutil])
AC_PATH_TOOL([INSTALL_NAME_TOOL], [install_name_tool], [install_name_tool])
AC_PATH_TOOL([OTOOL], [otool], [otool]) AC_PATH_TOOL([OTOOL], [otool], [otool])
AC_PATH_PROG([ZIP], [zip], [zip]) AC_PATH_PROG([ZIP], [zip], [zip])
@ -772,7 +774,6 @@ case $host in
esac esac
fi fi
AX_CHECK_LINK_FLAG([-Wl,-headerpad_max_install_names], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-headerpad_max_install_names"], [], [$LDFLAG_WERROR])
CORE_CPPFLAGS="$CORE_CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0" CORE_CPPFLAGS="$CORE_CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0"
dnl ignore deprecated-declarations warnings coming from objcxx code dnl ignore deprecated-declarations warnings coming from objcxx code

View file

@ -66,9 +66,8 @@ building for macOS.
Apple's version of `binutils` (called `cctools`) contains lots of functionality missing in the Apple's version of `binutils` (called `cctools`) contains lots of functionality missing in the
FSF's `binutils`. In addition to extra linker options for frameworks and sysroots, several FSF's `binutils`. In addition to extra linker options for frameworks and sysroots, several
other tools are needed as well such as `install_name_tool`, `lipo`, and `nmedit`. These other tools are needed as well. These do not build under Linux, so they have been patched to
do not build under Linux, so they have been patched to do so. The work here was used as do so. The work here was used as a starting point: [mingwandroid/toolchain4](https://github.com/mingwandroid/toolchain4).
a starting point: [mingwandroid/toolchain4](https://github.com/mingwandroid/toolchain4).
In order to build a working toolchain, the following source packages are needed from In order to build a working toolchain, the following source packages are needed from
Apple: `cctools`, `dyld`, and `ld64`. Apple: `cctools`, `dyld`, and `ld64`.

View file

@ -234,7 +234,6 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
-e 's|@NM@|$(host_NM)|' \ -e 's|@NM@|$(host_NM)|' \
-e 's|@STRIP@|$(host_STRIP)|' \ -e 's|@STRIP@|$(host_STRIP)|' \
-e 's|@OTOOL@|$(host_OTOOL)|' \ -e 's|@OTOOL@|$(host_OTOOL)|' \
-e 's|@INSTALL_NAME_TOOL@|$(host_INSTALL_NAME_TOOL)|' \
-e 's|@DSYMUTIL@|$(host_DSYMUTIL)|' \ -e 's|@DSYMUTIL@|$(host_DSYMUTIL)|' \
-e 's|@build_os@|$(build_os)|' \ -e 's|@build_os@|$(build_os)|' \
-e 's|@host_os@|$(host_os)|' \ -e 's|@host_os@|$(host_os)|' \

View file

@ -5,7 +5,6 @@ build_darwin_RANLIB:=$(shell xcrun -f ranlib)
build_darwin_STRIP:=$(shell xcrun -f strip) build_darwin_STRIP:=$(shell xcrun -f strip)
build_darwin_OTOOL:=$(shell xcrun -f otool) build_darwin_OTOOL:=$(shell xcrun -f otool)
build_darwin_NM:=$(shell xcrun -f nm) build_darwin_NM:=$(shell xcrun -f nm)
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
build_darwin_DSYMUTIL:=$(shell xcrun -f dsymutil) build_darwin_DSYMUTIL:=$(shell xcrun -f dsymutil)
build_darwin_SHA256SUM=shasum -a 256 build_darwin_SHA256SUM=shasum -a 256
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
@ -18,7 +17,6 @@ darwin_RANLIB:=$(shell xcrun -f ranlib)
darwin_STRIP:=$(shell xcrun -f strip) darwin_STRIP:=$(shell xcrun -f strip)
darwin_OTOOL:=$(shell xcrun -f otool) darwin_OTOOL:=$(shell xcrun -f otool)
darwin_NM:=$(shell xcrun -f nm) darwin_NM:=$(shell xcrun -f nm)
darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
darwin_DSYMUTIL:=$(shell xcrun -f dsymutil) darwin_DSYMUTIL:=$(shell xcrun -f dsymutil)
darwin_native_binutils= darwin_native_binutils=
darwin_native_toolchain= darwin_native_toolchain=

View file

@ -12,7 +12,7 @@ build_$(build_os)_$1 ?= $$(default_build_$1)
build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1) build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1)
build_$1=$$(build_$(build_arch)_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1)
endef endef
$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL DSYMUTIL TOUCH,$(eval $(call add_build_tool_func,$(var)))) $(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL DSYMUTIL TOUCH,$(eval $(call add_build_tool_func,$(var))))
define add_build_flags_func define add_build_flags_func
build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1) build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1)
build_$1=$$(build_$(build_arch)_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1)

View file

@ -123,11 +123,6 @@ if test "@host_os@" = darwin; then
ac_cv_path_OTOOL="${OTOOL}" ac_cv_path_OTOOL="${OTOOL}"
fi fi
if test -n "@INSTALL_NAME_TOOL@"; then
INSTALL_NAME_TOOL="@INSTALL_NAME_TOOL@"
ac_cv_path_INSTALL_NAME_TOOL="${INSTALL_NAME_TOOL}"
fi
if test -n "@DSYMUTIL@"; then if test -n "@DSYMUTIL@"; then
DSYMUTIL="@DSYMUTIL@" DSYMUTIL="@DSYMUTIL@"
ac_cv_path_DSYMUTIL="${DSYMUTIL}" ac_cv_path_DSYMUTIL="${DSYMUTIL}"

View file

@ -39,7 +39,7 @@ llvm_config_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-config")
llvm_lib_dir=$(shell $(llvm_config_prog) --libdir) llvm_lib_dir=$(shell $(llvm_config_prog) --libdir)
endif endif
cctools_TOOLS=AR RANLIB STRIP NM OTOOL INSTALL_NAME_TOOL DSYMUTIL cctools_TOOLS=AR RANLIB STRIP NM OTOOL DSYMUTIL
# Make-only lowercase function # Make-only lowercase function
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1)))))))))))))))))))))))))) lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))

View file

@ -38,5 +38,5 @@ host_$1 = $$($(host_arch)_$(host_os)_$1)
host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1) host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1)
endef endef
$(foreach tool,CC CXX AR RANLIB STRIP NM OBJCOPY OTOOL INSTALL_NAME_TOOL DSYMUTIL,$(eval $(call add_host_tool_func,$(tool)))) $(foreach tool,CC CXX AR RANLIB STRIP NM OBJCOPY OTOOL DSYMUTIL,$(eval $(call add_host_tool_func,$(tool))))
$(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags)))) $(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags))))