Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS build for marmara and remove explicit reference to libcc.dl and build it as in komodo codebase #49

Open
wants to merge 7 commits into
base: development
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
build the static libcc.a library as in upstream komodo codebae
  	build marmara for macos:
	- remove cpath, gcc in .github/workflows/marmara_mac_ci.yml
	- remove installing gcc from  README.md
	- deleted darwin.host.mk.patch
	- deleted darwin.mk.patch
	- change cc/g++ -> clang/clang++ default in depends/builders/darwin.mk and in depends/hosts/darwin.mk
	- fix bdb build on native darwin in depends/packages/bdb.mk
	- fix libcurl linkage under darwin and disable HTTP/2, librtmp and brotli  in depends/packages/libcurl.mk
	- fix MACOSX_DEPLOYMENT_TARGET in depends/packages/libsodium.mk
	- remove gcc specific linker flag -static-libgcc in src/Makefile.am
	- remove -enable-static --disable-shared from scripts in zcutil/build-mac-dtest.sh and zcutil/build-mac.sh
	- remove gcc related flags from Mac build in zcutil/build-mac-dtest.sh and zcutil/build-mac.sh
	- remove -Wno-builtin-declaration-mismatch for Mac in zcutil/build-mac-dtest.sh and zcutil/build-mac.sh
	- remove linker options -Wl,-undefined -Wl,dynamic_lookup in zcutil/build-mac-dtest.sh and zcutil/build-mac.sh
rumeysayilmaz committed Sep 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c0c4007c64775898e35d784bb7183dee67b401f3
40 changes: 21 additions & 19 deletions .github/workflows/marmara_mac_ci.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ jobs:

macos-build:
name: MacOS Build
runs-on: macos-latest
runs-on: macos-latest-large

steps:
- uses: actions/checkout@v4
@@ -31,47 +31,49 @@ jobs:
- name: Install deps (macOS)
run: |
brew update
brew upgrade || true
brew tap discoteq/discoteq; brew install flock
brew install autoconf autogen automake
brew install gcc@8
brew install binutils
brew install protobuf
brew install coreutils
brew install wget
brew install python3
brew install gmp
# https://www.jessesquires.com/blog/2020/01/06/selecting-an-xcode-version-on-github-ci/
# https://github.com/actions/runner-images/issues/2619 (bsdtar issues)
# flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!!
- name: Build (macOS)
run: |
# flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!!
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/
./zcutil/build-mac-dtest.sh -j4
tar -czvf marmara-macos.tar.gz src/marmarad src/marmara-cli
gtar -czvf marmara-macos.tar.gz src/marmarad src/marmara-cli src/wallet-utility src/komodo-tx
# env:
# DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer

- name: Upload marmara-macos.tar.gz as artifact
uses: actions/upload-artifact@v4
with:
name: marmara-macos
path: ./marmara-macos.tar.gz
path: |
./marmara-macos.tar.gz
# macos-test-dice-token-reards-faucet-cc:
# macos-test-dice-token-rewards-faucet-cc:
# if: ${{ false }}

# name: Test (MacOS/Dice, Token, Faucet, Rewards)
# runs-on: macos-latest
# needs: macos-build

# steps:
# - uses: actions/checkout@v2
# - uses: actions/checkout@v4

# - name: Install deps (Dice, Token, Faucet, Rewards CC)
# run: |
# brew install curl
# brew install python3 curl
# python3 -m pip install setuptools wheel
# python3 -m pip install slick-bitcoinrpc pytest wget jsonschema

# - name: Download komodo-macos.tar.gz
# uses: actions/download-artifact@v1
# uses: actions/download-artifact@v4
# with:
# name: komodo-macos

@@ -150,11 +152,11 @@ jobs:
# needs: macos-build

# steps:
# - uses: actions/checkout@v2
# - uses: actions/checkout@v4

# - name: Install deps (ChannelsCC)
# run: |
# brew install curl
# brew install python3 curl
# python3 -m pip install setuptools wheel
# python3 -m pip install slick-bitcoinrpc pytest wget jsonschema
# - name: Download komodo-macos.tar.gz
@@ -183,11 +185,11 @@ jobs:

# - name: Install deps (HeirCC)
# run: |
# brew install curl
# brew install python3 curl
# python3 -m pip install setuptools wheel
# python3 -m pip install slick-bitcoinrpc pytest wget jsonschema
# python3 -m pip install slick-bitcoinrpc pytest wget jsonschemaa
# - name: Download komodo-macos.tar.gz
# uses: actions/download-artifact@v1
# uses: actions/download-artifact@v4
# with:
# name: komodo-macos

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ brew update
brew upgrade
brew tap discoteq/discoteq; brew install flock
brew install autoconf autogen automake
brew update && brew install gcc@8
brew update
brew install binutils
brew install protobuf
brew install coreutils
21 changes: 0 additions & 21 deletions darwin.host.mk.patch

This file was deleted.

40 changes: 0 additions & 40 deletions darwin.mk.patch

This file was deleted.

11 changes: 6 additions & 5 deletions depends/builders/darwin.mk
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
build_darwin_CC = gcc-8
build_darwin_CXX = g++-8
build_darwin_CC:=$(shell xcrun -f clang) --sysroot $(shell xcrun --show-sdk-path)
build_darwin_CXX:=$(shell xcrun -f clang++) --sysroot $(shell xcrun --show-sdk-path)
build_darwin_AR: = $(shell xcrun -f ar)
build_darwin_RANLIB: = $(shell xcrun -f ranlib)
build_darwin_STRIP: = $(shell xcrun -f strip)
build_darwin_OTOOL: = $(shell xcrun -f otool)
build_darwin_NM: = $(shell xcrun -f nm)
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
build_darwin_SHA256SUM = shasum -a 256
build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o

#darwin host on darwin builder. overrides darwin host preferences.
darwin_CC= gcc-8
darwin_CXX= g++-8
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) -fvisibility=hidden -fvisibility-inlines-hidden --sysroot $(shell xcrun --show-sdk-path)
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -fvisibility=hidden -fvisibility-inlines-hidden -stdlib=libc++ --sysroot $(shell xcrun --show-sdk-path)
darwin_AR:=$(shell xcrun -f ar)
darwin_RANLIB:=$(shell xcrun -f ranlib)
darwin_STRIP:=$(shell xcrun -f strip)
darwin_LIBTOOL:=$(shell xcrun -f libtool)
darwin_OTOOL:=$(shell xcrun -f otool)
darwin_NM:=$(shell xcrun -f nm)
darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
darwin_native_binutils=
darwin_native_toolchain=
49 changes: 41 additions & 8 deletions depends/hosts/darwin.mk
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
OSX_MIN_VERSION=10.12
OSX_SDK_VERSION=10.12
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=253.9
darwin_CC=gcc-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CXX=g++-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
OSX_MIN_VERSION=10.15
OSX_SDK_VERSION=10.15.6
XCODE_VERSION=12.1
XCODE_BUILD_ID=12A7403
LD64_VERSION=609

OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers

# Flag explanations:
#
# -mlinker-version
#
# Ensures that modern linker features are enabled. See here for more
# details: https://github.com/bitcoin/bitcoin/pull/19407.
#
# -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.
#
# -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
#
# Forces clang to use the libc++ headers from our SDK and completely
# forget about the libc++ headers from the standard directories
#
# TODO: Once we start requiring a clang version that has the
# -stdlib++-isystem<directory> flag first introduced here:
# https://reviews.llvm.org/D64089, we should use that instead. Read the
# differential summary there for more details.
#
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1

darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)

darwin_release_CFLAGS=-O1
darwin_release_CFLAGS=-O2
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)

darwin_debug_CFLAGS=-O1
darwin_debug_CFLAGS=-g -O0
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)

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
8 changes: 5 additions & 3 deletions depends/packages/bdb.mk
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ 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)_cxxflags=-std=c++11
$(package)_cxxflags+=-std=c++11
endef

define $(package)_preprocess_cmds
@@ -25,7 +25,9 @@ endef

ifeq ($(build_os),darwin)
define $(package)_preprocess_cmds
sed -i -e "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h
sed -i -e "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h && \
sed -i.old 's/__atomic_compare_exchange\\(/__atomic_compare_exchange_db(/' src/dbinc/atomic.h && \
sed -i.old 's/atomic_init/atomic_init_db/' src/dbinc/atomic.h src/mp/mp_region.c src/mp/mp_mvcc.c src/mp/mp_fget.c src/mutex/mut_method.c src/mutex/mut_tas.c
endef
else ifeq ($(host_os),mingw32)
define $(package)_preprocess_cmds
@@ -39,4 +41,4 @@ endef

define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install_lib install_include
endef
endef
1 change: 1 addition & 0 deletions depends/packages/libcurl.mk
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ $(package)_sha256_hash=816e41809c043ff285e8c0f06a75a1fa250211bbfb2dc0a037eeef39f
$(package)_config_opts=--with-openssl --disable-shared --enable-static --prefix=$(host_prefix)
$(package)_config_opts_linux=--host=x86_64-unknown-linux-gnu
$(package)_config_opts_mingw32=--enable-mingw --host=x86_64-w64-mingw32
$(package)_config_opts_darwin=--without-libidn2 --without-zstd --without-nghttp2 --without-librtmp --without-brotli
$(package)_cflags_darwin=-mmacosx-version-min=$(OSX_MIN_VERSION)
$(package)_conf_tool=./configure

2 changes: 1 addition & 1 deletion depends/packages/libsodium.mk
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ $(package)_config_opts=
define $(package)_set_vars
$(package)_build_env=DO_NOT_UPDATE_CONFIG_SCRIPTS=1
ifeq ($(build_os),darwin)
$(package)_build_env+=MACOSX_DEPLOYMENT_TARGET="10.11"
$(package)_build_env+=MACOSX_DEPLOYMENT_TARGET="$(OSX_MIN_VERSION)"
$(package)_cc=clang
$(package)_cxx=clang++
endif
173 changes: 94 additions & 79 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -31,16 +31,17 @@ BITCOIN_INCLUDES += -I$(srcdir)/snark
BITCOIN_INCLUDES += -I$(srcdir)/snark/libsnark
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

# 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_SERVER=libbitcoin_server.a
LIBBITCOIN_WALLET=libbitcoin_wallet.a
LIBBITCOIN_COMMON=libbitcoin_common.a
LIBBITCOIN_CLI=libbitcoin_cli.a
@@ -52,6 +53,7 @@ LIBSECP256K1=secp256k1/libsecp256k1.la
LIBCRYPTOCONDITIONS=cryptoconditions/libcryptoconditions_core.la
LIBSNARK=snark/libsnark.a
LIBUNIVALUE=univalue/libunivalue.la
LIBCC=libcc.a
LIBZCASH=libzcash.a

if ENABLE_ZMQ
@@ -95,13 +97,15 @@ $(LIBCRYPTOCONDITIONS): $(wildcard cryptoconditions/src/*) $(wildcard cryptocond
# But to build the less dependent modules first, we manually select their order here:
EXTRA_LIBRARIES += \
$(LIBBITCOIN_CRYPTO) \
$(LIBVERUS_CRYPTO) \
$(LIBVERUS_PORTABLE_CRYPTO) \
# $(LIBVERUS_CRYPTO) \
# $(LIBVERUS_PORTABLE_CRYPTO) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_SERVER) \
$(LIBBITCOIN_CLI) \
libzcash.a
$(LIBZCASH) \
$(LIBCC)

if ENABLE_WALLET
BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
EXTRA_LIBRARIES += $(LIBBITCOIN_WALLET)
@@ -183,9 +187,9 @@ BITCOIN_CORE_H = \
consensus/validation.h \
core_io.h \
core_memusage.h \
crypto/haraka.h \
crypto/haraka_portable.h \
crypto/verus_hash.h \
crypto/haraka.h \ #does marmara use haraka check
crypto/haraka_portable.h \ # removed from komodo
crypto/verus_hash.h \ # removed from komodo, verus related
deprecation.h \
hash.h \
httprpc.h \
@@ -290,44 +294,44 @@ libbitcoin_server_a_SOURCES = \
cc/import.cpp \
cc/importgateway.cpp \
cc/CCassetsCore.cpp \
cc/old/CCassetsCore_v0.cpp \
cc/CCassetstx.cpp \
cc/old/CCassetstx_v0.cpp \
cc/old/CCassetsCore_v0.cpp \ #removed from komodo
cc/CCassetstx.cpp \ #removed from komodo
cc/old/CCassetstx_v0.cpp \ #removed from komodo
cc/CCcustom.cpp \
cc/CCtx.cpp \
cc/CCutils.cpp \
cc/CCvalidation.cpp \
cc/CCvalidation.cpp \ #removed from komodo
cc/CCtokens.cpp \
cc/old/CCtokens_v0.cpp \
cc/old/CCtokens_v0.cpp \ #removed from komodo
cc/assets.cpp \
cc/old/assets_v0.cpp \
cc/old/assets_v0.cpp \ #removed from komodo
cc/faucet.cpp \
cc/rewards.cpp \
cc/dice.cpp \
cc/lotto.cpp \
cc/fsm.cpp \
cc/heir.cpp \
cc/oracles.cpp \
cc/prices.cpp \
cc/pegs.cpp \
cc/prices.cpp \ #removed from komodo
cc/pegs.cpp \ #removed from komodo
cc/marmara.cpp \
cc/marmara_h0.cpp \
cc/payments.cpp \
cc/gateways.cpp \
cc/channels.cpp \
cc/auction.cpp \
cc/betprotocol.cpp \
cc/pricesfeed.cpp \
cc/priceslibs/cjsonpointer.cpp \
cc/kogs.cpp \
cc/pricesfeed.cpp \ #removed from komodo
cc/priceslibs/cjsonpointer.cpp \ #removed from komodo
cc/kogs.cpp \ #removed from komodo
chain.cpp \
checkpoints.cpp \
crosschain.cpp \
crosschain_authority.cpp \
crypto/haraka.h \
crypto/haraka_portable.h \
crypto/verus_hash.h \
crypto/verus_hash.cpp \
crosschain_authority.cpp \ #removed from komodo
crypto/haraka.h \ #removed from komodo
crypto/haraka_portable.h \ #removed from komodo
crypto/verus_hash.h \ #removed from komodo
crypto/verus_hash.cpp \ #removed from komodo
deprecation.cpp \
httprpc.cpp \
httpserver.cpp \
@@ -353,8 +357,8 @@ libbitcoin_server_a_SOURCES = \
rpc/net.cpp \
rpc/rawtransaction.cpp \
rpc/server.cpp \
rpc/tokensrpc.cpp \
rpc/pricesrpc.cpp \
rpc/tokensrpc.cpp \ #removed from komodo
rpc/pricesrpc.cpp \ #removed from komodo
rpc/marmararpc.cpp \
script/serverchecker.cpp \
script/sigcache.cpp \
@@ -411,6 +415,11 @@ libbitcoin_wallet_a_SOURCES = \
$(BITCOIN_CORE_H) \
$(LIBZCASH_H)

# a static library for cryptoconditions
libcc_a_SOURCES = cc/cclib.cpp
libcc_a_CXXFLAGS = -DBUILD_CUSTOMCC -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./cc
# libcc_a_LDFLAGS = -version-info 0:0:0

# crypto primitives library
crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
@@ -431,10 +440,10 @@ crypto_libbitcoin_crypto_a_SOURCES = \
crypto/sha256.h \
crypto/sha512.cpp \
crypto/sha512.h \
crypto/haraka.h \
crypto/haraka_portable.h \
crypto/verus_hash.h \
crypto/verus_hash.cpp
crypto/haraka.h \ # removed from komodo
crypto/haraka_portable.h \ # removed from komodo
crypto/verus_hash.h \ # removed from komodo
crypto/verus_hash.cpp # removed from komodo

if EXPERIMENTAL_ASM
crypto_libbitcoin_crypto_a_SOURCES += crypto/sha256_sse4.cpp
@@ -480,10 +489,10 @@ libbitcoin_common_a_SOURCES = \
consensus/upgrades.cpp \
core_read.cpp \
core_write.cpp \
crypto/haraka.h \
crypto/haraka_portable.h \
crypto/verus_hash.h \
crypto/verus_hash.cpp \
crypto/haraka.h \ # removed from komodo
crypto/haraka_portable.h \ # removed from komodo
crypto/verus_hash.h \ # removed from komodo
crypto/verus_hash.cpp \ # removed from komodo
hash.cpp \
importcoin.cpp \
key.cpp \
@@ -506,7 +515,7 @@ libbitcoin_common_a_SOURCES = \
script/standard.cpp \
transaction_builder.cpp \
cc/CCtokenutils.cpp \
cc/old/CCtokenutils_v0.cpp \
cc/old/CCtokenutils_v0.cpp \ # removed from komodo
cc/CCutilbits.cpp \
gmp_i64.c \
$(BITCOIN_CORE_H) \
@@ -570,8 +579,8 @@ marmarad_LDADD = \
$(LIBBITCOIN_ZMQ) \
$(LIBBITCOIN_PROTON) \
$(LIBBITCOIN_CRYPTO) \
$(LIBVERUS_CRYPTO) \
$(LIBVERUS_PORTABLE_CRYPTO) \
$(LIBVERUS_CRYPTO) \ #removed from komodo
$(LIBVERUS_PORTABLE_CRYPTO) \ #removed from komodo
$(LIBZCASH) \
$(LIBSNARK) \
$(LIBLEVELDB) \
@@ -593,44 +602,44 @@ marmarad_LDADD += \
$(ZMQ_LIBS) \
$(PROTON_LIBS) \
$(LIBBITCOIN_CRYPTO) \
$(LIBVERUS_CRYPTO) \
$(LIBVERUS_PORTABLE_CRYPTO) \
$(LIBVERUS_CRYPTO) \ #verus related, removed from komodo
$(LIBVERUS_PORTABLE_CRYPTO) \ #removed from komodo
$(LIBZCASH_LIBS)

if TARGET_DARWIN
marmarad_LDADD += libcc.dylib $(LIBSECP256K1)
endif
if TARGET_WINDOWS
marmarad_LDADD += libcc.dll $(LIBSECP256K1)
endif
if TARGET_LINUX
marmarad_LDADD += libcc.so $(LIBSECP256K1)
endif
$(LIBCC) \
-lcurl

# https://github.com/marmarachain/marmara/pull/47#issuecomment-2363865476 commented out explicit reference to libcc.dll
# if TARGET_DARWIN
# marmarad_LDADD += libcc.dylib $(LIBSECP256K1)
# endif
# if TARGET_WINDOWS
# marmarad_LDADD += libcc.dll $(LIBSECP256K1)
# endif
# if TARGET_LINUX
# marmarad_LDADD += libcc.so $(LIBSECP256K1)
# endif

if ENABLE_PROTON
marmarad_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
endif

# [+] Decker: use static linking for libstdc++.6.dylib, libgomp.1.dylib, libgcc_s.1.dylib
if TARGET_DARWIN
marmarad_LDFLAGS += -static-libgcc
endif

# bitcoin-cli binary #
marmara_cli_SOURCES = bitcoin-cli.cpp
marmara_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
marmara_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
marmara_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
if TARGET_DARWIN
marmara_cli_LDFLAGS += -static-libgcc
endif


# wallet-utility binary #
if ENABLE_WALLET
wallet_utility_SOURCES = wallet-utility.cpp
wallet_utility_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
wallet_utility_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
wallet_utility_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

if TARGET_WINDOWS
wallet_utility_SOURCES += wallet-utility-res.rc
endif
endif

if TARGET_WINDOWS
@@ -647,17 +656,17 @@ marmara_cli_LDADD = \
$(EVENT_LIBS) \
$(LIBZCASH) \
$(LIBBITCOIN_CRYPTO) \
$(LIBVERUS_CRYPTO) \
$(LIBVERUS_PORTABLE_CRYPTO) \
$(LIBVERUS_CRYPTO) \ # verus related, removed from komodo
$(LIBVERUS_PORTABLE_CRYPTO) \ # verus related, removed from komodo
$(LIBZCASH_LIBS)

if ENABLE_WALLET
wallet_utility_LDADD = \
libbitcoin_wallet.a \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_CRYPTO) \
$(LIBVERUS_CRYPTO) \
$(LIBVERUS_PORTABLE_CRYPTO) \
$(LIBVERUS_CRYPTO) \ # verus related, removed from komodo
$(LIBVERUS_PORTABLE_CRYPTO) \ # verus related, removed from komodo
$(LIBSECP256K1) \
$(LIBBITCOIN_UTIL) \
$(BOOST_LIBS) \
@@ -688,8 +697,8 @@ komodo_tx_LDADD = \
$(LIBZCASH) \
$(LIBSNARK) \
$(LIBBITCOIN_CRYPTO) \
$(LIBVERUS_CRYPTO) \
$(LIBVERUS_PORTABLE_CRYPTO) \
$(LIBVERUS_CRYPTO) \ # verus related, removed from komodo
$(LIBVERUS_PORTABLE_CRYPTO) \ # verus related, removed from komodo
$(LIBZCASH_LIBS) \
$(LIBCRYPTOCONDITIONS)

@@ -707,12 +716,12 @@ libzcash_a_SOURCES = \
zcash/prf.cpp \
zcash/util.cpp \
zcash/zip32.cpp \
zcash/circuit/commitment.tcc \
zcash/circuit/gadget.tcc \
zcash/circuit/merkle.tcc \
zcash/circuit/note.tcc \
zcash/circuit/prfs.tcc \
zcash/circuit/utils.tcc
zcash/circuit/commitment.tcc \ #removed from komodo
zcash/circuit/gadget.tcc \ #removed from komodo
zcash/circuit/merkle.tcc \ #removed from komodo
zcash/circuit/note.tcc \ #removed from komodo
zcash/circuit/prfs.tcc \ #removed from komodo
zcash/circuit/utils.tcc #removed from komodo

libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) $(HARDENED_CXXFLAGS) $(HARDENED_LDFLAGS) -pipe $(SAN_LDFLAGS) -O1 -g -Wstack-protector $(SAN_CXXFLAGS) -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)

@@ -770,6 +779,12 @@ clean-local:
-$(MAKE) -C cryptoconditions clean
rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
-rm -f config.h
-$(RM) *.a
-$(RM) crypto/*.a
-$(RM) cryptoconditions/.libs/*.a

clean-all: clean-local
-$(MAKE) -C univalue clean-all

.rc.o:
@test -f $(WINDRES)
@@ -797,6 +812,6 @@ endif

if ENABLE_TESTS
include Makefile.ktest.include
#include Makefile.test.include
#include Makefile.gtest.include
#include Makefile.test.include #bitcoin tests
#include Makefile.gtest.include #zcash tests
endif
46 changes: 22 additions & 24 deletions zcutil/build-mac-dtest.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
#!/bin/bash
export CC=gcc-8
export CXX=g++-8
export LIBTOOL=libtool
export AR=ar
export RANLIB=ranlib
export STRIP=strip
export OTOOL=otool
export NM=nm

set -eu -o pipefail

if [ "x$*" = 'x--help' ]
@@ -18,11 +9,13 @@ Usage:
$0 --help
Show this help message and exit.
$0 [ --enable-lcov ] [ MAKEARGS... ]
Build Zcash and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Zcash itself. If
--enable-lcov is passed, Zcash is configured to add coverage
$0 [ --enable-lcov ] [ --enable-debug ] [ MAKEARGS... ]
Build Komodo and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Komodo itself.
If --enable-lcov is passed, Komodo is configured to add coverage
instrumentation, thus enabling "make cov" to work.
If --enable-debug is passed, Komodo is built with debugging information. It
must be passed after the previous arguments, if present.
EOF
exit 0
fi
@@ -37,22 +30,27 @@ then
shift
fi

# If --enable-debug is the next argument, enable debugging
DEBUGGING_ARG=''
if [ "x${1:-}" = 'x--enable-debug' ]
then
DEBUG=1
export DEBUG
DEBUGGING_ARG='--enable-debug'
shift
fi

TRIPLET=`./depends/config.guess`
PREFIX="$(pwd)/depends/$TRIPLET"

make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1

#BUILD CCLIB

WD=$PWD
cd src/cc
echo $PWD
./makecustom
cd $WD

./autogen.sh

CPPFLAGS="-I$PREFIX/include -arch x86_64 -DTESTMODE" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.4.0_2/include/c++/8.4.0_2/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing \
-Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion \
-Wno-unknown-warning-option -Werror -Wno-error=attributes -g" \
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG"

make "$@" V=1 NO_GTEST=1 STATIC=1
make "$@" NO_GTEST=1 STATIC=1
53 changes: 22 additions & 31 deletions zcutil/build-mac.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
#!/bin/bash
export CC=gcc-8
export CXX=g++-8
export LIBTOOL=libtool
export AR=ar
export RANLIB=ranlib
export STRIP=strip
export OTOOL=otool
export NM=nm

set -eu -o pipefail

if [ "x$*" = 'x--help' ]
@@ -18,11 +9,13 @@ Usage:
$0 --help
Show this help message and exit.
$0 [ --enable-lcov ] [ MAKEARGS... ]
Build Zcash and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Zcash itself. If
--enable-lcov is passed, Zcash is configured to add coverage
$0 [ --enable-lcov ] [ --enable-debug ] [ MAKEARGS... ]
Build Komodo and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Komodo itself.
If --enable-lcov is passed, Komodo is configured to add coverage
instrumentation, thus enabling "make cov" to work.
If --enable-debug is passed, Komodo is built with debugging information. It
must be passed after the previous arguments, if present.
EOF
exit 0
fi
@@ -37,29 +30,27 @@ then
shift
fi

# If --enable-debug is the next argument, enable debugging
DEBUGGING_ARG=''
if [ "x${1:-}" = 'x--enable-debug' ]
then
DEBUG=1
export DEBUG
DEBUGGING_ARG='--enable-debug'
shift
fi

TRIPLET=`./depends/config.guess`
PREFIX="$(pwd)/depends/$TRIPLET"

make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1

#BUILD CCLIB

WD=$PWD

cd src/cc
echo $PWD
echo Making cclib...
./makecustom

cd ./priceslibs
echo Making prices feeds custom libs...
make all

cd $WD

./autogen.sh

CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing \
-Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion \
-Wno-unknown-warning-option -Werror -Wno-error=attributes -g" \
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG"

make "$@" V=1 NO_GTEST=1 STATIC=1
make "$@" NO_GTEST=1 STATIC=1