mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
depends: Fully determine path for darwin_{CC,CXX}
Instead of doing the awkward /bin path prepending at config.site creation time, set darwin_{CC,CXX} in a way that fully determines the program's path (clang/clang++) similar to how AC_PATH_{TOOL,PROG} would do. Also see the added comment block in depends/Makefile for more context on determining $PATH for our config.site.
This commit is contained in:
parent
8033110741
commit
880660acfa
2 changed files with 54 additions and 15 deletions
|
@ -167,11 +167,7 @@ $(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain)
|
||||||
include funcs.mk
|
include funcs.mk
|
||||||
|
|
||||||
binutils_path=$($($(host_arch)_$(host_os)_native_binutils)_prefixbin)
|
binutils_path=$($($(host_arch)_$(host_os)_native_binutils)_prefixbin)
|
||||||
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
|
|
||||||
toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin)
|
|
||||||
else
|
|
||||||
toolchain_path=
|
|
||||||
endif
|
|
||||||
final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in)
|
final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in)
|
||||||
final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH))
|
final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH))
|
||||||
$(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
|
$(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
|
||||||
|
@ -182,11 +178,35 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
|
||||||
$(AT)cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); )
|
$(AT)cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); )
|
||||||
$(AT)touch $@
|
$(AT)touch $@
|
||||||
|
|
||||||
|
# $PATH is not preserved between ./configure and make by convention. Its
|
||||||
|
# modification and overriding at ./configure time is (as I understand it)
|
||||||
|
# supposed to be captured by the AC_{PROG_{,OBJ}CXX,PATH_{PROG,TOOL}} macros,
|
||||||
|
# which will expand the program names to their full absolute paths. The notable
|
||||||
|
# exception is command line overriding: ./configure CC=clang, which skips the
|
||||||
|
# program name expansion step, and works because the user implicitly indicates
|
||||||
|
# with CC=clang that clang will be available in $PATH at all times, and is most
|
||||||
|
# likely part of the user's system.
|
||||||
|
#
|
||||||
|
# Therefore, when we "seed the autoconf cache"/"override well-known program
|
||||||
|
# vars" by setting AR=<blah> in our config.site, either one of two things needs
|
||||||
|
# to be true for the build system to work correctly:
|
||||||
|
#
|
||||||
|
# 1. If we refer to the program by name (e.g. AR=riscv64-gnu-linux-ar), the
|
||||||
|
# tool needs to be available in $PATH at all times.
|
||||||
|
#
|
||||||
|
# 2. If the tool is _**not**_ expected to be available in $PATH at all times
|
||||||
|
# (such as is the case for our native_cctools binutils tools), it needs to
|
||||||
|
# be referred to by its absolute path, such as would be output by the
|
||||||
|
# AC_PATH_{PROG,TOOL} macros.
|
||||||
|
#
|
||||||
|
# Minor note: it is also okay to refer to tools by their absolute path even if
|
||||||
|
# we expect them to be available in $PATH at all times, more specificity does
|
||||||
|
# not hurt.
|
||||||
$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id)
|
$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id)
|
||||||
$(AT)@mkdir -p $(@D)
|
$(AT)@mkdir -p $(@D)
|
||||||
$(AT)sed -e 's|@HOST@|$(host)|' \
|
$(AT)sed -e 's|@HOST@|$(host)|' \
|
||||||
-e 's|@CC@|$(toolchain_path)$(host_CC)|' \
|
-e 's|@CC@|$(host_CC)|' \
|
||||||
-e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \
|
-e 's|@CXX@|$(host_CXX)|' \
|
||||||
-e 's|@AR@|$(binutils_path)$(host_AR)|' \
|
-e 's|@AR@|$(binutils_path)$(host_AR)|' \
|
||||||
-e 's|@RANLIB@|$(binutils_path)$(host_RANLIB)|' \
|
-e 's|@RANLIB@|$(binutils_path)$(host_RANLIB)|' \
|
||||||
-e 's|@NM@|$(binutils_path)$(host_NM)|' \
|
-e 's|@NM@|$(binutils_path)$(host_NM)|' \
|
||||||
|
|
|
@ -7,8 +7,33 @@ LD64_VERSION=530
|
||||||
OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers
|
OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers
|
||||||
|
|
||||||
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
|
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
|
||||||
|
# FORCE_USE_SYSTEM_CLANG is empty, so we use our depends-managed, pinned clang
|
||||||
|
# from llvm.org
|
||||||
|
|
||||||
|
# The native_cctools package is what provides clang when FORCE_USE_SYSTEM_CLANG
|
||||||
|
# is empty
|
||||||
|
darwin_native_toolchain=native_cctools
|
||||||
|
|
||||||
|
clang_prog=$(build_prefix)/bin/clang
|
||||||
|
clangxx_prog=$(clang_prog)++
|
||||||
|
|
||||||
clang_resource_dir=$(build_prefix)/lib/clang/$(native_cctools_clang_version)
|
clang_resource_dir=$(build_prefix)/lib/clang/$(native_cctools_clang_version)
|
||||||
else
|
else
|
||||||
|
# FORCE_USE_SYSTEM_CLANG is non-empty, so we use the clang from the user's
|
||||||
|
# system
|
||||||
|
|
||||||
|
darwin_native_toolchain=
|
||||||
|
|
||||||
|
# We can't just use $(shell command -v clang) because GNU Make handles builtins
|
||||||
|
# in a special way and doesn't know that `command` is a POSIX-standard builtin
|
||||||
|
# prior to 1af314465e5dfe3e8baa839a32a72e83c04f26ef, first released in v4.2.90.
|
||||||
|
# At the time of writing, GNU Make v4.2.1 is still being used in supported
|
||||||
|
# distro releases.
|
||||||
|
#
|
||||||
|
# Source: https://lists.gnu.org/archive/html/bug-make/2017-11/msg00017.html
|
||||||
|
clang_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang")
|
||||||
|
clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
|
||||||
|
|
||||||
clang_resource_dir=$(shell clang -print-resource-dir)
|
clang_resource_dir=$(shell clang -print-resource-dir)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -62,7 +87,7 @@ endif
|
||||||
darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
||||||
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
||||||
-u LIBRARY_PATH \
|
-u LIBRARY_PATH \
|
||||||
clang --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
$(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
||||||
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
||||||
--sysroot=$(OSX_SDK) \
|
--sysroot=$(OSX_SDK) \
|
||||||
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
|
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
|
||||||
|
@ -70,7 +95,7 @@ darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
||||||
darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
||||||
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
||||||
-u LIBRARY_PATH \
|
-u LIBRARY_PATH \
|
||||||
clang++ --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
$(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
||||||
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
||||||
--sysroot=$(OSX_SDK) \
|
--sysroot=$(OSX_SDK) \
|
||||||
-stdlib=libc++ -nostdinc++ \
|
-stdlib=libc++ -nostdinc++ \
|
||||||
|
@ -88,10 +113,4 @@ darwin_debug_CFLAGS=-O1
|
||||||
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
|
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
|
||||||
|
|
||||||
darwin_native_binutils=native_cctools
|
darwin_native_binutils=native_cctools
|
||||||
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
|
|
||||||
darwin_native_toolchain=native_cctools
|
|
||||||
else
|
|
||||||
darwin_native_toolchain=
|
|
||||||
endif
|
|
||||||
|
|
||||||
darwin_cmake_system=Darwin
|
darwin_cmake_system=Darwin
|
||||||
|
|
Loading…
Add table
Reference in a new issue