Skip to content

Commit

Permalink
depends: Use vendored Clang for native compilation
Browse files Browse the repository at this point in the history
Clang is used for compiling C/C++ dependencies, as well as the Zcash
binaries themselves. GCC is still required for compiling native
toolchain dependencies (such as ccache).
  • Loading branch information
str4d committed Oct 12, 2020
1 parent d071e31 commit d306b72
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 39 deletions.
22 changes: 16 additions & 6 deletions depends/hosts/default.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
default_host_CC = $(host_toolchain)gcc
default_host_CXX = $(host_toolchain)g++
default_host_AR = $(host_toolchain)ar
default_host_RANLIB = $(host_toolchain)ranlib
default_host_STRIP = $(host_toolchain)strip
# Flag explanations:
#
# -B$(build_prefix)/bin
#
# Explicitly point to our binaries (e.g. cctools) so that they are
# ensured to be found and preferred over other possibilities.
#
default_host_CC = clang -target $(host) -B$(build_prefix)/bin
default_host_CXX = clang++ -target $(host) -B$(build_prefix)/bin -stdlib=libc++
default_host_AR = llvm-ar
default_host_RANLIB = llvm-ranlib
default_host_STRIP = llvm-strip
default_host_LIBTOOL = $(host_toolchain)libtool
default_host_INSTALL_NAME_TOOL = $(host_toolchain)install_name_tool
default_host_OTOOL = $(host_toolchain)otool
default_host_NM = $(host_toolchain)nm
default_host_NM = llvm-nm

$(host_os)_native_binutils?=native_clang
$(host_os)_native_toolchain?=native_clang

define add_host_tool_func
$(host_os)_$1?=$$(default_host_$1)
Expand Down
16 changes: 0 additions & 16 deletions depends/hosts/freebsd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,7 @@ freebsd_debug_CXXFLAGS=$(freebsd_debug_CFLAGS)

freebsd_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

ifeq (86,$(findstring 86,$(build_arch)))
i686_freebsd_CC=gcc -m32
i686_freebsd_CXX=g++ -m32
i686_freebsd_AR=ar
i686_freebsd_RANLIB=ranlib
i686_freebsd_NM=nm
i686_freebsd_STRIP=strip

x86_64_freebsd_CC=gcc -m64
x86_64_freebsd_CXX=g++ -m64
x86_64_freebsd_AR=ar
x86_64_freebsd_RANLIB=ranlib
x86_64_freebsd_NM=nm
x86_64_freebsd_STRIP=strip
else
i686_freebsd_CC=$(default_host_CC) -m32
i686_freebsd_CXX=$(default_host_CXX) -m32
x86_64_freebsd_CC=$(default_host_CC) -m64
x86_64_freebsd_CXX=$(default_host_CXX) -m64
endif
16 changes: 0 additions & 16 deletions depends/hosts/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,7 @@ linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)

linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

ifeq (86,$(findstring 86,$(build_arch)))
i686_linux_CC=gcc -m32
i686_linux_CXX=g++ -m32
i686_linux_AR=ar
i686_linux_RANLIB=ranlib
i686_linux_NM=nm
i686_linux_STRIP=strip

x86_64_linux_CC=gcc -m64
x86_64_linux_CXX=g++ -m64
x86_64_linux_AR=ar
x86_64_linux_RANLIB=ranlib
x86_64_linux_NM=nm
x86_64_linux_STRIP=strip
else
i686_linux_CC=$(default_host_CC) -m32
i686_linux_CXX=$(default_host_CXX) -m32
x86_64_linux_CC=$(default_host_CC) -m64
x86_64_linux_CXX=$(default_host_CXX) -m64
endif
2 changes: 1 addition & 1 deletion depends/packages/boost.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win3
$(package)_config_opts_x86_64_mingw32=address-model=64
$(package)_config_opts_i686_mingw32=address-model=32
$(package)_config_opts_i686_linux=address-model=32 architecture=x86
$(package)_toolset_$(host_os)=gcc
$(package)_toolset_$(host_os)=clang
$(package)_archiver_$(host_os)=$($(package)_ar)
$(package)_toolset_darwin=darwin
$(package)_archiver_darwin=$($(package)_libtool)
Expand Down

0 comments on commit d306b72

Please sign in to comment.