Skip to content

Commit

Permalink
Pull over depends and build changes from zc.v0.10.0.latest. Fails to …
Browse files Browse the repository at this point in the history
…build due to new ./configure dependency for serialization stuff.
  • Loading branch information
nejucomo committed Dec 22, 2015
1 parent 9d69aca commit c4da097
Show file tree
Hide file tree
Showing 18 changed files with 239 additions and 146 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ endif

dist_noinst_SCRIPTS = autogen.sh

EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.sh qa/pull-tester/run-bitcoin-cli qa/rpc-tests $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING)
EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.sh qa/pull-tester/run-bitcoin-cli qa/rpc-tests qa/zerocash $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING)

CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)

Expand Down
63 changes: 62 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ if test "x${CXXFLAGS+set}" = "xset"; then
else
CXXFLAGS_overridden=no
fi

# Zerocash requries C++11 compatibility; set it early:
CXXFLAGS="-std=c++11 $CXXFLAGS"
# Zerocash uses this libsnark curve:
CPPFLAGS="-DCURVE_ALT_BN128 $CPPFLAGS"

AC_PROG_CXX
m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX])

Expand Down Expand Up @@ -666,6 +672,9 @@ 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++, 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))

Expand All @@ -679,6 +688,53 @@ else
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)])

AC_CHECK_HEADER([cryptopp/eccrypto.h],,AC_MSG_ERROR(libcryptopp headers missing))
# We link against "main" as a stop-gap; crypto++ is full of template
# classes whose library symbols are mangled by some black alchemy.
AC_CHECK_LIB([cryptopp],[main],CRYPTOPP_LIBS=-lcryptopp, [AC_MSG_ERROR(libcryptopp missing)])

# libsnark header layout is broken unless cpp's -I is passed with the
# libsnark directory, so for now we use this hideous workaround:
echo 'Hunting for libsnark include directory...'
[LIBSNARK_INCDIR="$(echo "$CPPFLAGS" | sed 's,^.*-I\([^ ]*/include\).*$,\1/libsnark,')"]
if test -d "$LIBSNARK_INCDIR"; then
echo "Found libsnark include directory: $LIBSNARK_INCDIR"
else
AC_MSG_ERROR(libsnark include directory not found)
fi

CPPFLAGS="-I$LIBSNARK_INCDIR $CPPFLAGS"

# Now check for libsnark compilability using traditional autoconf tests:
AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])

# Abuse the ugly libsnark hack above further to get the libzerocash directory
[LIBZEROCASH_INCDIR=$(echo "$LIBSNARK_INCDIR" | sed 's,libsnark$,libzerocash,')]
if test -d "$LIBZEROCASH_INCDIR"; then
echo "Found libzerocash include directory: $LIBZEROCASH_INCDIR"
else
AC_MSG_ERROR(libzerocash include directory not found)
fi

CPPFLAGS="-I$LIBZEROCASH_INCDIR $CPPFLAGS"

# libzerocash depends on headers in ./src/, so for the following
# AC_CHECK_HEADER, that has to be on the include path list.
CPPFLAGS_TEMP="$CPPFLAGS"
CPPFLAGS="-I ./src/ $CPPFLAGS"
AC_CHECK_HEADER([libzerocash/libzerocash/Zerocash.h],,AC_MSG_ERROR(libzerocash headers missing))
AC_CHECK_LIB([zerocash], [main],LIBZEROCASH_LIBS="-lzerocash -lsnark -lcryptopp -lgmp -lgmpxx -lboost_system-mt -lcrypto", [AC_MSG_ERROR(libzerocash missing)], [-lsnark -lcryptopp -lgmp -lgmpxx -lboost_system-mt -lcrypto])
CPPFLAGS="$CPPFLAGS_TEMP"

AC_CHECK_LIB([crypto],[RAND_egd],[],[
AC_ARG_WITH([libressl],
[AS_HELP_STRING([--with-libressl],[Build with system LibreSSL (default is no; DANGEROUS; NOT SUPPORTED)])],
Expand All @@ -690,7 +746,7 @@ AC_CHECK_LIB([crypto],[RAND_egd],[],[
CFLAGS_TEMP="$CFLAGS"
LIBS_TEMP="$LIBS"
CFLAGS="$CFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS"
LIBS="$LIBS $SSL_LIBS $CRYPTO_LIBS"
LIBS="$LIBS $SSL_LIBS $CRYPTO_LIBS $GMP_LIBS $GMPXX_LIBS"
AC_CHECK_HEADER([openssl/ec.h],, AC_MSG_ERROR(OpenSSL ec header missing),)

AC_MSG_CHECKING(for a supported OpenSSL version)
Expand Down Expand Up @@ -883,6 +939,11 @@ AC_SUBST(BUILD_QT)
AC_SUBST(BUILD_TEST_QT)
AC_SUBST(MINIUPNPC_CPPFLAGS)
AC_SUBST(MINIUPNPC_LIBS)
AC_SUBST(GMP_LIBS)
AC_SUBST(GMPXX_LIBS)
AC_SUBST(CRYPTOPP_LIBS)
AC_SUBST(LIBSNARK_LIBS)
AC_SUBST(LIBZEROCASH_LIBS)
AC_CONFIG_FILES([Makefile src/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py])
AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])
AC_CONFIG_FILES([qa/pull-tester/tests-config.sh],[chmod +x qa/pull-tester/tests-config.sh])
Expand Down
17 changes: 17 additions & 0 deletions depends/packages/ate-pairing.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package=ate-pairing
$(package)_version=0.1
$(package)_download_path=https://github.com/herumi/$(package)/archive/
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz
$(package)_sha256_hash=37c05b4a60653b912a0130d77ac816620890d65a51dd9629ed65c15b54c2d8e0
$(package)_dependencies=xbyak libgmp

$(package)_git_commit=dd7889f2881e66f87165fcd180a03cf659bcb073

define $(package)_build_cmds
$(MAKE) -j SUPPORT_SNARK=1 INC_DIR='-I../include $($(package)_cppflags)' LIB_DIR='-L../lib $($(package)_ldflags)'
endef

define $(package)_stage_cmds
cp -rv include/ lib/ $($(package)_staging_dir)$(host_prefix)
endef
10 changes: 3 additions & 7 deletions depends/packages/boost.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package=boost
$(package)_version=1_55_0
$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.55.0
$(package)_version=1_57_0
$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.57.0
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
$(package)_sha256_hash=fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52
$(package)_patches=darwin_boost_atomic-1.patch darwin_boost_atomic-2.patch gcc_5_no_cxx11.patch
$(package)_sha256_hash=910c8c022a33ccec7f088bd65d4f14b466588dda94ba2124e78b8c57db264967

define $(package)_set_vars
$(package)_config_opts_release=variant=release
Expand All @@ -26,9 +25,6 @@ $(package)_cxxflags_linux=-fPIC
endef

define $(package)_preprocess_cmds
patch -p2 < $($(package)_patch_dir)/darwin_boost_atomic-1.patch && \
patch -p2 < $($(package)_patch_dir)/darwin_boost_atomic-2.patch && \
patch -p2 < $($(package)_patch_dir)/gcc_5_no_cxx11.patch && \
echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\"$($(package)_cxxflags) $($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$(boost_archiver_$(host_os))\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
endef

Expand Down
20 changes: 20 additions & 0 deletions depends/packages/crypto++.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package=crypto++
$(package)_version=5.6.2
$(package)_download_path=http://www.cryptopp.com/
$(package)_file_name=cryptopp562.zip
$(package)_sha256_hash=5cbfd2fcb4a6b3aab35902e2e0f3b59d9171fee12b3fc2b363e1801dfec53574
$(package)_dependencies=

# SECURITY BUG: _extract_cmds is responsible for verifying the archive
# hash, but does not do so here:
define $(package)_extract_cmds
unzip $($(package)_source_dir)/$($(package)_file_name)
endef

define $(package)_build_cmds
$(MAKE) static CXXFLAGS='-DNDEBUG -g -O2 -fPIC'
endef

define $(package)_stage_cmds
$(MAKE) install PREFIX=$($(package)_staging_dir)$(host_prefix)
endef
19 changes: 19 additions & 0 deletions depends/packages/libgmp.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package=libgmp
$(package)_version=6.0.0a
$(package)_download_path=https://gmplib.org/download/gmp/
$(package)_file_name=gmp-6.0.0a.tar.bz2
$(package)_sha256_hash=7f8e9a804b9c6d07164cf754207be838ece1219425d64e28cfa3e70d5c759aaf
$(package)_dependencies=
$(package)_config_opts=--enable-cxx --disable-shared

define $(package)_config_cmds
$($(package)_autoconf)
endef

define $(package)_build_cmds
$(MAKE) CPPFLAGS='-fPIC'
endef

define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install ; echo '=== staging find for $(package):' ; find $($(package)_staging_dir)
endef
22 changes: 22 additions & 0 deletions depends/packages/libsnark.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package=libsnark
$(package)_version=0.1
$(package)_download_path=https://github.com/scipr-lab/$(package)/archive/
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz
$(package)_sha256_hash=b5ec84a836d0d305407d5f39c8176bae2bb448abe802a8d11ba0f88f17e6d358
$(package)_git_commit=69f312f149cc4bd8def8e2fed26a7941ff41251d

$(package)_dependencies=crypto++ libgmp xbyak ate-pairing
$(package)_patches=1_fix_Wl_flag.patch

define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/1_fix_Wl_flag.patch
endef

define $(package)_build_cmds
CXXFLAGS="-fPIC -DNO_PT_COMPRESSION=1" $(MAKE) lib DEPINST=$(host_prefix) CURVE=ALT_BN128 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1
endef

define $(package)_stage_cmds
$(MAKE) install STATIC=1 DEPINST=$(host_prefix) PREFIX=$($(package)_staging_dir)$(host_prefix) CURVE=ALT_BN128 NO_SUPERCOP=1
endef
38 changes: 38 additions & 0 deletions depends/packages/libzerocash.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package=libzerocash
$(package)_download_path=https://github.com/Electric-Coin-Company/$(package)/archive/
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz
$(package)_sha256_hash=b79290e4ef412c07d519995caa1016d78d8263c6805a8ecfa1f42f8754978f95
$(package)_git_commit=29df1b8bb28dff1c3e7b5952944aa55b42c36f7b

$(package)_dependencies=libsnark crypto++ openssl boost libgmp
$(package)_patches=

define $(package)_preprocess_cmds
rm libzerocash/allocators.h libzerocash/serialize.h libzerocash/streams.h
endef

# FIXME: How do we know, at the point where the _build_cms are run, that the
# $(host_prefix)/include/libsnark folder is there? The lifecycle of that folder
# is as follows:
# 1. First, the _stage_cmds of libsnark.mk create it in the staging directory.
# 2. At some point in time, the depends system moves it from the staging
# directory to the actual $(host_prefix)/include/libsnark directory.
#
# If (2) happens after the libzerocash_build_cmds get run, then what's in the
# $(host_prefix)/include/libsnark directory will be an *old* copy of the
# libsnark headers, and we might have to build twice in order for libzerocash to
# get the changes. If (2) happens before, then all is well, and it works.
#
# ** Which is it? **
#
$(package)_cppflags += -I$(BASEDIR)/../src -I. -I$(host_prefix)/include -I$(host_prefix)/include/libsnark -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=c++11 -pipe -O2 -O0 -g -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden
$(package)_cppflags += -I$(BASEDIR)/../src -I. -I$(host_prefix)/include -I$(host_prefix)/include/libsnark -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=c++11 -pipe -O2 -O0 -g -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -fPIC

define $(package)_build_cmds
$(MAKE) all DEPINST=$(host_prefix) CXXFLAGS="$($(package)_cppflags)" STATIC=1 MINDEPS=1 USE_MT=1 LINK_RT=1
endef

define $(package)_stage_cmds
$(MAKE) install DEPINST=$(host_prefix) PREFIX=$($(package)_staging_dir)$(host_prefix) STATIC=1 MINDEPS=1 USE_MT=1
endef
3 changes: 2 additions & 1 deletion depends/packages/packages.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
packages:=boost openssl
zerocash_packages := libsnark crypto++ libgmp xbyak ate-pairing libzerocash
packages:=boost openssl $(zerocash_packages)
native_packages := native_ccache native_comparisontool

qt_native_packages = native_protobuf
Expand Down
17 changes: 17 additions & 0 deletions depends/packages/xbyak.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package=xbyak
$(package)_version=0.1
$(package)_download_path=https://github.com/herumi/$(package)/archive/
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz
$(package)_sha256_hash=467a9037c29bc417840177f3ff5d76910d3f688f2f216dd86ced4a7ac837bfb0
$(package)_dependencies=

$(package)_git_commit=62fd6d022acd83209e2a5af8ec359a3a1bed3a50

define $(package)_build_cmds
echo 'xbyak build is unnecessary for consumer ate-pairing.'
endef

define $(package)_stage_cmds
$(MAKE) install PREFIX=$($(package)_staging_dir)$(host_prefix)
endef
35 changes: 0 additions & 35 deletions depends/patches/boost/darwin_boost_atomic-1.patch

This file was deleted.

55 changes: 0 additions & 55 deletions depends/patches/boost/darwin_boost_atomic-2.patch

This file was deleted.

Loading

0 comments on commit c4da097

Please sign in to comment.