From 9544bd0ffcb60165ec1efc8f25aeb6dfc1521ea7 Mon Sep 17 00:00:00 2001 From: miodragpop Date: Sun, 12 Jul 2020 11:47:00 +0200 Subject: [PATCH] adjustments for cross build of aarch64 binaries on x86_64 linux --- configure.ac | 47 +- depends/.gitignore | 1 + depends/Makefile | 1 + depends/config.site.in | 3 + depends/funcs.mk | 11 +- depends/packages/bdb.mk | 5 + depends/packages/libcurl.mk | 2 +- depends/packages/librustzcash.mk | 18 +- depends/packages/packages.mk | 2 - depends/packages/proton.mk | 7 +- depends/packages/rust.mk | 53 +- depends/patches/proton/minimal-build.patch | 542 +++++++++--------- src/Makefile.am | 6 +- src/cc/Makefile_custom | 5 + src/cc/makecustom | 2 +- src/cryptoconditions/Makefile.am | 2 +- .../src/include/secp256k1/Makefile.am | 2 +- zcutil/build-cross-aarch64.sh | 64 +++ 18 files changed, 457 insertions(+), 316 deletions(-) mode change 100755 => 100644 src/cc/Makefile_custom mode change 100755 => 100644 src/cc/makecustom create mode 100644 zcutil/build-cross-aarch64.sh diff --git a/configure.ac b/configure.ac index e3be0c9dd..f0474aec0 100644 --- a/configure.ac +++ b/configure.ac @@ -334,11 +334,11 @@ case $host in dnl AC_CHECK_PROG([BREW],brew, brew) dnl if test x$BREW = xbrew; then - dnl These Homebrew packages may be keg-only, meaning that they won't be found - dnl in expected paths because they may conflict with system files. Ask - dnl Homebrew where each one is located, then adjust paths accordingly. - dnl It's safe to add these paths even if the functionality is disabled by - dnl the user (--without-wallet for example). + dnl These Homebrew packages may be keg-only, meaning that they won't be found + dnl in expected paths because they may conflict with system files. Ask + dnl Homebrew where each one is located, then adjust paths accordingly. + dnl It's safe to add these paths even if the functionality is disabled by + dnl the user (--without-wallet for example). dnl openssl_prefix=`$BREW --prefix openssl 2>/dev/null` dnl bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null` @@ -507,15 +507,24 @@ if test x$use_hardening != xno; then HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2" ],[AC_MSG_ERROR(Cannot enable -D_FORTIFY_SOURCE=2)]) - #AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)]) - #AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)]) + if test x$BUILD_OS = xdarwin || test x$TARGET_OS = xwindows; then + # Xcode's ld (at least ld64-302.3) doesn't support -z + # mingw-w64's ld (at least mingw-w64 4.0.4-2) also appears to not support -z + AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_WARN(Cannot enable RELRO)]) + AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_WARN(Cannot enable BIND_NOW)]) + else + AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)]) + AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)]) + fi if test x$TARGET_OS != xwindows; then # All windows code is PIC, forcing it on just adds useless compile warnings - AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)]) - AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)]) - AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)]) - AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)]) + AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)]) + if test x$BUILD_OS = xdarwin; then + AX_CHECK_LINK_FLAG([[-Wl,-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-pie"],[AC_MSG_ERROR(Cannot enable -Wl,-pie)]) + else + AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)]) + fi else # These are only available on Windows. AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"],[AC_MSG_ERROR(Cannot enable --dynamicbase)]) @@ -700,7 +709,7 @@ if test x$use_pkgconfig = xyes; then ) else # BUG: Fix this: - echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++, gmp' + echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++, libgmp' AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing)) AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing)) @@ -756,6 +765,14 @@ fi fi fi +# These packages don't provide pkgconfig config files across all +# platforms, so we use older autoconf detection mechanisms: +AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing)) +AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)]) + +AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing)) +AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)]) + RUST_LIBS="-lrustzcash" case $host in *mingw*) @@ -950,7 +967,7 @@ case $host in ;; esac -echo +echo echo "Options used to compile and link:" echo " with wallet = $enable_wallet" echo " with proton = $use_proton" @@ -958,7 +975,7 @@ echo " with zmq = $use_zmq" echo " with test = $use_tests" echo " debug enabled = $enable_debug" echo " werror = $enable_werror" -echo +echo echo " target os = $TARGET_OS" echo " build os = $BUILD_OS" echo @@ -969,4 +986,4 @@ echo " CXX = $CXX" echo " CXXFLAGS = $CXXFLAGS" echo " LDFLAGS = $LDFLAGS" echo " ARFLAGS = $ARFLAGS" -echo +echo diff --git a/depends/.gitignore b/depends/.gitignore index 1f163897b..3cb4b9ac1 100644 --- a/depends/.gitignore +++ b/depends/.gitignore @@ -7,3 +7,4 @@ x86_64* i686* mips* arm* +aarch64* diff --git a/depends/Makefile b/depends/Makefile index 636577d13..9d53bd1be 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -112,6 +112,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_ -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \ -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ + -e 's|@rust_target@|$(call rust_target,rust,$(canonical_host),$(host_os))|' \ -e 's|@no_wallet@|$(NO_WALLET)|' \ -e 's|@debug@|$(DEBUG)|' \ $< > $@ diff --git a/depends/config.site.in b/depends/config.site.in index 8cdbcd2e4..dbcb7a6e4 100644 --- a/depends/config.site.in +++ b/depends/config.site.in @@ -13,6 +13,9 @@ if test -z $enable_wallet && test -n "@no_wallet@"; then enable_wallet=no fi +RUST_TARGET="@rust_target@" +RUST_VENDORED_SOURCES="$depends_prefix/vendored-sources" + if test x@host_os@ = xdarwin; then BREW=no PORT=no diff --git a/depends/funcs.mk b/depends/funcs.mk index 3d89de8a7..35ca5abcf 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -40,7 +40,7 @@ endef define vendor_crate_source mkdir -p $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY) && \ -cp -r $($(1)_extract_dir) $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_name) && \ +cp -r $($(1)_extract_dir) $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_versioned_name) && \ cd $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_versioned_name) && \ rm -r `basename $($(1)_patch_dir)` .stamp_* .$($(1)_file_name).hash endef @@ -59,8 +59,8 @@ $(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SU final_build_id_long+=$($(package)_build_id_long) #override platform specific files and hashes -$(eval $(1)_file_name=$(if $($(1)_file_name_$(host_os)),$($(1)_file_name_$(host_os)),$($(1)_file_name))) -$(eval $(1)_sha256_hash=$(if $($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash))) +$(eval $(1)_file_name=$(if $($(1)_exact_file_name),$($(1)_exact_file_name),$(if $($(1)_file_name_$(host_os)),$($(1)_file_name_$(host_os)),$($(1)_file_name)))) +$(eval $(1)_sha256_hash=$(if $($(1)_exact_sha256_hash),$($(1)_exact_sha256_hash),$(if $($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash)))) #compute package-specific paths $(1)_build_subdir?=. @@ -91,8 +91,9 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path)) #default commands +# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior $(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash)) -$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --strip-components=1 -xf $$($(1)_source) +$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --no-same-owner --strip-components=1 -xf $$($(1)_source) $(1)_preprocess_cmds ?= $(1)_build_cmds ?= $(1)_config_cmds ?= @@ -193,7 +194,7 @@ $($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted) $(AT)touch $$@ $($(1)_configured): | $($(1)_preprocessed) $(AT)echo Configuring $(1)... - $(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar xf $($(package)_cached); ) + $(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); ) $(AT)mkdir -p $$(@D) $(AT)+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1)) $(AT)touch $$@ diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk index 404d94c51..c8f677490 100644 --- a/depends/packages/bdb.mk +++ b/depends/packages/bdb.mk @@ -9,6 +9,11 @@ define $(package)_set_vars $(package)_config_opts=--disable-shared --enable-cxx --disable-replication $(package)_config_opts_mingw32=--enable-mingw $(package)_config_opts_linux=--with-pic +$(package)_config_opts_freebsd=--with-pic +ifneq ($(build_os),darwin) +$(package)_config_opts_darwin=--disable-atomicsupport +endif +$(package)_config_opts_aarch64=--disable-atomicsupport $(package)_cxxflags=-std=c++11 endef diff --git a/depends/packages/libcurl.mk b/depends/packages/libcurl.mk index fd82dc4e0..91ff1c0f1 100644 --- a/depends/packages/libcurl.mk +++ b/depends/packages/libcurl.mk @@ -4,7 +4,7 @@ $(package)_dependencies=openssl $(package)_download_path=https://curl.haxx.se/download $(package)_file_name=curl-$($(package)_version).tar.gz $(package)_sha256_hash=52af3361cf806330b88b4fe6f483b6844209d47ae196ac46da4de59bb361ab02 -$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-unknown-linux-gnu +$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=$(host) $(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-w64-mingw32 $(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix) $(package)_cflags_darwin=-mmacosx-version-min=10.9 diff --git a/depends/packages/librustzcash.mk b/depends/packages/librustzcash.mk index 8612ac05a..fe6ef8a58 100644 --- a/depends/packages/librustzcash.mk +++ b/depends/packages/librustzcash.mk @@ -8,15 +8,29 @@ $(package)_git_commit=06da3b9ac8f278e5d4ae13088cf0a4c03d2c13f5 $(package)_dependencies=rust $(rust_crates) $(package)_patches=cargo.config 0001-Start-using-cargo-clippy-for-CI.patch remove-dev-dependencies.diff no-groth16.patch +$(package)_rust_target=$(if $(rust_rust_target_$(canonical_host)),$(rust_rust_target_$(canonical_host)),$(canonical_host)) + ifeq ($(host_os),mingw32) $(package)_library_file=target/x86_64-pc-windows-gnu/release/rustzcash.lib +else ifneq ($(canonical_host),$(build)) +ifeq ($(host_os),darwin) +$(package)_library_file=target/x86_64-apple-darwin/release/librustzcash.a +else +$(package)_library_file=target/$($(package)_rust_target)/release/librustzcash.a +endif else $(package)_library_file=target/release/librustzcash.a endif define $(package)_set_vars $(package)_build_opts=--frozen --release -$(package)_build_opts_mingw32=--target=x86_64-pc-windows-gnu +ifneq ($(canonical_host),$(build)) +ifeq ($(host_os),darwin) +$(package)_build_opts+=--target=x86_64-apple-darwin +else +$(package)_build_opts+=--target=$($(package)_rust_target) +endif +endif endef define $(package)_preprocess_cmds @@ -27,7 +41,7 @@ define $(package)_preprocess_cmds endef define $(package)_build_cmds - cargo build --package librustzcash $($(package)_build_opts) + $(host_prefix)/native/bin/cargo build --package librustzcash $($(package)_build_opts) endef define $(package)_stage_cmds diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index 8abb7c708..8a56f73f3 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -1,5 +1,3 @@ -rust_packages := rust librustzcash - ifeq ($(build_os),darwin) zcash_packages := libgmp libsodium utfcpp else diff --git a/depends/packages/proton.mk b/depends/packages/proton.mk index 1bb5c8865..d974fa5fa 100644 --- a/depends/packages/proton.mk +++ b/depends/packages/proton.mk @@ -1,8 +1,8 @@ package=proton -$(package)_version=0.26.0 +$(package)_version=0.30.0 $(package)_download_path=https://archive.apache.org/dist/qpid/proton/$($(package)_version) $(package)_file_name=qpid-proton-$($(package)_version).tar.gz -$(package)_sha256_hash=0eddac870f0085b9aeb0c9da333bd3f53fedb7c872164171a7cc06761ddbbd75 +$(package)_sha256_hash=e37fd8fb13391c3996f927839969a8f66edf35612392d0611eeac6e39e48dd33 $(package)_patches=minimal-build.patch define $(package)_preprocess_cmds @@ -11,7 +11,7 @@ define $(package)_preprocess_cmds endef define $(package)_config_cmds - cd build; cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=/ -DSYSINSTALL_BINDINGS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_PYTHON=OFF -DBUILD_PHP=OFF -DBUILD_JAVA=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_GO=OFF -DBUILD_STATIC_LIBS=ON + cd build; cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=/ -DSYSINSTALL_BINDINGS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_PYTHON=OFF -DBUILD_RUBY=OFF -DBUILD_GO=OFF -DBUILD_STATIC_LIBS=ON -DLIB_SUFFIX= -DENABLE_JSONCPP= endef define $(package)_build_cmds @@ -21,3 +21,4 @@ endef define $(package)_stage_cmds cd build; $(MAKE) VERBOSE=1 DESTDIR=$($(package)_staging_prefix_dir) install endef + diff --git a/depends/packages/rust.mk b/depends/packages/rust.mk index 9cfb95054..2546a733e 100644 --- a/depends/packages/rust.mk +++ b/depends/packages/rust.mk @@ -1,28 +1,33 @@ package=rust -$(package)_version=1.32.0 +$(package)_version=1.42.0 $(package)_download_path=https://static.rust-lang.org/dist - $(package)_file_name_linux=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz -$(package)_sha256_hash_linux=e024698320d76b74daf0e6e71be3681a1e7923122e3ebd03673fcac3ecc23810 +$(package)_sha256_hash_linux=7d1e07ad9c8a33d8d039def7c0a131c5917aa3ea0af3d0cc399c6faf7b789052 $(package)_file_name_darwin=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz -$(package)_sha256_hash_darwin=f0dfba507192f9b5c330b5984ba71d57d434475f3d62bd44a39201e36fa76304 -$(package)_file_name_mingw32=rust-$($(package)_version)-x86_64-pc-windows-gnu.tar.gz -$(package)_sha256_hash_mingw32=358e1435347c67dbf33aa9cad6fe501a833d6633ed5d5aa1863d5dffa0349be9 - -ifeq ($(build_os),darwin) -$(package)_file_name=$($(package)_file_name_darwin) -$(package)_sha256_hash=$($(package)_sha256_hash_darwin) -else ifeq ($(host_os),mingw32) -$(package)_file_name=$($(package)_file_name_mingw32) -$(package)_sha256_hash=$($(package)_sha256_hash_mingw32) -else -$(package)_file_name=$($(package)_file_name_linux) -$(package)_sha256_hash=$($(package)_sha256_hash_linux) -endif +$(package)_sha256_hash_darwin=db1055c46e0d54b99da05e88c71fea21b3897e74a4f5ff9390e934f3f050c0a8 +$(package)_file_name_freebsd=rust-$($(package)_version)-x86_64-unknown-freebsd.tar.gz +$(package)_sha256_hash_freebsd=230bcf17e4383fba85d3c87fe25d17737459fe561a5f4668fe70dcac2da4e17c + +# Mapping from GCC canonical hosts to Rust targets +# If a mapping is not present, we assume they are identical, unless $host_os is +# "darwin", in which case we assume x86_64-apple-darwin. +$(package)_rust_target_x86_64-w64-mingw32=x86_64-pc-windows-gnu + +# Mapping from Rust targets to SHA-256 hashes +$(package)_rust_std_sha256_hash_aarch64-unknown-linux-gnu=1343f51fc87049327233cee8941629c3d7dfdc425d359385f93665de3d46711b +$(package)_rust_std_sha256_hash_x86_64-apple-darwin=1d61e9ed5d29e1bb4c18e13d551c6d856c73fb8b410053245dc6e0d3b3a0e92c +$(package)_rust_std_sha256_hash_x86_64-pc-windows-gnu=8a8389f3860df6f42fbf8b76a62ddc7b9b6fe6d0fb526dcfc42faab1005bfb6d + +define rust_target +$(if $($(1)_rust_target_$(2)),$($(1)_rust_target_$(2)),$(if $(findstring darwin,$(3)),x86_64-apple-darwin,$(2))) +endef -ifeq ($(host_os),mingw32) +ifneq ($(canonical_host),$(build)) +$(package)_rust_target=$(call rust_target,$(package),$(canonical_host),$(host_os)) +$(package)_exact_file_name=rust-std-$($(package)_version)-$($(package)_rust_target).tar.gz +$(package)_exact_sha256_hash=$($(package)_rust_std_sha256_hash_$($(package)_rust_target)) $(package)_build_subdir=buildos -$(package)_extra_sources = $($(package)_file_name_$(build_os)) +$(package)_extra_sources=$($(package)_file_name_$(build_os)) define $(package)_fetch_cmds $(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \ @@ -34,19 +39,19 @@ define $(package)_extract_cmds echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \ echo "$($(package)_sha256_hash_$(build_os)) $($(package)_source_dir)/$($(package)_file_name_$(build_os))" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ - mkdir mingw32 && \ - tar --strip-components=1 -xf $($(package)_source) -C mingw32 && \ + mkdir $(canonical_host) && \ + tar --strip-components=1 -xf $($(package)_source) -C $(canonical_host) && \ mkdir buildos && \ tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_file_name_$(build_os)) -C buildos endef define $(package)_stage_cmds - ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig && \ - cp -r ../mingw32/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu $($(package)_staging_dir)$(host_prefix)/native/lib/rustlib + bash ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig && \ + ../$(canonical_host)/install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig endef else define $(package)_stage_cmds - ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig + bash ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig endef endif diff --git a/depends/patches/proton/minimal-build.patch b/depends/patches/proton/minimal-build.patch index 90588929f..dd138d2f6 100644 --- a/depends/patches/proton/minimal-build.patch +++ b/depends/patches/proton/minimal-build.patch @@ -1,288 +1,314 @@ -From 03f5fc0826115edbfca468261b70c0daf627f488 Mon Sep 17 00:00:00 2001 -From: Simon -Date: Thu, 27 Apr 2017 17:15:59 -0700 -Subject: [PATCH] Enable C++11, build static library and cpp bindings with minimal dependencies. - ---- - CMakeLists.txt | 13 +++++++------ - examples/cpp/CMakeLists.txt | 1 + - proton-c/CMakeLists.txt | 32 +++++++++++++++---------------- - proton-c/bindings/CMakeLists.txt | 6 +++--- - proton-c/bindings/cpp/CMakeLists.txt | 24 +++++++++++------------ - proton-c/bindings/cpp/docs/CMakeLists.txt | 2 +- - proton-c/docs/api/CMakeLists.txt | 2 +- - 7 files changed, 41 insertions(+), 39 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b538ffd..4a5e787 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -18,14 +18,15 @@ - # - cmake_minimum_required (VERSION 2.8.7) - -+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - project (Proton C) - - # Enable C++ now for examples and bindings subdirectories, but make it optional. - enable_language(CXX OPTIONAL) - - # Enable testing --enable_testing() --include (CTest) -+#enable_testing() -+#include (CTest) - - # Pull in local cmake modules - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/Modules/") -@@ -141,7 +142,7 @@ set (BINDINGS_DIR ${LIB_INSTALL_DIR}/proton/bindings) - - set (SYSINSTALL_BINDINGS OFF CACHE BOOL "If SYSINSTALL_BINDINGS is OFF then proton bindings will be installed underneath ${BINDINGS_DIR} and each user will need to modify their interpreter configuration to load the appropriate binding. If SYSINSTALL_BINDINGS is ON, then each language interpreter will be queried for the appropriate directory and proton bindings will be installed and available system wide with no additional per user configuration.") - --set (BINDING_LANGS PERL PHP PYTHON RUBY) -+#set (BINDING_LANGS PERL PHP PYTHON RUBY) - - foreach (LANG ${BINDING_LANGS}) - set (SYSINSTALL_${LANG} OFF CACHE BOOL "Install ${LANG} bindings into interpreter specified location.") -@@ -156,10 +157,10 @@ set (PROTON_SHARE ${SHARE_INSTALL_DIR}/proton-${PN_VERSION}) - # End of variables used during install - - # Check for valgrind here so tests under proton-c/ and examples/ can use it. --find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program") -+#find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program") - mark_as_advanced (VALGRIND_EXE) - --option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON) -+#option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON) - if (ENABLE_VALGRIND) - if (NOT VALGRIND_EXE) - message(STATUS "Can't locate the valgrind command; no run-time error detection") -@@ -171,7 +172,7 @@ if (ENABLE_VALGRIND) - endif (ENABLE_VALGRIND) +diff -ur a/c/CMakeLists.txt b/c/CMakeLists.txt +--- a/c/CMakeLists.txt 2019-12-09 07:17:00.000000000 -0700 ++++ b/c/CMakeLists.txt 2020-01-08 16:15:26.837987469 -0700 +@@ -428,18 +428,18 @@ + # Can't use target_link_libraries() because cmake 2.8.12 doesn't allow object libraries as the first param + # otherwise for cmake 3.9 and on this would be: + # target_link_libraries (qpid-proton-core-objects ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS}) +-target_compile_definitions(qpid-proton-core-objects PRIVATE $) +-target_compile_options (qpid-proton-core-objects PRIVATE $) +-target_include_directories(qpid-proton-core-objects PRIVATE $) +- +-add_library (qpid-proton-core SHARED $) +-target_link_libraries (qpid-proton-core ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS}) +-set_target_properties (qpid-proton-core +- PROPERTIES +- VERSION "${PN_LIB_CORE_VERSION}" +- SOVERSION "${PN_LIB_CORE_MAJOR_VERSION}" +- LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" +-) ++#target_compile_definitions(qpid-proton-core-objects PRIVATE $) ++#target_compile_options (qpid-proton-core-objects PRIVATE $) ++#target_include_directories(qpid-proton-core-objects PRIVATE $) ++ ++#add_library (qpid-proton-core SHARED $) ++#target_link_libraries (qpid-proton-core ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS}) ++#set_target_properties (qpid-proton-core ++# PROPERTIES ++# VERSION "${PN_LIB_CORE_VERSION}" ++# SOVERSION "${PN_LIB_CORE_MAJOR_VERSION}" ++# LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" ++#) + + if (BUILD_STATIC_LIBS) + add_library (qpid-proton-core-static STATIC ${qpid-proton-core-src}) +@@ -454,14 +454,14 @@ + ${qpid-proton-include-extra} + ) + +-add_library (qpid-proton SHARED $ ${qpid-proton-noncore-src}) +-target_link_libraries (qpid-proton LINK_PRIVATE ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS} ${PROACTOR_LIBS}) +-set_target_properties (qpid-proton +- PROPERTIES +- VERSION "${PN_LIB_LEGACY_VERSION}" +- SOVERSION "${PN_LIB_LEGACY_MAJOR_VERSION}" +- LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" +-) ++# add_library (qpid-proton SHARED $ ${qpid-proton-noncore-src}) ++# target_link_libraries (qpid-proton LINK_PRIVATE ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS} ${PROACTOR_LIBS}) ++# set_target_properties (qpid-proton ++# PROPERTIES ++# VERSION "${PN_LIB_LEGACY_VERSION}" ++# SOVERSION "${PN_LIB_LEGACY_MAJOR_VERSION}" ++# LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" ++# ) + + if (BUILD_STATIC_LIBS) + add_library(qpid-proton-static STATIC ${qpid-proton-core-src} ${qpid-proton-noncore-src}) +@@ -482,15 +482,15 @@ + + if (qpid-proton-proactor) + set(HAS_PROACTOR True) +- add_library (qpid-proton-proactor SHARED ${qpid-proton-proactor}) +- target_link_libraries (qpid-proton-proactor LINK_PUBLIC qpid-proton-core) +- target_link_libraries (qpid-proton-proactor LINK_PRIVATE ${PLATFORM_LIBS} ${PROACTOR_LIBS}) +- set_target_properties (qpid-proton-proactor +- PROPERTIES +- VERSION "${PN_LIB_PROACTOR_VERSION}" +- SOVERSION "${PN_LIB_PROACTOR_MAJOR_VERSION}" +- LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" +- ) ++ # add_library (qpid-proton-proactor SHARED ${qpid-proton-proactor}) ++ # target_link_libraries (qpid-proton-proactor LINK_PUBLIC qpid-proton-core) ++ # target_link_libraries (qpid-proton-proactor LINK_PRIVATE ${PLATFORM_LIBS} ${PROACTOR_LIBS}) ++ # set_target_properties (qpid-proton-proactor ++ # PROPERTIES ++ # VERSION "${PN_LIB_PROACTOR_VERSION}" ++ # SOVERSION "${PN_LIB_PROACTOR_MAJOR_VERSION}" ++ # LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" ++ # ) + if (BUILD_STATIC_LIBS) + add_library (qpid-proton-proactor-static STATIC ${qpid-proton-proactor}) + endif(BUILD_STATIC_LIBS) +@@ -500,11 +500,11 @@ + if (BUILD_STATIC_LIBS) + set(STATIC_LIBS qpid-proton-static qpid-proton-core-static) + endif() +-install(TARGETS qpid-proton qpid-proton-core ${STATIC_LIBS} +- EXPORT proton +- RUNTIME DESTINATION bin +- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} +- LIBRARY DESTINATION ${LIB_INSTALL_DIR}) ++# install(TARGETS qpid-proton qpid-proton-core ${STATIC_LIBS} ++# EXPORT proton ++# RUNTIME DESTINATION bin ++# ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ++# LIBRARY DESTINATION ${LIB_INSTALL_DIR}) + + # Install windows pdb files + if (MSVC) +@@ -520,11 +520,11 @@ + if (BUILD_STATIC_LIBS) + set(STATIC_LIBS qpid-proton-proactor-static) + endif() +- install(TARGETS qpid-proton-proactor ${STATIC_LIBS} +- EXPORT proton +- RUNTIME DESTINATION bin +- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} +- LIBRARY DESTINATION ${LIB_INSTALL_DIR}) ++ # install(TARGETS qpid-proton-proactor ${STATIC_LIBS} ++ # EXPORT proton ++ # RUNTIME DESTINATION bin ++ # ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ++ # LIBRARY DESTINATION ${LIB_INSTALL_DIR}) + + # Install windows pdb files + if (MSVC) +@@ -576,10 +576,10 @@ + ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake + DESTINATION ${LIB_INSTALL_DIR}/cmake/Proton) - add_subdirectory(proton-c) +-add_subdirectory(docs) -add_subdirectory(examples) -+#add_subdirectory(examples) - - install (FILES LICENSE README.md - DESTINATION ${PROTON_SHARE}) -diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt -index 304d899..f4877b4 100644 ---- a/examples/cpp/CMakeLists.txt -+++ b/examples/cpp/CMakeLists.txt -@@ -17,6 +17,7 @@ - # under the License. - # - -+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - find_package(ProtonCpp REQUIRED) - - include_directories(${ProtonCpp_INCLUDE_DIRS}) -diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt -index 8edb661..dc7b99c 100644 ---- a/proton-c/CMakeLists.txt -+++ b/proton-c/CMakeLists.txt -@@ -22,24 +22,24 @@ include(CheckSymbolExists) - - include(soversion.cmake) - --add_custom_target(docs) --add_custom_target(doc DEPENDS docs) -+#add_custom_target(docs) -+#add_custom_target(doc DEPENDS docs) - - # Set the default SSL/TLS implementation --find_package(OpenSSL) -+#find_package(OpenSSL) - find_package(PythonInterp REQUIRED) --find_package(SWIG) -+#find_package(SWIG) - # FindSwig.cmake "forgets" make its outputs advanced like a good citizen - mark_as_advanced(SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION) +-add_subdirectory(tests) +-add_subdirectory(tools) ++# add_subdirectory(docs) ++# add_subdirectory(examples) ++# add_subdirectory(tests) ++# add_subdirectory(tools) + + install (DIRECTORY examples/ + DESTINATION "${PROTON_SHARE}/examples/c" +diff -ur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2019-12-09 07:17:00.000000000 -0700 ++++ b/CMakeLists.txt 2019-12-19 18:11:57.128248724 -0700 +@@ -24,7 +24,7 @@ + set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/Modules") + set (CMAKE_THREAD_PREFER_PTHREAD TRUE) - # See if Cyrus SASL is available --find_library(CYRUS_SASL_LIBRARY sasl2) --find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include) --find_package_handle_standard_args(CyrusSASL DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR) -+#find_library(CYRUS_SASL_LIBRARY sasl2) -+#find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include) -+#find_package_handle_standard_args(CyrusSASL DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR) - mark_as_advanced(CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR) - - # Find saslpasswd2 executable to generate test config --find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing") -+#find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing") - mark_as_advanced(SASLPASSWD_EXE) - - if(WIN32 AND NOT CYGWIN) -@@ -315,8 +315,8 @@ pn_absolute_install_dir(EXEC_PREFIX "." ${CMAKE_INSTALL_PREFIX}) - pn_absolute_install_dir(LIBDIR ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}) - pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}) - --add_subdirectory(docs/api) --add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c) -+#add_subdirectory(docs/api) -+#add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c) - - # for full source distribution: - set (qpid-proton-platform-all -@@ -507,7 +507,7 @@ if (BUILD_WITH_CXX) - endif (BUILD_WITH_CXX) +-include (CTest) ++# include (CTest) + include (CheckLanguage) + include (CheckLibraryExists) + include (CheckSymbolExists) +@@ -33,13 +33,13 @@ + find_package (OpenSSL) + find_package (Threads) + find_package (PythonInterp REQUIRED) +-find_package (SWIG) ++# find_package (SWIG) + find_package (CyrusSASL) - add_library ( -- qpid-proton-core SHARED -+ qpid-proton-core STATIC - ${qpid-proton-core} - ${qpid-proton-layers} - ${qpid-proton-platform} -@@ -527,7 +527,7 @@ set_target_properties ( - ) +-enable_testing () ++#enable_testing () - add_library( -- qpid-proton SHARED -+ qpid-proton STATIC - # Proton Core - ${qpid-proton-core} - ${qpid-proton-layers} -@@ -629,7 +629,7 @@ install (FILES + # Set up runtime checks (valgrind, sanitizers etc.) +-include(tests/RuntimeCheck.cmake) ++# include(tests/RuntimeCheck.cmake) - # c tests: + ## Variables used across components --add_subdirectory(src/tests) -+#add_subdirectory(src/tests) +@@ -260,7 +260,7 @@ - if (CMAKE_SYSTEM_NAME STREQUAL Windows) - # No change needed for windows already use correct separator -@@ -712,7 +712,7 @@ if (BUILD_PYTHON) + set (SYSINSTALL_BINDINGS OFF CACHE BOOL "If SYSINSTALL_BINDINGS is OFF then proton bindings will be installed underneath ${BINDINGS_DIR} and each user will need to modify their interpreter configuration to load the appropriate binding. If SYSINSTALL_BINDINGS is ON, then each language interpreter will be queried for the appropriate directory and proton bindings will be installed and available system wide with no additional per user configuration.") - endif (BUILD_PYTHON) +-set (BINDING_LANGS PYTHON RUBY) ++# set (BINDING_LANGS PYTHON RUBY) --find_program(RUBY_EXE "ruby") -+#find_program(RUBY_EXE "ruby") - if (RUBY_EXE AND BUILD_RUBY) - set (rb_root "${pn_test_root}/ruby") - set (rb_src "${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby") -@@ -751,8 +751,8 @@ if (RUBY_EXE AND BUILD_RUBY) - else (DEFAULT_RUBY_TESTING) - message(STATUS "Skipping Ruby tests: missing dependencies") - endif (DEFAULT_RUBY_TESTING) --else (RUBY_EXE) -- message (STATUS "Cannot find ruby, skipping ruby tests") -+#else (RUBY_EXE) -+# message (STATUS "Cannot find ruby, skipping ruby tests") + foreach (LANG ${BINDING_LANGS}) + set (SYSINSTALL_${LANG} OFF CACHE BOOL "Install ${LANG} bindings into interpreter specified location.") +@@ -315,7 +315,7 @@ endif() - mark_as_advanced (RUBY_EXE RSPEC_EXE) -diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt -index 6b88384..d1a50a5 100644 ---- a/proton-c/bindings/CMakeLists.txt -+++ b/proton-c/bindings/CMakeLists.txt -@@ -19,14 +19,14 @@ - - # Add bindings that do not require swig here - the directory name must be the same as the binding name - # See below for swig bindings --set(BINDINGS javascript cpp go) -+set(BINDINGS cpp) - - # Prerequisites for javascript. - # - # It uses a C/C++ to JavaScript cross-compiler called emscripten (https://github.com/kripken/emscripten). Emscripten takes C/C++ - # and compiles it into a highly optimisable subset of JavaScript called asm.js (http://asmjs.org/) that can be - # aggressively optimised and run at near-native speed (usually between 1.5 to 10 times slower than native C/C++). --find_package(Emscripten) -+#find_package(Emscripten) - if (EMSCRIPTEN_FOUND) - set (DEFAULT_JAVASCRIPT ON) - endif (EMSCRIPTEN_FOUND) -@@ -37,7 +37,7 @@ if (CMAKE_CXX_COMPILER) - endif (CMAKE_CXX_COMPILER) - # Prerequisites for Go -find_program(GO_EXE go) -+#find_program(GO_EXE go) ++# find_program(GO_EXE go) mark_as_advanced(GO_EXE) if (GO_EXE) - if(WIN32) -diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt -index 0cc4024..796fe29 100644 ---- a/proton-c/bindings/cpp/CMakeLists.txt -+++ b/proton-c/bindings/cpp/CMakeLists.txt -@@ -16,7 +16,7 @@ - # specific language governing permissions and limitations - # under the License. - # -- -+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - include(cpp.cmake) # Compiler checks - - include_directories( -@@ -89,7 +89,7 @@ set_source_files_properties ( - COMPILE_FLAGS "${LTO}" - ) + set (DEFAULT_GO ON) +diff -ur a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +--- a/cpp/CMakeLists.txt 2019-12-09 07:17:00.000000000 -0700 ++++ b/cpp/CMakeLists.txt 2020-01-08 16:20:18.855394195 -0700 +@@ -174,30 +174,30 @@ + set (CMAKE_DEBUG_POSTFIX "d") + endif () -add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source}) -+add_library(qpid-proton-cpp STATIC ${qpid-proton-cpp-source}) - - target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton) - -@@ -120,8 +120,8 @@ endif (MSVC) ++# add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source}) + if(BUILD_STATIC_LIBS) + add_library(qpid-proton-cpp-static STATIC ${qpid-proton-cpp-source}) + set(STATIC_LIBS qpid-proton-cpp-static) + endif(BUILD_STATIC_LIBS) + +-target_link_libraries (qpid-proton-cpp LINK_PRIVATE ${PLATFORM_LIBS} qpid-proton-core qpid-proton-proactor ${CONNECT_CONFIG_LIBS}) ++# target_link_libraries (qpid-proton-cpp LINK_PRIVATE ${PLATFORM_LIBS} qpid-proton-core qpid-proton-proactor ${CONNECT_CONFIG_LIBS}) + +-set_target_properties ( +- qpid-proton-cpp +- PROPERTIES +- LINKER_LANGUAGE CXX +- VERSION "${PN_LIB_CPP_VERSION}" +- SOVERSION "${PN_LIB_CPP_MAJOR_VERSION}" +- LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" +- ) ++# set_target_properties ( ++# qpid-proton-cpp ++# PROPERTIES ++# LINKER_LANGUAGE CXX ++# VERSION "${PN_LIB_CPP_VERSION}" ++# SOVERSION "${PN_LIB_CPP_MAJOR_VERSION}" ++# LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" ++# ) + + ## Install + +-install(TARGETS qpid-proton-cpp ${STATIC_LIBS} +- EXPORT proton-cpp +- RUNTIME DESTINATION bin +- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} +- LIBRARY DESTINATION ${LIB_INSTALL_DIR}) ++# install(TARGETS qpid-proton-cpp ${STATIC_LIBS} ++# EXPORT proton-cpp ++# RUNTIME DESTINATION bin ++# ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ++# LIBRARY DESTINATION ${LIB_INSTALL_DIR}) + + # Install windows qpid-proton-cpp pdb files + if (MSVC) +@@ -209,12 +209,12 @@ install (DIRECTORY "include/proton" DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.hpp") + install (FILES "${CMAKE_CURRENT_BINARY_DIR}/config_presets.hpp" DESTINATION "${INCLUDE_INSTALL_DIR}/proton/internal") +-install (DIRECTORY "examples/" +- DESTINATION "${PROTON_SHARE}/examples/cpp" +- USE_SOURCE_PERMISSIONS +- PATTERN "ProtonCppConfig.cmake" EXCLUDE) ++# install (DIRECTORY "examples/" ++# DESTINATION "${PROTON_SHARE}/examples/cpp" ++# USE_SOURCE_PERMISSIONS ++# PATTERN "ProtonCppConfig.cmake" EXCLUDE) --add_subdirectory(docs) --add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp) -+#add_subdirectory(docs) -+#add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp) +-add_subdirectory(examples) ++# add_subdirectory(examples) + add_subdirectory(docs) # Pkg config file - configure_file( -@@ -171,12 +171,12 @@ macro(add_cpp_test test) - endif () - endmacro(add_cpp_test) +@@ -268,40 +268,40 @@ + set(test_env ${test_env} "PATH=$") + endif() +-macro(add_cpp_test test) +- add_executable (${test} src/${test}.cpp) +- target_link_libraries (${test} qpid-proton-cpp ${PLATFORM_LIBS}) +- add_test (NAME cpp-${test} +- COMMAND ${PN_ENV_SCRIPT} -- ${test_env} ${TEST_EXE_PREFIX_CMD} $ ${ARGN}) +-endmacro(add_cpp_test) +- -add_cpp_test(codec_test) -+#add_cpp_test(codec_test) - #add_cpp_test(engine_test) --add_cpp_test(thread_safe_test) +-add_cpp_test(connection_driver_test) -add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests) -add_cpp_test(message_test) +-add_cpp_test(map_test) -add_cpp_test(scalar_test) -add_cpp_test(value_test) -add_cpp_test(container_test) --add_cpp_test(url_test) -+#add_cpp_test(thread_safe_test) -+#add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests) -+#add_cpp_test(message_test) -+#add_cpp_test(scalar_test) -+#add_cpp_test(value_test) -+#add_cpp_test(container_test) -+#add_cpp_test(url_test) -diff --git a/proton-c/bindings/cpp/docs/CMakeLists.txt b/proton-c/bindings/cpp/docs/CMakeLists.txt -index d512d15..8576867 100644 ---- a/proton-c/bindings/cpp/docs/CMakeLists.txt -+++ b/proton-c/bindings/cpp/docs/CMakeLists.txt -@@ -17,7 +17,7 @@ - # under the License. - # - --find_package(Doxygen) -+#find_package(Doxygen) - - if (DOXYGEN_FOUND) - configure_file ( -diff --git a/proton-c/docs/api/CMakeLists.txt b/proton-c/docs/api/CMakeLists.txt -index 7756e48..71ebb93 100644 ---- a/proton-c/docs/api/CMakeLists.txt -+++ b/proton-c/docs/api/CMakeLists.txt -@@ -17,7 +17,7 @@ - # under the License. - # - --find_package(Doxygen) -+#find_package(Doxygen) - if (DOXYGEN_FOUND) - configure_file (${CMAKE_CURRENT_SOURCE_DIR}/user.doxygen.in - ${CMAKE_CURRENT_BINARY_DIR}/user.doxygen) --- -2.7.4 - +-add_cpp_test(reconnect_test) +-add_cpp_test(link_test) +-add_cpp_test(credit_test) +-if (ENABLE_JSONCPP) +- add_cpp_test(connect_config_test) +- target_link_libraries(connect_config_test qpid-proton-core) # For pn_sasl_enabled +- set_tests_properties(cpp-connect_config_test PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") +- # Test data and output directories for connect_config_test +- file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/testdata" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") +-endif() ++# macro(add_cpp_test test) ++# add_executable (${test} src/${test}.cpp) ++# target_link_libraries (${test} qpid-proton-cpp ${PLATFORM_LIBS}) ++# add_test (NAME cpp-${test} ++# COMMAND ${PN_ENV_SCRIPT} -- ${test_env} ${TEST_EXE_PREFIX_CMD} $ ${ARGN}) ++# endmacro(add_cpp_test) ++# ++# add_cpp_test(codec_test) ++# add_cpp_test(connection_driver_test) ++# add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests) ++# add_cpp_test(message_test) ++# add_cpp_test(map_test) ++# add_cpp_test(scalar_test) ++# add_cpp_test(value_test) ++# add_cpp_test(container_test) ++# add_cpp_test(reconnect_test) ++# add_cpp_test(link_test) ++# add_cpp_test(credit_test) ++# if (ENABLE_JSONCPP) ++# add_cpp_test(connect_config_test) ++# target_link_libraries(connect_config_test qpid-proton-core) # For pn_sasl_enabled ++# set_tests_properties(cpp-connect_config_test PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") ++# # Test data and output directories for connect_config_test ++# file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/testdata" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") ++# endif() + + # TODO aconway 2018-10-31: Catch2 tests + # This is a simple example of a C++ test using the Catch2 framework. + # See c/tests/ for more interesting examples. + # Eventually all the C++ tests will migrate to Catch2. + +-include_directories(${CMAKE_SOURCE_DIR}/tests/include) +-add_executable(cpp-test src/cpp-test.cpp src/url_test.cpp) +-target_link_libraries(cpp-test qpid-proton-cpp ${PLATFORM_LIBS}) ++#include_directories(${CMAKE_SOURCE_DIR}/tests/include) ++#add_executable(cpp-test src/cpp-test.cpp src/url_test.cpp) ++#target_link_libraries(cpp-test qpid-proton-cpp ${PLATFORM_LIBS}) + + macro(add_catch_test tag) + add_test ( diff --git a/src/Makefile.am b/src/Makefile.am index b44dd13c5..eb41a0031 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -65,13 +65,13 @@ LIBBITCOIN_WALLET=libbitcoin_wallet.a endif $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*) - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g " + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g " $(LIBUNIVALUE): $(wildcard univalue/lib/*) - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g " + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g " $(LIBCRYPTOCONDITIONS): $(wildcard cryptoconditions/src/*) $(wildcard cryptoconditions/include/*) - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g " + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g " # Make is not made aware of per-object dependencies to avoid limiting building parallelization # But to build the less dependent modules first, we manually select their order here: diff --git a/src/cc/Makefile_custom b/src/cc/Makefile_custom old mode 100755 new mode 100644 index 79219ec96..0c2401f31 --- a/src/cc/Makefile_custom +++ b/src/cc/Makefile_custom @@ -2,6 +2,7 @@ SHELL = /bin/sh CC = gcc CC_DARWIN = g++-8 CC_WIN = x86_64-w64-mingw32-gcc-posix +CC_ARM64 = aarch64-linux-gnu-g++ CFLAGS_DARWIN = -DBUILD_CUSTOMCC -std=c++11 -arch x86_64 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib CFLAGS = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared CFLAGS_WIN = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/x86_64-w64-mingw32/include -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared @@ -28,6 +29,10 @@ else ifeq ($(HOST),x86_64-w64-mingw32) $(CC_WIN) $(CFLAGS_WIN) $(DEBUGFLAGS) -o $(TARGET_WIN) -c $(SOURCES) cp $(TARGET_WIN) ../libcc.dll #else ifeq ($(WIN_HOST),True) - todo: pass ENV var from build.sh if WIN host +else ifeq ($(HOST),aarch64-linux-gnu) + $(info LINUX ARM 64bit ) + $(CC_ARM64) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) -c $(SOURCES) + cp $(TARGET) ../libcc.so else $(info LINUX) $(CC) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) -c $(SOURCES) diff --git a/src/cc/makecustom b/src/cc/makecustom old mode 100755 new mode 100644 index 7f1c789c9..3516b4023 --- a/src/cc/makecustom +++ b/src/cc/makecustom @@ -1,5 +1,5 @@ #!/bin/sh -if make -f Makefile_custom "$@"; then +if HOST="$HOST" make -B -f Makefile_custom "$@"; then echo CUSTOMCC BUILD SUCCESSFUL else echo CUSTOMCC BUILD FAILED diff --git a/src/cryptoconditions/Makefile.am b/src/cryptoconditions/Makefile.am index 787b11ac6..615ac5783 100644 --- a/src/cryptoconditions/Makefile.am +++ b/src/cryptoconditions/Makefile.am @@ -15,7 +15,7 @@ AM_CFLAGS = -I$(top_srcdir)/src/asn -I$(top_srcdir)/include -I$(top_srcdir)/src/ LIBSECP256K1=src/include/secp256k1/libsecp256k1.la $(LIBSECP256K1): $(wildcard src/secp256k1/*) - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) -march:x86-64 -g + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) -g CRYPTOCONDITIONS_CORE=libcryptoconditions_core.la diff --git a/src/cryptoconditions/src/include/secp256k1/Makefile.am b/src/cryptoconditions/src/include/secp256k1/Makefile.am index 52303e4e4..13c83fe18 100644 --- a/src/cryptoconditions/src/include/secp256k1/Makefile.am +++ b/src/cryptoconditions/src/include/secp256k1/Makefile.am @@ -71,7 +71,7 @@ endif endif libsecp256k1_la_SOURCES = src/secp256k1.c -libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -march=x86-64 -g +libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -g libsecp256k1_la_LIBADD = $(JNI_LIB) $(SECP_LIBS) $(COMMON_LIB) libsecp256k1_jni_la_SOURCES = src/java/org_bitcoin_NativeSecp256k1.c src/java/org_bitcoin_Secp256k1Context.c diff --git a/zcutil/build-cross-aarch64.sh b/zcutil/build-cross-aarch64.sh new file mode 100644 index 000000000..eea5af471 --- /dev/null +++ b/zcutil/build-cross-aarch64.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# Copyright (c) 2019-2020 radix42 +# Copyright (c) 2019-2020 The Hush developers +# Original aarch64 port by radix42. Thank you! + +set -eu -o pipefail + +cat <<'EOF' + ________________ +< Building Hush! > + ---------------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || +EOF + +if [ "x$*" = 'x--help' ] +then + cat ./zcutil/dragon.txt + cat <