Compare commits

...

9 Commits

  1. 3
      configure.ac
  2. 6
      depends/config.site.in
  3. 31
      depends/hosts/default.mk
  4. 14
      depends/packages/bdb.mk
  5. 13
      depends/packages/boost.mk
  6. 11
      depends/packages/googletest.mk
  7. 61
      depends/packages/libcxx.mk
  8. 62
      depends/packages/native_clang.mk
  9. 9
      src/Makefile.am

3
configure.ac

@ -404,6 +404,9 @@ dnl fi
*linux*)
TARGET_OS=linux
;;
*freebsd*)
LEVELDB_TARGET_FLAGS="-DOS_FREEBSD"
;;
*)
;;
esac

6
depends/config.site.in

@ -32,7 +32,11 @@ export PKG_CONFIG_LIBDIR=$depends_prefix/lib/pkgconfig
export PKG_CONFIG_PATH=$depends_prefix/share/pkgconfig
CPPFLAGS="-I$depends_prefix/include/ $CPPFLAGS"
LDFLAGS="-L$depends_prefix/lib $LDFLAGS"
if test x@host_os@ = xfreebsd; then
LDFLAGS="-L$depends_prefix/lib $LDFLAGS -static-libstdc++ -lcxxrt"
else
LDFLAGS="-L$depends_prefix/lib $LDFLAGS -static-libstdc++ -lc++abi"
fi
CC="@CC@"
CXX="@CXX@"

31
depends/hosts/default.mk

@ -1,17 +1,36 @@
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
ifneq ($(filter $(origin $1),undefined default),)
# Do not consider the well-known var $1 if it is undefined or is taking a value
# that is predefined by "make" (e.g. the make variable "CC" has a predefined
# value of "cc")
$(host_os)_$1?=$$(default_host_$1)
$(host_arch)_$(host_os)_$1?=$$($(host_os)_$1)
$(host_arch)_$(host_os)_$(release_type)_$1?=$$($(host_os)_$1)
else
$(host_os)_$1=$(or $($1),$($(host_os)_$1),$(default_host_$1))
$(host_arch)_$(host_os)_$1=$(or $($1),$($(host_arch)_$(host_os)_$1),$$($(host_os)_$1))
$(host_arch)_$(host_os)_$(release_type)_$1=$(or $($1),$($(host_arch)_$(host_os)_$(release_type)_$1),$$($(host_os)_$1))
endif
host_$1=$$($(host_arch)_$(host_os)_$1)
endef

14
depends/packages/bdb.mk

@ -5,8 +5,12 @@ $(package)_file_name=db-$($(package)_version).tar.gz
$(package)_sha256_hash=47612c8991aa9ac2f6be721267c8d3cdccf5ac83105df8e50809daea24e95dc7
$(package)_build_subdir=build_unix
ifneq ($(host_os),darwin)
$(package)_dependencies=libcxx
endif
define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication --enable-option-checking
$(package)_config_opts_mingw32=--enable-mingw
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic
@ -14,7 +18,13 @@ ifneq ($(build_os),darwin)
$(package)_config_opts_darwin=--disable-atomicsupport
endif
$(package)_config_opts_aarch64=--disable-atomicsupport
$(package)_cxxflags=-std=c++11
$(package)_cxxflags+=-std=c++17
ifeq ($(host_os),freebsd)
$(package)_ldflags+=-static-libstdc++ -lcxxrt
else
$(package)_ldflags+=-static-libstdc++ -lc++abi
endif
endef
define $(package)_preprocess_cmds

13
depends/packages/boost.mk

@ -6,12 +6,17 @@ $(package)_sha256_hash=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417c
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
$(package)_patches=fix-Solaris.patch
ifneq ($(host_os),darwin)
$(package)_dependencies+=libcxx
endif
define $(package)_set_vars
$(package)_config_opts_release=variant=release
$(package)_config_opts_debug=variant=debug
$(package)_config_opts=--layout=system --user-config=user-config.jam
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
$(package)_config_opts_freebsd=cxxflags=-fPIC
$(package)_config_opts_darwin=--toolset=gcc runtime-link=shared threadapi=pthread
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
$(package)_config_opts_x86_64_mingw32=address-model=64
@ -24,6 +29,14 @@ $(package)_archiver_darwin=$($(package)_ar)
$(package)_config_libraries=chrono,filesystem,program_options,system,thread,test
$(package)_cxxflags=-std=c++11 -fvisibility=hidden
$(package)_cxxflags_linux=-fPIC
$(package)_cxxflags_freebsd=-fPIC
ifeq ($(host_os),freebsd)
$(package)_ldflags+=-static-libstdc++ -lcxxrt
else
$(package)_ldflags+=-static-libstdc++ -lc++abi
endif
endef

11
depends/packages/googletest.mk

@ -5,10 +5,21 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_download_file=release-$($(package)_version).tar.gz
$(package)_sha256_hash=58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8
ifneq ($(host_os),darwin)
$(package)_dependencies+=libcxx
endif
define $(package)_set_vars
$(package)_cxxflags+=-std=c++11
$(package)_cxxflags_linux=-fPIC
$(package)_cxxflags_freebsd=-fPIC
ifeq ($(host_os),freebsd)
$(package)_ldflags+=-static-libstdc++ -lcxxrt
else
$(package)_ldflags+=-static-libstdc++ -lc++abi
endif
endef
ifeq ($(build_os),darwin)

61
depends/packages/libcxx.mk

@ -0,0 +1,61 @@
package=libcxx
$(package)_version=$(native_clang_version)
$(package)_msys2_version=15.0.7-3
ifneq ($(canonical_host),$(build))
ifneq ($(host_os),mingw32)
# Clang is provided pre-compiled for a bunch of targets; fetch the one we need
# and stage its copies of the static libraries.
$(package)_download_path=$(native_clang_download_path)
$(package)_download_file_aarch64_linux=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_file_name_aarch64_linux=clang-llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_sha256_hash_aarch64_linux=8ca4d68cf103da8331ca3f35fe23d940c1b78fb7f0d4763c1c059e352f5d1bec
$(package)_download_file_linux=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$(package)_file_name_linux=clang-llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$(package)_sha256_hash_linux=38bc7f5563642e73e69ac5626724e206d6d539fbef653541b34cae0ba9c3f036
# Starting from LLVM 14.0.0, some Clang binary tarballs store libc++ in a
# target-specific subdirectory.
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/lib && \
(test ! -f lib/*/libc++.a || cp lib/*/libc++.a $($(package)_staging_prefix_dir)/lib) && \
(test ! -f lib/*/libc++abi.a || cp lib/*/libc++abi.a $($(package)_staging_prefix_dir)/lib) && \
(test ! -f lib/libc++.a || cp lib/libc++.a $($(package)_staging_prefix_dir)/lib) && \
(test ! -f lib/libc++abi.a || cp lib/libc++abi.a $($(package)_staging_prefix_dir)/lib)
endef
else
# For Windows cross-compilation, use the MSYS2 binaries.
# Starting from LLVM 15.0.0, libc++abi is provided by libc++.
$(package)_download_path=https://repo.msys2.org/mingw/x86_64
$(package)_download_file=mingw-w64-x86_64-libc++-$($(package)_msys2_version)-any.pkg.tar.zst
$(package)_file_name=mingw-w64-x86_64-libcxx-$($(package)_msys2_version)-any.pkg.tar.zst
$(package)_sha256_hash=8c14da21fa9622cc7450b22467452c6c933a03cee526cf8744faea3d4674035b
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/lib && \
mv include/ $($(package)_staging_prefix_dir) && \
cp lib/libc++.a $($(package)_staging_prefix_dir)/lib && \
cp lib/libc++abi.a $($(package)_staging_prefix_dir)/lib
endef
endif
else
# For native compilation, use the static libraries from native_clang.
# We explicitly stage them so that subsequent dependencies don't link to the
# shared libraries distributed with Clang.
define $(package)_fetch_cmds
endef
define $(package)_extract_cmds
endef
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/lib && \
(test ! -f $(build_prefix)/lib/*/libc++.a || cp $(build_prefix)/lib/*/libc++.a $($(package)_staging_prefix_dir)/lib) && \
(test ! -f $(build_prefix)/lib/*/libc++abi.a || cp $(build_prefix)/lib/*/libc++abi.a $($(package)_staging_prefix_dir)/lib) && \
(test ! -f $(build_prefix)/lib/libc++.a || cp $(build_prefix)/lib/libc++.a $($(package)_staging_prefix_dir)/lib) && \
(test ! -f $(build_prefix)/lib/libc++abi.a || cp $(build_prefix)/lib/libc++abi.a $($(package)_staging_prefix_dir)/lib)
endef
endif

62
depends/packages/native_clang.mk

@ -0,0 +1,62 @@
package=native_clang
# To update the Clang compiler:
# - Change the versions below, and the MSYS2 version in libcxx.mk
# - Run the script ./contrib/devtools/update-clang-hashes.sh
# - Manually fix the versions for packages that don't exist (the LLVM project
# doesn't uniformly cut binaries across releases).
# The Clang compiler should use the same LLVM version as the Rust compiler.
$(package)_major_version=15
$(package)_version=15.0.6
$(package)_download_path_linux=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
$(package)_download_file_linux=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$(package)_file_name_linux=clang-llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$(package)_sha256_hash_linux=38bc7f5563642e73e69ac5626724e206d6d539fbef653541b34cae0ba9c3f036
$(package)_download_path_darwin=https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.4
$(package)_download_file_darwin=clang+llvm-15.0.4-x86_64-apple-darwin.tar.xz
$(package)_file_name_darwin=clang-llvm-15.0.4-x86_64-apple-darwin.tar.xz
$(package)_sha256_hash_darwin=4c98d891c07c8f6661b233bf6652981f28432cfdbd6f07181114195c3536544b
# 2023-02-16: No FreeBSD packages are available for Clang 15, so we use Clang 14
# here. This means FreeBSD builds will use two different versions of LLVM, but
# FreeBSD is only a Tier 3 platform, so that is acceptable.
$(package)_download_path_freebsd=https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6
$(package)_download_file_freebsd=clang+llvm-14.0.6-amd64-unknown-freebsd12.tar.xz
$(package)_file_name_freebsd=clang-llvm-14.0.6-amd64-unknown-freebsd12.tar.xz
$(package)_sha256_hash_freebsd=b0a7b86dacb12afb8dd2ca99ea1b894d9cce84aab7711cb1964b3005dfb09af3
$(package)_download_path_aarch64_linux=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
$(package)_download_file_aarch64_linux=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_file_name_aarch64_linux=clang-llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_sha256_hash_aarch64_linux=8ca4d68cf103da8331ca3f35fe23d940c1b78fb7f0d4763c1c059e352f5d1bec
ifneq (,$(wildcard /etc/arch-release))
$(package)_dependencies=native_libtinfo
endif
# Ensure we have clang native to the builder, not the target host
ifneq ($(canonical_host),$(build))
$(package)_exact_download_path=$($(package)_download_path_$(build_os))
$(package)_exact_download_file=$($(package)_download_file_$(build_os))
$(package)_exact_file_name=$($(package)_file_name_$(build_os))
$(package)_exact_sha256_hash=$($(package)_sha256_hash_$(build_os))
endif
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/bin && \
cp bin/clang-$($(package)_major_version) $($(package)_staging_prefix_dir)/bin && \
cp bin/lld $($(package)_staging_prefix_dir)/bin && \
cp bin/llvm-ar $($(package)_staging_prefix_dir)/bin && \
cp bin/llvm-config $($(package)_staging_prefix_dir)/bin && \
cp bin/llvm-nm $($(package)_staging_prefix_dir)/bin && \
cp bin/llvm-objcopy $($(package)_staging_prefix_dir)/bin && \
cp -P bin/clang $($(package)_staging_prefix_dir)/bin && \
cp -P bin/clang++ $($(package)_staging_prefix_dir)/bin && \
cp -P bin/ld.lld $($(package)_staging_prefix_dir)/bin && \
cp -P bin/ld64.lld $($(package)_staging_prefix_dir)/bin && \
cp -P bin/lld-link $($(package)_staging_prefix_dir)/bin && \
cp -P bin/llvm-ranlib $($(package)_staging_prefix_dir)/bin && \
cp -P bin/llvm-strip $($(package)_staging_prefix_dir)/bin && \
(test ! -f include/x86_64-unknown-linux-gnu/c++/v1/__config_site || \
cp include/x86_64-unknown-linux-gnu/c++/v1/__config_site include/c++/v1/__config_site) && \
mv include/ $($(package)_staging_prefix_dir) && \
mv lib/ $($(package)_staging_prefix_dir) && \
mv libexec/ $($(package)_staging_prefix_dir)
endef

9
src/Makefile.am

@ -40,16 +40,7 @@ BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/src
BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/src/asn
BITCOIN_INCLUDES += -I$(srcdir)/univalue/include
if TARGET_WINDOWS
LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl
endif
if TARGET_DARWIN
LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl
endif
if TARGET_LINUX
LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl
endif
LIBBITCOIN_WALLET=libbitcoin_wallet.a
LIBBITCOIN_COMMON=libbitcoin_common.a
LIBBITCOIN_CLI=libbitcoin_cli.a

Loading…
Cancel
Save