Added MacOS Compatibility (#53)

This commit is contained in:
Joshua Yabut 2017-01-16 14:21:36 -05:00 committed by GitHub
parent 5115f245a8
commit 36c4a6d4c5
17 changed files with 203 additions and 59 deletions

View File

@ -152,10 +152,10 @@ baseline.info:
baseline_filtered.info: baseline.info baseline_filtered.info: baseline.info
$(LCOV) -r $< "/usr/include/*" \ $(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \ "$(abs_builddir)/depends/$(BUILD)/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \ "$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gtest/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
"$(abs_builddir)/src/gtest/*" \ "$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \ "$(abs_builddir)/src/test/*" \
-o $@ -o $@
@ -165,10 +165,10 @@ leveldb_baseline.info: baseline_filtered.info
leveldb_baseline_filtered.info: leveldb_baseline.info leveldb_baseline_filtered.info: leveldb_baseline.info
$(LCOV) -r $< "/usr/include/*" \ $(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \ "$(abs_builddir)/depends/$(BUILD)/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \ "$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gtest/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
"$(abs_builddir)/src/gtest/*" \ "$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \ "$(abs_builddir)/src/test/*" \
-o $@ -o $@
@ -184,10 +184,10 @@ test_bitcoin.info: baseline_filtered_combined.info
test_bitcoin_filtered.info: test_bitcoin.info test_bitcoin_filtered.info: test_bitcoin.info
$(LCOV) -r $< "/usr/include/*" \ $(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \ "$(abs_builddir)/depends/$(BUILD)/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \ "$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gtest/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
"$(abs_builddir)/src/gtest/*" \ "$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \ "$(abs_builddir)/src/test/*" \
-o $@ -o $@
@ -200,10 +200,10 @@ zcash-gtest.info: baseline_filtered_combined.info
zcash-gtest_filtered.info: zcash-gtest.info zcash-gtest_filtered.info: zcash-gtest.info
$(LCOV) -r $< "/usr/include/*" \ $(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \ "$(abs_builddir)/depends/$(BUILD)/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \ "$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gtest/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
"$(abs_builddir)/src/gtest/*" \ "$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \ "$(abs_builddir)/src/test/*" \
-o $@ -o $@
@ -217,10 +217,10 @@ block_test.info: test_bitcoin_filtered.info
block_test_filtered.info: block_test.info block_test_filtered.info: block_test.info
$(LCOV) -r $< "/usr/include/*" \ $(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \ "$(abs_builddir)/depends/$(BUILD)/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \ "$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gtest/*" \ "$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
"$(abs_builddir)/src/gtest/*" \ "$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \ "$(abs_builddir)/src/test/*" \
-o $@ -o $@

View File

@ -1,5 +1,5 @@
build_darwin_CC: = $(shell xcrun -f clang) build_darwin_CC = gcc-5
build_darwin_CXX: = $(shell xcrun -f clang++) build_darwin_CXX = g++-5
build_darwin_AR: = $(shell xcrun -f ar) build_darwin_AR: = $(shell xcrun -f ar)
build_darwin_RANLIB: = $(shell xcrun -f ranlib) build_darwin_RANLIB: = $(shell xcrun -f ranlib)
build_darwin_STRIP: = $(shell xcrun -f strip) build_darwin_STRIP: = $(shell xcrun -f strip)
@ -7,11 +7,11 @@ build_darwin_OTOOL: = $(shell xcrun -f otool)
build_darwin_NM: = $(shell xcrun -f nm) build_darwin_NM: = $(shell xcrun -f nm)
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool) build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
build_darwin_SHA256SUM = shasum -a 256 build_darwin_SHA256SUM = shasum -a 256
build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -o build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o
#darwin host on darwin builder. overrides darwin host preferences. #darwin host on darwin builder. overrides darwin host preferences.
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) darwin_CC= gcc-5
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) darwin_CXX= g++-5
darwin_AR:=$(shell xcrun -f ar) darwin_AR:=$(shell xcrun -f ar)
darwin_RANLIB:=$(shell xcrun -f ranlib) darwin_RANLIB:=$(shell xcrun -f ranlib)
darwin_STRIP:=$(shell xcrun -f strip) darwin_STRIP:=$(shell xcrun -f strip)

View File

@ -2,8 +2,8 @@ OSX_MIN_VERSION=10.7
OSX_SDK_VERSION=10.9 OSX_SDK_VERSION=10.9
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=241.9 LD64_VERSION=241.9
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) darwin_CC=gcc-5 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) darwin_CXX=g++-5 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CFLAGS=-pipe darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS) darwin_CXXFLAGS=$(darwin_CFLAGS)

View File

@ -11,15 +11,15 @@ $(package)_config_opts_debug=variant=debug
$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam $(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1 $(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_linux=threadapi=pthread runtime-link=shared
$(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared $(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_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
$(package)_config_opts_x86_64_mingw32=address-model=64 $(package)_config_opts_x86_64_mingw32=address-model=64
$(package)_config_opts_i686_mingw32=address-model=32 $(package)_config_opts_i686_mingw32=address-model=32
$(package)_config_opts_i686_linux=address-model=32 architecture=x86 $(package)_config_opts_i686_linux=address-model=32 architecture=x86
$(package)_toolset_$(host_os)=gcc $(package)_toolset_$(host_os)=gcc
$(package)_archiver_$(host_os)=$($(package)_ar) $(package)_archiver_$(host_os)=$($(package)_ar)
$(package)_toolset_darwin=darwin $(package)_toolset_darwin=gcc
$(package)_archiver_darwin=$($(package)_libtool) $(package)_archiver_darwin=$($(package)_ar)
$(package)_config_libraries=chrono,filesystem,program_options,system,thread,test $(package)_config_libraries=chrono,filesystem,program_options,system,thread,test
$(package)_cxxflags=-fvisibility=hidden $(package)_cxxflags=-fvisibility=hidden
$(package)_cxxflags_linux=-fPIC $(package)_cxxflags_linux=-fPIC

View File

@ -9,12 +9,28 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_download_file=release-$($(package)_version).tar.gz $(package)_download_file=release-$($(package)_version).tar.gz
$(package)_sha256_hash=3f20b6acb37e5a98e8c4518165711e3e35d47deb6cdb5a4dd4566563b5efd232 $(package)_sha256_hash=3f20b6acb37e5a98e8c4518165711e3e35d47deb6cdb5a4dd4566563b5efd232
define $(package)_build_cmds ifeq ($(OS),Windows_NT)
$(MAKE) -C make GTEST_DIR='$(host_prefix)' CXXFLAGS='-fPIC' gmock-all.o uname_S := Windows
endef else
uname_S := $(shell uname -s)
endif
ifeq ($(uname_S), Darwin)
define $(package)_build_cmds
$(MAKE) -C make GTEST_DIR='$(host_prefix)' CXXFLAGS='-fPIC' gmock-all.o
endef
define $(package)_stage_cmds define $(package)_stage_cmds
install -D ./make/gmock-all.o $($(package)_staging_dir)$(host_prefix)/lib/libgmock.a && \ ginstall -D ./make/gmock-all.o $($(package)_staging_dir)$(host_prefix)/lib/libgmock.a && \
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
endef endef
else
define $(package)_build_cmds
$(MAKE) -C make GTEST_DIR='$(host_prefix)' CXXFLAGS='-fPIC' gmock-all.o
endef
define $(package)_stage_cmds
install -D ./make/gmock-all.o $($(package)_staging_dir)$(host_prefix)/lib/libgmock.a && \
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
endef
endif

View File

@ -5,11 +5,29 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_download_file=release-$($(package)_version).tar.gz $(package)_download_file=release-$($(package)_version).tar.gz
$(package)_sha256_hash=f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc $(package)_sha256_hash=f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc
define $(package)_build_cmds # Determine building operating system
$(MAKE) -C make CXXFLAGS=-fPIC gtest.a ifeq ($(OS),Windows_NT)
endef uname_S := Windows
else
uname_S := $(shell uname -s)
endif
define $(package)_stage_cmds ifeq ($(uname_S), Darwin)
install -D ./make/gtest.a $($(package)_staging_dir)$(host_prefix)/lib/libgtest.a && \ define $(package)_build_cmds
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include $(MAKE) -C make CXXFLAGS=-fPIC gtest.a
endef endef
define $(package)_stage_cmds
ginstall -D ./make/gtest.a $($(package)_staging_dir)$(host_prefix)/lib/libgtest.a && \
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
endef
else
define $(package)_build_cmds
$(MAKE) -C make CXXFLAGS=-fPIC gtest.a
endef
define $(package)_stage_cmds
install -D ./make/gtest.a $($(package)_staging_dir)$(host_prefix)/lib/libgtest.a && \
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
endef
endif

View File

@ -1,10 +1,10 @@
package=libsnark package=libsnark
$(package)_version=0.1 $(package)_download_path=https://github.com/z-classic/$(package)/archive/
$(package)_download_path=https://github.com/zcash/$(package)/archive/
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz $(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz $(package)_download_file=$($(package)_git_commit).tar.gz
$(package)_sha256_hash=9422b1a2a94e6b8be61f07af7f146087c2a7d70b208d07ad076622225aa7f0e4
$(package)_git_commit=2e6314a9f7efcd9af1c77669d7d9a229df86a777 $(package)_sha256_hash=2a8712a575bd9a98c1d1b2a1ebbded554cef09eea311c58da7cbc1278c306964
$(package)_git_commit=55e431e0117c7eea01f878244a664ad3554ea1de
$(package)_dependencies=libgmp libsodium $(package)_dependencies=libgmp libsodium

View File

@ -35,7 +35,7 @@ JSON_TEST_FILES = \
test/data/g1_compressed.json \ test/data/g1_compressed.json \
test/data/g2_compressed.json test/data/g2_compressed.json
RAW_TEST_FILES = #RAW_TEST_FILES = test/data/alertTests.raw // disabled for Zclassic
GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h) GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)

View File

@ -14,7 +14,9 @@
#include "crypto/equihash.h" #include "crypto/equihash.h"
#include "util.h" #include "util.h"
#ifdef __LP64__ // required to build on MacOS due to size_t ambiguity errors
#include "compat/endian.h"
#endif
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <stdexcept> #include <stdexcept>

View File

@ -38,8 +38,13 @@ TEST(Transaction, JSDescriptionRandomized) {
libzcash::JSOutput(addr, 50), libzcash::JSOutput(addr, 50),
libzcash::JSOutput(addr, 50) libzcash::JSOutput(addr, 50)
}; };
#ifdef __LP64__ // required for building on MacOS
boost::array<uint64_t, ZC_NUM_JS_INPUTS> inputMap;
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> outputMap;
#else
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap; boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap; boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
#endif
{ {
auto jsdesc = JSDescription::Randomized( auto jsdesc = JSDescription::Randomized(
@ -48,12 +53,22 @@ TEST(Transaction, JSDescriptionRandomized) {
inputMap, outputMap, inputMap, outputMap,
0, 0, false); 0, 0, false);
#ifdef __LP64__ // required for building on MacOS
std::set<uint64_t> inputSet(inputMap.begin(), inputMap.end());
std::set<uint64_t> expectedInputSet {0, 1};
#else
std::set<size_t> inputSet(inputMap.begin(), inputMap.end()); std::set<size_t> inputSet(inputMap.begin(), inputMap.end());
std::set<size_t> expectedInputSet {0, 1}; std::set<size_t> expectedInputSet {0, 1};
#endif
EXPECT_EQ(expectedInputSet, inputSet); EXPECT_EQ(expectedInputSet, inputSet);
#ifdef __LP64__ // required for building on MacOS
std::set<uint64_t> outputSet(outputMap.begin(), outputMap.end());
std::set<uint64_t> expectedOutputSet {0, 1};
#else
std::set<size_t> outputSet(outputMap.begin(), outputMap.end()); std::set<size_t> outputSet(outputMap.begin(), outputMap.end());
std::set<size_t> expectedOutputSet {0, 1}; std::set<size_t> expectedOutputSet {0, 1};
#endif
EXPECT_EQ(expectedOutputSet, outputSet); EXPECT_EQ(expectedOutputSet, outputSet);
} }
@ -64,8 +79,13 @@ TEST(Transaction, JSDescriptionRandomized) {
inputMap, outputMap, inputMap, outputMap,
0, 0, false, GenZero); 0, 0, false, GenZero);
#ifdef __LP64__ // required for building on MacOS
boost::array<uint64_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0};
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0};
#else
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0}; boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0};
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0}; boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0};
#endif
EXPECT_EQ(expectedInputMap, inputMap); EXPECT_EQ(expectedInputMap, inputMap);
EXPECT_EQ(expectedOutputMap, outputMap); EXPECT_EQ(expectedOutputMap, outputMap);
} }
@ -77,8 +97,13 @@ TEST(Transaction, JSDescriptionRandomized) {
inputMap, outputMap, inputMap, outputMap,
0, 0, false, GenMax); 0, 0, false, GenMax);
#ifdef __LP64__ // required for building on MacOS
boost::array<uint64_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1};
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1};
#else
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1}; boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1};
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1}; boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1};
#endif
EXPECT_EQ(expectedInputMap, inputMap); EXPECT_EQ(expectedInputMap, inputMap);
EXPECT_EQ(expectedOutputMap, outputMap); EXPECT_EQ(expectedOutputMap, outputMap);
} }

View File

@ -16,6 +16,10 @@
#include "util.h" #include "util.h"
#include "utilstrencodings.h" #include "utilstrencodings.h"
#ifdef __APPLE__
#undef HAVE_GETADDRINFO_A
#endif
#ifdef HAVE_GETADDRINFO_A #ifdef HAVE_GETADDRINFO_A
#include <netdb.h> #include <netdb.h>
#endif #endif

View File

@ -47,8 +47,13 @@ JSDescription JSDescription::Randomized(
const uint256& anchor, const uint256& anchor,
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs, boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS>& outputs, boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS>& outputs,
#ifdef __LP64__ // required to build on MacOS due to size_t ambiguity errors
boost::array<uint64_t, ZC_NUM_JS_INPUTS>& inputMap,
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS>& outputMap,
#else
boost::array<size_t, ZC_NUM_JS_INPUTS>& inputMap, boost::array<size_t, ZC_NUM_JS_INPUTS>& inputMap,
boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap, boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap,
#endif
CAmount vpub_old, CAmount vpub_old,
CAmount vpub_new, CAmount vpub_new,
bool computeProof, bool computeProof,

View File

@ -86,8 +86,13 @@ public:
const uint256& rt, const uint256& rt,
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs, boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS>& outputs, boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS>& outputs,
#ifdef __LP64__ // required to build on MacOS due to size_t ambiguity errors
boost::array<uint64_t, ZC_NUM_JS_INPUTS>& inputMap,
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS>& outputMap,
#else
boost::array<size_t, ZC_NUM_JS_INPUTS>& inputMap, boost::array<size_t, ZC_NUM_JS_INPUTS>& inputMap,
boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap, boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap,
#endif
CAmount vpub_old, CAmount vpub_old,
CAmount vpub_new, CAmount vpub_new,
bool computeProof = true, // Set to false in some tests bool computeProof = true, // Set to false in some tests

View File

@ -934,8 +934,13 @@ Object AsyncRPCOperation_sendmany::perform_joinsplit(
{info.vjsin[0], info.vjsin[1]}; {info.vjsin[0], info.vjsin[1]};
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs
{info.vjsout[0], info.vjsout[1]}; {info.vjsout[0], info.vjsout[1]};
#ifdef __LP64__ // required to build on MacOS due to size_t ambiguity errors
boost::array<uint64_t, ZC_NUM_JS_INPUTS> inputMap;
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> outputMap;
#else
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap; boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap; boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
#endif
JSDescription jsdesc = JSDescription::Randomized( JSDescription jsdesc = JSDescription::Randomized(
*pzcashParams, *pzcashParams,
joinSplitPubKey_, joinSplitPubKey_,

View File

@ -160,7 +160,11 @@ public:
// Transaction hash // Transaction hash
uint256 hash; uint256 hash;
// Index into CTransaction.vjoinsplit // Index into CTransaction.vjoinsplit
#ifdef __LP64__ // required to build on MacOS due to size_t ambiguity errors
uint64_t js;
#else
size_t js; size_t js;
#endif
// Index into JSDescription fields of length ZC_NUM_JS_OUTPUTS // Index into JSDescription fields of length ZC_NUM_JS_OUTPUTS
uint8_t n; uint8_t n;

50
zcutil/build-mac.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
export CC=gcc-5
export CXX=g++-5
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' ]
then
cat <<EOF
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
instrumentation, thus enabling "make cov" to work.
EOF
exit 0
fi
# If --enable-lcov is the first argument, enable lcov coverage support:
LCOV_ARG=''
HARDENING_ARG='--disable-hardening'
if [ "x${1:-}" = 'x--enable-lcov' ]
then
LCOV_ARG='--enable-lcov'
HARDENING_ARG='--disable-hardening'
shift
fi
TRIPLET=`./depends/config.guess`
PREFIX="$(pwd)/depends/$TRIPLET"
make "$@" -C ./depends/ V=1 NO_QT=1
./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/gcc5/5.4.0/include/c++/5.4.0 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
make "$@" V=1 NO_GTEST=0 STATIC=1

View File

@ -2,7 +2,11 @@
set -eu set -eu
PARAMS_DIR="$HOME/.zcash-params" if [[ "$OSTYPE" == "darwin"* ]]; then
PARAMS_DIR="$HOME/Library/Application Support/ZcashParams"
else
PARAMS_DIR="$HOME/.zcash-params"
fi
SPROUT_PKEY_NAME='sprout-proving.key' SPROUT_PKEY_NAME='sprout-proving.key'
SPROUT_VKEY_NAME='sprout-verifying.key' SPROUT_VKEY_NAME='sprout-verifying.key'
@ -18,15 +22,21 @@ function fetch_params {
local dlname="${output}.dl" local dlname="${output}.dl"
local expectedhash="$3" local expectedhash="$3"
if ! [ -f "$output" ] if ! [ -f "$output" ]; then
then
echo "Retrieving: $url" echo "Retrieving: $url"
wget \ if [ $(sw_vers -productName) == "Mac" ]; then
--progress=dot:giga \ curl \
--output-document="$dlname" \ --output "$dlname" \
--continue \ -# -L -C - \
--retry-connrefused --waitretry=3 --timeout=30 \ "$url"
"$url" else
wget \
--progress=dot:giga \
--output-document="$dlname" \
--continue \
--retry-connrefused --waitretry=3 --timeout=30 \
"$url"
fi
"$SHA256CMD" $SHA256ARGS --check <<EOF "$SHA256CMD" $SHA256ARGS --check <<EOF
$expectedhash $dlname $expectedhash $dlname