diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000000..3fef66cb32 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,172 @@ +ACLOCAL_AMFLAGS = -I src/m4 +SUBDIRS = src +.PHONY: deploy + +GZIP_ENV="-9n" + +BITCOIND_BIN=$(top_builddir)/src/zcoind$(EXEEXT) +BITCOIN_QT_BIN=$(top_builddir)/src/qt/zcoin-qt$(EXEEXT) +BITCOIN_CLI_BIN=$(top_builddir)/src/zcoin-cli$(EXEEXT) +BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT) + +OSX_APP=zcoin-Qt.app +OSX_DMG=zcoin-Qt.dmg +OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus +OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist +OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns +OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed +OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW + +DIST_DOCS = $(wildcard doc/*.md) $(wildcard doc/release-notes/*.md) + +WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/zcoin.ico \ + $(top_srcdir)/share/pixmaps/nsis-header.bmp \ + $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \ + $(top_srcdir)/doc/README_windows.txt + +OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \ + $(top_srcdir)/contrib/macdeploy/background.png \ + $(top_srcdir)/contrib/macdeploy/DS_Store + +COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \ + leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \ + baseline_filtered.info block_test_filtered.info \ + leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info + +dist-hook: + -$(MAKE) -C $(top_distdir)/src/leveldb clean + -$(GIT) archive --format=tar HEAD -- src/version.cpp | $(AMTAR) -C $(top_distdir) -xf - + +distcheck-hook: + $(MKDIR_P) $(top_distdir)/_build/src/leveldb + cp -rf $(top_srcdir)/src/leveldb/* $(top_distdir)/_build/src/leveldb/ + -$(MAKE) -C $(top_distdir)/_build/src/leveldb clean + +distcleancheck: + @: + +$(BITCOIN_WIN_INSTALLER): $(BITCOIND_BIN) $(BITCOIN_QT_BIN) $(BITCOIN_CLI_BIN) + $(MKDIR_P) $(top_builddir)/release + STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release + STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release + STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release + @test -f $(MAKENSIS) && $(MAKENSIS) $(top_builddir)/share/setup.nsi || \ + echo error: could not build $@ + +$(BITCOIND_BIN) $(BITCOIN_QT_BIN) $(BITCOIN_CLI_BIN): + make -C $(dir $@) $(notdir $@) + +$(OSX_APP)/Contents/PkgInfo: + $(MKDIR_P) $(@D) + @echo "APPL????" > $@ + +$(OSX_APP)/Contents/Resources/empty.lproj: + $(MKDIR_P) $(@D) + @touch $@ + +$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST) + $(MKDIR_P) $(@D) + $(INSTALL_DATA) $< $@ + +$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS) + $(MKDIR_P) $(@D) + $(INSTALL_DATA) $< $@ + +$(OSX_APP)/Contents/MacOS/zcoin-Qt: $(BITCOIN_QT_BIN) + $(MKDIR_P) $(@D) + STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@ + +OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \ + $(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \ + $(OSX_APP)/Contents/MacOS/Bitcoin-Qt + +if BUILD_DARWIN +$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING) + $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2 + +else +$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING) + INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2 + $(MKDIR_P) dist/.background + $(INSTALL) contrib/macdeploy/background.png dist/.background + $(INSTALL) contrib/macdeploy/DS_Store dist/.DS_Store + cd dist; $(LN_S) /Applications Applications + $(GENISOIMAGE) -no-cache-inodes -l -probe -V "zcoin-Qt" -no-pad -r -apple -o $@ dist +endif + +if TARGET_DARWIN +appbundle: $(OSX_APP_BUILT) +deploy: $(OSX_DMG) +endif +if TARGET_WINDOWS +deploy: $(BITCOIN_WIN_INSTALLER) +endif + +if USE_LCOV + +baseline.info: + $(LCOV) -c -i -d $(abs_builddir)/src -o $@ + +baseline_filtered.info: baseline.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +leveldb_baseline.info: baseline_filtered.info + $(LCOV) -c -i -d $(abs_builddir)/src/leveldb -b $(abs_builddir)/src/leveldb -o $@ + +leveldb_baseline_filtered.info: leveldb_baseline.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +baseline_filtered_combined.info: leveldb_baseline_filtered.info baseline_filtered.info + $(LCOV) -a leveldb_baseline_filtered.info -a baseline_filtered.info -o $@ + +test_bitcoin.info: baseline_filtered_combined.info + $(MAKE) -C src/ check + $(LCOV) -c -d $(abs_builddir)/src -t test_bitcoin -o $@ + $(LCOV) -z -d $(abs_builddir)/src + $(LCOV) -z -d $(abs_builddir)/src/leveldb + +test_bitcoin_filtered.info: test_bitcoin.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +block_test.info: test_bitcoin_filtered.info + $(MKDIR_P) qa/tmp + -@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool 0 + $(LCOV) -c -d $(abs_builddir)/src --t BitcoinJBlockTest -o $@ + $(LCOV) -z -d $(abs_builddir)/src + $(LCOV) -z -d $(abs_builddir)/src/leveldb + +block_test_filtered.info: block_test.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info + $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@ + +total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info block_test_filtered.info + $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt + +test_bitcoin.coverage/.dirstamp: test_bitcoin_coverage.info + $(GENHTML) -s $< -o $(@D) + @touch $@ + +total.coverage/.dirstamp: total_coverage.info + $(GENHTML) -s $< -o $(@D) + @touch $@ + +cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp + +endif + +if USE_COMPARISON_TOOL +check-local: + $(MKDIR_P) qa/tmp + @qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool $(COMPARISON_TOOL_REORG_TESTS) +endif + +EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/pull-tester.sh qa/rpc-tests $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) + +CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER) + +.INTERMEDIATE: $(COVERAGE_INFO) + +clean-local: + rm -rf test_bitcoin.coverage/ total.coverage/ $(OSX_APP) diff --git a/autogen.sh b/autogen.sh new file mode 100644 index 0000000000..5b883a6a4c --- /dev/null +++ b/autogen.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +srcdir="$(dirname $0)" +cd "$srcdir" +autoreconf --install --force diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000000..345b04b89c --- /dev/null +++ b/configure.ac @@ -0,0 +1,717 @@ +dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) +AC_PREREQ([2.60]) +define(_CLIENT_VERSION_MAJOR, 0) +define(_CLIENT_VERSION_MINOR, 8) +define(_CLIENT_VERSION_REVISION, 7) +define(_CLIENT_VERSION_BUILD, 8) +define(_CLIENT_VERSION_IS_RELEASE, true) +define(_COPYRIGHT_YEAR, 2015) +AC_INIT([Zcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[contact@zcoin.io],[zcoin]) +AC_CONFIG_AUX_DIR([src/build-aux]) +AC_CONFIG_MACRO_DIR([src/m4]) +AC_CANONICAL_HOST +AH_TOP([#ifndef BITCOIN_CONFIG_H]) +AH_TOP([#define BITCOIN_CONFIG_H]) +AH_BOTTOM([#endif //BITCOIN_CONFIG_H]) + +# This m4 will only be used if a system copy cannot be found. This is helpful +# on systems where autotools are installed but the pkg-config macros are not in +# a default location. It is currently used for building on OSX where autotools +# are preinstalled but pkg-config comes from macports or homebrew. It should +# probably be removed when building on <= 10.6 is no longer supported. +m4_include([pkg.m4]) + +dnl faketime breaks configure and is only needed for make. Disable it here. +unset FAKETIME + +if test "x${CXXFLAGS+set}" = "xset"; then + CXXFLAGS_overridden=yes +else + CXXFLAGS_overridden=no +fi + +dnl ============================================================== +dnl Setup for automake +dnl ============================================================== + +AM_INIT_AUTOMAKE([no-define subdir-objects foreign]) + +dnl faketime messes with timestamps and causes configure to be re-run. +dnl --disable-maintainer-mode can be used to bypass this. +AM_MAINTAINER_MODE([enable]) + +dnl make the compilation flags quiet unless V=1 is used +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +# Enable wallet +AC_ARG_ENABLE([wallet], + [AS_HELP_STRING([--enable-wallet], + [enable wallet (default is yes)])], + [enable_wallet=$enableval], + [enable_wallet=yes]) + +AC_ARG_WITH([miniupnpc], + [AS_HELP_STRING([--with-miniupnpc], + [enable UPNP (default is yes if libminiupnpc is found)])], + [use_upnp=$withval], + [use_upnp=auto]) + +AC_ARG_ENABLE([upnp-default], + [AS_HELP_STRING([--enable-upnp-default], + [if UPNP is enabled, turn it on at startup (default is no)])], + [use_upnp_default=$enableval], + [use_upnp_default=no]) + +AC_ARG_ENABLE(tests, + AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]), + [use_tests=$enableval], + [use_tests=yes]) + +AC_ARG_WITH([comparison-tool], + AS_HELP_STRING([--with-comparison-tool],[path to java comparison tool (requires --enable-tests)]), + [use_comparison_tool=$withval], + [use_comparison_tool=no]) + +AC_ARG_ENABLE([comparison-tool-reorg-tests], + AS_HELP_STRING([--enable-comparison-tool-reorg-tests],[enable expensive reorg tests in the comparison tool (default no)]), + [use_comparison_tool_reorg_tests=$enableval], + [use_comparison_tool_reorg_tests=no]) + +AC_ARG_WITH([qrencode], + [AS_HELP_STRING([--with-qrencode], + [enable QR code support (default is yes if qt is enabled and libqrencode is found)])], + [use_qr=$withval], + [use_qr=auto]) + +AC_ARG_ENABLE([hardening], + [AS_HELP_STRING([--enable-hardening], + [attempt to harden the resulting executables (default is yes)])], + [use_hardening=$enableval], + [use_hardening=yes]) + +AC_ARG_ENABLE([ccache], + [AS_HELP_STRING([--enable-ccache], + [use ccache for building (default is yes if ccache is found)])], + [use_ccache=$enableval], + [use_ccache=auto]) + +AC_ARG_ENABLE([lcov], + [AS_HELP_STRING([--enable-lcov], + [enable lcov testing (default is no)])], + [use_lcov=yes], + [use_lcov=no]) + +AC_ARG_ENABLE([glibc-back-compat], + [AS_HELP_STRING([--enable-glibc-back-compat], + [enable backwards compatibility with glibc and libstdc++])], + [use_glibc_compat=$enableval], + [use_glibc_compat=no]) + +AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], []) + + +AC_CONFIG_SRCDIR([src]) +AC_CONFIG_HEADERS([src/bitcoin-config.h]) + +dnl Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CXXCPP +AC_PROG_INSTALL +AC_PROG_OBJC +AC_PROG_LN_S +m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) +AC_PROG_MKDIR_P +AC_PROG_SED +AC_PATH_TOOL(AR, ar) +AC_PATH_TOOL(RANLIB, ranlib) +AC_PATH_TOOL(STRIP, strip) +AC_PATH_TOOL(GCOV, gcov) +AC_PATH_PROG(LCOV, lcov) +AC_PATH_PROG(JAVA, java) +AC_PATH_PROG(GENHTML, genhtml) +AC_PATH_PROG([GIT], [git]) +AC_PATH_PROG(CCACHE,ccache) +AC_PATH_PROG(XGETTEXT,xgettext) +AC_PATH_PROG(HEXDUMP,hexdump) +PKG_PROG_PKG_CONFIG + +# Enable debug +AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], + [use debug compiler flags and macros (default is no)])], + [enable_debug=$enableval], + [enable_debug=no]) + +if test "x$enable_debug" = xyes; then + if test "x$GCC" = xyes; then + CFLAGS="-g3 -O0 -DDEBUG" + fi + + if test "x$GXX" = xyes; then + CXXFLAGS="-g3 -O0 -DDEBUG" + fi +fi + +## TODO: Remove these hard-coded paths and flags. They are here for the sake of +## compatibility with the legacy buildsystem. +## +if test "x$CXXFLAGS_overridden" = "xno"; then + CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter" +fi +CPPFLAGS="$CPPFLAGS -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS" + +AC_LANG_PUSH([C++]) + +use_pkgconfig=yes +case $host in + *mingw*) + + #pkgconfig does more harm than good with MinGW + use_pkgconfig=no + + TARGET_OS=windows + AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(lib missing)) + + AX_CHECK_LINK_FLAG([[-static]],[LDFLAGS="$LDFLAGS -static"]) + AX_CHECK_LINK_FLAG([[-static-libgcc]],[LDFLAGS="$LDFLAGS -static-libgcc"]) + AX_CHECK_LINK_FLAG([[-static-libstdc++]],[LDFLAGS="$LDFLAGS -static-libstdc++"]) + + AC_PATH_PROG([MAKENSIS], [makensis], none) + if test x$MAKENSIS = xnone; then + AC_MSG_WARN("makensis not found. Cannot create installer.") + fi + + AC_PATH_TOOL(WINDRES, windres, none) + if test x$WINDRES = xnone; then + AC_MSG_ERROR("windres not found") + fi + + CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB" + LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE" + if test "x$CXXFLAGS_overridden" = "xno"; then + CXXFLAGS="$CXXFLAGS -w" + fi + case $host in + i?86-*) WINDOWS_BITS=32 ;; + x86_64-*) WINDOWS_BITS=64 ;; + *) AC_MSG_ERROR("Could not determine win32/win64 for installer") ;; + esac + AC_SUBST(WINDOWS_BITS) + ;; + *darwin*) + TARGET_OS=darwin + LEVELDB_TARGET_FLAGS="TARGET_OS=Darwin" + if test x$cross_compiling != xyes; then + BUILD_OS=darwin + AC_CHECK_PROG([PORT],port, port) + if test x$PORT = xport; then + dnl add default macports paths + CPPFLAGS="$CPPFLAGS -isystem /opt/local/include -I/opt/local/include/db48" + LIBS="$LIBS -L/opt/local/lib -L/opt/local/lib/db48" + fi + + AC_CHECK_PROG([BREW],brew, brew) + if test x$BREW = xbrew; then + dnl These Homebrew packages may be bottled, 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 or --without-gui for example). + + openssl_prefix=`$BREW --prefix openssl 2>/dev/null` + bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null` + qt5_prefix=`$BREW --prefix qt5 2>/dev/null` + if test x$openssl_prefix != x; then + export PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + fi + if test x$bdb_prefix != x; then + CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include" + LIBS="$LIBS -L$bdb_prefix/lib" + fi + if test x$qt5_prefix != x; then + export PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + fi + fi + else + case $build_os in + *darwin*) + BUILD_OS=darwin + ;; + *) + AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool) + AC_PATH_TOOL([OTOOL], [otool], otool) + AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage) + ;; + esac + fi + + CPPFLAGS="$CPPFLAGS -DMAC_OSX" + ;; + *) + ;; +esac + +if test x$use_comparison_tool != xno; then + AC_SUBST(JAVA_COMPARISON_TOOL, $use_comparison_tool) +fi + +if test x$use_comparison_tool_reorg_tests != xno; then + if test x$use_comparison_tool == x; then + AC_MSG_ERROR("comparison tool reorg tests but comparison tool was not specified") + fi + AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 1) +else + AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 0) +fi + +if test x$use_lcov == xyes; then + if test x$LCOV == x; then + AC_MSG_ERROR("lcov testing requested but lcov not found") + fi + if test x$GCOV == x; then + AC_MSG_ERROR("lcov testing requested but gcov not found") + fi + if test x$JAVA == x; then + AC_MSG_ERROR("lcov testing requested but java not found") + fi + if test x$GENHTML == x; then + AC_MSG_ERROR("lcov testing requested but genhtml not found") + fi + if test x$use_comparison_tool == x; then + AC_MSG_ERROR("lcov testing requested but comparison tool was not specified") + fi + LCOV="$LCOV --gcov-tool=$GCOV" + AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"], + [AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")]) +fi + +dnl Require little endian +AC_C_BIGENDIAN([AC_MSG_ERROR("Big Endian not supported")]) + +dnl Check for pthread compile/link requirements +AX_PTHREAD +INCLUDES="$INCLUDES $PTHREAD_CFLAGS" + +# The following macro will add the necessary defines to bitcoin-config.h, but +# they also need to be passed down to any subprojects. Pull the results out of +# the cache and add them to CPPFLAGS. +AC_SYS_LARGEFILE +# detect POSIX or GNU variant of strerror_r +AC_FUNC_STRERROR_R + +if test x$ac_cv_sys_file_offset_bits != x && + test x$ac_cv_sys_file_offset_bits != xno && + test x$ac_cv_sys_file_offset_bits != xunknown; then + CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" +fi + +if test x$ac_cv_sys_large_files != x && + test x$ac_cv_sys_large_files != xno && + test x$ac_cv_sys_large_files != xunknown; then + CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" +fi + +AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"]) + +if test x$use_glibc_compat != xno; then + + #__fdelt_chk's params and return type have changed from long unsigned int to long int. + # See which one is present here. + AC_MSG_CHECKING(__fdelt_chk type) + AC_TRY_COMPILE([#ifdef _FORTIFY_SOURCE + #undef _FORTIFY_SOURCE + #endif + #define _FORTIFY_SOURCE 2 + #include + extern "C" long unsigned int __fdelt_warn(long unsigned int);],[], + [ fdelt_type="long unsigned int"], + [ fdelt_type="long int"]) + AC_MSG_RESULT($fdelt_type) + AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk]) + +fi + +if test x$use_hardening != xno; then + AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) + AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"]) + AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"]) + + AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[ + AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[ + HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -U_FORTIFY_SOURCE" + ]) + HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2" + ]) + + AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"]) + AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"]) + AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"]) + AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"]) + + if test x$TARGET_OS != xwindows; then + # -pie will link successfully with MinGW, but it's unsupported and leads to undeterministic binaries + AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"]) + fi + + CXXFLAGS="$CXXFLAGS $HARDENED_CXXFLAGS" + CPPFLAGS="$CPPFLAGS $HARDENED_CPPFLAGS" + LDFLAGS="$LDFLAGS $HARDENED_LDFLAGS" + OBJCXXFLAGS="$CXXFLAGS" +fi + +dnl this flag screws up non-darwin gcc even when the check fails. special-case it. +if test x$TARGET_OS = xdarwin; then + AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"]) +fi + +AC_CHECK_HEADERS([stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h]) + +dnl Check for MSG_NOSIGNAL +AC_MSG_CHECKING(for MSG_NOSIGNAL) +AC_TRY_COMPILE([#include ], + [ int f = MSG_NOSIGNAL; ], + [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ], + [ AC_MSG_RESULT(no)] +) + +LEVELDB_CPPFLAGS= +LIBLEVELDB= +LIBMEMENV= +AM_CONDITIONAL([EMBEDDED_LEVELDB],[true]) +AC_SUBST(LEVELDB_CPPFLAGS) +AC_SUBST(LIBLEVELDB) +AC_SUBST(LIBMEMENV) + +if test x$enable_wallet != xno; then + dnl Check for libdb_cxx only if wallet enabled + BITCOIN_FIND_BDB48 +fi + +dnl Check for libminiupnpc (optional) +if test x$use_upnp != xno; then + AC_CHECK_HEADERS( + [miniupnpc/miniwget.h miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h], + [AC_CHECK_LIB([miniupnpc], [main],, [have_miniupnpc=no])], + [have_miniupnpc=no] + ) +fi + +dnl Check for boost libs +AX_BOOST_BASE +AX_BOOST_SYSTEM +AX_BOOST_FILESYSTEM +AX_BOOST_PROGRAM_OPTIONS +AX_BOOST_THREAD +AX_BOOST_CHRONO + +if test x$use_tests = xyes; then + + if test x$HEXDUMP = x; then + AC_MSG_ERROR(hexdump is required for tests) + fi + + + AX_BOOST_UNIT_TEST_FRAMEWORK + + dnl Determine if -DBOOST_TEST_DYN_LINK is needed + AC_MSG_CHECKING([for dynamic linked boost test]) + TEMP_LIBS="$LIBS" + LIBS="$LIBS $BOOST_LDFLAGS $BOOST_UNIT_TEST_FRAMEWORK_LIB" + TEMP_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + AC_LINK_IFELSE([AC_LANG_SOURCE([ + #define BOOST_TEST_DYN_LINK + #define BOOST_TEST_MAIN + #include + + ])], + [AC_MSG_RESULT(yes)] + [TESTDEFS="$TESTDEFS -DBOOST_TEST_DYN_LINK"], + [AC_MSG_RESULT(no)]) + LIBS="$TEMP_LIBS" + CPPFLAGS="$TEMP_CPPFLAGS" +fi + +BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB" +BOOST_INCLUDES="$BOOST_CPPFLAGS" + +dnl Boost >= 1.50 uses sleep_for rather than the now-deprecated sleep, however +dnl it was broken from 1.50 to 1.52 when backed by nanosleep. Use sleep_for if +dnl a working version is available, else fall back to sleep. sleep was removed +dnl after 1.56. +dnl If neither is available, abort. +dnl If sleep_for is used, boost_chrono becomes a requirement. +if test x$ax_cv_boost_chrono = xyes; then +dnl Allow passing extra needed dependency libraries for boost-chrono from static gitian build +BOOST_CHRONO_LIB="$BOOST_CHRONO_LIB $BOOST_CHRONO_EXTRALIBS" + +TEMP_LIBS="$LIBS" +LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB" +TEMP_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +AC_TRY_LINK([ + #include + #include + ],[ + #if BOOST_VERSION >= 105000 && (!defined(BOOST_HAS_NANOSLEEP) || BOOST_VERSION >= 105200) + boost::this_thread::sleep_for(boost::chrono::milliseconds(0)); + #else + choke me + #endif + ], + [boost_sleep=yes; BOOST_LIBS="$BOOST_LIBS $BOOST_CHRONO_LIB"; + AC_DEFINE(HAVE_WORKING_BOOST_SLEEP_FOR, 1, [Define this symbol if boost sleep_for works])], + [boost_sleep=no]) +LIBS="$TEMP_LIBS" +CPPFLAGS="$TEMP_CPPFLAGS" +fi + +if test x$boost_sleep != xyes; then +TEMP_LIBS="$LIBS" +LIBS="$LIBS $BOOST_LIBS" +TEMP_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +AC_TRY_LINK([ + #include + #include + #include + ],[ + #if BOOST_VERSION <= 105600 + boost::this_thread::sleep(boost::posix_time::milliseconds(0)); + #else + choke me + #endif + ], + [boost_sleep=yes; AC_DEFINE(HAVE_WORKING_BOOST_SLEEP, 1, [Define this symbol if boost sleep works])], + [boost_sleep=no]) +LIBS="$TEMP_LIBS" +CPPFLAGS="$TEMP_CPPFLAGS" +fi + +if test x$boost_sleep != xyes; then + AC_MSG_ERROR(No working boost sleep implementation found.) +fi + +AC_ARG_WITH([cli], + [AS_HELP_STRING([--with-cli], + [with CLI (default is yes)])], + [build_bitcoin_cli=$withval], + [build_bitcoin_cli=yes]) + +AC_ARG_WITH([daemon], + [AS_HELP_STRING([--with-daemon], + [with daemon (default is yes)])], + [build_bitcoind=$withval], + [build_bitcoind=yes]) + +BITCOIN_QT_INIT + +if test x$use_pkgconfig = xyes; then + + if test x$PKG_CONFIG == x; then + AC_MSG_ERROR(pkg-config not found.) + fi + + : #NOP + m4_ifdef( + [PKG_CHECK_MODULES], + [ + PKG_CHECK_MODULES([SSL], [libssl], [INCLUDES="$INCLUDES $SSL_CFLAGS"; LIBS="$LIBS $SSL_LIBS"], [AC_MSG_ERROR(openssl not found.)]) + PKG_CHECK_MODULES([CRYPTO], [libcrypto], [INCLUDES="$INCLUDES $CRYPTO_CFLAGS"; LIBS="$LIBS $CRYPTO_LIBS"], [AC_MSG_ERROR(libcrypto not found.)]) + BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])]) + if test x$use_qr != xno; then + BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])]) + fi + ] + ) +else + AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing)) + AC_CHECK_LIB([crypto], [main],, AC_MSG_ERROR(libcrypto missing)) + + AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),) + AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR(libssl missing)) + + BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],,BITCOIN_QT_FAIL(libprotobuf not found))) + if test x$use_qr != xno; then + BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],, [have_qrencode=no])]) + BITCOIN_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)]) + fi +fi + +BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path) + +AC_MSG_CHECKING([whether to build bitcoind]) +AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes]) +AC_MSG_RESULT($build_bitcoind) + +AC_MSG_CHECKING([whether to build bitcoin-cli]) +AM_CONDITIONAL([BUILD_BITCOIN_CLI], [test x$build_bitcoin_cli = xyes]) +AC_MSG_RESULT($build_bitcoin_cli) + +dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus +BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt4]) + +AC_LANG_POP + +if test "x$use_ccache" != "xno"; then + AC_MSG_CHECKING(if ccache should be used) + if test x$CCACHE = x; then + if test "x$use_ccache" = "xyes"; then + AC_MSG_ERROR([ccache not found.]); + else + use_ccache=no + fi + else + use_ccache=yes + CC="$ac_cv_path_CCACHE $CC" + CXX="$ac_cv_path_CCACHE $CXX" + fi + AC_MSG_RESULT($use_ccache) +fi + +dnl enable wallet +AC_MSG_CHECKING([if wallet should be enabled]) +if test x$enable_wallet != xno; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions]) + +else + AC_MSG_RESULT(no) +fi + +dnl enable upnp support +AC_MSG_CHECKING([whether to build with support for UPnP]) +if test x$have_miniupnpc = xno; then + if test x$use_upnp = xyes; then + AC_MSG_ERROR("UPnP requested but cannot be built. use --without-miniupnpc") + fi + AC_MSG_RESULT(no) +else + if test x$use_upnp != xno; then + AC_MSG_RESULT(yes) + AC_MSG_CHECKING([whether to build with UPnP enabled by default]) + use_upnp=yes + upnp_setting=0 + if test x$use_upnp_default != xno; then + use_upnp_default=yes + upnp_setting=1 + fi + AC_MSG_RESULT($use_upnp_default) + AC_DEFINE_UNQUOTED([USE_UPNP],[$upnp_setting],[UPnP support not compiled if undefined, otherwise value (0 or 1) determines default state]) + if test x$TARGET_OS = xwindows; then + CPPFLAGS="$CPPFLAGS -DMINIUPNP_STATICLIB" + fi + else + AC_MSG_RESULT(no) + fi +fi + +dnl these are only used when qt is enabled +if test x$bitcoin_enable_qt != xno; then + BUILD_QT=qt + dnl enable dbus support + AC_MSG_CHECKING([whether to build GUI with support for D-Bus]) + if test x$bitcoin_enable_qt_dbus != xno; then + AC_DEFINE([USE_DBUS],[1],[Define if dbus support should be compiled in]) + fi + AC_MSG_RESULT($bitcoin_enable_qt_dbus) + + dnl enable qr support + AC_MSG_CHECKING([whether to build GUI with support for QR codes]) + if test x$have_qrencode = xno; then + if test x$use_qr == xyes; then + AC_MSG_ERROR("QR support requested but cannot be built. use --without-qrencode") + fi + AC_MSG_RESULT(no) + else + if test x$use_qr != xno; then + AC_MSG_RESULT(yes) + AC_DEFINE([USE_QRCODE],[1],[Define if QR support should be compiled in]) + use_qr=yes + else + AC_MSG_RESULT(no) + fi + fi + + if test x$XGETTEXT == x; then + AC_MSG_WARN("xgettext is required to update qt translations") + fi + + AC_MSG_CHECKING([whether to build test_bitcoin-qt]) + if test x$use_tests$bitcoin_enable_qt_test = xyesyes; then + AC_MSG_RESULT([yes]) + BUILD_TEST_QT="test" + else + AC_MSG_RESULT([no]) + fi +fi + +AC_MSG_CHECKING([whether to build test_bitcoin]) +if test x$use_tests = xyes; then + AC_MSG_RESULT([yes]) + BUILD_TEST="test" +else + AC_MSG_RESULT([no]) +fi + +if test "x$use_tests$build_bitcoind$use_qt" = "xnonono"; then + AC_MSG_ERROR([No targets! Please specify at least one of: --enable-cli --enable-daemon --enable-gui or --enable-tests]) +fi + +AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin]) +AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin]) +AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) +AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet == xyes]) +AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes]) +AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes]) +AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno]) +AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno]) +AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) + +AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) +AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) +AC_DEFINE(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION, [Build revision]) +AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build]) +AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release]) +AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Version is release]) +AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR) +AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR) +AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION) +AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD) +AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE) +AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR) + + +AC_SUBST(USE_UPNP) +AC_SUBST(USE_QRCODE) +AC_SUBST(INCLUDES) +AC_SUBST(BOOST_LIBS) +AC_SUBST(TESTDEFS) +AC_SUBST(LEVELDB_TARGET_FLAGS) +AC_SUBST(BUILD_TEST) +AC_SUBST(BUILD_QT) +AC_SUBST(BUILD_TEST_QT) +AC_CONFIG_FILES([Makefile src/Makefile src/test/Makefile src/qt/Makefile src/qt/test/Makefile share/setup.nsi share/qt/Info.plist]) +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/build-tests.sh],[chmod +x qa/pull-tester/build-tests.sh]) +AC_OUTPUT diff --git a/contrib/gitian-descriptors/README b/contrib/gitian-descriptors/README deleted file mode 100755 index 922a07a7d7..0000000000 --- a/contrib/gitian-descriptors/README +++ /dev/null @@ -1,49 +0,0 @@ -Refer to doc/release-notes.md for directions on obtaining inputs/ and using gitian to build zcoin. -================================================================ - -Gavin's notes on getting gitian builds up and running using KVM: ------------------------------------------------ - -These instructions distilled from: - https://help.ubuntu.com/community/KVM/Installation -... see there for complete details. - -You need the right hardware: you need a 64-bit-capable CPU with hardware virtualization support (Intel VT-x or AMD-V). Not all modern CPUs support hardware virtualization. - -You probably need to enable hardware virtualization in your machine's BIOS. - -You need to be running a recent version of 64-bit-Ubuntu, and you need to install several prerequisites: - sudo apt-get install ruby apache2 git apt-cacher-ng python-vm-builder qemu-kvm - -Sanity checks: - sudo service apt-cacher-ng status # Should return apt-cacher-ng is running - ls -l /dev/kvm # Should show a /dev/kvm device - -gitian-builder now also supports building using LXC. See - https://help.ubuntu.com/12.04/serverguide/lxc.html -... for how to get LXC up and running under Ubuntu. - -If your main machine is a 64-bit Mac or PC with a few gigabytes of memory -and at least 10 gigabytes of free disk space, you can gitian-build using -LXC running inside a virtual machine. - -Here's a description of Gavin's setup on OSX 10.6: - -1. Download and install VirtualBox from https://www.virtualbox.org/ - -2. Download the 64-bit Ubuntu Desktop 12.04 LTS .iso CD image from - http://www.ubuntu.com/ - -3. Run VirtualBox and create a new virtual machine, using the - Ubuntu .iso (see the VirtualBox documentation for details). - Create it with at least 2 gigabytes of memory and a disk - that is at least 20 gigabytes big. - -4. Inside the running Ubuntu desktop, install: - sudo apt-get install debootstrap lxc ruby apache2 git apt-cacher-ng python-vm-builder - -5. Still inside Ubuntu, tell gitian-builder to use LXC, then follow the "Once you've got the right - hardware and software" instructions above: - export USE_LXC=1 - git clone git://github.com/bitcoin/bitcoin.git - ... etc diff --git a/contrib/gitian-descriptors/README.md b/contrib/gitian-descriptors/README.md new file mode 100644 index 0000000000..7a67263ee4 --- /dev/null +++ b/contrib/gitian-descriptors/README.md @@ -0,0 +1,67 @@ +### Gavin's notes on getting gitian builds up and running using KVM:### + +These instructions distilled from: +[ https://help.ubuntu.com/community/KVM/Installation]( https://help.ubuntu.com/community/KVM/Installation) +... see there for complete details. + +You need the right hardware: you need a 64-bit-capable CPU with hardware virtualization support (Intel VT-x or AMD-V). Not all modern CPUs support hardware virtualization. + +You probably need to enable hardware virtualization in your machine's BIOS. + +You need to be running a recent version of 64-bit-Ubuntu, and you need to install several prerequisites: + + sudo apt-get install ruby apache2 git apt-cacher-ng python-vm-builder qemu-kvm + +Sanity checks: + + sudo service apt-cacher-ng status # Should return apt-cacher-ng is running + ls -l /dev/kvm # Should show a /dev/kvm device + + +Once you've got the right hardware and software: + + git clone git://github.com/bitcoin/bitcoin.git + git clone git://github.com/devrandom/gitian-builder.git + mkdir gitian-builder/inputs + cd gitian-builder/inputs + + # Create base images + cd gitian-builder + bin/make-base-vm --suite precise --arch i386 + bin/make-base-vm --suite precise --arch amd64 + cd .. + + # Get inputs (see doc/release-process.md for exact inputs needed and where to get them) + ... + + # For further build instructions see doc/release-notes.md + ... + +--------------------- + +`gitian-builder` now also supports building using LXC. See +[ https://help.ubuntu.com/12.04/serverguide/lxc.html]( https://help.ubuntu.com/12.04/serverguide/lxc.html) +... for how to get LXC up and running under Ubuntu. + +If your main machine is a 64-bit Mac or PC with a few gigabytes of memory +and at least 10 gigabytes of free disk space, you can `gitian-build` using +LXC running inside a virtual machine. + +Here's a description of Gavin's setup on OSX 10.6: + +1. Download and install VirtualBox from [https://www.virtualbox.org/](https://www.virtualbox.org/) + +2. Download the 64-bit Ubuntu Desktop 12.04 LTS .iso CD image from + [http://www.ubuntu.com/](http://www.ubuntu.com/) + +3. Run VirtualBox and create a new virtual machine, using the Ubuntu .iso (see the [VirtualBox documentation](https://www.virtualbox.org/wiki/Documentation) for details). Create it with at least 2 gigabytes of memory and a disk that is at least 20 gigabytes big. + +4. Inside the running Ubuntu desktop, install: + + sudo apt-get install debootstrap lxc ruby apache2 git apt-cacher-ng python-vm-builder + +5. Still inside Ubuntu, tell gitian-builder to use LXC, then follow the "Once you've got the right hardware and software" instructions above: + + export USE_LXC=1 + git clone git://github.com/bitcoin/bitcoin.git + ... etc diff --git a/contrib/gitian-descriptors/boot-win32.yml b/contrib/gitian-descriptors/boot-win32.yml new file mode 100644 index 0000000000..3bc7216901 --- /dev/null +++ b/contrib/gitian-descriptors/boot-win32.yml @@ -0,0 +1,65 @@ +--- +name: "boost" +suites: +- "precise" +architectures: +- "amd64" +packages: +- "mingw-w64" +- "g++-mingw-w64" +- "faketime" +- "zip" +reference_datetime: "2011-01-30 00:00:00" +remotes: [] +files: +- "boost_1_55_0.tar.bz2" +- "boost-mingw-gas-cross-compile-2013-03-03.patch" +script: | + # Defines + INSTALLPREFIX="$OUTDIR/staging/boost" + HOST=i686-w64-mingw32 + # Input Integrity Check + echo "fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52 boost_1_55_0.tar.bz2" | shasum -c + echo "d2b7f6a1d7051faef3c9cf41a92fa3671d905ef1e1da920d07651a43299f6268 boost-mingw-gas-cross-compile-2013-03-03.patch" | shasum -c + mkdir -p "$INSTALLPREFIX" + tar xjf boost_1_55_0.tar.bz2 + cd boost_1_55_0 + GCCVERSION=$($HOST-g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2) + echo "using gcc : $GCCVERSION : $HOST-g++ + : + $HOST-windres + $HOST-ar + -frandom-seed=boost1 + $HOST-ranlib + ;" > user-config.jam + ./bootstrap.sh --without-icu + + # Workaround: Upstream boost dev refuses to include patch that would allow Free Software cross-compile toolchain to work + # This patch was authored by the Fedora package developer and ships in Fedora's mingw32-boost. + # Please obtain the exact patch that matches the above sha256sum from one of the following mirrors. + # + # Read History: https://svn.boost.org/trac/boost/ticket/7262 + # History Mirror: http://rose.makesad.us/~paulproteus/mirrors/7262%20Boost.Context%20fails%20to%20build%20using%20MinGW.html + # + # Patch: https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch + # Patch Mirror: http://wtogami.fedorapeople.org/boost-mingw-gas-cross-compile-2013-03-03.patch + # Patch Mirror: http://mindstalk.net/host/boost-mingw-gas-cross-compile-2013-03-03.patch + # Patch Mirror: http://rose.makesad.us/~paulproteus/mirrors/boost-mingw-gas-cross-compile-2013-03-03.patch + patch -p0 < ../boost-mingw-gas-cross-compile-2013-03-03.patch + + # Bug Workaround: boost-1.54.0 broke the ability to disable zlib, still broken in 1.55 + # https://svn.boost.org/trac/boost/ticket/9156 + sed -i 's^\[ ac.check-library /zlib//zlib : /zlib//zlib^^' libs/iostreams/build/Jamfile.v2 + sed -i 's^zlib.cpp gzip.cpp \]^^' libs/iostreams/build/Jamfile.v2 + + # http://statmt.org/~s0565741/software/boost_1_52_0/libs/context/doc/html/context/requirements.html + # Note: Might need these options in the future for 64bit builds. + # "Please note that address-model=64 must be given to bjam command line on 64bit Windows for 64bit build; otherwise 32bit code will be generated." + # "For cross-compiling the lib you must specify certain additional properties at bjam command line: target-os, abi, binary-format, architecture and address-model." + ./bjam toolset=gcc binary-format=pe target-os=windows threadapi=win32 threading=multi variant=release link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install + + cd "$INSTALLPREFIX" + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + zip -r boost-win32-1.55.0-gitian-r6.zip * + cp boost-win32-1.55.0-gitian-r6.zip $OUTDIR \ No newline at end of file diff --git a/contrib/gitian-descriptors/deps-linux.yml b/contrib/gitian-descriptors/deps-linux.yml index af92cf46aa..d1e37833d9 100644 --- a/contrib/gitian-descriptors/deps-linux.yml +++ b/contrib/gitian-descriptors/deps-linux.yml @@ -1,5 +1,5 @@ --- -name: "zcoin-deps" +name: "bitcoin" suites: - "precise" architectures: diff --git a/contrib/gitian-descriptors/deps-win.yml b/contrib/gitian-descriptors/deps-win.yml index ae41631e4e..ba157f06d8 100644 --- a/contrib/gitian-descriptors/deps-win.yml +++ b/contrib/gitian-descriptors/deps-win.yml @@ -14,9 +14,9 @@ packages: reference_datetime: "2011-01-30 00:00:00" remotes: [] files: -- "openssl-1.0.1k.tar.gz" +- "openssl-1.0.2g.tar.gz" - "db-4.8.30.NC.tar.gz" -- "miniupnpc-1.9.20140701.tar.gz" +- "miniupnpc-1.9.20140401.tar.gz" - "zlib-1.2.8.tar.gz" - "libpng-1.6.8.tar.gz" - "qrencode-3.4.3.tar.bz2" @@ -28,9 +28,9 @@ script: | INDIR=$HOME/build TEMPDIR=$HOME/tmp # Input Integrity Check - echo "8f9faeaebad088e772f4ef5e38252d472be4d878c6b3a2718c10a4fcebe7a41c openssl-1.0.1k.tar.gz" | sha256sum -c + echo "b784b1b3907ce39abf4098702dade6365522a253ad1552e267a9a0e89594aa33 openssl-1.0.2g.tar.gz" | sha256sum -c echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c - echo "26f3985bad7768b8483b793448ae49414cdc4451d0ec83e7c1944367e15f9f07 miniupnpc-1.9.20140701.tar.gz" | sha256sum -c + echo "d02670112125300f7a3d61421714d99105edd90190bf12542d16785f16f017aa miniupnpc-1.9.20140401.tar.gz" | sha256sum -c echo "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d zlib-1.2.8.tar.gz" | sha256sum -c echo "32c7acf1608b9c8b71b743b9780adb7a7b347563dbfb4a5263761056da44cc96 libpng-1.6.8.tar.gz" | sha256sum -c echo "dfd71487513c871bad485806bfd1fdb304dedc84d2b01a8fb8e0940b50597a98 qrencode-3.4.3.tar.bz2" | sha256sum -c @@ -48,8 +48,8 @@ script: | mkdir -p $INSTALLPREFIX $BUILDDIR cd $BUILDDIR # - tar xzf $INDIR/openssl-1.0.1k.tar.gz - cd openssl-1.0.1k + tar xzf $INDIR/openssl-1.0.2g.tar.gz + cd openssl-1.0.2g if [ "$BITS" == "32" ]; then OPENSSL_TGT=mingw else @@ -67,8 +67,8 @@ script: | make install_lib install_include cd ../.. # - tar xzf $INDIR/miniupnpc-1.9.20140701.tar.gz - cd miniupnpc-1.9.20140701 + tar xzf $INDIR/miniupnpc-1.9.20140401.tar.gz + cd miniupnpc-1.9.20140401 echo " --- miniupnpc-1.9/Makefile.mingw.orig 2013-09-29 18:52:51.014087958 -1000 +++ miniupnpc-1.9/Makefile.mingw 2013-09-29 19:09:29.663318691 -1000 @@ -124,5 +124,5 @@ script: | done # cd $INSTALLPREFIX - find include lib | sort | zip -X@ $OUTDIR/bitcoin-deps-win$BITS-gitian-r16.zip + find include lib | sort | zip -X@ $OUTDIR/zcoin-deps-win$BITS-gitian-r16.zip done # for BITS in diff --git a/contrib/gitian-descriptors/deps-win32.yml b/contrib/gitian-descriptors/deps-win32.yml new file mode 100644 index 0000000000..9cc2973ab9 --- /dev/null +++ b/contrib/gitian-descriptors/deps-win32.yml @@ -0,0 +1,99 @@ +--- +name: "bitcoin-deps" +suites: +- "precise" +architectures: +- "amd64" +packages: +- "mingw-w64" +- "g++-mingw-w64" +- "git-core" +- "zip" +- "faketime" +- "psmisc" +reference_datetime: "2011-01-30 00:00:00" +remotes: [] +files: +- "openssl-1.0.2g.tar.gz" +- "db-4.8.30.NC.tar.gz" +- "miniupnpc-1.9.20140401.tar.gz" +- "zlib-1.2.8.tar.gz" +- "libpng-1.6.8.tar.gz" +- "qrencode-3.4.3.tar.bz2" +script: | + # + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + export INSTALLPREFIX=$OUTDIR/staging/deps + export HOST=i686-w64-mingw32 + # Integrity Check + echo "b784b1b3907ce39abf4098702dade6365522a253ad1552e267a9a0e89594aa33 openssl-1.0.2g.tar.gz" | sha256sum -c + echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c + echo "d02670112125300f7a3d61421714d99105edd90190bf12542d16785f16f017aa miniupnpc-1.9.20140401.tar.gz" | sha256sum -c + echo "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d zlib-1.2.8.tar.gz" | sha256sum -c + echo "32c7acf1608b9c8b71b743b9780adb7a7b347563dbfb4a5263761056da44cc96 libpng-1.6.8.tar.gz" | sha256sum -c + echo "dfd71487513c871bad485806bfd1fdb304dedc84d2b01a8fb8e0940b50597a98 qrencode-3.4.3.tar.bz2" | sha256sum -c + # + mkdir -p $INSTALLPREFIX + tar xzf openssl-1.0.2g.tar.gz + cd openssl-1.0.2g + ./Configure --cross-compile-prefix=$HOST- mingw --openssldir=$INSTALLPREFIX + make + make install_sw + cd .. + # + tar xzf db-4.8.30.NC.tar.gz + cd db-4.8.30.NC/build_unix + ../dist/configure --prefix=$INSTALLPREFIX --enable-mingw --enable-cxx --host=$HOST --disable-shared + make $MAKEOPTS library_build + make install_lib install_include + cd ../.. + # + tar xzf miniupnpc-1.9.20140401.tar.gz + cd miniupnpc-1.9.20140401 + echo " + --- miniupnpc-1.6/Makefile.mingw.orig 2013-09-29 18:52:51.014087958 -1000 + +++ miniupnpc-1.6/Makefile.mingw 2013-09-29 19:09:29.663318691 -1000 + @@ -67,8 +67,8 @@ + + wingenminiupnpcstrings.o: wingenminiupnpcstrings.c + + -miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings + - wingenminiupnpcstrings \$< \$@ + +miniupnpcstrings.h: miniupnpcstrings.h.in + + sed -e 's|OS/version|MSWindows/5.1.2600|' -e 's|MINIUPNPC_VERSION_STRING \"version\"|MINIUPNPC_VERSION_STRING \"VERSIONHERE\"|' \$< > \$@ + + minixml.o: minixml.c minixml.h miniupnpcstrings.h + + " | sed "s/VERSIONHERE/$(cat VERSION)/" | patch -p1 + mkdir -p dll + make -f Makefile.mingw CC=$HOST-gcc AR=$HOST-ar libminiupnpc.a + install -d $INSTALLPREFIX/include/miniupnpc + install *.h $INSTALLPREFIX/include/miniupnpc + install libminiupnpc.a $INSTALLPREFIX/lib + cd .. + # + tar xzf zlib-1.2.8.tar.gz + cd zlib-1.2.8 + CROSS_PREFIX=$HOST- ./configure --prefix=$INSTALLPREFIX --static + make + make install + cd .. + # + tar xzf libpng-1.6.8.tar.gz + cd libpng-1.6.8 + CPPFLAGS="-I$INSTALLPREFIX/include" LDFLAGS="-L$INSTALLPREFIX/lib" ./configure --disable-shared --prefix=$INSTALLPREFIX --host=$HOST + make $MAKEOPTS + make install + cd .. + # + tar xjf qrencode-3.4.3.tar.bz2 + cd qrencode-3.4.3 + png_CFLAGS="-I$INSTALLPREFIX/include" png_LIBS="-L$INSTALLPREFIX/lib -lpng" ./configure --prefix=$INSTALLPREFIX --host=$HOST + make + make install + cd .. + # + cd $INSTALLPREFIX + zip -r $OUTDIR/bitcoin08-deps-win32-gitian-r12.zip include lib \ No newline at end of file diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 37e2e11d7c..d2fe3ebe87 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -1,5 +1,5 @@ --- -name: "zcoin" +name: "bitcoin" suites: - "precise" architectures: @@ -22,11 +22,11 @@ packages: - "libqt4-test" reference_datetime: "2013-06-01 00:00:00" remotes: -- "url": "https://github.com/zcoinofficial/zcoin.git" - "dir": "zcoin" +- "url": "https://github.com/bitcoin/bitcoin.git" + "dir": "bitcoin" files: -- "zcoin-deps-linux32-gitian-r9.zip" -- "zcoin-deps-linux64-gitian-r9.zip" +- "bitcoin-deps-linux32-gitian-r9.zip" +- "bitcoin-deps-linux64-gitian-r9.zip" - "boost-linux32-1.55.0-gitian-r1.zip" - "boost-linux64-1.55.0-gitian-r1.zip" - "qt-linux32-4.6.4-gitian-r1.tar.gz" @@ -43,13 +43,13 @@ script: | # mkdir -p $STAGING cd $STAGING - unzip ../build/zcoin-deps-linux${GBUILD_BITS}-gitian-r9.zip + unzip ../build/bitcoin-deps-linux${GBUILD_BITS}-gitian-r9.zip unzip ../build/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip tar -zxf ../build/qt-linux${GBUILD_BITS}-4.6.4-gitian-r1.tar.gz cd ../build # Avoid exporting *any* symbols from the executable - # This avoids conflicts between the libraries statically linked into zcoin and any + # This avoids conflicts between the libraries statically linked into bitcoin and any # libraries we may link dynamically (such as Qt and OpenSSL, see issue #4094). # It also avoids start-up overhead to not export any unnecessary symbols. # To do this, build a linker script that marks all symbols as local. @@ -59,14 +59,14 @@ script: | local: *; };' > $LINKER_SCRIPT function do_configure { - ./configure "$@" --prefix=$STAGING --with-protoc-bindir=$STAGING/host/bin --with-qt-bindir=$STAGING/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib -Wl,--version-script=$LINKER_SCRIPT ${OPTFLAGS}" CXXFLAGS="-frandom-seed=zcoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" --enable-glibc-back-compat + ./configure "$@" --prefix=$STAGING --with-protoc-bindir=$STAGING/host/bin --with-qt-bindir=$STAGING/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib -Wl,--version-script=$LINKER_SCRIPT ${OPTFLAGS}" CXXFLAGS="-frandom-seed=bitcoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" --enable-glibc-back-compat } # - cd zcoin + cd bitcoin ./autogen.sh do_configure make dist - DISTNAME=`echo zcoin-*.tar.gz` + DISTNAME=`echo bitcoin-*.tar.gz` # Build dynamic versions of everything # (with static linking to boost and openssl as well a some non-OS deps) @@ -83,4 +83,4 @@ script: | rm -rf $TEMPDIR mkdir -p $TEMPDIR cd $TEMPDIR - tar -xvf $HOME/build/zcoin/$DISTNAME | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 --mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/src/$DISTNAME + tar -xvf $HOME/build/bitcoin/$DISTNAME | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 --mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/src/$DISTNAME diff --git a/contrib/gitian-descriptors/gitian-osx-zcoin.yml b/contrib/gitian-descriptors/gitian-osx-bitcoin.yml similarity index 100% rename from contrib/gitian-descriptors/gitian-osx-zcoin.yml rename to contrib/gitian-descriptors/gitian-osx-bitcoin.yml diff --git a/contrib/gitian-descriptors/gitian-win-old.yml b/contrib/gitian-descriptors/gitian-win-old.yml new file mode 100644 index 0000000000..1c6ae63704 --- /dev/null +++ b/contrib/gitian-descriptors/gitian-win-old.yml @@ -0,0 +1,54 @@ +--- +name: "zcoin" +suites: +- "trusty" +architectures: +- "amd64" +packages: +- "mingw-w64" +- "g++-mingw-w64" +- "git-core" +- "unzip" +- "nsis" +- "faketime" +- "autoconf2.13" +- "libtool" +- "automake" +- "pkg-config" +- "bsdmainutils" + +reference_datetime: "2013-06-01 00:00:00" +remotes: +- "url": "https://github.com/zcoinofficial/zcoin.git" + "dir": "zcoin" +files: +- "qt-win32-4.8.5-gitian-r7.zip" +- "boost-win32-1.55.0-gitian-r6.zip" +- "zcoin-deps-win32-gitian-r16.zip" +script: | + # + INDIR=$HOME/build + STAGING=$HOME/staging + HOST=i686-w64-mingw32 + # + mkdir -p $STAGING + cd $STAGING + unzip $INDIR/qt-win32-4.8.5-gitian-r7.zip + unzip $INDIR/boost-win32-1.55.0-gitian-r6.zip + unzip $INDIR/zcoin-deps-win32-gitian-r16.zip + cd $HOME/build/ + # + cd zcoin + export PATH=$STAGING/host/bin:$PATH + mkdir -p $OUTDIR/src + git archive HEAD | tar -x -C $OUTDIR/src + cp $OUTDIR/src/doc/README_windows.txt $OUTDIR/readme.txt + cp $OUTDIR/src/COPYING $OUTDIR/COPYING.txt + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + ln -s $STAGING $HOME/qt + $HOME/staging/host/bin/qmake "RELEASE=1" -spec unsupported/win32-g++-cross MINIUPNPC_LIB_PATH=$STAGING MINIUPNPC_INCLUDE_PATH=$STAGING BDB_LIB_PATH=$STAGING BDB_INCLUDE_PATH=$STAGING BOOST_LIB_PATH=$STAGING BOOST_INCLUDE_PATH=$STAGING BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$STAGING OPENSSL_INCLUDE_PATH=$STAGING QRENCODE_LIB_PATH=$STAGING QRENCODE_INCLUDE_PATH=$STAGING USE_QRCODE=1 INCLUDEPATH=$STAGING DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_CXXFLAGS=-frandom-seed=moneta USE_BUILD_INFO=1 USE_SSE2=1 USE_UPNP=1 zcoin.pro + make $MAKEOPTS + ls -la + $HOST-strip release/zcoin-qt.exe + cp release/zcoin-qt.exe $OUTDIR/ \ No newline at end of file diff --git a/contrib/gitian-descriptors/gitian-win32.yml b/contrib/gitian-descriptors/gitian-win32.yml new file mode 100644 index 0000000000..1eb8ab348e --- /dev/null +++ b/contrib/gitian-descriptors/gitian-win32.yml @@ -0,0 +1,69 @@ +--- +name: "zcoin" +suites: +- "trusty" +architectures: +- "amd64" +packages: +- "mingw-w64" +- "g++-mingw-w64" +- "git-core" +- "unzip" +- "nsis" +- "faketime" +reference_datetime: "2011-01-30 00:00:00" +remotes: +- "url": "https://github.com/leoreinaux/zcoin" + "dir": "zcoin" + "commit": "sync-fix-0.8.7.7" +files: +- "qt-win32-4.8.5-gitian-r7.zip" +- "boost-win32-1.55.0-gitian-r6.zip" +- "bitcoin08-deps-win32-gitian-r12.zip" +script: | + # + STAGING=$HOME/staging + HOST=i686-w64-mingw32 + # + mkdir -p $STAGING + cd $STAGING + unzip ../build/qt-win32-4.8.5-gitian-r7.zip + unzip ../build/boost-win32-1.55.0-gitian-r6.zip + unzip ../build/bitcoin08-deps-win32-gitian-r12.zip + cd $HOME/build/ + # + cd zcoin + export PATH=$STAGING/host/bin:$PATH + mkdir -p $OUTDIR/src + git archive HEAD | tar -x -C $OUTDIR/src + cp $OUTDIR/src/doc/README_windows.txt $OUTDIR/readme.txt + cp $OUTDIR/src/COPYING $OUTDIR/COPYING.txt + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + ln -s $STAGING $HOME/qt + $HOME/staging/host/bin/qmake -spec unsupported/win32-g++-cross MINIUPNPC_LIB_PATH=$STAGING MINIUPNPC_INCLUDE_PATH=$STAGING BDB_LIB_PATH=$STAGING BDB_INCLUDE_PATH=$STAGING BOOST_LIB_PATH=$STAGING BOOST_INCLUDE_PATH=$STAGING BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$STAGING OPENSSL_INCLUDE_PATH=$STAGING QRENCODE_LIB_PATH=$STAGING QRENCODE_INCLUDE_PATH=$STAGING USE_QRCODE=1 INCLUDEPATH=$STAGING DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_CXXFLAGS=-frandom-seed=moneta USE_BUILD_INFO=1 USE_SSE2=1 USE_UPNP=1 zcoin.pro + make $MAKEOPTS + ls -la + $HOST-strip release/zcoin-qt.exe + cp release/zcoin-qt.exe $OUTDIR/ + # + #cd src + #mkdir obj/libzerocoin + #export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + #export FAKETIME=$REFERENCE_DATETIME + #export TZ=UTC + #make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$STAGING monetad.exe USE_UPNP=1 DEBUGFLAGS="-frandom-seed=moneta" USE_SSE2=1 + #$HOST-strip monetad.exe + #mkdir $OUTDIR/daemon + #cp monetad.exe $OUTDIR/daemon + #cd .. + #mkdir nsis + #git archive HEAD | tar -x -C nsis + #cd nsis/src + #mkdir ../release + #cp ../../release/* ../release/ + #cp ../../src/*.exe . + #makensis ../share/setup.nsi + #cp ../share/moneta-*-win32-setup.exe $OUTDIR/ + diff --git a/contrib/gitian-descriptors/qt-win.yml b/contrib/gitian-descriptors/qt-win.yml index 6211d721aa..63c4f1844c 100644 --- a/contrib/gitian-descriptors/qt-win.yml +++ b/contrib/gitian-descriptors/qt-win.yml @@ -15,8 +15,8 @@ reference_datetime: "2011-01-30 00:00:00" remotes: [] files: - "qt-everywhere-opensource-src-5.2.0.tar.gz" -- "bitcoin-deps-win32-gitian-r16.zip" -- "bitcoin-deps-win64-gitian-r16.zip" +- "zcoin-deps-win32-gitian-r16.zip" +- "zcoin-deps-win64-gitian-r16.zip" script: | # Defines export TZ=UTC @@ -46,9 +46,9 @@ script: | # mkdir -p $INSTALLPREFIX $INSTALLPREFIX/host/bin $DEPSDIR $BUILDDIR # - # Need mingw-compiled openssl from bitcoin-deps: + # Need mingw-compiled openssl from zcoin-deps: cd $DEPSDIR - unzip $INDIR/bitcoin-deps-win${BITS}-gitian-r16.zip + unzip $INDIR/zcoin-deps-win${BITS}-gitian-r16.zip # cd $BUILDDIR # diff --git a/contrib/gitian-descriptors/qt-win32.yml b/contrib/gitian-descriptors/qt-win32.yml new file mode 100644 index 0000000000..078f6582ac --- /dev/null +++ b/contrib/gitian-descriptors/qt-win32.yml @@ -0,0 +1,64 @@ +--- +name: "qt" +suites: +- "precise" +architectures: +- "amd64" +packages: +- "mingw-w64" +- "g++-mingw-w64" +- "zip" +- "unzip" +- "faketime" +reference_datetime: "2011-01-30 00:00:00" +remotes: [] +files: +- "qt-everywhere-opensource-src-4.8.5.tar.gz" +- "bitcoin08-deps-win32-gitian-r12.zip" +script: | + # + HOST=i686-w64-mingw32 + INSTDIR="$HOME/qt/" + # Integrity Check + echo "eb728f8268831dc4373be6403b7dd5d5dde03c169ad6882f9a8cb560df6aa138 qt-everywhere-opensource-src-4.8.5.tar.gz" | sha256sum -c + # + mkdir $INSTDIR + mkdir -p $INSTDIR/host/bin + # + # Need mingw-compiled openssl from bitcoin-deps: + unzip bitcoin08-deps-win32-gitian-r12.zip + DEPSDIR=`pwd` + # + tar xzf qt-everywhere-opensource-src-4.8.5.tar.gz + cd qt-everywhere-opensource-src-4.8.5 + sed 's/$TODAY/2011-01-30/' -i configure + sed "s/i686-pc-mingw32-/$HOST-/" -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix "s|QMAKE_CFLAGS\t\t= -pipe|QMAKE_CFLAGS\t\t= -pipe -isystem /usr/$HOST/include/ -frandom-seed=qtbuild|" -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed 's/QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads/QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed 's/QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads/QMAKE_LFLAGS_EXCEPTIONS_ON = -lmingwthrd/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix "s/QMAKE_MOC\t\t= $HOST-moc/QMAKE_MOC\t\t= moc/" -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix "s/QMAKE_RCC\t\t= $HOST-rcc/QMAKE_RCC\t\t= rcc/" -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix "s/QMAKE_UIC\t\t= $HOST-uic/QMAKE_UIC\t\t= uic/" -i mkspecs/unsupported/win32-g++-cross/qmake.conf + # ar adds timestamps to every object file included in the static library + # providing -D as ar argument is supposed to solve it, but doesn't work as qmake strips off the arguments and adds -M to pass a script... + # which somehow cannot be combined with other flags. + # use faketime only for ar, as it confuses make/qmake into hanging sometimes + sed --posix "s|QMAKE_LIB\t\t= $HOST-ar -ru|QMAKE_LIB\t\t= $HOME/ar -Dr|" -i mkspecs/unsupported/win32-g++-cross/qmake.conf + echo '#!/bin/bash' > $HOME/ar + echo 'export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1' >> $HOME/ar + echo "$HOST-ar \"\$@\"" >> $HOME/ar + chmod +x $HOME/ar + #export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + # Compile static libraries, and use statically linked openssl (-openssl-linked): + OPENSSL_LIBS="-L$DEPSDIR/lib -lssl -lcrypto -lgdi32" ./configure -prefix $INSTDIR -bindir $INSTDIR/host/bin -I $DEPSDIR/include -confirm-license -release -opensource -static -no-qt3support -xplatform unsupported/win32-g++-cross -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -no-script -no-scripttools -no-javascript-jit -no-webkit -no-svg -no-xmlpatterns -no-sql-sqlite -no-nis -no-cups -no-iconv -no-dbus -no-gif -no-libtiff -no-opengl -nomake examples -nomake demos -nomake docs -no-feature-style-plastique -no-feature-style-cleanlooks -no-feature-style-motif -no-feature-style-cde -no-feature-style-windowsce -no-feature-style-windowsmobile -no-feature-style-s60 -openssl-linked + find . -name *.prl | xargs -l sed 's|/\.||' -i + find . -name *.prl | xargs -l sed 's|/$||' -i + make $MAKEOPTS install + cd $INSTDIR + find . -name *.prl | xargs -l sed 's|/$||' -i + + # as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + zip -r $OUTDIR/qt-win32-4.8.5-gitian-r7.zip * \ No newline at end of file diff --git a/doc/gitian-building.md b/doc/gitian-building.md new file mode 100644 index 0000000000..dd232e243f --- /dev/null +++ b/doc/gitian-building.md @@ -0,0 +1,409 @@ +Gitian building +================ + +*Setup instructions for a gitian build of Zcoin using a Debian VM or physical system.* + +Gitian is the deterministic build process that is used to build the Zcoin +Core executables [1]. It provides a way to be reasonably sure that the +executables are really built from source on github. It also makes sure that +the same, tested dependencies are used and statically built into the executable. + +Multiple developers build the source code by following a specific descriptor +("recipe"), cryptographically sign the result, and upload the resulting signature. +These results are compared and only if they match, the build is accepted and uploaded +to Zcoin.org. + +More independent gitian builders are needed, which is why I wrote this +guide. It is preferred to follow these steps yourself instead of using someone else's +VM image to avoid 'contaminating' the build. + +[1] For all platforms except for MacOSX, at this point. Work for deterministic +builds for Mac is under way here: https://github.com/theuni/osx-cross-depends . + +Table of Contents +------------------ + +- [Create a new VirtualBox VM](#create-a-new-virtualbox-vm) +- [Connecting to the VM](#connecting-to-the-vm) +- [Setting up Debian for gitian building](#setting-up-debian-for-gitian-building) +- [Installing gitian](#installing-gitian) +- [Setting up gitian images](#setting-up-gitian-images) +- [Getting and building the inputs](#getting-and-building-the-inputs) +- [Building Zcoin](#building-zcoin) +- [Building an alternative repository](#building-an-alternative-repository) +- [Signing externally](#signing-externally) +- [Uploading signatures](#uploading-signatures) + +Create a new VirtualBox VM +--------------------------- + +The first step is to create a new Virtual Machine, which will be explained in +this section. This VM will be used to do the Gitian builds. In this guide it +will be explained how to set up the environment, and how to get the builds +started. + +Debian Linux was chosen as the host distribution because it has a lightweight install (in +contrast to Ubuntu) and is readily available. We here show the steps for +VirtualBox [1], but any kind of virtualization can be used. You can also install +on actual hardware instead of using a VM, in this case you can skip this section. + +In the VirtualBox GUI click "Create" and choose the following parameters in the wizard: + +![](gitian-building/create_vm_page1.png) + +- Type: Linux, Debian (64 bit) + +![](gitian-building/create_vm_memsize.png) + +- Memory Size: at least 1024MB, anything lower will really slow the build down + +![](gitian-building/create_vm_hard_drive.png) + +- Hard Drive: Create a virtual hard drive now + +![](gitian-building/create_vm_hard_drive_file_type.png) + +- Hard Drive file type: Use the default, VDI (VirtualBox Disk Image) + +![](gitian-building/create_vm_storage_physical_hard_drive.png) + +- Storage on Physical hard drive: Dynamically Allocated + +![](gitian-building/create_vm_file_location_size.png) + +- Disk size: at least 40GB; as low as 20GB *may* be possible, but better to err on the safe side +- Push the `Create` button + +Get the [Debian 7.4 net installer](http://cdimage.debian.org/debian-cd/7.4.0/amd64/iso-cd/debian-7.4.0-amd64-netinst.iso). +This DVD image can be validated using a SHA256 hashing tool, for example on +Unixy OSes by entering the following in a terminal: + + echo "b712a141bc60269db217d3b3e456179bd6b181645f90e4aac9c42ed63de492e9 /home/orion/Downloads/debian-7.4.0-amd64-netinst.iso" | sha256sum -c + # (must return OK) + +After creating the VM, we need to configure it. + +- Click the `Settings` button, then go to the `Network` tab. Adapter 1 should be attacked to `NAT`. + +![](gitian-building/network_settings.png) + +- Click `Advanced`, then `Port Forwarding`. We want to set up a port through where we can reach the VM to get files in and out. +- Create a new rule by clicking the plus icon. + +![](gitian-building/port_forwarding_rules.png) + +- Set up the new rule the following way: + - Name: `SSH` + - Protocol: `TCP` + - Leave Host IP empty + - Host Port: `22222` + - Leave Guest IP empty + - Guest Port: `22` + +- Click `Ok` twice to save. + +Then start the VM. On the first launch you will be asked for a CD or DVD image. Choose the downloaded iso. + +![](gitian-building/select_startup_disk.png) + +[1] https://www.virtualbox.org/ + +Installing Debian +------------------ + +In this section it will be explained how to install Debian on the newly created VM. + +- Choose the non-graphical installer. We do not need the graphical environment, it will only increase installation time and disk usage. + +![](gitian-building/debian_install_1_boot_menu.png) + +**Note**: Navigation in the Debian installer: To keep a setting at the default +and proceed, just press `Enter`. To select a different button, press `Tab`. + +- Choose locale and keyboard settings (doesn't matter, you can just go with the defaults or select your own information) + +![](gitian-building/debian_install_2_select_a_language.png) +![](gitian-building/debian_install_3_select_location.png) +![](gitian-building/debian_install_4_configure_keyboard.png) + +- The VM will detect network settings using DHCP, this should all proceed automatically +- Configure the network: + - System name `debian`. + - Leave domain name empty. + +![](gitian-building/debian_install_5_configure_the_network.png) + +- Choose a root password and enter it twice (and remember it for later) + +![](gitian-building/debian_install_6a_set_up_root_password.png) + +- Name the new user `debian` (the full name doesn't matter, you can leave it empty) + +![](gitian-building/debian_install_7_set_up_user_fullname.png) +![](gitian-building/debian_install_8_set_up_username.png) + +- Choose a user password and enter it twice (and remember it for later) + +![](gitian-building/debian_install_9_user_password.png) + +- The installer will set up the clock using a time server, this process should be automatic +- Set up the clock: choose a time zone (depends on the locale settings that you picked earlier; specifics don't matter) + +![](gitian-building/debian_install_10_configure_clock.png) + +- Disk setup + - Partitioning method: Guided - Use the entire disk + +![](gitian-building/debian_install_11_partition_disks.png) + + - Select disk to partition: SCSI1 (0,0,0) + +![](gitian-building/debian_install_12_choose_disk.png) + + - Partitioning scheme: All files in one partition + +![](gitian-building/debian_install_13_partition_scheme.png) + + - Finish partitioning and write changes to disk -> *Yes* (`Tab`, `Enter` to select the `Yes` button) + +![](gitian-building/debian_install_14_finish.png) +![](gitian-building/debian_install_15_write_changes.png) + +- The base system will be installed, this will take a minute or so +- Choose a mirror (any will do) + +![](gitian-building/debian_install_16_choose_a_mirror.png) + +- Enter proxy information (unless you are on an intranet, you can leave this empty) + +![](gitian-building/debian_install_18_proxy_settings.png) + +- Wait a bit while 'Select and install software' runs +- Participate in popularity contest -> *No* +- Choose software to install. We need just the base system. + +![](gitian-building/debian_install_19_software_selection.png) + +- Make sure only 'SSH server' and 'Standard System Utilities' are checked +- Uncheck 'Debian Desktop Environment' and 'Print Server' + +![](gitian-building/debian_install_20_install_grub.png) + +- Install the GRUB boot loader to the master boot record? -> Yes + +![](gitian-building/debian_install_21_finish_installation.png) + +- Installation Complete -> *Continue* +- After installation, the VM will reboot and you will have a working Debian VM. Congratulations! + +Connecting to the VM +---------------------- + +After the VM has booted you can connect to it using SSH, and files can be copied from and to the VM using a SFTP utility. +Connect to `localhost`, port `22222` (or the port configured when installing the VM). +On Windows you can use putty[1] and WinSCP[2]. + +For example to connect as `root` from a Linux command prompt use + + $ ssh root@localhost -p 22222 + The authenticity of host '[localhost]:22222 ([127.0.0.1]:22222)' can't be established. + ECDSA key fingerprint is 8e:71:f9:5b:62:46:de:44:01:da:fb:5f:34:b5:f2:18. + Are you sure you want to continue connecting (yes/no)? yes + Warning: Permanently added '[localhost]:22222' (ECDSA) to the list of known hosts. + root@localhost's password: (enter root password configured during install) + Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 + root@debian:~# + +Replace `root` with `debian` to log in as user. + +[1] http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html +[2] http://winscp.net/eng/index.php + +Setting up Debian for gitian building +-------------------------------------- + +In this section we will be setting up the Debian installation for Gitian building. + +First we need to log in as `root` to set up dependencies and make sure that our +user can use the sudo command. Type/paste the following in the terminal: + +```bash +apt-get install git ruby sudo apt-cacher-ng qemu-utils debootstrap lxc python-cheetah parted kpartx bridge-utils +adduser debian sudo +``` + +When you get a colorful screen with a question about the 'LXC directory', just +go with the default (`/var/lib/lxc`). + +Then set up LXC and the rest with the following is a complex jumble of settings and workarounds: + +```bash +# the version of lxc-start in Debian 7.4 needs to run as root, so make sure +# that the build script can exectute it without providing a password +echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/gitian-lxc +# add cgroup for LXC +echo "cgroup /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab +# make /etc/rc.local script that sets up bridge between guest and host +echo '#!/bin/sh -e' > /etc/rc.local +echo 'brctl addbr br0' >> /etc/rc.local +echo 'ifconfig br0 10.0.3.2/24 up' >> /etc/rc.local +echo 'exit 0' >> /etc/rc.local +# make sure that USE_LXC is always set when logging in as debian, +# and configure LXC IP addresses +echo 'export USE_LXC=1' >> /home/debian/.profile +echo 'export GITIAN_HOST_IP=10.0.3.2' >> /home/debian/.profile +echo 'export LXC_GUEST_IP=10.0.3.5' >> /home/debian/.profile +reboot +``` + +At the end the VM is rebooted to make sure that the changes take effect. The steps in this +section need only to be performed once. + +Installing gitian +------------------ + +Re-login as the user `debian` that was created during installation. +The rest of the steps in this guide will be performed as that user. + +There is no `python-vm-builder` package in Debian, so we need to install it from source ourselves, + +```bash +wget http://archive.ubuntu.com/ubuntu/pool/universe/v/vm-builder/vm-builder_0.12.4+bzr489.orig.tar.gz +echo "ec12e0070a007989561bfee5862c89a32c301992dd2771c4d5078ef1b3014f03 vm-builder_0.12.4+bzr489.orig.tar.gz" | sha256sum -c +# (verification -- must return OK) +tar -zxvf vm-builder_0.12.4+bzr489.orig.tar.gz +cd vm-builder-0.12.4+bzr489 +sudo python setup.py install +cd .. +``` + +**Note**: When sudo asks for a password, enter the password for the user *debian* not for *root*. + +Clone the git repositories for zcoin and gitian, + +```bash +git clone https://github.com/devrandom/gitian-builder.git +git clone https://github.com/zcoinofficial/zcoin +``` + +Setting up gitian images +------------------------- + +Gitian needs virtual images of the operating system to build in. +Currently this is Ubuntu Trusty for both x86 architectures. +These images will be copied and used every time that a build is started to +make sure that the build is deterministic. +Creating the images will take a while, but only has to be done once. + +Execute the following as user `debian`: + +```bash +cd gitian-builder +bin/make-base-vm --lxc --arch i386 --suite trusty +bin/make-base-vm --lxc --arch amd64 --suite trusty +``` + +There will be a lot of warnings printed during build of the images. These can be ignored. + +**Note**: When sudo asks for a password, enter the password for the user *debian* not for *root*. + +Getting and building the inputs +-------------------------------- + +In [doc/release-process.md](release-process.md) in the zcoin repository under 'Fetch and build inputs'. +you will find a list of `wget` commands that can be executed to get the dependencies. + +I needed to add `--no-check-certificate` to the OpenSSL wget line to make it work. +Likely this is because the ca-certificates in Debian 7.4 is fairly old. This does not create a +security issue as the gitian descriptors check integrity of the input archives and refuse to work +if any one is corrupted. + +After downloading the archives, execute the `gbuild` commends to build the dependencies. +This can take a long time, but only has to be done when the dependencies change, for example +to upgrade the used version. + +**Note**: Do not forget to copy the result from `build/out` to `inputs` after every gbuild command! This will save +you a lot of time. + +At any time you can check the package installation and build progress with + +```bash +tail -f var/install.log +tail -f var/build.log +``` + +Building Zcoin +---------------- + +To build Zcoin (for Linux and/or Windows) just follow the steps under 'perform +gitian builds' in [doc/release-process.md](release-process.md) in the zcoin repository. + +Output from `gbuild` will look something like + + Initialized empty Git repository in /home/debian/gitian-builder/inputs/zcoin/.git/ + remote: Reusing existing pack: 35606, done. + remote: Total 35606 (delta 0), reused 0 (delta 0) + Receiving objects: 100% (35606/35606), 26.52 MiB | 4.28 MiB/s, done. + Resolving deltas: 100% (25724/25724), done. + From https://github.com/zcoinofficial/zcoin + ... (new tags, new branch etc) + --- Building for precise i386 --- + Stopping target if it is up + Making a new image copy + stdin: is not a tty + Starting target + Checking if target is up + Preparing build environment + Updating apt-get repository (log in var/install.log) + Installing additional packages (log in var/install.log) + Grabbing package manifest + stdin: is not a tty + Creating build script (var/build-script) + lxc-start: Connection refused - inotify event with no name (mask 32768) + Running build script (log in var/build.log) + +As when building the dependencies, the progress of package installation and building +can be inspected in `var/install.log` and `var/build.log`. + +Building an alternative repository +----------------------------------- + +If you want to do a test build of a pull on github it can be useful to point +the gitian builder at an alternative repository, using the same descriptors +and inputs. + +For example: +```bash +URL=https://github.com/leoreinaux/zcoin.git +COMMIT=2014_03_windows_unicode_path +./bin/gbuild --commit zcoin=${COMMIT} --url zcoin=${URL} ../zcoin/contrib/gitian-descriptors/gitian-linux.yml +./bin/gbuild --commit zcoin=${COMMIT} --url zcoin=${URL} ../zcoin/contrib/gitian-descriptors/gitian-win.yml +``` + +Signing externally +------------------- + +If you want to do the PGP signing on another device that's possible too; just define `SIGNER` as mentioned +and follow the steps in the build process as normally. + + gpg: skipped "laanwj": secret key not available + +When you execute `gsign` you will get an error from GPG, which can be ignored. Copy the resulting `.assert` files +in `gitian.sigs` to your signing machine and do + +```bash + gpg --detach-sign ${VERSION}/${SIGNER}/zcoin-build.assert + gpg --detach-sign ${VERSION}-win/${SIGNER}/zcoin-build.assert +``` + +This will create the `.sig` files that can be committed together with the `.assert` files to assert your +gitian build. + +Uploading signatures +--------------------- + +After building and signing you can push your signatures (both the `.assert` and +`.assert.sig` files) to the +[zcoin/gitian.sigs](https://github.com/zcoin/gitian.sigs/) repository, or +if not possible create a pull request. + diff --git a/doc/gitian-building/create_vm_file_location_size.png b/doc/gitian-building/create_vm_file_location_size.png new file mode 100644 index 0000000000..14aef5abae Binary files /dev/null and b/doc/gitian-building/create_vm_file_location_size.png differ diff --git a/doc/gitian-building/create_vm_hard_drive.png b/doc/gitian-building/create_vm_hard_drive.png new file mode 100644 index 0000000000..a1706e14fd Binary files /dev/null and b/doc/gitian-building/create_vm_hard_drive.png differ diff --git a/doc/gitian-building/create_vm_hard_drive_file_type.png b/doc/gitian-building/create_vm_hard_drive_file_type.png new file mode 100644 index 0000000000..251b8ee3e2 Binary files /dev/null and b/doc/gitian-building/create_vm_hard_drive_file_type.png differ diff --git a/doc/gitian-building/create_vm_memsize.png b/doc/gitian-building/create_vm_memsize.png new file mode 100644 index 0000000000..33717867a5 Binary files /dev/null and b/doc/gitian-building/create_vm_memsize.png differ diff --git a/doc/gitian-building/create_vm_page1.png b/doc/gitian-building/create_vm_page1.png new file mode 100644 index 0000000000..edaebc6223 Binary files /dev/null and b/doc/gitian-building/create_vm_page1.png differ diff --git a/doc/gitian-building/create_vm_storage_physical_hard_drive.png b/doc/gitian-building/create_vm_storage_physical_hard_drive.png new file mode 100644 index 0000000000..987efaa40c Binary files /dev/null and b/doc/gitian-building/create_vm_storage_physical_hard_drive.png differ diff --git a/doc/gitian-building/debian_install_10_configure_clock.png b/doc/gitian-building/debian_install_10_configure_clock.png new file mode 100644 index 0000000000..467c79018e Binary files /dev/null and b/doc/gitian-building/debian_install_10_configure_clock.png differ diff --git a/doc/gitian-building/debian_install_11_partition_disks.png b/doc/gitian-building/debian_install_11_partition_disks.png new file mode 100644 index 0000000000..18110734df Binary files /dev/null and b/doc/gitian-building/debian_install_11_partition_disks.png differ diff --git a/doc/gitian-building/debian_install_12_choose_disk.png b/doc/gitian-building/debian_install_12_choose_disk.png new file mode 100644 index 0000000000..a00d4abf17 Binary files /dev/null and b/doc/gitian-building/debian_install_12_choose_disk.png differ diff --git a/doc/gitian-building/debian_install_13_partition_scheme.png b/doc/gitian-building/debian_install_13_partition_scheme.png new file mode 100644 index 0000000000..2f80f19b63 Binary files /dev/null and b/doc/gitian-building/debian_install_13_partition_scheme.png differ diff --git a/doc/gitian-building/debian_install_14_finish.png b/doc/gitian-building/debian_install_14_finish.png new file mode 100644 index 0000000000..411d457e95 Binary files /dev/null and b/doc/gitian-building/debian_install_14_finish.png differ diff --git a/doc/gitian-building/debian_install_15_write_changes.png b/doc/gitian-building/debian_install_15_write_changes.png new file mode 100644 index 0000000000..f26093982c Binary files /dev/null and b/doc/gitian-building/debian_install_15_write_changes.png differ diff --git a/doc/gitian-building/debian_install_16_choose_a_mirror.png b/doc/gitian-building/debian_install_16_choose_a_mirror.png new file mode 100644 index 0000000000..d2c2e9523b Binary files /dev/null and b/doc/gitian-building/debian_install_16_choose_a_mirror.png differ diff --git a/doc/gitian-building/debian_install_17_choose_a_mirror2.png b/doc/gitian-building/debian_install_17_choose_a_mirror2.png new file mode 100644 index 0000000000..cef2db0781 Binary files /dev/null and b/doc/gitian-building/debian_install_17_choose_a_mirror2.png differ diff --git a/doc/gitian-building/debian_install_18_proxy_settings.png b/doc/gitian-building/debian_install_18_proxy_settings.png new file mode 100644 index 0000000000..24ba25c109 Binary files /dev/null and b/doc/gitian-building/debian_install_18_proxy_settings.png differ diff --git a/doc/gitian-building/debian_install_19_software_selection.png b/doc/gitian-building/debian_install_19_software_selection.png new file mode 100644 index 0000000000..d462757aff Binary files /dev/null and b/doc/gitian-building/debian_install_19_software_selection.png differ diff --git a/doc/gitian-building/debian_install_1_boot_menu.png b/doc/gitian-building/debian_install_1_boot_menu.png new file mode 100644 index 0000000000..27fd849b4f Binary files /dev/null and b/doc/gitian-building/debian_install_1_boot_menu.png differ diff --git a/doc/gitian-building/debian_install_20_install_grub.png b/doc/gitian-building/debian_install_20_install_grub.png new file mode 100644 index 0000000000..de4f9be0c9 Binary files /dev/null and b/doc/gitian-building/debian_install_20_install_grub.png differ diff --git a/doc/gitian-building/debian_install_21_finish_installation.png b/doc/gitian-building/debian_install_21_finish_installation.png new file mode 100644 index 0000000000..b967c3550d Binary files /dev/null and b/doc/gitian-building/debian_install_21_finish_installation.png differ diff --git a/doc/gitian-building/debian_install_2_select_a_language.png b/doc/gitian-building/debian_install_2_select_a_language.png new file mode 100644 index 0000000000..1c9e0bcfc1 Binary files /dev/null and b/doc/gitian-building/debian_install_2_select_a_language.png differ diff --git a/doc/gitian-building/debian_install_3_select_location.png b/doc/gitian-building/debian_install_3_select_location.png new file mode 100644 index 0000000000..005c395656 Binary files /dev/null and b/doc/gitian-building/debian_install_3_select_location.png differ diff --git a/doc/gitian-building/debian_install_4_configure_keyboard.png b/doc/gitian-building/debian_install_4_configure_keyboard.png new file mode 100644 index 0000000000..580c8af7c5 Binary files /dev/null and b/doc/gitian-building/debian_install_4_configure_keyboard.png differ diff --git a/doc/gitian-building/debian_install_5_configure_the_network.png b/doc/gitian-building/debian_install_5_configure_the_network.png new file mode 100644 index 0000000000..a7fdffc66b Binary files /dev/null and b/doc/gitian-building/debian_install_5_configure_the_network.png differ diff --git a/doc/gitian-building/debian_install_6_domain_name.png b/doc/gitian-building/debian_install_6_domain_name.png new file mode 100644 index 0000000000..7a986d92f4 Binary files /dev/null and b/doc/gitian-building/debian_install_6_domain_name.png differ diff --git a/doc/gitian-building/debian_install_6a_set_up_root_password.png b/doc/gitian-building/debian_install_6a_set_up_root_password.png new file mode 100644 index 0000000000..31bd210f38 Binary files /dev/null and b/doc/gitian-building/debian_install_6a_set_up_root_password.png differ diff --git a/doc/gitian-building/debian_install_7_set_up_user_fullname.png b/doc/gitian-building/debian_install_7_set_up_user_fullname.png new file mode 100644 index 0000000000..bffc6ccd7a Binary files /dev/null and b/doc/gitian-building/debian_install_7_set_up_user_fullname.png differ diff --git a/doc/gitian-building/debian_install_8_set_up_username.png b/doc/gitian-building/debian_install_8_set_up_username.png new file mode 100644 index 0000000000..9e2750ad4e Binary files /dev/null and b/doc/gitian-building/debian_install_8_set_up_username.png differ diff --git a/doc/gitian-building/debian_install_9_user_password.png b/doc/gitian-building/debian_install_9_user_password.png new file mode 100644 index 0000000000..a26d30cba5 Binary files /dev/null and b/doc/gitian-building/debian_install_9_user_password.png differ diff --git a/doc/gitian-building/network_settings.png b/doc/gitian-building/network_settings.png new file mode 100644 index 0000000000..1d9b6428a7 Binary files /dev/null and b/doc/gitian-building/network_settings.png differ diff --git a/doc/gitian-building/port_forwarding_rules.png b/doc/gitian-building/port_forwarding_rules.png new file mode 100644 index 0000000000..e45c9efffc Binary files /dev/null and b/doc/gitian-building/port_forwarding_rules.png differ diff --git a/doc/gitian-building/select_startup_disk.png b/doc/gitian-building/select_startup_disk.png new file mode 100644 index 0000000000..729b368fd1 Binary files /dev/null and b/doc/gitian-building/select_startup_disk.png differ diff --git a/doc/release-process.md b/doc/release-process.md index dabf7d2b1e..56b6de0208 100755 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -33,21 +33,26 @@ Release Process Fetch and build inputs: (first time, or when dependency versions change) mkdir -p inputs; cd inputs/ - wget 'http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.9.20140401.tar.gz' -O miniupnpc-1.9.20140401.tar.gz' - wget 'http://www.openssl.org/source/openssl-1.0.1g.tar.gz' + wget 'http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.9.20140401.tar.gz' -O miniupnpc-1.9.20140401.tar.gz + wget 'http://www.openssl.org/source/openssl-1.0.2g.tar.gz' wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz' - wget 'http://zlib.net/zlib-1.2.8.tar.gz' + wget 'https://www.zlib.net/fossils/zlib-1.2.8.tar.gz' wget 'ftp://ftp.simplesystems.org/pub/libpng/png/src/history/libpng16/libpng-1.6.8.tar.gz' wget 'http://fukuchi.org/works/qrencode/qrencode-3.4.3.tar.bz2' wget 'http://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2' - wget 'http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz' + wget -q 'https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch' -O boost-mingw-gas-cross-compile-2013-03-03.patch + wget 'http://download.qt.io/archive/qt/5.2/5.2.0/single/qt-everywhere-opensource-src-5.2.0.tar.gz' + wget 'ftp://ftp.fi.debian.org/gentoo/distfiles/protobuf-2.5.0.tar.bz2' cd .. - ./bin/gbuild ../zcoin/contrib/gitian-descriptors/boost-win32.yml - mv build/out/boost-win32-1.55.0-gitian2.zip inputs/ - ./bin/gbuild ../zcoin/contrib/gitian-descriptors/qt-win32.yml - mv build/out/qt-win32-4.8.5-gitian-r1.zip inputs/ - ./bin/gbuild ../zcoin/contrib/gitian-descriptors/deps-win32.yml - mv build/out/zcoin-deps-0.0.5.zip inputs/ + cd gitian-builder/ + ./bin/gbuild ../zcoin/contrib/gitian-descriptors/boost-win.yml + mv build/out/boost-*.zip inputs/ + ./bin/gbuild ../zcoin/contrib/gitian-descriptors/deps-win.yml + mv build/out/zcoin-*.zip inputs/ + ./bin/gbuild ../zcoin/contrib/gitian-descriptors/qt-win.yml + mv build/out/qt-*.zip inputs/ + ./bin/gbuild ../zcoin/contrib/gitian-descriptors/protobuf-win.yml + mv build/out/protobuf-*.zip inputs/ Build zcoind and zcoin-qt on Linux32, Linux64, and Win32: @@ -57,7 +62,7 @@ Release Process zip -r zcoin-${VERSION}-linux-gitian.zip * mv zcoin-${VERSION}-linux-gitian.zip ../../ popd - ./bin/gbuild --commit zcoin=v${VERSION} ../zcoin/contrib/gitian-descriptors/gitian-win32.yml + ./bin/gbuild --commit zcoin=v${VERSION} ../zcoin/contrib/gitian-descriptors/gitian-win.yml ./bin/gsign --signer $SIGNER --release ${VERSION}-win32 --destination ../gitian.sigs/ ../zcoin/contrib/gitian-descriptors/gitian-win32.yml pushd build/out zip -r zcoin-${VERSION}-win32-gitian.zip * @@ -82,7 +87,7 @@ repackage gitian builds for release as stand-alone zip/tar/installer exe unzip zcoin-${VERSION}-win32-gitian.zip -d zcoin-${VERSION}-win32 mv zcoin-${VERSION}-win32/zcoin-*-setup.exe . - zip -r zcoin-${VERSION}-win32.zip bitcoin-${VERSION}-win32 + zip -r zcoin-${VERSION}-win32.zip zcoin-${VERSION}-win32 rm -rf zcoin-${VERSION}-win32 **Perform Mac build:** @@ -102,7 +107,7 @@ repackage gitian builds for release as stand-alone zip/tar/installer exe ###Next steps: * Code-sign Windows -setup.exe (in a Windows virtual machine) and - OSX Bitcoin-Qt.app (Note: only Gavin has the code-signing keys currently) + OSX zcoin-qt.app (Note: only Gavin has the code-signing keys currently) * upload builds to SourceForge diff --git a/pkg.m4 b/pkg.m4 new file mode 100644 index 0000000000..c5b26b52e6 --- /dev/null +++ b/pkg.m4 @@ -0,0 +1,214 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR diff --git a/share/genbuild.sh b/share/genbuild.sh index d959877dc8..679566e596 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -1,5 +1,7 @@ #!/bin/sh - +if [ $# -gt 1 ]; then + cd "$2" +fi if [ $# -gt 0 ]; then FILE="$1" shift @@ -7,23 +9,35 @@ if [ $# -gt 0 ]; then INFO="$(head -n 1 "$FILE")" fi else - echo "Usage: $0 " + echo "Usage: $0 " exit 1 fi -if [ -e "$(which git)" ]; then +DESC="" +SUFFIX="" +LAST_COMMIT_DATE="" +if [ -e "$(which git 2>/dev/null)" -a $(git rev-parse --is-inside-work-tree 2>/dev/null) = "true" ]; then # clean 'dirty' status of touched files that haven't been modified git diff >/dev/null 2>/dev/null - # get a string like "v0.6.0-66-g59887e8-dirty" - DESC="$(git describe --dirty 2>/dev/null)" + # if latest commit is tagged and not dirty, then override using the tag name + RAWDESC=$(git describe --abbrev=0 2>/dev/null) + if [ "$(git rev-parse HEAD)" = "$(git rev-list -1 $RAWDESC)" ]; then + git diff-index --quiet HEAD -- && DESC=$RAWDESC + fi + + # otherwise generate suffix from git, i.e. string like "59887e8-dirty" + SUFFIX=$(git rev-parse --short HEAD) + git diff-index --quiet HEAD -- || SUFFIX="$SUFFIX-dirty" # get a string like "2012-04-10 16:27:19 +0200" - TIME="$(git log -n 1 --format="%ci")" + LAST_COMMIT_DATE="$(git log -n 1 --format="%ci")" fi if [ -n "$DESC" ]; then NEWINFO="#define BUILD_DESC \"$DESC\"" +elif [ -n "$SUFFIX" ]; then + NEWINFO="#define BUILD_SUFFIX $SUFFIX" else NEWINFO="// No build information available" fi @@ -31,5 +45,7 @@ fi # only update build.h if necessary if [ "$INFO" != "$NEWINFO" ]; then echo "$NEWINFO" >"$FILE" - echo "#define BUILD_DATE \"$TIME\"" >>"$FILE" + if [ -n "$LAST_COMMIT_DATE" ]; then + echo "#define BUILD_DATE \"$LAST_COMMIT_DATE\"" >> "$FILE" + fi fi diff --git a/share/pixmaps/zcoin.ico b/share/pixmaps/zcoin.ico new file mode 100644 index 0000000000..125f427cb3 Binary files /dev/null and b/share/pixmaps/zcoin.ico differ diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000000..215d0319f9 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,203 @@ +include Makefile.include + +AM_CPPFLAGS += -I$(builddir) + +noinst_LIBRARIES = \ + libbitcoin_server.a \ + libbitcoin_common.a \ + libbitcoin_cli.a +if ENABLE_WALLET +noinst_LIBRARIES += libbitcoin_wallet.a +endif + +bin_PROGRAMS = + +if BUILD_BITCOIND + bin_PROGRAMS += bitcoind +endif + +if BUILD_BITCOIN_CLI + bin_PROGRAMS += bitcoin-cli +endif + +SUBDIRS = . $(BUILD_QT) $(BUILD_TEST) +DIST_SUBDIRS = . qt test +.PHONY: FORCE +# bitcoin core # +BITCOIN_CORE_H = \ + addrman.h \ + alert.h \ + allocators.h \ + base58.h bignum.h \ + bloom.h \ + chainparams.h \ + checkpoints.h \ + checkqueue.h \ + clientversion.h \ + coincontrol.h \ + coins.h \ + compat.h \ + core.h \ + crypter.h \ + db.h \ + hash.h \ + init.h \ + key.h \ + keystore.h \ + leveldbwrapper.h \ + limitedmap.h \ + main.h \ + miner.h \ + mruset.h \ + netbase.h \ + net.h \ + noui.h \ + protocol.h \ + rpcclient.h \ + rpcprotocol.h \ + rpcserver.h \ + script.h \ + serialize.h \ + sync.h \ + threadsafety.h \ + tinyformat.h \ + txdb.h \ + txmempool.h \ + ui_interface.h \ + uint256.h \ + util.h \ + version.h \ + walletdb.h \ + wallet.h + +JSON_H = \ + json/json_spirit.h \ + json/json_spirit_error_position.h \ + json/json_spirit_reader.h \ + json/json_spirit_reader_template.h \ + json/json_spirit_stream_reader.h \ + json/json_spirit_utils.h \ + json/json_spirit_value.h \ + json/json_spirit_writer.h \ + json/json_spirit_writer_template.h + +obj/build.h: FORCE + @$(MKDIR_P) $(abs_top_builddir)/src/obj + @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \ + $(abs_top_srcdir) +version.o: obj/build.h + +libbitcoin_server_a_SOURCES = \ + addrman.cpp \ + alert.cpp \ + bloom.cpp \ + checkpoints.cpp \ + coins.cpp \ + init.cpp \ + keystore.cpp \ + leveldbwrapper.cpp \ + main.cpp \ + miner.cpp \ + net.cpp \ + noui.cpp \ + rpcblockchain.cpp \ + rpcmining.cpp \ + rpcmisc.cpp \ + rpcnet.cpp \ + rpcrawtransaction.cpp \ + rpcserver.cpp \ + txdb.cpp \ + txmempool.cpp \ + $(JSON_H) \ + $(BITCOIN_CORE_H) + +libbitcoin_wallet_a_SOURCES = \ + db.cpp \ + crypter.cpp \ + rpcdump.cpp \ + rpcwallet.cpp \ + wallet.cpp \ + walletdb.cpp \ + $(BITCOIN_CORE_H) + +libbitcoin_common_a_SOURCES = \ + base58.cpp \ + allocators.cpp \ + chainparams.cpp \ + core.cpp \ + hash.cpp \ + key.cpp \ + netbase.cpp \ + protocol.cpp \ + rpcprotocol.cpp \ + script.cpp \ + sync.cpp \ + util.cpp \ + version.cpp \ + $(BITCOIN_CORE_H) + +if GLIBC_BACK_COMPAT +libbitcoin_common_a_SOURCES += compat/glibc_compat.cpp +libbitcoin_common_a_SOURCES += compat/glibcxx_compat.cpp +endif + +libbitcoin_cli_a_SOURCES = \ + rpcclient.cpp \ + $(BITCOIN_CORE_H) + +nodist_libbitcoin_common_a_SOURCES = $(top_srcdir)/src/obj/build.h +# + +# bitcoind binary # +bitcoind_LDADD = \ + libbitcoin_server.a \ + libbitcoin_cli.a \ + libbitcoin_common.a \ + $(LIBLEVELDB) \ + $(LIBMEMENV) +if ENABLE_WALLET +bitcoind_LDADD += libbitcoin_wallet.a +endif +bitcoind_SOURCES = bitcoind.cpp +# + +if TARGET_WINDOWS +bitcoind_SOURCES += bitcoind-res.rc +endif + +AM_CPPFLAGS += $(BDB_CPPFLAGS) +bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) + +# bitcoin-cli binary # +bitcoin_cli_LDADD = \ + libbitcoin_cli.a \ + libbitcoin_common.a \ + $(BOOST_LIBS) +bitcoin_cli_SOURCES = bitcoin-cli.cpp +# + +if TARGET_WINDOWS +bitcoin_cli_SOURCES += bitcoin-cli-res.rc +endif + +# NOTE: This dependency is not strictly necessary, but without it make may try to build both in parallel, which breaks the LevelDB build system in a race +leveldb/libleveldb.a: leveldb/libmemenv.a + +leveldb/%.a: + @echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \ + CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \ + OPT="$(CXXFLAGS) $(CPPFLAGS)" + +qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_common_a_SOURCES) $(libbitcoin_cli_a_SOURCES) + @test -n $(XGETTEXT) || echo "xgettext is required for updating translations" + @cd $(top_srcdir); XGETTEXT=$(XGETTEXT) share/qt/extract_strings_qt.py + +CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno + +DISTCLEANFILES = obj/build.h + +EXTRA_DIST = leveldb Makefile.include + +clean-local: + -$(MAKE) -C leveldb clean + rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno diff --git a/src/Makefile.include b/src/Makefile.include new file mode 100644 index 0000000000..2fc6cd7775 --- /dev/null +++ b/src/Makefile.include @@ -0,0 +1,79 @@ +if EMBEDDED_LEVELDB +LEVELDB_CPPFLAGS += -I$(top_srcdir)/src/leveldb/include +LEVELDB_CPPFLAGS += -I$(top_srcdir)/src/leveldb/helpers/memenv +LIBLEVELDB += $(top_builddir)/src/leveldb/libleveldb.a +LIBMEMENV += $(top_builddir)/src/leveldb/libmemenv.a +endif + +AM_CPPFLAGS = $(INCLUDES) \ + -I$(top_builddir)/src/obj \ + $(BDB_CPPFLAGS) \ + $(BOOST_CPPFLAGS) $(BOOST_INCLUDES) +AM_CPPFLAGS += $(LEVELDB_CPPFLAGS) +AM_LDFLAGS = $(PTHREAD_CFLAGS) + +LIBBITCOIN_SERVER=$(top_builddir)/src/libbitcoin_server.a +LIBBITCOIN_WALLET=$(top_builddir)/src/libbitcoin_wallet.a +LIBBITCOIN_COMMON=$(top_builddir)/src/libbitcoin_common.a +LIBBITCOIN_CLI=$(top_builddir)/src/libbitcoin_cli.a +LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a + +$(LIBBITCOIN): + $(MAKE) -C $(top_builddir)/src $(@F) + +if EMBEDDED_LEVELDB +$(LIBLEVELDB) $(LIBMEMENV): + $(MAKE) -C $(top_builddir)/src leveldb/$(@F) +endif + +$(LIBBITCOINQT): + $(MAKE) -C $(top_builddir)/src/qt $(@F) + +.mm.o: + $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(CXXFLAGS) -c -o $@ $< + +.rc.o: + @test -f $(WINDRES) && $(WINDRES) -i $< -o $@ || \ + echo error: could not build $@ + +ui_%.h: %.ui + @test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D) + @test -f $(UIC) && QT_SELECT=$(QT_SELECT) $(UIC) -o $(abs_builddir)/$@ $(abs_srcdir)/$< || echo error: could not build $(abs_builddir)/$@ + $(SED) -e '/^\*\*.*Created:/d' $(abs_builddir)/$@ > $(abs_builddir)/$@.n && mv $(abs_builddir)/$@{.n,} + $(SED) -e '/^\*\*.*by:/d' $(abs_builddir)/$@ > $(abs_builddir)/$@.n && mv $(abs_builddir)/$@{.n,} + +%.moc: %.cpp + QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $< + $(SED) -e '/^\*\*.*Created:/d' $@ > $@.n && mv $@{.n,} + $(SED) -e '/^\*\*.*by:/d' $@ > $@.n && mv $@{.n,} + +moc_%.cpp: %.h + QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $< + $(SED) -e '/^\*\*.*Created:/d' $@ > $@.n && mv $@{.n,} + $(SED) -e '/^\*\*.*by:/d' $@ > $@.n && mv $@{.n,} + +%.qm: %.ts + @test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D) + @test -f $(LRELEASE) && QT_SELECT=$(QT_SELECT) $(LRELEASE) $(abs_srcdir)/$< -qm $(abs_builddir)/$@ || \ + echo error: could not build $(abs_builddir)/$@ + +%.pb.cc %.pb.h: %.proto + test -f $(PROTOC) && $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $( $@ + @echo "static unsigned const char $(*F)[] = {" >> $@ + @$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' >> $@ + @echo "};};" >> $@ + @echo "Generated $@" + +%.raw.h: %.raw + @$(MKDIR_P) $(@D) + @echo "namespace alert_tests{" > $@ + @echo "static unsigned const char $(*F)[] = {" >> $@ + @$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' >> $@ + @echo "};};" >> $@ + @echo "Generated $@" diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 34fdc7cc19..802ca84904 100755 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -122,7 +122,7 @@ namespace Checkpoints return checkpoints.rbegin()->first; } - CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex) + CBlockIndex* GetLastCheckpoint(BlockMap mapBlockIndex) { if (!GetBoolArg("-checkpoints", true)) return NULL; @@ -132,7 +132,7 @@ namespace Checkpoints BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints) { const uint256& hash = i.second; - std::map::const_iterator t = mapBlockIndex.find(hash); + BlockMap::const_iterator t = mapBlockIndex.find(hash); if (t != mapBlockIndex.end()) return t->second; } diff --git a/src/checkpoints.h b/src/checkpoints.h index 3d56885556..3d51d8caa5 100755 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -5,10 +5,18 @@ #define BITCOIN_CHECKPOINT_H #include +#include +#include "uint256.h" -class uint256; class CBlockIndex; +struct BlockHasher +{ + size_t operator()(const uint256& hash) const { return hash.GetLow64(); } +}; + +typedef boost::unordered_map BlockMap; + /** Block-chain checkpoints are compiled-in sanity checks. * They are updated every release or three. */ @@ -21,7 +29,7 @@ namespace Checkpoints int GetTotalBlocksEstimate(); // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint - CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex); + CBlockIndex* GetLastCheckpoint(BlockMap mapBlockIndex); double GuessVerificationProgress(CBlockIndex *pindex); } diff --git a/src/init.cpp b/src/init.cpp index a29316757c..d04913c9bc 100755 --- a/src/init.cpp +++ b/src/init.cpp @@ -1000,7 +1000,7 @@ bool AppInit2(boost::thread_group& threadGroup) { string strMatch = mapArgs["-printblock"]; int nFound = 0; - for (map::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi) + for (BlockMap::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi) { uint256 hash = (*mi).first; if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0) diff --git a/src/main.cpp b/src/main.cpp index 0c45a38948..d1059012f6 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,7 @@ CCriticalSection cs_main; CTxMemPool mempool; unsigned int nTransactionsUpdated = 0; -map mapBlockIndex; +BlockMap mapBlockIndex; uint256 hashGenesisBlock("0x4381deb85b1b2c9843c222944b616d997516dcbd6a964e1eaf0def0830695233"); static CBigNum bnProofOfWorkLimit(~uint256(0) >> 8); // zcoin: starting difficulty is 1 / 2^12 CBlockIndex* pindexGenesisBlock = NULL; @@ -443,7 +443,7 @@ bool AddOrphanTx(const CTransaction& tx, NodeId peer) //EXCLUSIVE_LOCKS_REQUIRED unsigned int sz = GetTransactionWeight(tx); if (sz >= MAX_STANDARD_TX_WEIGHT) { - LogPrint("mempool", "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString()); + //LogPrint("mempool", "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString()); return false; } @@ -740,7 +740,7 @@ int CMerkleTx::SetMerkleBranch(const CBlock* pblock) } // Is the tx in a block that's in the main chain - map::iterator mi = mapBlockIndex.find(hashBlock); + BlockMap::iterator mi = mapBlockIndex.find(hashBlock); if (mi == mapBlockIndex.end()) return 0; CBlockIndex* pindex = (*mi).second; @@ -2251,7 +2251,7 @@ int CMerkleTx::GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const return 0; // Find the block it claims to be in - map::iterator mi = mapBlockIndex.find(hashBlock); + BlockMap::iterator mi = mapBlockIndex.find(hashBlock); if (mi == mapBlockIndex.end()) return 0; CBlockIndex* pindex = (*mi).second; @@ -2705,10 +2705,10 @@ void Misbehaving(NodeId pnode, int howmuch) int banscore = GetArg("-banscore", DEFAULT_BANSCORE_THRESHOLD); if (state->nMisbehavior >= banscore && state->nMisbehavior - howmuch < banscore) { - LogPrintf("%s: %s (%d -> %d) BAN THRESHOLD EXCEEDED\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior); + //LogPrintf("%s: %s (%d -> %d) BAN THRESHOLD EXCEEDED\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior); state->fShouldBan = true; - } else - LogPrintf("%s: %s (%d -> %d)\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior); + } //else + //LogPrintf("%s: %s (%d -> %d)\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior); } void static InvalidChainFound(CBlockIndex* pindexNew) @@ -3707,9 +3707,9 @@ bool CBlock::AddToBlockIndex(CValidationState &state, const CDiskBlockPos &pos) // Construct new block index object CBlockIndex* pindexNew = new CBlockIndex(*this); assert(pindexNew); - map::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; + BlockMap::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; pindexNew->phashBlock = &((*mi).first); - map::iterator miPrev = mapBlockIndex.find(hashPrevBlock); + BlockMap::iterator miPrev = mapBlockIndex.find(hashPrevBlock); if (miPrev != mapBlockIndex.end()) { pindexNew->pprev = (*miPrev).second; @@ -3934,7 +3934,7 @@ bool CBlock::CheckBlock(CValidationState &state, int nHeight, bool fCheckPOW, bo if (GetHash() != hashGenesisBlock) { int nHeightCheckPoW = 0; - map::iterator mi = mapBlockIndex.find(hashPrevBlock); + BlockMap::iterator mi = mapBlockIndex.find(hashPrevBlock); pindexPrev = (*mi).second; if (mi != mapBlockIndex.end()) { @@ -4007,7 +4007,7 @@ bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp) CBlockIndex* pindexPrev = NULL; int nHeight = 0; if (hash != hashGenesisBlock) { - map::iterator mi = mapBlockIndex.find(hashPrevBlock); + BlockMap::iterator mi = mapBlockIndex.find(hashPrevBlock); if (mi == mapBlockIndex.end()) return state.DoS(10, error("AcceptBlock() : prev block not found")); pindexPrev = (*mi).second; @@ -4404,7 +4404,7 @@ CBlockIndex * InsertBlockIndex(uint256 hash) return NULL; // Return existing - map::iterator mi = mapBlockIndex.find(hash); + BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) return (*mi).second; @@ -4560,7 +4560,6 @@ bool VerifyDB(int nCheckLevel, int nCheckDepth) void UnloadBlockIndex() { - mapBlockIndex.clear(); setBlockIndexValid.clear(); pindexGenesisBlock = NULL; nBestHeight = 0; @@ -4572,6 +4571,10 @@ void UnloadBlockIndex() mapOrphanTransactions.clear(); mapOrphanTransactionsByPrev.clear(); mapNodeState.clear(); + BOOST_FOREACH(BlockMap::value_type& entry, mapBlockIndex) { + delete entry.second; + } + mapBlockIndex.clear(); } bool LoadBlockIndex() @@ -4597,13 +4600,13 @@ bool LoadBlockIndex() bool InitBlockIndex() { + // Initialize global variables that cannot be constructed at startup. + recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); + // Check whether we're already initialized if (pindexGenesisBlock != NULL) return true; - // Initialize global variables that cannot be constructed at startup. - recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); - // Use the provided setting for -txindex in the new database fTxIndex = GetBoolArg("-txindex", false); pblocktree->WriteFlag("txindex", fTxIndex); @@ -4697,7 +4700,7 @@ void PrintBlockTree() { // pre-compute tree structure map > mapNext; - for (map::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi) + for (BlockMap::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi) { CBlockIndex* pindex = (*mi).second; mapNext[pindex->pprev].push_back(pindex); @@ -4969,7 +4972,7 @@ void static ProcessGetData(CNode* pfrom) if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) { bool send = true; - map::iterator mi = mapBlockIndex.find(inv.hash); + BlockMap::iterator mi = mapBlockIndex.find(inv.hash); pfrom->nBlocksRequested++; if (mi != mapBlockIndex.end()) { @@ -5401,7 +5404,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (locator.IsNull()) { // If locator is null, return the hashStop block - map::iterator mi = mapBlockIndex.find(hashStop); + BlockMap::iterator mi = mapBlockIndex.find(hashStop); if (mi == mapBlockIndex.end()) return true; pindex = (*mi).second; @@ -5482,7 +5485,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (setMisbehaving.count(fromPeer)) continue; if (orphanTx.AcceptToMemoryPool(stateDummy, true, true, &fMissingInputs2)) { - LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString()); + //LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString()); RelayTransaction(orphanTx, orphanHash); for (unsigned int i = 0; i < orphanTx.vout.size(); i++) { vWorkQueue.emplace_back(orphanHash, i); @@ -5579,7 +5582,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (!fRejectedParents) { //uint32_t nFetchFlags = GetFetchFlags(pfrom, chainActive.Tip(), chainparams.GetConsensus()); BOOST_FOREACH(const CTxIn& txin, tx.vin) { - CInv _inv(MSG_TX, txin.prevout.hash); + CInv _inv(MSG_TX , txin.prevout.hash); pfrom->AddInventoryKnown(_inv); if (!AlreadyHave(_inv)) pfrom->AskFor(_inv); } @@ -5588,13 +5591,38 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) // DoS prevention: do not allow mapOrphanTransactions to grow unbounded unsigned int nMaxOrphanTx = (unsigned int)std::max((int64)0, GetArg("-maxorphantx", MAX_ORPHAN_TRANSACTIONS)); unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx); - if (nEvicted > 0) - printf("mapOrphan overflow, removed %u tx\n", nEvicted); - } - //else { - // LogPrint("mempool", "not keeping orphan with rejected parents %s\n",tx.GetHash().ToString()); + //if (nEvicted > 0) + // LogPrint("mempool", "mapOrphan overflow, removed %u tx\n", nEvicted); + } //else { + // LogPrint("mempool", "not keeping orphan with rejected parents %s\n",tx.GetHash().ToString()); + //} + } //else { + // if (tx.wit.IsNull() && !state.CorruptionPossible()) { + // // Do not use rejection cache for witness transactions or + // // witness-stripped transactions, as they can have been malleated. + // // See https://github.com/bitcoin/bitcoin/issues/8279 for details. + // assert(recentRejects); + // recentRejects->insert(tx.GetHash()); // } - } + + //if (pfrom->fWhitelisted && GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY)) { + // Always relay transactions received from whitelisted peers, even + // if they were already in the mempool or rejected from it due + // to policy, allowing the node to function as a gateway for + // nodes hidden behind it. + // + // Never relay transactions that we would assign a non-zero DoS + // score for, as we expect peers to do the same with us in that + // case. + //int nDoS = 0; + //if (!state.IsInvalid(nDoS) || nDoS == 0) { + //LogPrintf("Force relaying tx %s from whitelisted peer=%d\n", tx.GetHash().ToString(), pfrom->id); + // RelayTransaction(tx, tx.GetHash()); + // } //else { + //LogPrintf("Not relaying invalid transaction %s from whitelisted peer=%d (%s)\n", tx.GetHash().ToString(), pfrom->id, FormatStateMessage(state)); + //} + //} + //} int nDoS = 0; if (state.IsInvalid(nDoS)) { @@ -6586,7 +6614,7 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey) int nHeight = 0; if (pblock->GetHash() != hashGenesisBlock) { - map::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); + BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); pindexPrev = (*mi).second; nHeight = pindexPrev->nHeight+1; } @@ -6926,18 +6954,13 @@ class CMainCleanup CMainCleanup() {} ~CMainCleanup() { // block headers - std::map::iterator it1 = mapBlockIndex.begin(); + BlockMap::iterator it1 = mapBlockIndex.begin(); for (; it1 != mapBlockIndex.end(); it1++) delete (*it1).second; mapBlockIndex.clear(); - // orphan blocks - std::map::iterator it2 = mapOrphanBlocks.begin(); - for (; it2 != mapOrphanBlocks.end(); it2++) - delete (*it2).second; - mapOrphanBlocks.clear(); - // orphan transactions mapOrphanTransactions.clear(); + mapOrphanTransactionsByPrev.clear(); } } instance_of_cmaincleanup; diff --git a/src/main.h b/src/main.h index c668052593..d3941cb42a 100755 --- a/src/main.h +++ b/src/main.h @@ -10,11 +10,13 @@ #include "net.h" #include "script.h" #include "scrypt.h" +#include "checkpoints.h" #include "Lyra2Z/Lyra2Z.h" #include "Lyra2Z/Lyra2.h" #include "libzerocoin/Zerocoin.h" #include "db.h" +#include #include class CWallet; @@ -30,6 +32,8 @@ class CAuxPow; struct CBlockIndexWorkComparator; +/** Default for DEFAULT_WHITELISTFORCERELAY. */ +static const bool DEFAULT_WHITELISTFORCERELAY = true; /** The maximum allowed size for a serialized block, in bytes (network rule) */ static const unsigned int MAX_BLOCK_SIZE = 2000000; // 2000KB block hard limit /** Obsolete: maximum size for mined blocks */ @@ -88,9 +92,8 @@ static const unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 5 * 60; extern CScript COINBASE_FLAGS; - extern CCriticalSection cs_main; -extern std::map mapBlockIndex; +extern BlockMap mapBlockIndex; extern std::set setBlockIndexValid; extern uint256 hashGenesisBlock; extern CBlockIndex* pindexGenesisBlock; @@ -2076,7 +2079,7 @@ class CBlockLocator explicit CBlockLocator(uint256 hashBlock) { - std::map::iterator mi = mapBlockIndex.find(hashBlock); + BlockMap::iterator mi = mapBlockIndex.find(hashBlock); if (mi != mapBlockIndex.end()) Set((*mi).second); } @@ -2127,7 +2130,7 @@ class CBlockLocator int nStep = 1; BOOST_FOREACH(const uint256& hash, vHave) { - std::map::iterator mi = mapBlockIndex.find(hash); + BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) { CBlockIndex* pindex = (*mi).second; @@ -2146,7 +2149,7 @@ class CBlockLocator // Find the first block the caller has in the main chain BOOST_FOREACH(const uint256& hash, vHave) { - std::map::iterator mi = mapBlockIndex.find(hash); + BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) { CBlockIndex* pindex = (*mi).second; @@ -2162,7 +2165,7 @@ class CBlockLocator // Find the first block the caller has in the main chain BOOST_FOREACH(const uint256& hash, vHave) { - std::map::iterator mi = mapBlockIndex.find(hash); + BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) { CBlockIndex* pindex = (*mi).second; diff --git a/src/net.cpp b/src/net.cpp index 80c5bc57d6..686208a778 100755 --- a/src/net.cpp +++ b/src/net.cpp @@ -1114,7 +1114,7 @@ void ThreadMapPort() #elif defined UPNPDISCOVER_SUCCESS int error = 0; devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error); -#elif +#else devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0); #endif diff --git a/src/net.h b/src/net.h index 2cfa277fc0..51d18e83d3 100755 --- a/src/net.h +++ b/src/net.h @@ -230,7 +230,6 @@ class CNode std::set setKnown; // Block and TXN accept times - std::atomic nLastBlockTime; std::atomic nLastTXTime; // inventory based relay @@ -275,7 +274,7 @@ class CNode fRelayTxes = false; setInventoryKnown.max_size(SendBufferSize() / 1000); pfilter = new CBloomFilter(); - + nLastTXTime = 0; // Be shy and don't send version until we hear if (hSocket != INVALID_SOCKET && !fInbound) PushVersion(); diff --git a/src/obj/build.h b/src/obj/build.h index e6f708e0c8..3b84555f7c 100644 --- a/src/obj/build.h +++ b/src/obj/build.h @@ -1,2 +1,2 @@ // No build information available -#define BUILD_DATE "2017-05-28 16:50:50 -0300" +#define BUILD_DATE "2017-06-05 04:20:00 -0300" diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index c1f068f5a4..db6e406475 100755 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -609,7 +609,7 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks) } progressBarLabel->setVisible(true); - progressBar->setFormat(tr("%1 behind").arg(timeBehindText)); + //progressBar->setFormat(tr("%1 behind").arg(timeBehindText)); progressBar->setMaximum(1000000000); progressBar->setValue(clientModel->getVerificationProgress() * 1000000000.0 + 0.5); progressBar->setVisible(true); diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 79fd6099db..2426a33bf2 100755 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -152,7 +152,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) // Find the block the tx is in CBlockIndex* pindex = NULL; - std::map::iterator mi = mapBlockIndex.find(wtx.hashBlock); + BlockMap::iterator mi = mapBlockIndex.find(wtx.hashBlock); if (mi != mapBlockIndex.end()) pindex = (*mi).second; diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 6e5ce6263d..f4fb45889d 100755 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2010 Satoshi Nakamoto + // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -116,7 +116,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) if (hashBlock != 0) { entry.push_back(Pair("blockhash", hashBlock.GetHex())); - map::iterator mi = mapBlockIndex.find(hashBlock); + BlockMap::iterator mi = mapBlockIndex.find(hashBlock); if (mi != mapBlockIndex.end() && (*mi).second) { CBlockIndex* pindex = (*mi).second; diff --git a/src/txdb.cpp b/src/txdb.cpp index de5f3b57dc..d5846b3e1f 100755 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -42,7 +42,7 @@ CBlockIndex *CCoinsViewDB::GetBestBlock() { uint256 hashBestChain; if (!db.Read('B', hashBestChain)) return NULL; - std::map::iterator it = mapBlockIndex.find(hashBestChain); + BlockMap::iterator it = mapBlockIndex.find(hashBestChain); if (it == mapBlockIndex.end()) return NULL; return it->second; diff --git a/src/uint256.h b/src/uint256.h index 65dfd972bf..0faeef4204 100755 --- a/src/uint256.h +++ b/src/uint256.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_UINT256_H #define BITCOIN_UINT256_H +#include #include #include #include @@ -580,6 +581,12 @@ class uint256 : public base_uint256 return *this; } + uint64_t GetLow64() const + { + assert(WIDTH >= 2); + return pn[0] | (uint64_t)pn[1] << 32; + } + explicit uint256(const std::string& str) { SetHex(str); diff --git a/zcoin.pro b/zcoin.pro index df496b4a0a..6e3cb854b3 100755 --- a/zcoin.pro +++ b/zcoin.pro @@ -8,6 +8,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE CONFIG += no_include_pwd CONFIG += thread +CONFIG += debug_and_release # for boost 1.37, add -mt to the boost libraries # use: qmake BOOST_LIB_SUFFIX=-mt @@ -34,6 +35,7 @@ contains(RELEASE, 1) { # Linux: static link and extra security (see: https://wiki.debian.org/Hardening) LIBS += -Wl,-Bstatic -Wl,-z,relro -Wl,-z,now } + } !win32 { @@ -44,11 +46,11 @@ contains(RELEASE, 1) { # This can be enabled for Windows, when we switch to MinGW >= 4.4.x. } # for extra security (see: https://wiki.debian.org/Hardening): this flag is GCC compiler-specific -QMAKE_CXXFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=c++11 +QMAKE_CXXFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=c++11 -DBOOST_NO_CXX11_SCOPED_ENUMS # for extra security on Windows: enable ASLR and DEP via GCC linker flags -win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat +win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat -static # on Windows: enable GCC large address aware linker flag -win32:QMAKE_LFLAGS *= -Wl,--large-address-aware +win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static # i686-w64-mingw32 win32:QMAKE_LFLAGS *= -static-libgcc -static-libstdc++