From 49c82c9dd0467361ba3b3d5f1ef508f3d4910415 Mon Sep 17 00:00:00 2001 From: lbrynaut Date: Tue, 12 Feb 2019 14:16:44 -0600 Subject: [PATCH] Continue rebasing LBRY on to bitcoin upstream. Upgrade Windows build to 64 bit for proper C++11 support. Set required mingw profile in Windows build env. Remove dead OpenSSL usage. Update reproducible build. Rename lbrycrd binaries. Add man pages. Update all build dependencies in reproducible_build and eliminate usage of lbrycrd_dependencies repo. Update ICU dependency version in Windows build. Additional branding/renaming updates. Temporarily remove code formatting, since it can't work sanely for this kind of merge. Temporarily add clean for linux/osx. --- .gitignore | 18 +- .travis.yml | 222 +-- LICENSE | 15 + Makefile.am | 2 +- README.md | 122 +- build-aux/m4/ax_boost_locale.m4 | 120 ++ configure.ac | 60 +- contrib/patches/atomic.patch | 20 + depends/.gitignore | 3 - depends/Makefile | 37 +- depends/README.md | 33 +- depends/builders/darwin.mk | 20 +- depends/config.guess | 611 +++--- depends/config.site.in | 44 +- depends/config.sub | 1669 +++++++++-------- depends/description.md | 2 +- depends/hosts/darwin.mk | 8 +- depends/hosts/default.mk | 4 - depends/packages/bdb.mk | 4 +- depends/packages/boost.mk | 29 +- depends/packages/dbus.mk | 6 +- depends/packages/expat.mk | 8 +- depends/packages/fontconfig.mk | 10 +- depends/packages/freetype.mk | 6 +- depends/packages/icu.mk | 25 + depends/packages/libevent.mk | 13 +- depends/packages/miniupnpc.mk | 6 +- depends/packages/native_biplist.mk | 6 +- depends/packages/native_ccache.mk | 25 + depends/packages/native_cctools.mk | 23 +- depends/packages/native_comparisontool.mk | 21 + depends/packages/native_ds_store.mk | 9 +- depends/packages/native_mac_alias.mk | 9 +- depends/packages/openssl.mk | 42 +- depends/packages/packages.icu.mk | 1 + depends/packages/packages.mk | 10 +- depends/packages/protobuf.mk | 1 - depends/packages/qrencode.mk | 2 +- depends/packages/qt.mk | 141 +- depends/packages/qt46.mk | 66 + depends/packages/xextproto.mk | 4 - depends/packages/zeromq.mk | 21 +- depends/packages/zlib.mk | 27 - depends/patches/libevent/reuseaddr.patch | 21 + .../patches/qt/fix-xcb-include-order.patch | 45 + depends/patches/qt/fix_configure_mac.patch | 50 - depends/patches/qt/fix_no_printer.patch | 19 - depends/patches/qt/fix_qt_pkgconfig.patch | 11 - depends/patches/qt/fix_rcc_determinism.patch | 15 - depends/patches/qt/mac-qmake.conf | 16 +- depends/patches/qt/mingw-uuidof.patch | 44 + depends/patches/qt/pidlist_absolute.patch | 37 + depends/patches/qt/xkb-default.patch | 26 - depends/patches/qt46/stlfix.patch | 10 + .../0001-fix-build-with-older-mingw64.patch | 30 - .../0002-disable-pthread_set_name_np.patch | 35 - doc/man/Makefile.am | 6 +- doc/man/{bitcoin-cli.1 => lbrycrd-cli.1} | 30 +- doc/man/{bitcoin-qt.1 => lbrycrd-qt.1} | 20 +- doc/man/{bitcoin-tx.1 => lbrycrd-tx.1} | 22 +- doc/man/{bitcoind.1 => lbrycrdd.1} | 22 +- packaging/build_windows.sh | 64 + packaging/remove_consensus.patch | 23 + reproducible_build.sh | 213 ++- src/Makefile.am | 55 +- src/Makefile.bench.include | 2 +- src/Makefile.qt.include | 36 +- src/Makefile.qttest.include | 34 +- src/Makefile.test.include | 6 +- src/bitcoin-cli.cpp | 10 +- src/bitcoin-tx.cpp | 6 +- src/bitcoind.cpp | 6 +- src/chainparams.cpp | 27 +- src/chainparamsbase.cpp | 4 +- src/claimtrie.cpp | 778 +++----- src/claimtrie.h | 280 ++- src/claimtrieforks.cpp | 300 +++ src/clientversion.cpp | 2 +- src/consensus/params.h | 2 + src/consensus/validation.h | 2 +- src/dbwrapper.h | 2 +- src/init.cpp | 12 +- src/miner.cpp | 5 +- src/net_processing.cpp | 15 +- src/policy/feerate.cpp | 2 +- src/pow.cpp | 30 - src/qt/bitcoinamountfield.cpp | 4 +- src/qt/bitcoinunits.cpp | 38 +- src/qt/bitcoinunits.h | 6 +- src/qt/coincontroldialog.cpp | 2 +- src/qt/guiutil.cpp | 8 +- src/qt/networkstyle.cpp | 4 +- src/qt/openuridialog.cpp | 4 +- src/qt/optionsmodel.cpp | 2 +- src/qt/overviewpage.cpp | 4 +- src/qt/paymentrequest.proto | 2 +- src/qt/paymentserver.cpp | 12 +- src/qt/sendcoinsentry.cpp | 2 +- src/qt/test/paymentservertests.cpp | 4 +- src/qt/test/rpcnestedtests.cpp | 4 +- src/qt/test/wallettests.cpp | 4 +- src/rpc/blockchain.cpp | 4 +- src/rpc/claimtrie.cpp | 3 +- src/rpc/mining.cpp | 6 +- src/rpc/misc.cpp | 12 +- src/rpc/net.cpp | 2 +- src/rpc/rawtransaction.cpp | 20 +- src/rpc/server.cpp | 6 +- src/test/amount_tests.cpp | 2 +- src/test/claimtriebranching_tests.cpp | 94 +- src/test/claimtriecache_tests.cpp | 81 +- src/test/data/key_io_valid.json | 112 +- src/test/denialofservice_tests.cpp | 2 +- src/test/miner_tests.cpp | 135 +- src/test/util_tests.cpp | 18 +- src/util.cpp | 54 +- src/validation.cpp | 44 +- test/util/data/bitcoin-util-test.json | 140 +- 118 files changed, 3537 insertions(+), 3198 deletions(-) create mode 100644 LICENSE create mode 100644 build-aux/m4/ax_boost_locale.m4 create mode 100644 contrib/patches/atomic.patch create mode 100644 depends/packages/icu.mk create mode 100644 depends/packages/native_ccache.mk create mode 100644 depends/packages/native_comparisontool.mk create mode 100644 depends/packages/packages.icu.mk create mode 100644 depends/packages/qt46.mk delete mode 100644 depends/packages/zlib.mk create mode 100644 depends/patches/libevent/reuseaddr.patch create mode 100644 depends/patches/qt/fix-xcb-include-order.patch delete mode 100644 depends/patches/qt/fix_configure_mac.patch delete mode 100644 depends/patches/qt/fix_no_printer.patch delete mode 100644 depends/patches/qt/fix_qt_pkgconfig.patch delete mode 100644 depends/patches/qt/fix_rcc_determinism.patch create mode 100644 depends/patches/qt/mingw-uuidof.patch create mode 100644 depends/patches/qt/pidlist_absolute.patch delete mode 100644 depends/patches/qt/xkb-default.patch create mode 100644 depends/patches/qt46/stlfix.patch delete mode 100644 depends/patches/zeromq/0001-fix-build-with-older-mingw64.patch delete mode 100644 depends/patches/zeromq/0002-disable-pthread_set_name_np.patch rename doc/man/{bitcoin-cli.1 => lbrycrd-cli.1} (80%) rename doc/man/{bitcoin-qt.1 => lbrycrd-qt.1} (97%) rename doc/man/{bitcoin-tx.1 => lbrycrd-tx.1} (82%) rename doc/man/{bitcoind.1 => lbrycrdd.1} (96%) create mode 100755 packaging/build_windows.sh create mode 100644 packaging/remove_consensus.patch create mode 100644 src/claimtrieforks.cpp diff --git a/.gitignore b/.gitignore index b0e08868b..3aac53fa3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,14 @@ *.tar.gz *.exe -src/bitcoin -src/bitcoind -src/bitcoin-cli -src/bitcoin-tx -src/test/test_bitcoin -src/test/test_bitcoin_fuzzy -src/qt/test/test_bitcoin-qt +src/lbrycrd +src/lbrycrdd +src/lbrycrd-cli +src/lbrycrd-tx +src/test/test_lbrycrd +src/test/test_lbrycrd_fuzzy +src/qt/lbrycrd-qt +src/qt/test/test_lbrycrd-qt # autoreconf Makefile.in @@ -61,7 +62,6 @@ src/qt/bitcoin-qt.includes *.pyc *.o *.o-* -*.patch *.a *.pb.cc *.pb.h @@ -118,4 +118,4 @@ libbitcoinconsensus.pc contrib/devtools/split-debug.sh .idea -cmake-build-*/ \ No newline at end of file +cmake-build-*/ diff --git a/.travis.yml b/.travis.yml index 91b5af0f3..cb85f094d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,164 +1,70 @@ -dist: trusty -os: linux -language: minimal +matrix: + include: + - os: linux + sudo: required + dist: xenial + language: c + env: TARGET=linux + - os: linux + sudo: required + dist: xenial + language: c + env: TARGET=windows + - os: osx + language: c + osx_image: xcode8.3 + env: TARGET=osx cache: + apt: true ccache: true directories: + - build - depends/built - - depends/sdk-sources - - $HOME/.ccache -stages: - - lint - - test -env: - global: - - MAKEJOBS=-j3 - - RUN_TESTS=false - - RUN_BENCH=false # Set to true for any one job that has debug enabled, to quickly check bench is not crashing or hitting assertions - - DOCKER_NAME_TAG=ubuntu:18.04 - - LC_ALL=C.UTF-8 - - BOOST_TEST_RANDOM=1$TRAVIS_BUILD_ID - - CCACHE_SIZE=100M - - CCACHE_TEMPDIR=/tmp/.ccache-temp - - CCACHE_COMPRESS=1 - - CCACHE_DIR=$HOME/.ccache - - BASE_OUTDIR=$TRAVIS_BUILD_DIR/out - - SDK_URL=https://bitcoincore.org/depends-sources/sdks - - WINEDEBUG=fixme-all - - DOCKER_PACKAGES="build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git ca-certificates ccache" +git: + depth: false before_install: - - export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g") - - BEGIN_FOLD () { echo ""; CURRENT_FOLD_NAME=$1; echo "travis_fold:start:${CURRENT_FOLD_NAME}"; } - - END_FOLD () { RET=$?; echo "travis_fold:end:${CURRENT_FOLD_NAME}"; return $RET; } -install: - - travis_retry docker pull $DOCKER_NAME_TAG - - env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL)' | tee /tmp/env - - if [[ $HOST = *-mingw32 ]]; then DOCKER_ADMIN="--cap-add SYS_ADMIN"; fi - - DOCKER_ID=$(docker run $DOCKER_ADMIN -idt --mount type=bind,src=$TRAVIS_BUILD_DIR,dst=$TRAVIS_BUILD_DIR --mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR -w $TRAVIS_BUILD_DIR --env-file /tmp/env $DOCKER_NAME_TAG) - - DOCKER_EXEC () { docker exec $DOCKER_ID bash -c "cd $PWD && $*"; } - - if [ -n "$DPKG_ADD_ARCH" ]; then DOCKER_EXEC dpkg --add-architecture "$DPKG_ADD_ARCH" ; fi - - travis_retry DOCKER_EXEC apt-get update - - travis_retry DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES $DOCKER_PACKAGES -before_script: - - DOCKER_EXEC echo \> \$HOME/.bitcoin # Make sure default datadir does not exist and is never read by creating a dummy file - - mkdir -p depends/SDKs depends/sdk-sources - - if [ -n "$OSX_SDK" -a ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi - - if [ -n "$OSX_SDK" -a -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi - - if [[ $HOST = *-mingw32 ]]; then DOCKER_EXEC update-alternatives --set $HOST-g++ \$\(which $HOST-g++-posix\); fi - - if [ -z "$NO_DEPENDS" ]; then DOCKER_EXEC CONFIG_SHELL= make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS; fi +- date +%s > "${TRAVIS_BUILD_DIR}/start_time" +- ls -lh build +- du -h -d 2 build +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install ccache; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi +install: true script: - - export TRAVIS_COMMIT_LOG=`git log --format=fuller -1` - - OUTDIR=$BASE_OUTDIR/$TRAVIS_PULL_REQUEST/$TRAVIS_JOB_NUMBER-$HOST - - BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$TRAVIS_BUILD_DIR/depends/$HOST --bindir=$OUTDIR/bin --libdir=$OUTDIR/lib" - - if [ -z "$NO_DEPENDS" ]; then DOCKER_EXEC ccache --max-size=$CCACHE_SIZE; fi - - BEGIN_FOLD autogen; test -n "$CONFIG_SHELL" && DOCKER_EXEC "$CONFIG_SHELL" -c "./autogen.sh" || DOCKER_EXEC ./autogen.sh; END_FOLD - - mkdir build && cd build - - BEGIN_FOLD configure; DOCKER_EXEC ../configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false); END_FOLD - - BEGIN_FOLD distdir; DOCKER_EXEC make distdir VERSION=$HOST; END_FOLD - - cd bitcoin-$HOST - - BEGIN_FOLD configure; DOCKER_EXEC ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false); END_FOLD - - BEGIN_FOLD build; DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false ); END_FOLD - - if [ "$RUN_TESTS" = "true" ]; then BEGIN_FOLD unit-tests; DOCKER_EXEC LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib make $MAKEJOBS check VERBOSE=1; END_FOLD; fi - - if [ "$RUN_BENCH" = "true" ]; then BEGIN_FOLD bench; DOCKER_EXEC LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib $OUTDIR/bin/bench_bitcoin -scaling=0.001 ; END_FOLD; fi - - if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then extended="--extended --exclude feature_pruning,feature_dbcrash"; fi - - if [ "$RUN_TESTS" = "true" ]; then BEGIN_FOLD functional-tests; DOCKER_EXEC test/functional/test_runner.py --combinedlogslen=4000 --coverage --quiet --failfast ${extended}; END_FOLD; fi -after_script: - - echo $TRAVIS_COMMIT_RANGE - - echo $TRAVIS_COMMIT_LOG -jobs: - include: -# ARM - - stage: test - env: >- - HOST=arm-linux-gnueabihf - PACKAGES="g++-arm-linux-gnueabihf" - DEP_OPTS="NO_QT=1" - GOAL="install" - BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports" -# Win32 - - stage: test - env: >- - HOST=i686-w64-mingw32 - DPKG_ADD_ARCH="i386" - DEP_OPTS="NO_QT=1" - PACKAGES="python3 nsis g++-mingw-w64-i686 wine-binfmt wine32" - RUN_TESTS=true - GOAL="install" - BITCOIN_CONFIG="--enable-reduce-exports" -# Win64 - - stage: test - env: >- - HOST=x86_64-w64-mingw32 - DEP_OPTS="NO_QT=1" - PACKAGES="python3 nsis g++-mingw-w64-x86-64 wine-binfmt wine64" - RUN_TESTS=true - GOAL="install" - BITCOIN_CONFIG="--enable-reduce-exports" -# 32-bit + dash - - stage: test - env: >- - HOST=i686-pc-linux-gnu - PACKAGES="g++-multilib python3-zmq" - DEP_OPTS="NO_QT=1" - RUN_TESTS=true - GOAL="install" - BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++" - CONFIG_SHELL="/bin/dash" -# x86_64 Linux (uses qt5 dev package instead of depends Qt to speed up build and avoid timeout) - - stage: test - env: >- - HOST=x86_64-unknown-linux-gnu - PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools protobuf-compiler libdbus-1-dev libharfbuzz-dev libprotobuf-dev" - DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1" - RUN_TESTS=true - RUN_BENCH=true - GOAL="install" - BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CXXFLAGS=\"-g0 -O2\"" -# x86_64 Linux (Qt5 & system libs) - - stage: test - env: >- - HOST=x86_64-unknown-linux-gnu - PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev" - NO_DEPENDS=1 - RUN_TESTS=true - GOAL="install" - BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER" -# x86_64 Linux, No wallet - - stage: test - env: >- - HOST=x86_64-unknown-linux-gnu - PACKAGES="python3" - DEP_OPTS="NO_WALLET=1" - RUN_TESTS=true - GOAL="install" - BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports" -# Cross-Mac - - stage: test - env: >- - HOST=x86_64-apple-darwin14 - PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev python3-setuptools-git" - OSX_SDK=10.11 - GOAL="all deploy" - BITCOIN_CONFIG="--enable-gui --enable-reduce-exports --enable-werror" - - stage: lint - env: - cache: false - language: python - python: '3.6' - install: - - travis_retry pip install flake8==3.5.0 - before_script: - - git fetch --unshallow - script: - - if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then test/lint/commit-script-check.sh $TRAVIS_COMMIT_RANGE; fi - - test/lint/git-subtree-check.sh src/crypto/ctaes - - test/lint/git-subtree-check.sh src/secp256k1 - - test/lint/git-subtree-check.sh src/univalue - - test/lint/git-subtree-check.sh src/leveldb - - test/lint/check-doc.py - - test/lint/check-rpc-mappings.py . - - test/lint/lint-all.sh - - if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" -a "$TRAVIS_EVENT_TYPE" = "cron" ]; then - while read LINE; do travis_retry gpg --keyserver hkp://subset.pool.sks-keyservers.net --recv-keys $LINE; done < contrib/verify-commits/trusted-keys && - travis_wait 50 contrib/verify-commits/verify-commits.py; - fi +- mkdir -p "dist/${TRAVIS_BRANCH}" +- if [[ "${TARGET}" == "osx" ]]; then ./reproducible_build.sh -t -o -c -r; fi +- if [[ "${TARGET}" == "linux" ]]; then ./reproducible_build.sh -t -o -c -r; fi +- if [[ "${TARGET}" == "windows" ]]; then ./packaging/build_windows.sh; fi +- if [[ "${TARGET}" == "osx" ]]; then zip -j "dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi +- if [[ "${TARGET}" == "linux" ]]; then zip -j "dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi +- if [[ "${TARGET}" == "windows" ]]; then zip -j "dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip" src/lbrycrdd.exe src/lbrycrd-cli.exe src/lbrycrd-tx.exe; fi +- if [[ "${TARGET}" == "osx" ]]; then shasum -a 256 dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip > dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}-sha256.txt; fi +- if [[ "${TARGET}" == "linux" ]]; then sha256sum -b dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip > dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}-sha256.txt; fi +- if [[ "${TARGET}" == "windows" ]]; then sha256sum -b dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip > dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}-sha256.txt; fi +- cat dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}-sha256.txt +before_cache: +- ls -lh build +- du -h -d 2 build +deploy: +- provider: releases + draft: true + file: "dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip" + name: "${TRAVIS_BRANCH}" + skip_cleanup: true + target_commitish: $TRAVIS_COMMIT + tag_name: $TRAVIS_TAG + on: + tags: true + api_key: + secure: "Ni5WZNR5CefWXpyDUQLMQbQ2LH4Iot+0SqIoM9c4maW06al1M8vu57vWuj2cESsW7JsaBehCE45Cwmo5kWyEjAiZY8sIMmvixkMP/8uPWuLgNmnIbm7U+d0j652DmZshDYtt8EomqV2RhAx/rmBnzGkruLOw9WTp9ZdBN3WbTt/IpZ2gMgVbGWYGOx+uRw7/yGw8m4gShQheto/dycbyyR3XV2WP9wuLmNYkcQ6JumSoQdDWXcvVfbCwylGq2sLDKwhvfTr4iwYyYsWdmhfdEQl0WcIv5C8xgdiY2vzhi2LmLqFbS/fvKNC26Tfo4bOHFG/eOnvqc+yyEB8B/xqW9Gs+A0TUh/3N30vHYZGcpiDU35DwAN5bZ1+s+mr/ZrNzBJ5BgT8io3g0Ko8gykbDvFQVpg7kxFsqA1YCikEpG86lVGk6clTa5guJvAHse+DfnbWO1nfDxYQXW0md861m0txk8RpTC/TVNyH/lL/vsS7LB67EHhRdZY+O1+5sUGMdtvvhMoxJYCwQGpLkh43KRsKynkMUR94w2O9hc8cknXdV3wrndVz00XNdcur6y4D7HTll1tBrF68CA2yKUSY5hsjtPmdlN+DW8ou/rJiKOpQZ/Xzp69AQEheOFfDPItxQRYxWj0dMOk8eszf0wFvi1N7J/hT/IHnuX5ITfa/T4NE=" +- provider: s3 + access_key_id: AKIAICKFHNTR5RITASAQ + secret_access_key: + secure: Qfgs8vGnEUvgiZNP2S9zY8qHEzaDOceF/XTv32jRBOISWfTqOTE56DZbOp8WKHPAqn0dx04jKA1NfV9f06sXU1NVbiJ2VYISo6XAk0n3RBJL3/mhNxvut/zM2DHkFPljWTkWEColS0ZyA3m4eUyJvAw/i+mOBT/zDD/oIlS5Uo5l/x3LmF9fYBuei0ucwSQeNOr2wCMIl+pXrIU7B3lEzXh1asayW6A9y7DOqMLnrSQ7TLlSssbnhuhDVpFx0xxX/U2NPraotbGKdo3wwMbms/lluBe60I/LsDNp9/SZXMDXh2YLGUImr97octwpdzIMjF+kU7QAZJzM7grz8PU9+MQh2V5sn6Xsww2x4PdkmHGz/2FMzhrCrlPf5JCaPBH49G+w4/29HYmMrlimOOVx4qXCpQ/XtWWne/d6MF0qqT6JhdPuD9ohmTpxcHRkCe2fxUw6Yn3dj+/+YoCywAcwcBm5jLpAotmWoCmmcnm9rvB7bIuPPZAjJUZViCnyvwY4Tj3Fb+sOuK4b/O5D2+cuS+WgQRkN/RspYlXrXTIh8Efv/yhW5L9WdzG1OExJDw2hX5VTccRRgIKZxZp80U2eYqn2M07+1nU+ShX4kgiSon46k5cfacLgzLKWEyCxWSSTbsYcwRxvDEjtYy4wxAYx8+J3dgQPs/opDXoQTJMjud0= + bucket: build.lbry.io + upload-dir: lbrycrd + acl: public_read + local_dir: dist + skip_cleanup: true + on: + repo: lbryio/lbrycrd + all_branches: true diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..dc60f89cd --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +The MIT License (MIT) + +Copyright (c) 2015-2019 LBRY Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile.am b/Makefile.am index 8972c47f4..23bac4daa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,7 +25,7 @@ BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EX empty := space := $(empty) $(empty) -OSX_APP=Bitcoin-Qt.app +OSX_APP=LBRYcrd-Qt.app OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME)) OSX_DMG = $(OSX_VOLNAME).dmg OSX_BACKGROUND_SVG=background.svg diff --git a/README.md b/README.md index 55b85da97..1a38dbf17 100644 --- a/README.md +++ b/README.md @@ -1,76 +1,94 @@ -Bitcoin Core integration/staging tree -===================================== +# LBRYcrd - The LBRY blockchain -[![Build Status](https://travis-ci.org/bitcoin/bitcoin.svg?branch=master)](https://travis-ci.org/bitcoin/bitcoin) +![alt text](lbrycrdd_daemon_screenshot.png "lbrycrdd daemon screenshot") -https://bitcoincore.org +LBRYcrd uses a blockchain similar to bitcoin's to implement an index and payment system for content on the LBRY network. It is a fork of bitcoin core. -What is Bitcoin? ----------------- +## Installation -Bitcoin is an experimental digital currency that enables instant payments to -anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate -with no central authority: managing transactions and issuing money are carried -out collectively by the network. Bitcoin Core is the name of open source -software which enables the use of this currency. +Latest binaries are available from https://github.com/lbryio/lbrycrd/releases. There is no installation procedure, the binaries will be run as-is. -For more information, as well as an immediately useable, binary version of -the Bitcoin Core software, see https://bitcoincore.org/en/download/, or read the -[original whitepaper](https://bitcoincore.org/bitcoin.pdf). +## Usage -License -------- +The `lbrycrdd` executable will start a LBRYcrd node and connect you to the LBRYcrd network. Use the `lbrycrd-cli` executable +to interact with lbrycrdd through the command line. Help pages for both executable are available through +the "--help" flag (e.g. `lbrycrd-cli --help`). -Bitcoin Core is released under the terms of the MIT license. See [COPYING](COPYING) for more -information or see https://opensource.org/licenses/MIT. +### Example Usage -Development Process -------------------- +Run `./lbrycrdd -server -daemon` to start lbrycrdd in the background. + +Run `./lbrycrd-cli getinfo` to check for some basic information about your LBRYcrd node. + +Run `./lbrycrd-cli help` to get a list of all commands that you can run. To get help on specific commands run `./lbrycrd-cli [command_name] help` + +### Data directory + +Lbrycrdd will use the below default data directories: + +Windows < Vista: C:\Documents and Settings\Username\Application Data\lbrycrd + +Windows >= Vista: C:\Users\Username\AppData\Roaming\lbrycrd + +Mac: ~/Library/Application Support/lbrycrd + +Unix: ~/.lbrycrd + +The data directory contains various things such as your default wallet (wallet.dat), debug logs (debug.log), and blockchain data. You can optionally create a configuration file lbrycrd.conf in the default data directory which will be used by default when running lbrycrdd. + +For a list of configuration parameters, run `./lbrycrdd --help`. Below is a sample lbrycrd.conf to enable JSON RPC server on lbrycrdd. + +``` +rpcuser=lbry +rpcpassword=xyz123456790 +daemon=1 +server=1 +txindex=1 +``` + +## Running from Source + +Run `./reproducible_build.sh -c -t`. This will build the binaries and put them into the `./src` directory. + +If you encounter any errors, please check `doc/build-*.md` for further instructions. If you're still stuck, [create an issue](https://github.com/lbryio/lbrycrd/issues/new) with the output of that command, your system info, and any other information you think might be helpful. + +## Contributing + +Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.io/faq/contributing](https://lbry.io/faq/contributing) + +The codebase is in C++03. C++11 is currently not supported but we will be migrating to it in the near future. Recommended GCC version is 4.8 or greater. +We follow the same coding guidelines as documented by Bitcoin Core, see [here](/doc/developer-notes.md). To run an automated code formatting check, try: +`git diff -U0 master -- '*.h' '*.cpp' | ./contrib/devtools/clang-format-diff.py -p1`. This will check any commits not on master for proper code formatting. +We try to avoid altering parts of the code that is inherited from Bitcoin Core unless absolutely necessary. This will make it easier to merge changes from Bitcoin Core. If commits are expected not to be merged upstream (i.e. we broke up a commit from Bitcoin Core in order to use a single feature in it), the commit message must contain the string "NOT FOR UPSTREAM MERGE". The `master` branch is regularly built and tested, but is not guaranteed to be -completely stable. [Tags](https://github.com/bitcoin/bitcoin/tags) are created -regularly to indicate new official, stable release versions of Bitcoin Core. - -The contribution workflow is described in [CONTRIBUTING.md](CONTRIBUTING.md). - -Testing -------- +completely stable. [Releases](https://github.com/lbryio/lbrycrd/releases) are created +regularly to indicate new official, stable release versions. Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people -lots of money. - -### Automated Testing - -Developers are strongly encouraged to write [unit tests](src/test/README.md) for new code, and to +lots of money. Developers are strongly encouraged to write [unit tests](/doc/unit-tests.md) for new code, and to submit new unit tests for old code. Unit tests can be compiled and run -(assuming they weren't disabled in configure) with: `make check`. Further details on running -and extending unit tests can be found in [/src/test/README.md](/src/test/README.md). +(assuming they weren't disabled in configure) with: `make check` -There are also [regression and integration tests](/test), written -in Python, that are run automatically on the build server. -These tests can be run (if the [test dependencies](/test) are installed) with: `test/functional/test_runner.py` +The Travis CI system makes sure that every pull request is built, and that unit and sanity tests are automatically run. -The Travis CI system makes sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically. +### Testnet -### Manual Quality Assurance (QA) Testing +Testnet is maintained for testing purposes and can be accessed using the command `./lbrycrdd -testnet`. If you would like to obtain testnet credits, please contact brannon@lbry.io or grin@lbry.io. -Changes should be tested by somebody other than the developer who wrote the -code. This is especially important for large or high-risk changes. It is useful -to add a test plan to the pull request description if testing the changes is -not straightforward. +## License -Translations ------------- +This project is MIT licensed. For the full license, see [LICENSE](LICENSE). -Changes to translations as well as new translations can be submitted to -[Bitcoin Core's Transifex page](https://www.transifex.com/projects/p/bitcoin/). +## Security -Translations are periodically pulled from Transifex and merged into the git repository. See the -[translation process](doc/translation_process.md) for details on how this works. +We take security seriously. Please contact security@lbry.io regarding any security issues. +Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it. + +## Contact + +The primary contact for this project is [@BrannonKing](https://github.com/BrannonKing) (brannon@lbry.io) -**Important**: We do not accept translation changes as GitHub pull requests because the next -pull from Transifex would automatically overwrite them again. -Translators should also subscribe to the [mailing list](https://groups.google.com/forum/#!forum/bitcoin-translators). diff --git a/build-aux/m4/ax_boost_locale.m4 b/build-aux/m4/ax_boost_locale.m4 new file mode 100644 index 000000000..4f9883b72 --- /dev/null +++ b/build-aux/m4/ax_boost_locale.m4 @@ -0,0 +1,120 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_boost_locale.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_LOCALE +# +# DESCRIPTION +# +# Test for System library from the Boost C++ libraries. The macro requires +# a preceding call to AX_BOOST_BASE. Further documentation is available at +# . +# +# This macro calls: +# +# AC_SUBST(BOOST_LOCALE_LIB) +# +# And sets: +# +# HAVE_BOOST_LOCALE +# +# LICENSE +# +# Copyright (c) 2012 Xiyue Deng +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([AX_BOOST_LOCALE], +[ + AC_ARG_WITH([boost-locale], + AS_HELP_STRING([--with-boost-locale@<:@=special-lib@:>@], + [use the Locale library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-locale=boost_locale-gcc-mt ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_locale_lib="" + else + want_boost="yes" + ax_boost_user_locale_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_BUILD]) + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_CACHE_CHECK(whether the Boost::Locale library is available, + ax_cv_boost_locale, + [AC_LANG_PUSH([C++]) + CXXFLAGS_SAVE=$CXXFLAGS + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[boost::locale::generator gen; + std::locale::global(gen(""));]])], + ax_cv_boost_locale=yes, ax_cv_boost_locale=no) + CXXFLAGS=$CXXFLAGS_SAVE + AC_LANG_POP([C++]) + ]) + if test "x$ax_cv_boost_locale" = "xyes"; then + AC_SUBST(BOOST_CPPFLAGS) + + AC_DEFINE(HAVE_BOOST_LOCALE,,[define if the Boost::Locale library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + + LDFLAGS_SAVE=$LDFLAGS + if test "x$ax_boost_user_locale_lib" = "x"; then + for libextension in `ls $BOOSTLIBDIR/libboost_locale*.so* $BOOSTLIBDIR/libboost_locale*.dylib* $BOOSTLIBDIR/libboost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_locale.*\)\.so.*$;\1;' -e 's;^lib\(boost_locale.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_locale.*\)\.a.*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break], + [link_locale="no"]) + done + if test "x$link_locale" != "xyes"; then + for libextension in `ls $BOOSTLIBDIR/boost_locale*.dll* $BOOSTLIBDIR/boost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_locale.*\)\.dll.*$;\1;' -e 's;^\(boost_locale.*\)\.a.*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break], + [link_locale="no"]) + done + fi + + else + for ax_lib in $ax_boost_user_locale_lib boost_locale-$ax_boost_user_locale_lib; do + AC_CHECK_LIB($ax_lib, exit, + [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break], + [link_locale="no"]) + done + + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the library!) + fi + if test "x$link_locale" = "xno"; then + AC_MSG_ERROR(Could not link against $ax_lib !) + fi + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi +]) + diff --git a/configure.ac b/configure.ac index 6303916bc..0e7eeb696 100644 --- a/configure.ac +++ b/configure.ac @@ -7,17 +7,17 @@ define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) define(_COPYRIGHT_HOLDERS,[The %s developers]) -define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Bitcoin Core]]) -AC_INIT([Bitcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/bitcoin/bitcoin/issues],[bitcoin],[https://bitcoincore.org/]) +define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[LBRYcrd Core]]) +AC_INIT([LBRYcrd Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/bitcoin/bitcoin/issues],[bitcoin],[https://bitcoincore.org/]) AC_CONFIG_SRCDIR([src/validation.cpp]) AC_CONFIG_HEADERS([src/config/bitcoin-config.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([build-aux/m4]) -BITCOIN_DAEMON_NAME=bitcoind -BITCOIN_GUI_NAME=bitcoin-qt -BITCOIN_CLI_NAME=bitcoin-cli -BITCOIN_TX_NAME=bitcoin-tx +BITCOIN_DAEMON_NAME=lbrycrd +BITCOIN_GUI_NAME=lbrycrd-qt +BITCOIN_CLI_NAME=lbrycrd-cli +BITCOIN_TX_NAME=lbrycrd-tx dnl Unless the user specified ARFLAGS, force it to be cr AC_ARG_VAR(ARFLAGS, [Flags for the archiver, defaults to if not set]) @@ -146,6 +146,12 @@ AC_ARG_WITH([qrencode], [use_qr=$withval], [use_qr=auto]) +AC_ARG_WITH([icu], + [AS_HELP_STRING([--with-icu], + [Required ICU root path])], + [ICU_PREFIX=$withval], + [ICU_PREFIX=auto]) + AC_ARG_ENABLE([hardening], [AS_HELP_STRING([--disable-hardening], [do not attempt to harden the resulting executables (default is to harden when possible)])], @@ -395,7 +401,7 @@ CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS" AC_ARG_WITH([utils], [AS_HELP_STRING([--with-utils], - [build bitcoin-cli bitcoin-tx (default=yes)])], + [build lbrycrd-cli lbrycrd-tx (default=yes)])], [build_bitcoin_utils=$withval], [build_bitcoin_utils=yes]) @@ -780,7 +786,7 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([ ) TEMP_LDFLAGS="$LDFLAGS" -LDFLAGS="$TEMP_LDFLAGS $PTHREAD_CFLAGS" +LDFLAGS="$TEMP_LDFLAGS $PTHREAD_LIBS" AC_MSG_CHECKING([for thread_local support]) AC_LINK_IFELSE([AC_LANG_SOURCE([ #include @@ -896,6 +902,7 @@ AX_BOOST_SYSTEM AX_BOOST_FILESYSTEM AX_BOOST_THREAD AX_BOOST_CHRONO +AX_BOOST_LOCALE dnl Boost 1.56 through 1.62 allow using std::atomic instead of its own atomic dnl counter implementations. In 1.63 and later the std::atomic approach is default. @@ -962,7 +969,7 @@ fi if test x$use_boost = xyes; then -BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB" +BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB $BOOST_LOCALE_LIB" dnl If boost (prior to 1.57) was built without c++11, it emulated scoped enums @@ -1053,6 +1060,20 @@ fi fi +AS_IF([test "x$ICU_PREFIX" != xauto], [ + ICU_CPPFLAGS="-I$ICU_PREFIX/include" + ICU_LIBS="-L$ICU_PREFIX/lib -licui18n -licuuc -licudata -ldl" +# PKG_CONFIG_PATH="${ICU_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH" +# export PKG_CONFIG_PATH +]) + +AC_MSG_NOTICE([Using ICU_CPPFLAGS $ICU_CPPFLAGS]) +AC_MSG_NOTICE([Using ICU_LIBS $ICU_LIBS]) + +CPPFLAGS="$CPPFLAGS $ICU_CPPFLAGS" +ORIG_LDFLAGS=$LDFLAGS +LDFLAGS="$LDFLAGS $ICU_LIBS" + if test x$use_pkgconfig = xyes; then : dnl m4_ifdef( @@ -1082,7 +1103,19 @@ if test x$use_pkgconfig = xyes; then fi ] ) -else +else # compiling on Window: + AC_MSG_NOTICE([Configuring for Windows]) + + CPPFLAGS="$CPPFLAGS -Ix86_64-w64-mingw32/include" + LDFLAGS="$LDFLAGS -Lx86_64-w64-mingw32/lib" + + AC_CHECK_HEADER([unicode/errorcode.h],,AC_MSG_ERROR(libicu headers missing)) + AC_CHECK_LIB([icudata], [main], ICU_LIBS=$ICU_LIBS, + AC_CHECK_LIB([icu18n], [main],ICU_LIBS=$ICU_LIBS, ICU_LIBS="-L$ICU_PREFIX/lib -lsicuio -lsicuin -lsiculx -lsicule -lsicuuc -lsicudt")) + AC_MSG_NOTICE([Using ICU_LIBS=$ICU_LIBS]) + LDFLAGS="$ORIG_LDFLAGS $ICU_LIBS" + AC_CHECK_LIB([sicudt], [main], ICU_LIBS=$ICU_LIBS, AC_MSG_ERROR(icu libraries missing)) + AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing)) AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing)) @@ -1188,7 +1221,7 @@ 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 utils (bitcoin-cli bitcoin-tx)]) +AC_MSG_CHECKING([whether to build utils (lbrycrd-cli lbrycrd-tx)]) AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes]) AC_MSG_RESULT($build_bitcoin_utils) @@ -1289,7 +1322,7 @@ if test x$bitcoin_enable_qt != xno; then AC_MSG_WARN("xgettext is required to update qt translations") fi - AC_MSG_CHECKING([whether to build test_bitcoin-qt]) + AC_MSG_CHECKING([whether to build test_lbrycrd-qt]) if test x$use_gui_tests$bitcoin_enable_qt_test = xyesyes; then AC_MSG_RESULT([yes]) BUILD_TEST_QT="yes" @@ -1386,11 +1419,14 @@ AC_SUBST(LIBTOOL_APP_LDFLAGS) AC_SUBST(USE_UPNP) AC_SUBST(USE_QRCODE) AC_SUBST(BOOST_LIBS) +AC_SUBST(ICU_CPPFLAGS) +AC_SUBST(ICU_LIBS) AC_SUBST(TESTDEFS) AC_SUBST(LEVELDB_TARGET_FLAGS) AC_SUBST(MINIUPNPC_CPPFLAGS) AC_SUBST(MINIUPNPC_LIBS) AC_SUBST(CRYPTO_LIBS) +AC_SUBST(SSL_CFLAGS) AC_SUBST(SSL_LIBS) AC_SUBST(EVENT_LIBS) AC_SUBST(EVENT_PTHREADS_LIBS) diff --git a/contrib/patches/atomic.patch b/contrib/patches/atomic.patch new file mode 100644 index 000000000..398aa1d37 --- /dev/null +++ b/contrib/patches/atomic.patch @@ -0,0 +1,20 @@ +--- src/dbinc/atomic.h 2013-03-12 14:07:22.000000000 -0400 ++++ src/dbinc/atomic.h.change 2013-03-12 14:06:35.000000000 -0400 +@@ -144,7 +144,7 @@ + #define atomic_inc(env, p) __atomic_inc(p) + #define atomic_dec(env, p) __atomic_dec(p) + #define atomic_compare_exchange(env, p, o, n) \ +- __atomic_compare_exchange((p), (o), (n)) ++ __atomic_compare_exchange_db((p), (o), (n)) + static inline int __atomic_inc(db_atomic_t *p) + { + int temp; +@@ -176,7 +176,7 @@ + * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html + * which configure could be changed to use. + */ +-static inline int __atomic_compare_exchange( ++static inline int __atomic_compare_exchange_db( + db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval) + { + atomic_value_t was; diff --git a/depends/.gitignore b/depends/.gitignore index 72734102c..1f163897b 100644 --- a/depends/.gitignore +++ b/depends/.gitignore @@ -7,6 +7,3 @@ x86_64* i686* mips* arm* -aarch64* -riscv32* -riscv64* diff --git a/depends/Makefile b/depends/Makefile index 3686aaf1f..cde860b9a 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -1,12 +1,13 @@ .NOTPARALLEL : SOURCES_PATH ?= $(BASEDIR)/sources -WORK_PATH = $(BASEDIR)/work BASE_CACHE ?= $(BASEDIR)/built SDK_PATH ?= $(BASEDIR)/SDKs NO_QT ?= NO_WALLET ?= NO_UPNP ?= +ICU_DIR ?= +ICU_ONLY ?= FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources BUILD = $(shell ./config.guess) @@ -22,6 +23,7 @@ BUILD_ID_SALT ?= salt host:=$(BUILD) ifneq ($(HOST),) host:=$(HOST) +host_toolchain:=$(HOST)- endif ifneq ($(DEBUG),) @@ -30,9 +32,9 @@ else release_type=release endif -base_build_dir=$(WORK_PATH)/build -base_staging_dir=$(WORK_PATH)/staging -base_download_dir=$(WORK_PATH)/download +base_build_dir=$(BASEDIR)/work/build +base_staging_dir=$(BASEDIR)/work/staging +base_download_dir=$(BASEDIR)/work/download canonical_host:=$(shell ./config.sub $(HOST)) build:=$(shell ./config.sub $(BUILD)) @@ -73,7 +75,11 @@ include hosts/$(host_os).mk include hosts/default.mk include builders/$(build_os).mk include builders/default.mk +ifeq ($(ICU_ONLY),) include packages/packages.mk +else +include packages/packages.icu.mk +endif build_id_string:=$(BUILD_ID_SALT) build_id_string+=$(shell $(build_CC) --version 2>/dev/null) @@ -89,17 +95,14 @@ $(host_arch)_$(host_os)_id_string+=$(shell $(host_CXX) --version 2>/dev/null) $(host_arch)_$(host_os)_id_string+=$(shell $(host_RANLIB) --version 2>/dev/null) $(host_arch)_$(host_os)_id_string+=$(shell $(host_STRIP) --version 2>/dev/null) -qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) +qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) +qt_native_packages_$(NO_QT) = $(qt_native_packages) wallet_packages_$(NO_WALLET) = $(wallet_packages) upnp_packages_$(NO_UPNP) = $(upnp_packages) packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) -native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) - -ifneq ($(qt_packages_),) -native_packages += $(qt_native_packages) -endif - +$(info $$packages is [${packages}]) +native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) $(qt_native_packages_) all_packages = $(packages) $(native_packages) meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk @@ -134,8 +137,8 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_ -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \ -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ - -e 's|@allow_host_packages@|$(ALLOW_HOST_PACKAGES)|' \ -e 's|@no_qt@|$(NO_QT)|' \ + -e 's|@ICU_DIR@|$(ICU_DIR)|' \ -e 's|@no_wallet@|$(NO_WALLET)|' \ -e 's|@no_upnp@|$(NO_UPNP)|' \ -e 's|@debug@|$(DEBUG)|' \ @@ -166,23 +169,17 @@ $(host_prefix)/share/config.site: check-packages check-packages: check-sources -clean-all: clean - @rm -rf $(SOURCES_PATH) x86_64* i686* mips* arm* aarch64* riscv32* riscv64* - -clean: - @rm -rf $(WORK_PATH) $(BASE_CACHE) $(BUILD) - install: check-packages $(host_prefix)/share/config.site download-one: check-sources $(all_sources) download-osx: - @$(MAKE) -s HOST=x86_64-apple-darwin14 download-one + @$(MAKE) -s HOST=x86_64-apple-darwin11 download-one download-linux: @$(MAKE) -s HOST=x86_64-unknown-linux-gnu download-one download-win: @$(MAKE) -s HOST=x86_64-w64-mingw32 download-one download: download-osx download-linux download-win -.PHONY: install cached clean clean-all download-one download-osx download-linux download-win download check-packages check-sources +.PHONY: install cached download-one download-osx download-linux download-win download check-packages check-sources diff --git a/depends/README.md b/depends/README.md index fd343f701..271bbd80b 100644 --- a/depends/README.md +++ b/depends/README.md @@ -22,42 +22,17 @@ Common `host-platform-triplets` for cross compilation are: - `i686-w64-mingw32` for Win32 - `x86_64-w64-mingw32` for Win64 -- `x86_64-apple-darwin14` for macOS -- `arm-linux-gnueabihf` for Linux ARM 32 bit -- `aarch64-linux-gnu` for Linux ARM 64 bit -- `riscv32-linux-gnu` for Linux RISC-V 32 bit -- `riscv64-linux-gnu` for Linux RISC-V 64 bit +- `x86_64-apple-darwin11` for MacOSX +- `arm-linux-gnueabihf` for Linux ARM No other options are needed, the paths are automatically configured. -Install the required dependencies: Ubuntu & Debian --------------------------------------------------- - -For macOS cross compilation: - - sudo apt-get install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python-setuptools - -For Win32/Win64 cross compilation: - -- see [build-windows.md](../doc/build-windows.md#cross-compilation-for-ubuntu-and-windows-subsystem-for-linux) - -For linux (including i386, ARM) cross compilation: - - sudo apt-get install curl g++-aarch64-linux-gnu g++-4.8-aarch64-linux-gnu gcc-4.8-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-arm-linux-gnueabihf g++-4.8-arm-linux-gnueabihf gcc-4.8-arm-linux-gnueabihf binutils-arm-linux-gnueabihf g++-4.8-multilib gcc-4.8-multilib binutils-gold bsdmainutils - -For linux RISC-V 64-bit cross compilation (there are no packages for 32-bit): - - sudo apt-get install curl g++-riscv64-linux-gnu binutils-riscv64-linux-gnu - -RISC-V known issue: gcc-7.3.0 and gcc-7.3.1 result in a broken `test_bitcoin` executable (see https://github.com/bitcoin/bitcoin/pull/13543), -this is apparently fixed in gcc-8.1.0. - Dependency Options: The following can be set when running make: make FOO=bar SOURCES_PATH: downloaded sources will be placed here BASE_CACHE: built packages will be placed here - SDK_PATH: Path where sdk's can be found (used by macOS) + SDK_PATH: Path where sdk's can be found (used by OSX) FALLBACK_DOWNLOAD_PATH: If a source file can't be fetched, try here before giving up NO_QT: Don't download/build/cache qt and its dependencies NO_WALLET: Don't download/build/cache libs needed to enable the wallet @@ -72,7 +47,7 @@ options will be passed to bitcoin's configure. In this case, `--disable-wallet`. Additional targets: download: run 'make download' to fetch all sources without building them - download-osx: run 'make download-osx' to fetch all sources needed for macOS builds + download-osx: run 'make download-osx' to fetch all sources needed for osx builds download-win: run 'make download-win' to fetch all sources needed for win builds download-linux: run 'make download-linux' to fetch all sources needed for linux builds diff --git a/depends/builders/darwin.mk b/depends/builders/darwin.mk index c7671c154..200d6ed22 100644 --- a/depends/builders/darwin.mk +++ b/depends/builders/darwin.mk @@ -1,17 +1,17 @@ -build_darwin_CC:=$(shell xcrun -f clang) -build_darwin_CXX:=$(shell xcrun -f clang++) -build_darwin_AR:=$(shell xcrun -f ar) -build_darwin_RANLIB:=$(shell xcrun -f ranlib) -build_darwin_STRIP:=$(shell xcrun -f strip) -build_darwin_OTOOL:=$(shell xcrun -f otool) -build_darwin_NM:=$(shell xcrun -f nm) +build_darwin_CC: = $(shell xcrun -f clang) +build_darwin_CXX: = $(shell xcrun -f clang++) +build_darwin_AR: = $(shell xcrun -f ar) +build_darwin_RANLIB: = $(shell xcrun -f ranlib) +build_darwin_STRIP: = $(shell xcrun -f strip) +build_darwin_OTOOL: = $(shell xcrun -f otool) +build_darwin_NM: = $(shell xcrun -f nm) build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool) -build_darwin_SHA256SUM=shasum -a 256 -build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o +build_darwin_SHA256SUM = shasum -a 256 +build_darwin_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o #darwin host on darwin builder. overrides darwin host preferences. darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) -darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -stdlib=libc++ +darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) darwin_AR:=$(shell xcrun -f ar) darwin_RANLIB:=$(shell xcrun -f ranlib) darwin_STRIP:=$(shell xcrun -f strip) diff --git a/depends/config.guess b/depends/config.guess index 2b79f6d83..373a659a0 100755 --- a/depends/config.guess +++ b/depends/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2018-07-06' +timestamp='2016-02-11' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ timestamp='2018-07-06' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,7 +27,7 @@ timestamp='2018-07-06' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . @@ -39,7 +39,7 @@ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. -Options: +Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -101,15 +101,15 @@ trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && e trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp 2>/dev/null) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in - ,,) echo "int x;" > "$dummy.c" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do - if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; @@ -132,14 +132,14 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in +case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu - eval "$set_cc_for_build" - cat <<-EOF > "$dummy.c" + eval $set_cc_for_build + cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc @@ -149,20 +149,13 @@ Linux|GNU|GNU/*) LIBC=gnu #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" - - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl - fi + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -176,30 +169,27 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ echo unknown)` - case "$UNAME_MACHINE_ARCH" in + case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) - arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine="${arch}${endian}"-unknown + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in - earm*) - os=netbsdelf - ;; - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval "$set_cc_for_build" + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -215,10 +205,10 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ;; esac # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in + case "${UNAME_MACHINE_ARCH}" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` ;; esac # The OS release @@ -226,55 +216,46 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in + case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) - release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi-}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; - *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix + echo ${UNAME_MACHINE}-unknown-sortix exit ;; - *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; - mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -326,19 +307,28 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos + echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos + echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -350,7 +340,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" + echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos @@ -377,38 +367,38 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" + echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval "$set_cc_for_build" + eval $set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in @@ -417,25 +407,25 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" + echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" + echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" + echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" + echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not @@ -446,44 +436,44 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" + echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" + echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" + echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" + echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" + echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" + echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" + echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" + echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" + echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { @@ -492,23 +482,23 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`"$dummy" "$dummyarg"` && + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" + echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax @@ -534,17 +524,17 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] then - echo m88k-dg-dgux"$UNAME_RELEASE" + echo m88k-dg-dgux${UNAME_RELEASE} else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" + echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else - echo i586-dg-dgux"$UNAME_RELEASE" + echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) @@ -561,7 +551,7 @@ EOF echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id @@ -573,14 +563,14 @@ EOF if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #include main() @@ -591,7 +581,7 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else @@ -605,7 +595,7 @@ EOF exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -614,18 +604,18 @@ EOF IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; - ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx @@ -640,28 +630,28 @@ EOF echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - case "$UNAME_MACHINE" in - 9000/31?) HP_ARCH=m68000 ;; - 9000/[34]??) HP_ARCH=m68k ;; + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "$sc_cpu_version" in + case "${sc_cpu_version}" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in + case "${sc_kernel_bits}" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if [ "$HP_ARCH" = "" ]; then - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include @@ -694,13 +684,13 @@ EOF exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ "$HP_ARCH" = hppa2.0w ] + if [ ${HP_ARCH} = hppa2.0w ] then - eval "$set_cc_for_build" + eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -711,7 +701,7 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w @@ -719,15 +709,15 @@ EOF HP_ARCH=hppa64 fi fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux"$HPUX_REV" + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #include int main () @@ -752,11 +742,11 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) @@ -765,7 +755,7 @@ EOF *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) @@ -773,9 +763,9 @@ EOF exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then - echo "$UNAME_MACHINE"-unknown-osf1mk + echo ${UNAME_MACHINE}-unknown-osf1mk else - echo "$UNAME_MACHINE"-unknown-osf1 + echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) @@ -800,109 +790,127 @@ EOF echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) - echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" + echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case "$UNAME_PROCESSOR" in + case ${UNAME_PROCESSOR} in amd64) - UNAME_PROCESSOR=x86_64 ;; - i386) - UNAME_PROCESSOR=i586 ;; + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin + echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 + echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 + echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 + echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) - case "$UNAME_MACHINE" in + case ${UNAME_MACHINE} in x86) - echo i586-pc-interix"$UNAME_RELEASE" + echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" + echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" + echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin + echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; - *:Minix:*:*) - echo "$UNAME_MACHINE"-unknown-minix + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -916,63 +924,63 @@ EOF esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) - eval "$set_cc_for_build" + eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el @@ -986,70 +994,64 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" - test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" + echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" + echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" + echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1063,34 +1065,34 @@ EOF # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx + echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop + echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos + echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable + echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" + echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp + echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; - i*86:*:4.*:*) - UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) @@ -1100,12 +1102,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1115,9 +1117,9 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv32 + echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) @@ -1137,9 +1139,9 @@ EOF exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) @@ -1159,9 +1161,9 @@ EOF test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; @@ -1170,28 +1172,28 @@ EOF test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" + echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" + echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" + echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" + echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" + echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 @@ -1202,7 +1204,7 @@ EOF *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo "$UNAME_MACHINE"-sni-sysv4 + echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi @@ -1222,23 +1224,23 @@ EOF exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos + echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" + echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv"$UNAME_RELEASE" + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv"$UNAME_RELEASE" + echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. @@ -1257,56 +1259,46 @@ EOF echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" + echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" + echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" + echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" + echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" + echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; - SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" + echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" + echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval "$set_cc_for_build" + eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi - if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub @@ -1317,7 +1309,7 @@ EOF # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` @@ -1325,25 +1317,19 @@ EOF UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" + echo nse-tandem-nsk${UNAME_RELEASE} exit ;; - NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; - NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; - NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux @@ -1352,7 +1338,7 @@ EOF echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 @@ -1363,7 +1349,7 @@ EOF else UNAME_MACHINE="$cputype" fi - echo "$UNAME_MACHINE"-unknown-plan9 + echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 @@ -1384,14 +1370,14 @@ EOF echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "$UNAME_MACHINE" in + case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; @@ -1400,48 +1386,37 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos + echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros + echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx + echo ${UNAME_MACHINE}-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac -echo "$0: unable to guess system type" >&2 - -case "$UNAME_MACHINE:$UNAME_SYSTEM" in - mips:Linux | mips64:Linux) - # If we got here on MIPS GNU/Linux, output extra information. - cat >&2 <&2 < in order to provide the needed +information to handle your system. config.guess timestamp = $timestamp @@ -1460,16 +1435,16 @@ hostinfo = `(hostinfo) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` -UNAME_MACHINE = "$UNAME_MACHINE" -UNAME_RELEASE = "$UNAME_RELEASE" -UNAME_SYSTEM = "$UNAME_SYSTEM" -UNAME_VERSION = "$UNAME_VERSION" +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/depends/config.site.in b/depends/config.site.in index 8444dc26f..5c68b87c5 100644 --- a/depends/config.site.in +++ b/depends/config.site.in @@ -1,25 +1,27 @@ -depends_prefix="`dirname ${ac_site_file}`/.." - cross_compiling=maybe host_alias=@HOST@ ac_tool_prefix=${host_alias}- if test -z $with_boost; then - with_boost=$depends_prefix + with_boost=$prefix fi if test -z $with_qt_plugindir; then - with_qt_plugindir=$depends_prefix/plugins + with_qt_plugindir=$prefix/plugins fi if test -z $with_qt_translationdir; then - with_qt_translationdir=$depends_prefix/translations + with_qt_translationdir=$prefix/translations fi -if test -z $with_qt_bindir && test -z "@no_qt@"; then - with_qt_bindir=$depends_prefix/native/bin +if test -z $with_qt_bindir; then + with_qt_bindir=$prefix/native/bin fi -if test -z $with_protoc_bindir && test -z "@no_qt@"; then - with_protoc_bindir=$depends_prefix/native/bin +if test -z $with_protoc_bindir; then + with_protoc_bindir=$prefix/native/bin +fi +if test -z $with_comparison_tool; then + with_comparison_tool=$prefix/native/share/BitcoindComparisonTool_jar/BitcoindComparisonTool.jar fi +with_icu_dir=@icu_dir@ if test -z $enable_wallet && test -n "@no_wallet@"; then enable_wallet=no @@ -40,31 +42,32 @@ fi if test x@host_os@ = xmingw32; then if test -z $with_qt_incdir; then - with_qt_incdir=$depends_prefix/include + with_qt_incdir=$prefix/include fi if test -z $with_qt_libdir; then - with_qt_libdir=$depends_prefix/lib + with_qt_libdir=$prefix/lib fi fi -PATH=$depends_prefix/native/bin:$PATH +PATH=$prefix/native/bin:$PATH PKG_CONFIG="`which pkg-config` --static" # These two need to remain exported because pkg-config does not see them # otherwise. That means they must be unexported at the end of configure.ac to # avoid ruining the cache. Sigh. -export PKG_CONFIG_PATH=$depends_prefix/share/pkgconfig:$depends_prefix/lib/pkgconfig -if test -z "@allow_host_packages@"; then - export PKGCONFIG_LIBDIR= -fi -CPPFLAGS="-I$depends_prefix/include/ $CPPFLAGS" -LDFLAGS="-L$depends_prefix/lib $LDFLAGS" +export PKG_CONFIG_LIBDIR=$prefix/lib/pkgconfig +export PKG_CONFIG_PATH=$prefix/share/pkgconfig + +CPPFLAGS="-I$prefix/include/ $CPPFLAGS" +LDFLAGS="-L$prefix/lib $LDFLAGS" CC="@CC@" CXX="@CXX@" OBJC="${CC}" -PYTHONPATH=$depends_prefix/native/lib/python/dist-packages:$PYTHONPATH +OBJCXX="${CXX}" +CCACHE=$prefix/native/bin/ccache +PYTHONPATH=$prefix/native/lib/python/dist-packages:$PYTHONPATH if test -n "@AR@"; then AR=@AR@ @@ -97,3 +100,6 @@ fi if test -n "@LDFLAGS@"; then LDFLAGS="@LDFLAGS@ $LDFLAGS" fi +if test -n "@ICU_DIR@"; then + ICU_DIR="@ICU_DIR@" +fi diff --git a/depends/config.sub b/depends/config.sub index c95acc681..6223dde93 100755 --- a/depends/config.sub +++ b/depends/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2018-07-03' +timestamp='2016-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ timestamp='2018-07-03' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,7 +33,7 @@ timestamp='2018-07-03' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -57,7 +57,7 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. -Options: +Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -67,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -94,7 +94,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. - echo "$1" + echo $1 exit ;; * ) @@ -110,455 +110,134 @@ case $# in exit 1;; esac -# Split fields of configuration type -IFS="-" read -r field1 field2 field3 field4 <&2 - exit 1 +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. ;; - *-*-*-*) - basic_machine=$field1-$field2 - os=$field3-$field4 + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 ;; - *-*-*) - # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two - # parts - maybe_os=$field2-$field3 - case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ - | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ - | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ - | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova*) - basic_machine=$field1 - os=$maybe_os - ;; - android-linux) - basic_machine=$field1-unknown - os=linux-android - ;; - *) - basic_machine=$field1-$field2 - os=$field3 - ;; - esac + -bluegene*) + os=-cnk ;; - *-*) - # Second component is usually, but not always the OS - case $field2 in - # Prevent following clause from handling this valid os - sun*os*) - basic_machine=$field1 - os=$field2 - ;; - # Manufacturers - dec* | mips* | sequent* | encore* | pc532* | sgi* | sony* \ - | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ - | unicom* | ibm* | next | hp | isi* | apollo | altos* \ - | convergent* | ncr* | news | 32* | 3600* | 3100* | hitachi* \ - | c[123]* | convex* | sun | crds | omron* | dg | ultra | tti* \ - | harris | dolphin | highlevel | gould | cbm | ns | masscomp \ - | apple | axis | knuth | cray | microblaze* \ - | sim | cisco | oki | wec | wrs | winbond) - basic_machine=$field1-$field2 - os= - ;; - *) - basic_machine=$field1 - os=$field2 - ;; - esac + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 ;; - *) - # Convert single-component short-hands not valid as part of - # multi-component configurations. - case $field1 in - 386bsd) - basic_machine=i386-pc - os=bsd - ;; - a29khif) - basic_machine=a29k-amd - os=udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=scout - ;; - am29k) - basic_machine=a29k-none - os=bsd - ;; - amdahl) - basic_machine=580-amdahl - os=sysv - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=bsd - ;; - aros) - basic_machine=i386-pc - os=aros - ;; - aux) - basic_machine=m68k-apple - os=aux - ;; - balance) - basic_machine=ns32k-sequent - os=dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=linux - ;; - cegcc) - basic_machine=arm-unknown - os=cegcc - ;; - cray) - basic_machine=j90-cray - os=unicos - ;; - craynv) - basic_machine=craynv-cray - os=unicosmp - ;; - delta88) - basic_machine=m88k-motorola - os=sysv3 - ;; - dicos) - basic_machine=i686-pc - os=dicos - ;; - djgpp) - basic_machine=i586-pc - os=msdosdjgpp - ;; - ebmon29k) - basic_machine=a29k-amd - os=ebmon - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=ose - ;; - gmicro) - basic_machine=tron-gmicro - os=sysv - ;; - go32) - basic_machine=i386-pc - os=go32 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=hms - ;; - harris) - basic_machine=m88k-harris - os=sysv3 - ;; - hp300bsd) - basic_machine=m68k-hp - os=bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=hpux - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=proelf - ;; - i386mach) - basic_machine=i386-mach - os=mach - ;; - vsta) - basic_machine=i386-unknown - os=vsta - ;; - isi68 | isi) - basic_machine=m68k-isi - os=sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=linux - ;; - magnum | m3230) - basic_machine=mips-mips - os=sysv - ;; - merlin) - basic_machine=ns32k-utek - os=sysv - ;; - mingw64) - basic_machine=x86_64-pc - os=mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=mingw32ce - ;; - monitor) - basic_machine=m68k-rom68k - os=coff - ;; - morphos) - basic_machine=powerpc-unknown - os=morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=moxiebox - ;; - msdos) - basic_machine=i386-pc - os=msdos - ;; - msys) - basic_machine=i686-pc - os=msys - ;; - mvs) - basic_machine=i370-ibm - os=mvs - ;; - nacl) - basic_machine=le32-unknown - os=nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=newsos - ;; - news1000) - basic_machine=m68030-sony - os=newsos - ;; - necv70) - basic_machine=v70-nec - os=sysv - ;; - nh3000) - basic_machine=m68k-harris - os=cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=cxux - ;; - nindy960) - basic_machine=i960-intel - os=nindy - ;; - mon960) - basic_machine=i960-intel - os=mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=nonstopux - ;; - os400) - basic_machine=powerpc-ibm - os=os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=ose - ;; - os68k) - basic_machine=m68k-none - os=os68k - ;; - paragon) - basic_machine=i860-intel - os=osf - ;; - parisc) - basic_machine=hppa-unknown - os=linux - ;; - pw32) - basic_machine=i586-unknown - os=pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=rdos - ;; - rdos32) - basic_machine=i386-pc - os=rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=coff - ;; - sa29200) - basic_machine=a29k-amd - os=udi - ;; - sei) - basic_machine=mips-sei - os=seiux - ;; - sps7) - basic_machine=m68k-bull - os=sysv2 - ;; - stratus) - basic_machine=i860-stratus - os=sysv4 - ;; - sun2os3) - basic_machine=m68000-sun - os=sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=solaris2 - ;; - sv1) - basic_machine=sv1-cray - os=unicos - ;; - symmetry) - basic_machine=i386-sequent - os=dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=unicos - ;; - t90) - basic_machine=t90-cray - os=unicos - ;; - toad1) - basic_machine=pdp10-xkl - os=tops20 - ;; - tpf) - basic_machine=s390x-ibm - os=tpf - ;; - udi29k) - basic_machine=a29k-amd - os=udi - ;; - ultra3) - basic_machine=a29k-nyu - os=sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=none - ;; - vaxv) - basic_machine=vax-dec - os=sysv - ;; - vms) - basic_machine=vax-dec - os=vms - ;; - vxworks960) - basic_machine=i960-wrs - os=vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=vxworks - ;; - xbox) - basic_machine=i686-pc - os=mingw32 - ;; - ymp) - basic_machine=ymp-cray - os=unicos - ;; - *) - basic_machine=$1 - os= - ;; - esac + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint ;; esac @@ -573,18 +252,18 @@ case $basic_machine in | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ - | c4x | c8051 | clipper | csky \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia16 | ia64 \ + | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ @@ -617,15 +296,13 @@ case $basic_machine in | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nfp \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ - | pdp10 | pj | pjl \ + | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ | pyramid \ - | riscv | riscv32 | riscv64 \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -637,7 +314,7 @@ case $basic_machine in | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ - | wasm32 \ + | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown @@ -656,23 +333,20 @@ case $basic_machine in ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown - os=${os:-none} + os=-none ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) - ;; - m9s12z | m68hcs12z | hcs12z | s12z) - basic_machine=s12z-unknown - os=${os:-none} + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; + strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown - os=${os:-none} + os=-none ;; xscaleeb) basic_machine=armeb-unknown @@ -688,6 +362,11 @@ case $basic_machine in i*86 | x86_64) basic_machine=$basic_machine-pc ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ @@ -701,14 +380,14 @@ case $basic_machine in | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ @@ -742,7 +421,6 @@ case $basic_machine in | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nfp-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ @@ -750,9 +428,8 @@ case $basic_machine in | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ | pyramid-* \ - | riscv-* | riscv32-* | riscv64-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ @@ -767,7 +444,6 @@ case $basic_machine in | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ - | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -780,77 +456,141 @@ case $basic_machine in ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; abacus) basic_machine=abacus-unknown ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; amd64) basic_machine=x86_64-pc ;; amd64-*) - basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; asmjs) basic_machine=asmjs-unknown ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; blackfin-*) - basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=linux + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux ;; bluegene*) basic_machine=powerpc-ibm - os=cnk + os=-cnk ;; c54x-*) - basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) - basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) - basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray - os=${os:-unicos} + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc ;; convex-c1) basic_machine=c1-convex - os=bsd + os=-bsd ;; convex-c2) basic_machine=c2-convex - os=bsd + os=-bsd ;; convex-c32) basic_machine=c32-convex - os=bsd + os=-bsd ;; convex-c34) basic_machine=c34-convex - os=bsd + os=-bsd ;; convex-c38) basic_machine=c38-convex - os=bsd + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown - os=${os:-elf} + os=-elf ;; crds | unos) basic_machine=m68k-crds @@ -863,7 +603,7 @@ case $basic_machine in ;; crx) basic_machine=crx-unknown - os=${os:-elf} + os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 @@ -873,38 +613,50 @@ case $basic_machine in ;; decsystem10* | dec10*) basic_machine=pdp10-dec - os=tops10 + os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec - os=tops20 + os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull - os=${os:-bosx} + os=-bosx ;; - dpx2*) + dpx2* | dpx2*-bull) basic_machine=m68k-bull - os=sysv3 + os=-sysv3 ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" + ebmon29k) + basic_machine=a29k-amd + os=-ebmon ;; - e500v[12]-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=$os"spe" + elxsi) + basic_machine=elxsi-elxsi + os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; - elxsi) - basic_machine=elxsi-elxsi - os=${os:-bsd} + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose ;; fx2800) basic_machine=i860-alliant @@ -912,13 +664,45 @@ case $basic_machine in genix) basic_machine=ns32k-ns ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi - os=hiuxwe2 + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; @@ -948,82 +732,200 @@ case $basic_machine in hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=sysv32 + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 ;; i*86v4*) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=sysv4 + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 ;; i*86v) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=sysv + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv ;; i*86sol2) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=solaris2 + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 ;; - j90 | j90-cray) - basic_machine=j90-cray - os=${os:-unicos} + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in - irix*) + -irix*) ;; *) - os=irix4 + os=-irix4 ;; esac ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; leon-*|leon[3-9]-*) - basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux ;; m68knommu-*) - basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=linux + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; - *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari - os=mint + os=-mint ;; mips3*-*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; + msdos) + basic_machine=i386-pc + os=-msdos ;; ms1-*) - basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony - os=newsos + os=-newsos ;; - next | m*-next) + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) basic_machine=m68k-next case $os in - nextstep* ) + -nextstep* ) ;; - ns2*) - os=nextstep2 + -ns2*) + os=-nextstep2 ;; *) - os=nextstep3 + os=-nextstep3 ;; esac ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; np1) basic_machine=np1-gould ;; @@ -1036,26 +938,40 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; - nsv-tandem) - basic_machine=nsv-tandem - ;; - nsx-tandem) - basic_machine=nsx-tandem - ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki - os=proelf + os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; pa-hitachi) basic_machine=hppa1.1-hitachi - os=hiuxwe2 + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux ;; parisc-*) - basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=linux + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux ;; pbd) basic_machine=sparc-tti @@ -1070,7 +986,7 @@ case $basic_machine in basic_machine=i386-pc ;; pc98-*) - basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc @@ -1085,16 +1001,16 @@ case $basic_machine in basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) - basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould @@ -1104,27 +1020,43 @@ case $basic_machine in ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle) + ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; - ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little) + ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; rm[46]00) basic_machine=mips-siemens ;; @@ -1137,6 +1069,10 @@ case $basic_machine in s390x | s390x-*) basic_machine=s390x-ibm ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; sb1) basic_machine=mipsisa64sb1-unknown ;; @@ -1145,17 +1081,32 @@ case $basic_machine in ;; sde) basic_machine=mipsisa32-sde - os=${os:-elf} + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux ;; sequent) basic_machine=i386-sequent ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; sh5el) basic_machine=sh5le-unknown ;; - simso-wrs) + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs - os=vxworks + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 ;; spur) basic_machine=spur-unknown @@ -1163,12 +1114,44 @@ case $basic_machine in st2000) basic_machine=m68k-tandem ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; strongarm-* | thumb-*) - basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; sun3 | sun3-*) basic_machine=m68k-sun ;; @@ -1178,9 +1161,25 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; tile*) basic_machine=$basic_machine-unknown - os=linux-gnu + os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown @@ -1188,32 +1187,85 @@ case $basic_machine in tx39el) basic_machine=mipstx39el-unknown ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; w65*) basic_machine=w65-wdc - os=none + os=-none ;; w89k-*) basic_machine=hppa1.1-winbond - os=proelf + os=-proelf ;; - x64) - basic_machine=x86_64-pc + xbox) + basic_machine=i686-pc + os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) - basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim ;; none) basic_machine=none-none - os=${os:-none} + os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in @@ -1239,6 +1291,10 @@ case $basic_machine in vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; @@ -1248,6 +1304,9 @@ case $basic_machine in sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; cydra) basic_machine=cydra-cydrome ;; @@ -1267,7 +1326,7 @@ case $basic_machine in # Make sure to match an already-canonicalized machine name. ;; *) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac @@ -1275,10 +1334,10 @@ esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) - basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) - basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; @@ -1286,246 +1345,198 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x$os != x ] +if [ x"$os" != x"" ] then case $os in - # First match some system type aliases that might get confused - # with valid system types. - # solaris* is a basic system type, with this one exception. - auroraux) - os=auroraux + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux ;; - bluegene*) - os=cnk - ;; - solaris1 | solaris1.*) + -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; - solaris) - os=solaris2 + -solaris) + os=-solaris2 ;; - unixware*) - os=sysv4.2uw + -svr4*) + os=-sysv4 ;; - gnu/linux*) + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; - # es1800 is here to avoid being matched by es* (a different OS) - es1800*) - os=ose - ;; - # Some version numbers need modification - chorusos*) - os=chorusos - ;; - isc) - os=isc2.2 - ;; - sco6) - os=sco5v6 - ;; - sco5) - os=sco3.2v5 - ;; - sco4) - os=sco3.2v4 - ;; - sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - ;; - sco3.2v[4-9]* | sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - ;; - scout) - # Don't match below - ;; - sco*) - os=sco3.2v2 - ;; - psos*) - os=psos - ;; - # Now accept the basic system types. + # First accept the basic system types. # The portable systems comes first. - # Each alternative MUST end in a * to match a version number. - # sysv* is not here because it comes later, after sysvr4. - gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ - | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ - | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ - | sym* | kopensolaris* | plan9* \ - | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ - | aos* | aros* | cloudabi* | sortix* \ - | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ - | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \ - | knetbsd* | mirbsd* | netbsd* \ - | bitrig* | openbsd* | solidbsd* | libertybsd* \ - | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ - | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ - | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ - | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ - | chorusrdb* | cegcc* | glidix* \ - | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ - | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ - | linux-newlib* | linux-musl* | linux-uclibc* \ - | uxpv* | beos* | mpeix* | udk* | moxiebox* \ - | interix* | uwin* | mks* | rhapsody* | darwin* \ - | openstep* | oskit* | conix* | pw32* | nonstopux* \ - | storm-chaos* | tops10* | tenex* | tops20* | its* \ - | os2* | vos* | palmos* | uclinux* | nucleus* \ - | morphos* | superux* | rtmk* | windiss* \ - | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ - | skyos* | haiku* | rdos* | toppers* | drops* | es* \ - | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd*) + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; - qnx*) + -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) - os=nto-$os + os=-nto$os ;; esac ;; - hiux*) - os=hiuxwe2 + -nto-qnx*) ;; - nto-qnx*) - ;; - nto*) + -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; - sim | xray | os68k* | v88r* \ - | windows* | osx | abug | netware* | os9* \ - | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; - linux-dietlibc) - os=linux-dietlibc + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` ;; - linux*) + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; - lynx*178) - os=lynxos178 + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; - lynx*5) - os=lynxos5 + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; - lynx*) - os=lynxos + -opened*) + os=-openedition ;; - mac*) - os=`echo "$os" | sed -e 's|mac|macos|'` + -os400*) + os=-os400 ;; - opened*) - os=openedition + -wince*) + os=-wince ;; - os400*) - os=os400 + -osfrose*) + os=-osfrose ;; - sunos5*) - os=`echo "$os" | sed -e 's|sunos5|solaris2|'` + -osf*) + os=-osf ;; - sunos6*) - os=`echo "$os" | sed -e 's|sunos6|solaris3|'` + -utek*) + os=-bsd ;; - wince*) - os=wince + -dynix*) + os=-bsd ;; - utek*) - os=bsd + -acis*) + os=-aos ;; - dynix*) - os=bsd + -atheos*) + os=-atheos ;; - acis*) - os=aos + -syllable*) + os=-syllable ;; - atheos*) - os=atheos + -386bsd) + os=-bsd ;; - syllable*) - os=syllable + -ctix* | -uts*) + os=-sysv ;; - 386bsd) - os=bsd + -nova*) + os=-rtmk-nova ;; - ctix* | uts*) - os=sysv + -ns2 ) + os=-nextstep2 ;; - nova*) - os=rtmk-nova - ;; - ns2) - os=nextstep2 - ;; - nsk*) - os=nsk + -nsk*) + os=-nsk ;; # Preserve the version number of sinix5. - sinix5.*) + -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; - sinix*) - os=sysv4 + -sinix*) + os=-sysv4 ;; - tpf*) - os=tpf + -tpf*) + os=-tpf ;; - triton*) - os=sysv3 + -triton*) + os=-sysv3 ;; - oss*) - os=sysv3 + -oss*) + os=-sysv3 ;; - svr4*) - os=sysv4 + -svr4) + os=-sysv4 ;; - svr3) - os=sysv3 + -svr3) + os=-sysv3 ;; - sysvr4) - os=sysv4 + -sysvr4) + os=-sysv4 ;; - # This must come after sysvr4. - sysv*) + # This must come after -sysvr4. + -sysv*) ;; - ose*) - os=ose + -ose*) + os=-ose ;; - *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) - os=mint + -es1800*) + os=-ose ;; - zvmoe) - os=zvmoe + -xenix) + os=-xenix ;; - dicos*) - os=dicos + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint ;; - pikeos*) - # Until real need of OS specific support for - # particular features comes up, bare metal - # configurations are quite functional. - case $basic_machine in - arm*) - os=eabi - ;; - *) - os=elf - ;; - esac + -aros*) + os=-aros ;; - nacl*) + -zvmoe) + os=-zvmoe ;; - ios) + -dicos*) + os=-dicos ;; - none) + -nacl*) ;; - *-eabi) + -none) ;; *) - echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac @@ -1543,179 +1554,176 @@ else case $basic_machine in score-*) - os=elf + os=-elf ;; spu-*) - os=elf + os=-elf ;; *-acorn) - os=riscix1.2 + os=-riscix1.2 ;; arm*-rebel) - os=linux + os=-linux ;; arm*-semi) - os=aout + os=-aout ;; c4x-* | tic4x-*) - os=coff + os=-coff ;; c8051-*) - os=elf - ;; - clipper-intergraph) - os=clix + os=-elf ;; hexagon-*) - os=elf + os=-elf ;; tic54x-*) - os=coff + os=-coff ;; tic55x-*) - os=coff + os=-coff ;; tic6x-*) - os=coff + os=-coff ;; # This must come before the *-dec entry. pdp10-*) - os=tops20 + os=-tops20 ;; pdp11-*) - os=none + os=-none ;; *-dec | vax-*) - os=ultrix4.2 + os=-ultrix4.2 ;; m68*-apollo) - os=domain + os=-domain ;; i386-sun) - os=sunos4.0.2 + os=-sunos4.0.2 ;; m68000-sun) - os=sunos3 + os=-sunos3 ;; m68*-cisco) - os=aout + os=-aout ;; mep-*) - os=elf + os=-elf ;; mips*-cisco) - os=elf + os=-elf ;; mips*-*) - os=elf + os=-elf ;; or32-*) - os=coff + os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=sysv3 + os=-sysv3 ;; sparc-* | *-sun) - os=sunos4.1.1 - ;; - pru-*) - os=elf + os=-sunos4.1.1 ;; *-be) - os=beos + os=-beos + ;; + *-haiku) + os=-haiku ;; *-ibm) - os=aix + os=-aix ;; *-knuth) - os=mmixware + os=-mmixware ;; *-wec) - os=proelf + os=-proelf ;; *-winbond) - os=proelf + os=-proelf ;; *-oki) - os=proelf + os=-proelf ;; *-hp) - os=hpux + os=-hpux ;; *-hitachi) - os=hiux + os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=sysv + os=-sysv ;; *-cbm) - os=amigaos + os=-amigaos ;; *-dg) - os=dgux + os=-dgux ;; *-dolphin) - os=sysv3 + os=-sysv3 ;; m68k-ccur) - os=rtu + os=-rtu ;; m88k-omron*) - os=luna + os=-luna ;; - *-next) - os=nextstep + *-next ) + os=-nextstep ;; *-sequent) - os=ptx + os=-ptx ;; *-crds) - os=unos + os=-unos ;; *-ns) - os=genix + os=-genix ;; i370-*) - os=mvs + os=-mvs + ;; + *-next) + os=-nextstep3 ;; *-gould) - os=sysv + os=-sysv ;; *-highlevel) - os=bsd + os=-bsd ;; *-encore) - os=bsd + os=-bsd ;; *-sgi) - os=irix + os=-irix ;; *-siemens) - os=sysv4 + os=-sysv4 ;; *-masscomp) - os=rtu + os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=uxpv + os=-uxpv ;; *-rom68k) - os=coff + os=-coff ;; *-*bug) - os=coff + os=-coff ;; *-apple) - os=macos + os=-macos ;; *-atari*) - os=mint - ;; - *-wrs) - os=vxworks + os=-mint ;; *) - os=none + os=-none ;; esac fi @@ -1726,82 +1734,79 @@ vendor=unknown case $basic_machine in *-unknown) case $os in - riscix*) + -riscix*) vendor=acorn ;; - sunos*) + -sunos*) vendor=sun ;; - cnk*|-aix*) + -cnk*|-aix*) vendor=ibm ;; - beos*) + -beos*) vendor=be ;; - hpux*) + -hpux*) vendor=hp ;; - mpeix*) + -mpeix*) vendor=hp ;; - hiux*) + -hiux*) vendor=hitachi ;; - unos*) + -unos*) vendor=crds ;; - dgux*) + -dgux*) vendor=dg ;; - luna*) + -luna*) vendor=omron ;; - genix*) + -genix*) vendor=ns ;; - clix*) - vendor=intergraph - ;; - mvs* | opened*) + -mvs* | -opened*) vendor=ibm ;; - os400*) + -os400*) vendor=ibm ;; - ptx*) + -ptx*) vendor=sequent ;; - tpf*) + -tpf*) vendor=ibm ;; - vxsim* | vxworks* | windiss*) + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; - aux*) + -aux*) vendor=apple ;; - hms*) + -hms*) vendor=hitachi ;; - mpw* | macos*) + -mpw* | -macos*) vendor=apple ;; - *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; - vos*) + -vos*) vendor=stratus ;; esac - basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac -echo "$basic_machine-$os" +echo $basic_machine$os exit # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/depends/description.md b/depends/description.md index 9fc7093be..74f9ef3f2 100644 --- a/depends/description.md +++ b/depends/description.md @@ -7,7 +7,7 @@ In theory, binaries for any target OS/architecture can be created, from a builder running any OS/architecture. In practice, build-side tools must be specified when the defaults don't fit, and packages must be amended to work on new hosts. For now, a build architecture of x86_64 is assumed, either on -Linux or macOS. +Linux or OSX. ### No reliance on timestamps diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index a1c943d60..2958dc50c 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -1,9 +1,9 @@ -OSX_MIN_VERSION=10.10 -OSX_SDK_VERSION=10.11 +OSX_MIN_VERSION=10.7 +OSX_SDK_VERSION=10.9 OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk -LD64_VERSION=253.9 +LD64_VERSION=241.9 darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -stdlib=libc++ +darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) darwin_CFLAGS=-pipe darwin_CXXFLAGS=$(darwin_CFLAGS) diff --git a/depends/hosts/default.mk b/depends/hosts/default.mk index 144e5f88b..6f60d6b3f 100644 --- a/depends/hosts/default.mk +++ b/depends/hosts/default.mk @@ -1,7 +1,3 @@ -ifneq ($(host),$(build)) -host_toolchain:=$(host)- -endif - default_host_CC = $(host_toolchain)gcc default_host_CXX = $(host_toolchain)g++ default_host_AR = $(host_toolchain)ar diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk index 6c9876c2c..e2f85ad4f 100644 --- a/depends/packages/bdb.mk +++ b/depends/packages/bdb.mk @@ -9,13 +9,11 @@ define $(package)_set_vars $(package)_config_opts=--disable-shared --enable-cxx --disable-replication $(package)_config_opts_mingw32=--enable-mingw $(package)_config_opts_linux=--with-pic -$(package)_cxxflags=-std=c++11 endef define $(package)_preprocess_cmds sed -i.old 's/__atomic_compare_exchange/__atomic_compare_exchange_db/' dbinc/atomic.h && \ - sed -i.old 's/atomic_init/atomic_init_db/' dbinc/atomic.h mp/mp_region.c mp/mp_mvcc.c mp/mp_fget.c mutex/mut_method.c mutex/mut_tas.c && \ - cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub dist + sed -i.old 's/atomic_init/atomic_init_db/' dbinc/atomic.h mp/mp_region.c mp/mp_mvcc.c mp/mp_fget.c mutex/mut_method.c mutex/mut_tas.c endef define $(package)_config_cmds diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index 61806c750..e7d9ea393 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -1,14 +1,16 @@ package=boost -$(package)_version=1_64_0 -$(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/ +$(package)_version=1_59_0 +$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.59.0 $(package)_file_name=$(package)_$($(package)_version).tar.bz2 -$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332 +$(package)_sha256_hash=727a932322d94287b62abb1bd2d41723eec4356a7728909e38adb65ca25241ca +$(package)_dependencies:icu define $(package)_set_vars $(package)_config_opts_release=variant=release $(package)_config_opts_debug=variant=debug -$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam -$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1 +$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam boost.locale.iconv=off boost.locale.posix=off +$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1 -sICU_PATH=$(ICU_DIR) +$(package)_config_opts+=-sICU_LINK=-L$(ICU_DIR) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc $(package)_config_opts_linux=threadapi=pthread runtime-link=shared $(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared $(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static @@ -19,9 +21,17 @@ $(package)_toolset_$(host_os)=gcc $(package)_archiver_$(host_os)=$($(package)_ar) $(package)_toolset_darwin=darwin $(package)_archiver_darwin=$($(package)_libtool) -$(package)_config_libraries=chrono,filesystem,system,thread,test -$(package)_cxxflags=-std=c++11 -fvisibility=hidden +$(package)_config_libraries=chrono,filesystem,program_options,system,locale,regex,thread,test +$(package)_cxxflags=-fvisibility=hidden $(package)_cxxflags_linux=-fPIC +$(package)_config_env+=BOOST_ICU_ICONV="off" +$(package)_config_env+=BOOST_ICU_POSIX="off" +$(package)_config_env+=ICU_PREFIX=$(ICU_DIR) +$(package)_config_env+=BOOST_ICU_LIBS="-L$(ICU_DIR) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc" +$(package)_build_env+=BOOST_ICU_ICONV="off" +$(package)_build_env+=BOOST_ICU_POSIX="off" +$(package)_build_env+=ICU_PREFIX=$(ICU_DIR) +$(package)_build_env+=BOOST_ICU_LIBS="-L$(ICU_DIR) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc" endef define $(package)_preprocess_cmds @@ -29,13 +39,12 @@ define $(package)_preprocess_cmds endef define $(package)_config_cmds - ./bootstrap.sh --without-icu --with-libraries=$(boost_config_libraries) + echo "int main() { return 0; }" > ./libs/locale/build/has_icu_test.cpp && echo "int main() { return 0; }" > ./libs/regex/build/has_icu_test.cpp && echo "ICU INSTALL: $(ICU_DIR)" && echo "BOOST CONFIG LIBRARIES: $(boost_config_libraries)" && ./bootstrap.sh --with-icu=$(ICU_DIR) --with-libraries=$(boost_config_libraries) endef define $(package)_build_cmds - ./b2 -d2 -j2 -d1 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) stage + ICU_PATH=$(ICU_DIR) ./b2 link=static cxxflags=-fPIC -d0 -q -j12 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install endef define $(package)_stage_cmds - ./b2 -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install endef diff --git a/depends/packages/dbus.mk b/depends/packages/dbus.mk index bbe037540..8ac9ab742 100644 --- a/depends/packages/dbus.mk +++ b/depends/packages/dbus.mk @@ -1,8 +1,8 @@ package=dbus -$(package)_version=1.10.18 -$(package)_download_path=https://dbus.freedesktop.org/releases/dbus +$(package)_version=1.8.6 +$(package)_download_path=http://dbus.freedesktop.org/releases/dbus $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=6049ddd5f3f3e2618f615f1faeda0a115104423a7996b7aa73e2f36e38cc514a +$(package)_sha256_hash=eded83ca007b719f32761e60fd8b9ffd0f5796a4caf455b01b5a5ef740ebd23f $(package)_dependencies=expat define $(package)_set_vars diff --git a/depends/packages/expat.mk b/depends/packages/expat.mk index acbc60eea..1ac443537 100644 --- a/depends/packages/expat.mk +++ b/depends/packages/expat.mk @@ -1,8 +1,8 @@ package=expat -$(package)_version=2.2.5 -$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_2_2_5/ -$(package)_file_name=$(package)-$($(package)_version).tar.bz2 -$(package)_sha256_hash=d9dc32efba7e74f788fcc4f212a43216fc37cf5f23f4c2339664d473353aedf6 +$(package)_version=2.1.0 +$(package)_download_path=http://sourceforge.net/projects/expat/files/expat/$($(package)_version) +$(package)_file_name=$(package)-$($(package)_version).tar.gz +$(package)_sha256_hash=823705472f816df21c8f6aa026dd162b280806838bb55b3432b0fb1fcca7eb86 define $(package)_set_vars $(package)_config_opts=--disable-static diff --git a/depends/packages/fontconfig.mk b/depends/packages/fontconfig.mk index 12695db4b..2cf553ed9 100644 --- a/depends/packages/fontconfig.mk +++ b/depends/packages/fontconfig.mk @@ -1,8 +1,8 @@ package=fontconfig -$(package)_version=2.12.1 +$(package)_version=2.11.1 $(package)_download_path=http://www.freedesktop.org/software/fontconfig/release/ $(package)_file_name=$(package)-$($(package)_version).tar.bz2 -$(package)_sha256_hash=b449a3e10c47e1d1c7a6ec6e2016cca73d3bd68fbbd4f0ae5cc6b573f7d6c7f3 +$(package)_sha256_hash=dc62447533bca844463a3c3fd4083b57c90f18a70506e7a9f4936b5a1e516a99 $(package)_dependencies=freetype expat define $(package)_set_vars @@ -13,13 +13,7 @@ define $(package)_config_cmds $($(package)_autoconf) endef -# 2.12.1 uses CHAR_WIDTH which is reserved and clashes with some glibc versions, but newer versions of fontconfig -# have broken makefiles which needlessly attempt to re-generate headers with gperf. -# Instead, change all uses of CHAR_WIDTH, and disable the rule that forces header re-generation. -# This can be removed once the upstream build is fixed. define $(package)_build_cmds - sed -i 's/CHAR_WIDTH/CHARWIDTH/g' fontconfig/fontconfig.h src/fcobjshash.gperf src/fcobjs.h src/fcobjshash.h && \ - sed -i 's/fcobjshash.h: fcobjshash.gperf/fcobjshash.h:/' src/Makefile && \ $(MAKE) endef diff --git a/depends/packages/freetype.mk b/depends/packages/freetype.mk index 76b025c46..f7d6e0f9f 100644 --- a/depends/packages/freetype.mk +++ b/depends/packages/freetype.mk @@ -1,8 +1,8 @@ package=freetype -$(package)_version=2.7.1 -$(package)_download_path=http://download.savannah.gnu.org/releases/$(package) +$(package)_version=2.5.3 +$(package)_download_path=http://downloads.sourceforge.net/$(package) $(package)_file_name=$(package)-$($(package)_version).tar.bz2 -$(package)_sha256_hash=3a3bb2c4e15ffb433f2032f50a5b5a92558206822e22bfe8cbe339af4aa82f88 +$(package)_sha256_hash=c0848b29d52ef3ca27ad92e08351f023c5e24ce8cea7d8fe69fc96358e65f75e define $(package)_set_vars $(package)_config_opts=--without-zlib --without-png --disable-static diff --git a/depends/packages/icu.mk b/depends/packages/icu.mk new file mode 100644 index 000000000..88fb2e014 --- /dev/null +++ b/depends/packages/icu.mk @@ -0,0 +1,25 @@ +package=icu +$(package)_version=57_1 +$(package)_download_path=http://download.icu-project.org/files/icu4c/57.1 +$(package)_file_name=$(package)4c-$($(package)_version)-src.tgz +$(package)_sha256_hash=ff8c67cb65949b1e7808f2359f2b80f722697048e90e7cfc382ec1fe229e9581 +$(package)_build_subdir=source + +define $(package)_set_vars + $(package)_config_opts=--enable-debug --disable-release --host=x86_64-w64-mingw32 --with-cross-build=/tmp/icu_staging/icu/source --enable-extras=no --enable-strict=no --enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no + $(package)_config_opts_release=--disable-debug --enable-release + $(package)_config_opts_mingw32=--host=x86_64-w64-mingw32 + $(package)_config_opts_linux=--with-pic +endef + +define $(package)_config_cmds + $($(package)_autoconf) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=/tmp/icu_install install +endef diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index 5f622f8e6..2e9be1e98 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -1,15 +1,16 @@ package=libevent -$(package)_version=2.1.8-stable -$(package)_download_path=https://github.com/libevent/libevent/archive/ -$(package)_file_name=release-$($(package)_version).tar.gz -$(package)_sha256_hash=316ddb401745ac5d222d7c529ef1eada12f58f6376a66c1118eee803cb70f83d +$(package)_version=2.0.22 +$(package)_download_path=https://github.com/libevent/libevent/releases/download/release-2.0.22-stable +$(package)_file_name=$(package)-$($(package)_version)-stable.tar.gz +$(package)_sha256_hash=71c2c49f0adadacfdbe6332a372c38cf9c8b7895bb73dabeaa53cdcc1d4e1fa3 +$(package)_patches=reuseaddr.patch define $(package)_preprocess_cmds - ./autogen.sh + patch -p1 < $($(package)_patch_dir)/reuseaddr.patch endef define $(package)_set_vars - $(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress --disable-samples + $(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress $(package)_config_opts_release=--disable-debug-mode $(package)_config_opts_linux=--with-pic endef diff --git a/depends/packages/miniupnpc.mk b/depends/packages/miniupnpc.mk index 5ad2b580d..45fa03631 100644 --- a/depends/packages/miniupnpc.mk +++ b/depends/packages/miniupnpc.mk @@ -1,12 +1,12 @@ package=miniupnpc -$(package)_version=2.0.20180203 +$(package)_version=1.9.20160209 $(package)_download_path=http://miniupnp.free.fr/files $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=90dda8c7563ca6cd4a83e23b3c66dbbea89603a1675bfdb852897c2c9cc220b7 +$(package)_sha256_hash=572171eacc1d72537ce47b6f4571260757ab7bcfdaf54c3a55c7f88594d94b6f define $(package)_set_vars $(package)_build_opts=CC="$($(package)_cc)" -$(package)_build_opts_darwin=LIBTOOL="$($(package)_libtool)" +$(package)_build_opts_darwin=OS=Darwin LIBTOOL="$($(package)_libtool)" $(package)_build_opts_mingw32=-f Makefile.mingw $(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)" endef diff --git a/depends/packages/native_biplist.mk b/depends/packages/native_biplist.mk index 5f247e9bf..eb8672d55 100644 --- a/depends/packages/native_biplist.mk +++ b/depends/packages/native_biplist.mk @@ -1,8 +1,8 @@ package=native_biplist -$(package)_version=1.0.3 -$(package)_download_path=https://bitbucket.org/wooster/biplist/downloads +$(package)_version=0.9 +$(package)_download_path=https://pypi.python.org/packages/source/b/biplist $(package)_file_name=biplist-$($(package)_version).tar.gz -$(package)_sha256_hash=4c0549764c5fe50b28042ec21aa2e14fe1a2224e239a1dae77d9e7f3932aa4c6 +$(package)_sha256_hash=b57cadfd26e4754efdf89e9e37de87885f9b5c847b2615688ca04adfaf6ca604 $(package)_install_libdir=$(build_prefix)/lib/python/dist-packages define $(package)_build_cmds diff --git a/depends/packages/native_ccache.mk b/depends/packages/native_ccache.mk new file mode 100644 index 000000000..cc76f9a79 --- /dev/null +++ b/depends/packages/native_ccache.mk @@ -0,0 +1,25 @@ +package=native_ccache +$(package)_version=3.2.4 +$(package)_download_path=http://samba.org/ftp/ccache +$(package)_file_name=ccache-$($(package)_version).tar.bz2 +$(package)_sha256_hash=ffeb967edb549e67da0bd5f44f729a2022de9fdde65dfd80d2a7204d7f75332e + +define $(package)_set_vars +$(package)_config_opts= +endef + +define $(package)_config_cmds + $($(package)_autoconf) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install +endef + +define $(package)_postprocess_cmds + rm -rf lib include +endef diff --git a/depends/packages/native_cctools.mk b/depends/packages/native_cctools.mk index 44d238cc4..b5603a8d4 100644 --- a/depends/packages/native_cctools.mk +++ b/depends/packages/native_cctools.mk @@ -1,14 +1,14 @@ package=native_cctools -$(package)_version=807d6fd1be5d2224872e381870c0a75387fe05e6 +$(package)_version=ee31ae567931c426136c94aad457c7b51d844beb $(package)_download_path=https://github.com/theuni/cctools-port/archive $(package)_file_name=$($(package)_version).tar.gz -$(package)_sha256_hash=a09c9ba4684670a0375e42d9d67e7f12c1f62581a27f28f7c825d6d7032ccc6a +$(package)_sha256_hash=ef107e6ab1b3994cb22e14f4f5c59ea0c0b5a988e6b21d42ed9616b018bbcbf9 $(package)_build_subdir=cctools -$(package)_clang_version=3.7.1 +$(package)_clang_version=3.3 $(package)_clang_download_path=http://llvm.org/releases/$($(package)_clang_version) -$(package)_clang_download_file=clang+llvm-$($(package)_clang_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz -$(package)_clang_file_name=clang-llvm-$($(package)_clang_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz -$(package)_clang_sha256_hash=99b28a6b48e793705228a390471991386daa33a9717cd9ca007fcdde69608fd9 +$(package)_clang_download_file=clang+llvm-$($(package)_clang_version)-amd64-Ubuntu-12.04.2.tar.gz +$(package)_clang_file_name=clang-llvm-$($(package)_clang_version)-amd64-Ubuntu-12.04.2.tar.gz +$(package)_clang_sha256_hash=60d8f69f032d62ef61bf527857ebb933741ec3352d4d328c5516aa520662dab7 $(package)_extra_sources=$($(package)_clang_file_name) define $(package)_fetch_cmds @@ -23,7 +23,6 @@ define $(package)_extract_cmds $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ mkdir -p toolchain/bin toolchain/lib/clang/3.5/include && \ tar --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \ - rm -f toolchain/lib/libc++abi.so* && \ echo "#!/bin/sh" > toolchain/bin/$(host)-dsymutil && \ echo "exit 0" >> toolchain/bin/$(host)-dsymutil && \ chmod +x toolchain/bin/$(host)-dsymutil && \ @@ -31,15 +30,14 @@ define $(package)_extract_cmds endef define $(package)_set_vars -$(package)_config_opts=--target=$(host) --disable-lto-support +$(package)_config_opts=--target=$(host) --disable-libuuid $(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib $(package)_cc=$($(package)_extract_dir)/toolchain/bin/clang $(package)_cxx=$($(package)_extract_dir)/toolchain/bin/clang++ endef define $(package)_preprocess_cmds - cd $($(package)_build_subdir); ./autogen.sh && \ - sed -i.old "/define HAVE_PTHREADS/d" ld64/src/ld/InputFiles.h + cd $($(package)_build_subdir); ./autogen.sh endef define $(package)_config_cmds @@ -55,11 +53,10 @@ define $(package)_stage_cmds cd $($(package)_extract_dir)/toolchain && \ mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include && \ mkdir -p $($(package)_staging_prefix_dir)/bin $($(package)_staging_prefix_dir)/include && \ - cp bin/clang $($(package)_staging_prefix_dir)/bin/ &&\ - cp -P bin/clang++ $($(package)_staging_prefix_dir)/bin/ &&\ + cp -P bin/clang bin/clang++ $($(package)_staging_prefix_dir)/bin/ &&\ cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \ cp -rf lib/clang/$($(package)_clang_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include/ && \ - cp bin/llvm-dsymutil $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil && \ + cp bin/$(host)-dsymutil $($(package)_staging_prefix_dir)/bin && \ if `test -d include/c++/`; then cp -rf include/c++/ $($(package)_staging_prefix_dir)/include/; fi && \ if `test -d lib/c++/`; then cp -rf lib/c++/ $($(package)_staging_prefix_dir)/lib/; fi endef diff --git a/depends/packages/native_comparisontool.mk b/depends/packages/native_comparisontool.mk new file mode 100644 index 000000000..e0ae0cec7 --- /dev/null +++ b/depends/packages/native_comparisontool.mk @@ -0,0 +1,21 @@ +package=native_comparisontool +$(package)_version=8c6666f +$(package)_download_path=https://github.com/theuni/bitcoind-comparisontool/raw/master +$(package)_file_name=pull-tests-$($(package)_version).jar +$(package)_sha256_hash=a865332b3827abcde684ab79f5f43c083b0b6a4c97ff5508c79f29fee24f11cd +$(package)_install_dirname=BitcoindComparisonTool_jar +$(package)_install_filename=BitcoindComparisonTool.jar + +define $(package)_extract_cmds +endef + +define $(package)_configure_cmds +endef + +define $(package)_build_cmds +endef + +define $(package)_stage_cmds + mkdir -p $($(package)_staging_prefix_dir)/share/$($(package)_install_dirname) && \ + cp $($(package)_source) $($(package)_staging_prefix_dir)/share/$($(package)_install_dirname)/$($(package)_install_filename) +endef diff --git a/depends/packages/native_ds_store.mk b/depends/packages/native_ds_store.mk index 116fa25d3..8e902af1b 100644 --- a/depends/packages/native_ds_store.mk +++ b/depends/packages/native_ds_store.mk @@ -1,8 +1,9 @@ package=native_ds_store -$(package)_version=1.1.2 -$(package)_download_path=https://github.com/al45tair/ds_store/archive/ -$(package)_file_name=v$($(package)_version).tar.gz -$(package)_sha256_hash=3b3ecb7bf0a5157f5b6010bc3af7c141fb0ad3527084e63336220d22744bc20c +$(package)_version=c80c23706eae +$(package)_download_path=https://bitbucket.org/al45tair/ds_store/get +$(package)_download_file=$($(package)_version).tar.bz2 +$(package)_file_name=$(package)-$($(package)_version).tar.bz2 +$(package)_sha256_hash=ce1aa412211610c63d567bbe3e06213006a2d5ba5d76d89399c151b5472cb0da $(package)_install_libdir=$(build_prefix)/lib/python/dist-packages $(package)_dependencies=native_biplist diff --git a/depends/packages/native_mac_alias.mk b/depends/packages/native_mac_alias.mk index 306c83565..d117c1c9a 100644 --- a/depends/packages/native_mac_alias.mk +++ b/depends/packages/native_mac_alias.mk @@ -1,8 +1,9 @@ package=native_mac_alias -$(package)_version=2.0.7 -$(package)_download_path=https://github.com/al45tair/mac_alias/archive/ -$(package)_file_name=v$($(package)_version).tar.gz -$(package)_sha256_hash=6f606d3b6bccd2112aeabf1a063f5b5ece87005a5d7e97c8faca23b916e88838 +$(package)_version=1.1.0 +$(package)_download_path=https://bitbucket.org/al45tair/mac_alias/get +$(package)_download_file=v$($(package)_version).tar.bz2 +$(package)_file_name=$(package)-$($(package)_version).tar.bz2 +$(package)_sha256_hash=87ad827e66790028361e43fc754f68ed041a9bdb214cca03c853f079b04fb120 $(package)_install_libdir=$(build_prefix)/lib/python/dist-packages define $(package)_build_cmds diff --git a/depends/packages/openssl.mk b/depends/packages/openssl.mk index db47113b2..c6452820a 100644 --- a/depends/packages/openssl.mk +++ b/depends/packages/openssl.mk @@ -6,54 +6,18 @@ $(package)_sha256_hash=8f9faeaebad088e772f4ef5e38252d472be4d878c6b3a2718c10a4fce define $(package)_set_vars $(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" -$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl -$(package)_config_opts+=no-camellia -$(package)_config_opts+=no-capieng -$(package)_config_opts+=no-cast -$(package)_config_opts+=no-comp -$(package)_config_opts+=no-dso -$(package)_config_opts+=no-dtls1 -$(package)_config_opts+=no-ec_nistp_64_gcc_128 -$(package)_config_opts+=no-gost -$(package)_config_opts+=no-gmp -$(package)_config_opts+=no-heartbeats -$(package)_config_opts+=no-idea -$(package)_config_opts+=no-jpake -$(package)_config_opts+=no-krb5 -$(package)_config_opts+=no-libunbound -$(package)_config_opts+=no-md2 -$(package)_config_opts+=no-mdc2 -$(package)_config_opts+=no-rc4 -$(package)_config_opts+=no-rc5 -$(package)_config_opts+=no-rdrand -$(package)_config_opts+=no-rfc3779 -$(package)_config_opts+=no-rsax -$(package)_config_opts+=no-sctp -$(package)_config_opts+=no-seed -$(package)_config_opts+=no-sha0 -$(package)_config_opts+=no-shared -$(package)_config_opts+=no-ssl-trace -$(package)_config_opts+=no-ssl2 -$(package)_config_opts+=no-ssl3 -$(package)_config_opts+=no-static_engine -$(package)_config_opts+=no-store -$(package)_config_opts+=no-unit-test -$(package)_config_opts+=no-weak-ssl-ciphers -$(package)_config_opts+=no-whirlpool -$(package)_config_opts+=no-zlib -$(package)_config_opts+=no-zlib-dynamic +$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl no-zlib no-shared no-dso +$(package)_config_opts+=no-krb5 no-camellia no-capieng no-cast no-cms no-dtls1 no-gost no-gmp no-heartbeats no-idea no-jpake no-md2 +$(package)_config_opts+=no-mdc2 no-rc5 no-rdrand no-rfc3779 no-rsax no-sctp no-seed no-sha0 no-static_engine no-whirlpool no-rc2 no-rc4 no-ssl2 no-ssl3 $(package)_config_opts+=$($(package)_cflags) $($(package)_cppflags) $(package)_config_opts_linux=-fPIC -Wa,--noexecstack $(package)_config_opts_x86_64_linux=linux-x86_64 $(package)_config_opts_i686_linux=linux-generic32 $(package)_config_opts_arm_linux=linux-generic32 -$(package)_config_opts_armv7l_linux=linux-generic32 $(package)_config_opts_aarch64_linux=linux-generic64 $(package)_config_opts_mipsel_linux=linux-generic32 $(package)_config_opts_mips_linux=linux-generic32 $(package)_config_opts_powerpc_linux=linux-generic32 -$(package)_config_opts_riscv32_linux=linux-generic32 -$(package)_config_opts_riscv64_linux=linux-generic64 $(package)_config_opts_x86_64_darwin=darwin64-x86_64-cc $(package)_config_opts_x86_64_mingw32=mingw64 $(package)_config_opts_i686_mingw32=mingw diff --git a/depends/packages/packages.icu.mk b/depends/packages/packages.icu.mk new file mode 100644 index 000000000..4c7cfdfc7 --- /dev/null +++ b/depends/packages/packages.icu.mk @@ -0,0 +1 @@ +packages:=icu diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index 5fe6f98da..13b894c2f 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -1,10 +1,12 @@ -packages:=boost openssl libevent zeromq +packages:=boost openssl libevent +darwin_packages:=zeromq +linux_packages:=zeromq +native_packages := native_ccache native_comparisontool qt_native_packages = native_protobuf -qt_packages = qrencode protobuf zlib - -qt_linux_packages:=qt expat dbus libxcb xcb_proto libXau xproto freetype fontconfig libX11 xextproto libXext xtrans +qt_packages = qrencode protobuf +qt_linux_packages= qt expat dbus libxcb xcb_proto libXau xproto freetype fontconfig libX11 xextproto libXext xtrans qt_darwin_packages=qt qt_mingw32_packages=qt diff --git a/depends/packages/protobuf.mk b/depends/packages/protobuf.mk index 54d3fd924..5affad283 100644 --- a/depends/packages/protobuf.mk +++ b/depends/packages/protobuf.mk @@ -4,7 +4,6 @@ $(package)_download_path=$(native_$(package)_download_path) $(package)_file_name=$(native_$(package)_file_name) $(package)_sha256_hash=$(native_$(package)_sha256_hash) $(package)_dependencies=native_$(package) -$(package)_cxxflags=-std=c++11 define $(package)_set_vars $(package)_config_opts=--disable-shared --with-protoc=$(build_prefix)/bin/protoc diff --git a/depends/packages/qrencode.mk b/depends/packages/qrencode.mk index 44fdf1c29..7b2124713 100644 --- a/depends/packages/qrencode.mk +++ b/depends/packages/qrencode.mk @@ -1,7 +1,7 @@ package=qrencode $(package)_version=3.4.4 $(package)_download_path=https://fukuchi.org/works/qrencode/ -$(package)_file_name=$(package)-$($(package)_version).tar.bz2 +$(package)_file_name=qrencode-$(qrencode_version).tar.bz2 $(package)_sha256_hash=efe5188b1ddbcbf98763b819b146be6a90481aac30cfc8d858ab78a19cde1fa5 define $(package)_set_vars diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 113b8dbc3..77df77b73 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -1,47 +1,42 @@ PACKAGE=qt -$(package)_version=5.9.6 -$(package)_download_path=https://download.qt.io/official_releases/qt/5.9/$($(package)_version)/submodules -$(package)_suffix=opensource-src-$($(package)_version).tar.xz +$(package)_version=5.5.0 +$(package)_download_path=http://download.qt.io/official_releases/qt/5.5/$($(package)_version)/submodules +$(package)_suffix=opensource-src-$($(package)_version).tar.gz $(package)_file_name=qtbase-$($(package)_suffix) -$(package)_sha256_hash=eed620cb268b199bd83b3fc6a471c51d51e1dc2dbb5374fc97a0cc75facbe36f -$(package)_dependencies=openssl zlib -$(package)_linux_dependencies=freetype fontconfig libxcb libX11 xproto libXext +$(package)_sha256_hash=7e82b1318f88e56a2a9376e069aa608d4fd96b48cb0e1b880ae658b0a1af0561 +$(package)_dependencies=openssl +$(package)_linux_dependencies=freetype fontconfig dbus libxcb libX11 xproto libXext $(package)_build_subdir=qtbase $(package)_qt_libs=corelib network widgets gui plugins testlib -$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch xkb-default.patch +$(package)_patches=mac-qmake.conf fix-xcb-include-order.patch mingw-uuidof.patch pidlist_absolute.patch $(package)_qttranslations_file_name=qttranslations-$($(package)_suffix) -$(package)_qttranslations_sha256_hash=9822084f8e2d2939ba39f4af4c0c2320e45d5996762a9423f833055607604ed8 +$(package)_qttranslations_sha256_hash=c4bd6db6e426965c6f8824c54e81f68bbd61e2bae1bcadc328c6e81c45902a0d $(package)_qttools_file_name=qttools-$($(package)_suffix) -$(package)_qttools_sha256_hash=50e75417ec0c74bb8b1989d1d8e981ee83690dce7dfc0c2169f7c00f397e5117 +$(package)_qttools_sha256_hash=d9e06bd19ecc86afba5e95d45a906d1bc1ad579aa70001e36143c1aaf695bdd6 $(package)_extra_sources = $($(package)_qttranslations_file_name) $(package)_extra_sources += $($(package)_qttools_file_name) define $(package)_set_vars $(package)_config_opts_release = -release -$(package)_config_opts_debug = -debug -$(package)_config_opts += -bindir $(build_prefix)/bin -$(package)_config_opts += -c++std c++11 -$(package)_config_opts += -confirm-license -$(package)_config_opts += -dbus-runtime -$(package)_config_opts += -hostprefix $(build_prefix) -$(package)_config_opts += -no-cups -$(package)_config_opts += -no-egl -$(package)_config_opts += -no-eglfs -$(package)_config_opts += -no-freetype -$(package)_config_opts += -no-gif +$(package)_config_opts_debug = -debug +$(package)_config_opts += -opensource -confirm-license +$(package)_config_opts += -no-audio-backend $(package)_config_opts += -no-glib $(package)_config_opts += -no-icu +$(package)_config_opts += -no-cups $(package)_config_opts += -no-iconv -$(package)_config_opts += -no-kms -$(package)_config_opts += -no-linuxfb -$(package)_config_opts += -no-libudev -$(package)_config_opts += -no-mtdev -$(package)_config_opts += -no-openvg -$(package)_config_opts += -no-reduce-relocations +$(package)_config_opts += -no-gif +$(package)_config_opts += -no-freetype +$(package)_config_opts += -no-nis +$(package)_config_opts += -no-pch $(package)_config_opts += -no-qml-debug +$(package)_config_opts += -nomake examples +$(package)_config_opts += -nomake tests +$(package)_config_opts += -no-feature-style-windowsmobile +$(package)_config_opts += -no-feature-style-windowsce $(package)_config_opts += -no-sql-db2 $(package)_config_opts += -no-sql-ibase $(package)_config_opts += -no-sql-oci @@ -51,27 +46,36 @@ $(package)_config_opts += -no-sql-odbc $(package)_config_opts += -no-sql-psql $(package)_config_opts += -no-sql-sqlite $(package)_config_opts += -no-sql-sqlite2 -$(package)_config_opts += -no-use-gold-linker -$(package)_config_opts += -no-xinput2 -$(package)_config_opts += -nomake examples -$(package)_config_opts += -nomake tests -$(package)_config_opts += -opensource -$(package)_config_opts += -openssl-linked -$(package)_config_opts += -optimized-qmake -$(package)_config_opts += -pch -$(package)_config_opts += -pkg-config $(package)_config_opts += -prefix $(host_prefix) -$(package)_config_opts += -qt-libpng -$(package)_config_opts += -qt-libjpeg -$(package)_config_opts += -qt-pcre -$(package)_config_opts += -system-zlib +$(package)_config_opts += -hostprefix $(build_prefix) +$(package)_config_opts += -bindir $(build_prefix)/bin +$(package)_config_opts += -no-c++11 +$(package)_config_opts += -openssl-linked +$(package)_config_opts += -v $(package)_config_opts += -static $(package)_config_opts += -silent -$(package)_config_opts += -v -$(package)_config_opts += -no-feature-printer -$(package)_config_opts += -no-feature-printdialog -$(package)_config_opts += -no-feature-concurrent -$(package)_config_opts += -no-feature-xml +$(package)_config_opts += -pkg-config +$(package)_config_opts += -qt-libpng +$(package)_config_opts += -qt-libjpeg +$(package)_config_opts += -qt-zlib +$(package)_config_opts += -qt-pcre +$(package)_config_opts += -no-pulseaudio +$(package)_config_opts += -no-openvg +$(package)_config_opts += -no-xrender +$(package)_config_opts += -no-alsa +$(package)_config_opts += -no-mtdev +$(package)_config_opts += -no-gstreamer +$(package)_config_opts += -no-mitshm +$(package)_config_opts += -no-kms +$(package)_config_opts += -no-reduce-relocations +$(package)_config_opts += -no-egl +$(package)_config_opts += -no-eglfs +$(package)_config_opts += -no-linuxfb +$(package)_config_opts += -no-xinput2 +$(package)_config_opts += -no-libudev +$(package)_config_opts += -no-use-gold-linker +$(package)_config_opts += -reduce-exports +$(package)_config_opts += -optimized-qmake ifneq ($(build_os),darwin) $(package)_config_opts_darwin = -xplatform macx-clang-linux @@ -83,19 +87,16 @@ $(package)_config_opts_darwin += -device-option MAC_TARGET=$(host) $(package)_config_opts_darwin += -device-option MAC_LD64_VERSION=$(LD64_VERSION) endif -$(package)_config_opts_linux = -qt-xkbcommon-x11 +$(package)_config_opts_linux = -qt-xkbcommon $(package)_config_opts_linux += -qt-xcb $(package)_config_opts_linux += -system-freetype -$(package)_config_opts_linux += -no-feature-sessionmanager +$(package)_config_opts_linux += -no-sm $(package)_config_opts_linux += -fontconfig $(package)_config_opts_linux += -no-opengl -$(package)_config_opts_arm_linux += -platform linux-g++ -xplatform bitcoin-linux-g++ +$(package)_config_opts_arm_linux = -platform linux-g++ -xplatform $(host) $(package)_config_opts_i686_linux = -xplatform linux-g++-32 -$(package)_config_opts_x86_64_linux = -xplatform linux-g++-64 -$(package)_config_opts_aarch64_linux = -xplatform linux-aarch64-gnu-g++ $(package)_config_opts_mingw32 = -no-opengl -xplatform win32-g++ -device-option CROSS_COMPILE="$(host)-" $(package)_build_env = QT_RCC_TEST=1 -$(package)_build_env += QT_RCC_SOURCE_DATE_OVERRIDE=1 endef define $(package)_fetch_cmds @@ -119,33 +120,24 @@ define $(package)_extract_cmds endef define $(package)_preprocess_cmds - sed -i.old "s|FT_Get_Font_Format|FT_Get_X11_Font_Format|" qtbase/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp && \ sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \ - sed -i.old "/updateqm.depends =/d" qttranslations/translations/translations.pro && \ - sed -i.old "s/src_plugins.depends = src_sql src_network/src_plugins.depends = src_network/" qtbase/src/src.pro && \ + sed -i.old "s/src_plugins.depends = src_sql src_xml src_network/src_plugins.depends = src_xml src_network/" qtbase/src/src.pro && \ sed -i.old "s|X11/extensions/XIproto.h|X11/X.h|" qtbase/src/plugins/platforms/xcb/qxcbxsettings.cpp && \ sed -i.old 's/if \[ "$$$$XPLATFORM_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/if \[ "$$$$BUILD_ON_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/' qtbase/configure && \ - sed -i.old 's/CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0)/CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, kCGMouseButtonLeft)/' qtbase/src/plugins/platforms/cocoa/qcocoacursor.mm && \ mkdir -p qtbase/mkspecs/macx-clang-linux &&\ cp -f qtbase/mkspecs/macx-clang/Info.plist.lib qtbase/mkspecs/macx-clang-linux/ &&\ cp -f qtbase/mkspecs/macx-clang/Info.plist.app qtbase/mkspecs/macx-clang-linux/ &&\ cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\ cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \ - cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \ - sed -i.old "s/arm-linux-gnueabi-/$(host)-/g" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ - patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch &&\ - patch -p1 -i $($(package)_patch_dir)/fix_configure_mac.patch &&\ - patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch &&\ - patch -p1 -i $($(package)_patch_dir)/fix_rcc_determinism.patch &&\ - patch -p1 -i $($(package)_patch_dir)/xkb-default.patch &&\ - echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ - echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ - echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ - echo "QMAKE_LINK_OBJECT_MAX = 10" >> qtbase/mkspecs/win32-g++/qmake.conf &&\ - echo "QMAKE_LINK_OBJECT_SCRIPT = object_script" >> qtbase/mkspecs/win32-g++/qmake.conf &&\ - sed -i.old "s|QMAKE_CFLAGS = |!host_build: QMAKE_CFLAGS = $($(package)_cflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \ - sed -i.old "s|QMAKE_LFLAGS = |!host_build: QMAKE_LFLAGS = $($(package)_ldflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \ - sed -i.old "s|QMAKE_CXXFLAGS = |!host_build: QMAKE_CXXFLAGS = $($(package)_cxxflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf + patch -p1 < $($(package)_patch_dir)/fix-xcb-include-order.patch && \ + patch -p1 < $($(package)_patch_dir)/mingw-uuidof.patch && \ + patch -p1 < $($(package)_patch_dir)/pidlist_absolute.patch && \ + echo "QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ + echo "QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ + echo "QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ + sed -i.old "s|QMAKE_CFLAGS = |QMAKE_CFLAGS = $($(package)_cflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \ + sed -i.old "s|QMAKE_LFLAGS = |QMAKE_LFLAGS = $($(package)_ldflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \ + sed -i.old "s|QMAKE_CXXFLAGS = |QMAKE_CXXFLAGS = $($(package)_cxxflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf endef define $(package)_config_cmds @@ -153,26 +145,21 @@ define $(package)_config_cmds export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \ export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \ ./configure $($(package)_config_opts) && \ - echo "host_build: QT_CONFIG ~= s/system-zlib/zlib" >> mkspecs/qconfig.pri && \ - echo "CONFIG += force_bootstrap" >> mkspecs/qconfig.pri && \ $(MAKE) sub-src-clean && \ cd ../qttranslations && ../qtbase/bin/qmake qttranslations.pro -o Makefile && \ - cd translations && ../../qtbase/bin/qmake translations.pro -o Makefile && cd ../.. && \ - cd qttools/src/linguist/lrelease/ && ../../../../qtbase/bin/qmake lrelease.pro -o Makefile && \ - cd ../lupdate/ && ../../../../qtbase/bin/qmake lupdate.pro -o Makefile && cd ../../../.. + cd translations && ../../qtbase/bin/qmake translations.pro -o Makefile && cd ../.. &&\ + cd qttools/src/linguist/lrelease/ && ../../../../qtbase/bin/qmake lrelease.pro -o Makefile endef define $(package)_build_cmds $(MAKE) -C src $(addprefix sub-,$($(package)_qt_libs)) && \ $(MAKE) -C ../qttools/src/linguist/lrelease && \ - $(MAKE) -C ../qttools/src/linguist/lupdate && \ $(MAKE) -C ../qttranslations endef define $(package)_stage_cmds - $(MAKE) -C src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && cd .. && \ + $(MAKE) -C src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && cd .. &&\ $(MAKE) -C qttools/src/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install_target && \ - $(MAKE) -C qttools/src/linguist/lupdate INSTALL_ROOT=$($(package)_staging_dir) install_target && \ $(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets && \ if `test -f qtbase/src/plugins/platforms/xcb/xcb-static/libxcb-static.a`; then \ cp qtbase/src/plugins/platforms/xcb/xcb-static/libxcb-static.a $($(package)_staging_prefix_dir)/lib; \ diff --git a/depends/packages/qt46.mk b/depends/packages/qt46.mk new file mode 100644 index 000000000..8fb30a5c4 --- /dev/null +++ b/depends/packages/qt46.mk @@ -0,0 +1,66 @@ +PACKAGE=qt46 +$(package)_version=4.6.4 +$(package)_download_path=http://download.qt-project.org/archive/qt/4.6/ +$(package)_file_name=qt-everywhere-opensource-src-$($(package)_version).tar.gz +$(package)_sha256_hash=9ad4d46c721b53a429ed5a2eecfd3c239a9ab566562f183f99d3125f1a234250 +$(package)_dependencies=openssl freetype dbus libX11 xproto libXext libICE libSM +$(package)_patches=stlfix.patch + +define $(package)_set_vars +$(package)_config_opts = -prefix $(host_prefix) -headerdir $(host_prefix)/include/qt4 -bindir $(build_prefix)/bin +$(package)_config_opts += -release -no-separate-debug-info -opensource -confirm-license +$(package)_config_opts += -stl -qt-zlib + +$(package)_config_opts += -nomake examples -nomake tests -nomake tools -nomake translations -nomake demos -nomake docs +$(package)_config_opts += -no-audio-backend -no-glib -no-nis -no-cups -no-iconv -no-gif -no-pch +$(package)_config_opts += -no-xkb -no-xrender -no-xrandr -no-xfixes -no-xcursor -no-xinerama -no-xsync -no-xinput -no-mitshm -no-xshape +$(package)_config_opts += -no-libtiff -no-fontconfig -openssl-linked +$(package)_config_opts += -no-sql-db2 -no-sql-ibase -no-sql-oci -no-sql-tds -no-sql-mysql +$(package)_config_opts += -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 +$(package)_config_opts += -no-xmlpatterns -no-multimedia -no-phonon -no-scripttools -no-declarative +$(package)_config_opts += -no-phonon-backend -no-webkit -no-javascript-jit -no-script +$(package)_config_opts += -no-svg -no-libjpeg -no-libtiff -no-libpng -no-libmng -no-qt3support -no-opengl + +$(package)_config_opts_x86_64_linux += -platform linux-g++-64 +$(package)_config_opts_i686_linux = -platform linux-g++-32 +$(package)_build_env = QT_RCC_TEST=1 +endef + +define $(package)_preprocess_cmds + sed -i.old "s|/include /usr/include||" config.tests/unix/freetype/freetype.pri && \ + sed -i.old "s|src_plugins.depends = src_gui src_sql src_svg|src_plugins.depends = src_gui src_sql|" src/src.pro && \ + sed -i.old "s|\.lower(|\.toLower(|g" src/network/ssl/qsslsocket_openssl.cpp && \ + sed -i.old "s|Key_BackSpace|Key_Backspace|" src/gui/itemviews/qabstractitemview.cpp && \ + sed -i.old "s|/usr/X11R6/lib64|$(host_prefix)/lib|" mkspecs/*/*.conf && \ + sed -i.old "s|/usr/X11R6/lib|$(host_prefix)/lib|" mkspecs/*/*.conf && \ + sed -i.old "s|/usr/X11R6/include|$(host_prefix)/include|" mkspecs/*/*.conf && \ + sed -i.old "s|QMAKE_LFLAGS_SHLIB\t+= -shared|QMAKE_LFLAGS_SHLIB\t+= -shared -Wl,--exclude-libs,ALL|" mkspecs/common/g++.conf && \ + sed -i.old "/SSLv2_client_method/d" src/network/ssl/qsslsocket_openssl.cpp src/network/ssl/qsslsocket_openssl_symbols.cpp && \ + sed -i.old "/SSLv2_server_method/d" src/network/ssl/qsslsocket_openssl.cpp src/network/ssl/qsslsocket_openssl_symbols.cpp && \ + patch -p1 < $($(package)_patch_dir)/stlfix.patch +endef + +define $(package)_config_cmds + export PKG_CONFIG_SYSROOT_DIR=/ && \ + export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \ + export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \ + export CPATH=$(host_prefix)/include && \ + OPENSSL_LIBS='-L$(host_prefix)/lib -lssl -lcrypto' ./configure $($(package)_config_opts) && \ + cd tools/linguist/lrelease; ../../../bin/qmake -o Makefile lrelease.pro +endef + +define $(package)_build_cmds + export CPATH=$(host_prefix)/include && \ + $(MAKE) -C src && \ + $(MAKE) -C tools/linguist/lrelease +endef + +define $(package)_stage_cmds + $(MAKE) -C src INSTALL_ROOT=$($(package)_staging_dir) install && \ + $(MAKE) -C tools/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install +endef + +define $(package)_postprocess_cmds + rm -rf mkspecs/ lib/cmake/ lib/*.prl lib/*.la && \ + find native/bin -type f -exec mv {} {}-qt4 \; +endef diff --git a/depends/packages/xextproto.mk b/depends/packages/xextproto.mk index 7065237bd..98a11eb49 100644 --- a/depends/packages/xextproto.mk +++ b/depends/packages/xextproto.mk @@ -4,10 +4,6 @@ $(package)_download_path=http://xorg.freedesktop.org/releases/individual/proto $(package)_file_name=$(package)-$($(package)_version).tar.bz2 $(package)_sha256_hash=f3f4b23ac8db9c3a9e0d8edb591713f3d70ef9c3b175970dd8823dfc92aa5bb0 -define $(package)_preprocess_cmds - cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub . -endef - define $(package)_set_vars $(package)_config_opts=--disable-shared endef diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index dfbc50580..7b866e9c0 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -1,20 +1,12 @@ package=zeromq -$(package)_version=4.3.1 -$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/ +$(package)_version=4.0.7 +$(package)_download_path=http://download.zeromq.org $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=bcbabe1e2c7d0eec4ed612e10b94b112dd5f06fcefa994a0c79a45d835cd21eb -$(package)_patches=0001-fix-build-with-older-mingw64.patch 0002-disable-pthread_set_name_np.patch +$(package)_sha256_hash=e00b2967e074990d0538361cc79084a0a92892df2c6e7585da34e4c61ee47b03 define $(package)_set_vars - $(package)_config_opts=--without-docs --disable-shared --without-libsodium --disable-curve --disable-curve-keygen --disable-perf --disable-Werror + $(package)_config_opts=--without-documentation --disable-shared $(package)_config_opts_linux=--with-pic - $(package)_cxxflags=-std=c++11 -endef - -define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/0001-fix-build-with-older-mingw64.patch && \ - patch -p1 < $($(package)_patch_dir)/0002-disable-pthread_set_name_np.patch && \ - cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub config endef define $(package)_config_cmds @@ -22,14 +14,13 @@ define $(package)_config_cmds endef define $(package)_build_cmds - $(MAKE) src/libzmq.la + $(MAKE) -C src endef define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install-libLTLIBRARIES install-includeHEADERS install-pkgconfigDATA + $(MAKE) -C src DESTDIR=$($(package)_staging_dir) install endef define $(package)_postprocess_cmds - sed -i.old "s/ -lstdc++//" lib/pkgconfig/libzmq.pc && \ rm -rf bin share endef diff --git a/depends/packages/zlib.mk b/depends/packages/zlib.mk deleted file mode 100644 index 589490800..000000000 --- a/depends/packages/zlib.mk +++ /dev/null @@ -1,27 +0,0 @@ -package=zlib -$(package)_version=1.2.11 -$(package)_download_path=http://www.zlib.net -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 - -define $(package)_set_vars -$(package)_build_opts= CC="$($(package)_cc)" -$(package)_build_opts+=CFLAGS="$($(package)_cflags) $($(package)_cppflags) -fPIC" -$(package)_build_opts+=RANLIB="$($(package)_ranlib)" -$(package)_build_opts+=AR="$($(package)_ar)" -$(package)_build_opts_darwin+=AR="$($(package)_libtool)" -$(package)_build_opts_darwin+=ARFLAGS="-o" -endef - -define $(package)_config_cmds - ./configure --static --prefix=$(host_prefix) -endef - -define $(package)_build_cmds - $(MAKE) $($(package)_build_opts) libz.a -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install $($(package)_build_opts) -endef - diff --git a/depends/patches/libevent/reuseaddr.patch b/depends/patches/libevent/reuseaddr.patch new file mode 100644 index 000000000..58695c11f --- /dev/null +++ b/depends/patches/libevent/reuseaddr.patch @@ -0,0 +1,21 @@ +--- old/evutil.c 2015-08-28 19:26:23.488765923 -0400 ++++ new/evutil.c 2015-08-28 19:27:41.392767019 -0400 +@@ -321,15 +321,16 @@ + int + evutil_make_listen_socket_reuseable(evutil_socket_t sock) + { +-#ifndef WIN32 + int one = 1; ++#ifndef WIN32 + /* REUSEADDR on Unix means, "don't hang on to this address after the + * listener is closed." On Windows, though, it means "don't keep other + * processes from binding to this address while we're using it. */ + return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &one, + (ev_socklen_t)sizeof(one)); + #else +- return 0; ++ return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*) &one, ++ (ev_socklen_t)sizeof(one)); + #endif + } + diff --git a/depends/patches/qt/fix-xcb-include-order.patch b/depends/patches/qt/fix-xcb-include-order.patch new file mode 100644 index 000000000..ae469ea94 --- /dev/null +++ b/depends/patches/qt/fix-xcb-include-order.patch @@ -0,0 +1,45 @@ +--- old/qtbase/src/plugins/platforms/xcb/xcb_qpa_lib.pro 2015-03-17 02:06:42.705930685 +0000 ++++ new/qtbase/src/plugins/platforms/xcb/xcb_qpa_lib.pro 2015-03-17 02:08:41.281926351 +0000 +@@ -94,8 +94,6 @@ + + DEFINES += $$QMAKE_DEFINES_XCB + LIBS += $$QMAKE_LIBS_XCB +-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB +-QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB + + CONFIG += qpa/genericunixfontdatabase + +@@ -104,7 +102,8 @@ + contains(QT_CONFIG, xcb-qt) { + DEFINES += XCB_USE_RENDER + XCB_DIR = ../../../3rdparty/xcb +- INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude ++ QMAKE_CFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/sysinclude $$QMAKE_CFLAGS_XCB ++ QMAKE_CXXFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/sysinclude $$QMAKE_CFLAGS_XCB + LIBS += -lxcb -L$$OUT_PWD/xcb-static -lxcb-static + } else { + LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms +--- old/qtbase/src/plugins/platforms/xcb/xcb-static/xcb-static.pro 2015-03-17 02:07:04.641929383 +0000 ++++ new/qtbase/src/plugins/platforms/xcb/xcb-static/xcb-static.pro 2015-03-17 02:10:15.485922059 +0000 +@@ -8,7 +8,8 @@ + + XCB_DIR = ../../../../3rdparty/xcb + +-INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude ++QMAKE_CFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/include/xcb -I$$XCB_DIR/sysinclude ++QMAKE_CXXFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/include/xcb -I$$XCB_DIR/sysinclude + + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB + QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB +--- old/qtbase/src/plugins/platforms/xcb/xcb-plugin.pro 2015-07-24 16:02:59.530038830 -0400 ++++ new/qtbase/src/plugins/platforms/xcb/xcb-plugin.pro 2015-07-24 16:01:22.106037459 -0400 +@@ -11,3 +11,9 @@ + qxcbmain.cpp + OTHER_FILES += xcb.json README + ++contains(QT_CONFIG, xcb-qt) { ++ DEFINES += XCB_USE_RENDER ++ XCB_DIR = ../../../3rdparty/xcb ++ QMAKE_CFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/sysinclude $$QMAKE_CFLAGS_XCB ++ QMAKE_CXXFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/sysinclude $$QMAKE_CFLAGS_XCB ++} diff --git a/depends/patches/qt/fix_configure_mac.patch b/depends/patches/qt/fix_configure_mac.patch deleted file mode 100644 index 0d7dd647d..000000000 --- a/depends/patches/qt/fix_configure_mac.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- old/qtbase/mkspecs/features/mac/sdk.prf 2018-02-08 10:24:48.000000000 -0800 -+++ new/qtbase/mkspecs/features/mac/sdk.prf 2018-03-23 10:38:56.000000000 -0700 -@@ -8,21 +8,21 @@ - defineReplace(xcodeSDKInfo) { - info = $$1 - equals(info, "Path"): \ -- info = --show-sdk-path -+ infoarg = --show-sdk-path - equals(info, "PlatformPath"): \ -- info = --show-sdk-platform-path -+ infoarg = --show-sdk-platform-path - equals(info, "SDKVersion"): \ -- info = --show-sdk-version -+ infoarg = --show-sdk-version - sdk = $$2 - isEmpty(sdk): \ - sdk = $$QMAKE_MAC_SDK - - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) { -- QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null") -+ QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null") - # --show-sdk-platform-path won't work for Command Line Tools; this is fine - # only used by the XCTest backend to testlib -- isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \ -- error("Could not resolve SDK $$info for \'$$sdk\'") -+ isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \ -+ error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg") - cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info}) - } - ---- old/qtbase/configure 2018-02-08 10:24:48.000000000 -0800 -+++ new/qtbase/configure 2018-03-23 05:42:29.000000000 -0700 -@@ -232,8 +232,13 @@ - - sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1") - if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi -- sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null) -- if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi -+ sysroot=$(getSingleQMakeVariable "QMAKE_MAC_SDK_PATH" "$1") -+ -+ echo "sysroot pre-configured as $sysroot"; -+ if [ -z "$sysroot" ]; then -+ sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null) -+ if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi -+ fi - - case "$sdk" in - macosx*) - - diff --git a/depends/patches/qt/fix_no_printer.patch b/depends/patches/qt/fix_no_printer.patch deleted file mode 100644 index f868ca257..000000000 --- a/depends/patches/qt/fix_no_printer.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- x/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h -+++ y/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h -@@ -52,6 +52,7 @@ - // - - #include -+#include - - #ifndef QT_NO_PRINTER - ---- x/qtbase/src/plugins/plugins.pro -+++ y/qtbase/src/plugins/plugins.pro -@@ -8,6 +8,3 @@ qtHaveModule(gui) { - qtConfig(imageformatplugin): SUBDIRS *= imageformats - !android:qtConfig(library): SUBDIRS *= generic - } -- --!winrt:qtHaveModule(printsupport): \ -- SUBDIRS += printsupport diff --git a/depends/patches/qt/fix_qt_pkgconfig.patch b/depends/patches/qt/fix_qt_pkgconfig.patch deleted file mode 100644 index 34302a9f2..000000000 --- a/depends/patches/qt/fix_qt_pkgconfig.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- old/qtbase/mkspecs/features/qt_module.prf -+++ new/qtbase/mkspecs/features/qt_module.prf -@@ -245,7 +245,7 @@ - load(qt_targets) - - # this builds on top of qt_common --!internal_module:!lib_bundle:if(unix|mingw) { -+unix|mingw { - CONFIG += create_pc - QMAKE_PKGCONFIG_DESTDIR = pkgconfig - host_build: \ diff --git a/depends/patches/qt/fix_rcc_determinism.patch b/depends/patches/qt/fix_rcc_determinism.patch deleted file mode 100644 index c1b07fe23..000000000 --- a/depends/patches/qt/fix_rcc_determinism.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- old/qtbase/src/tools/rcc/rcc.cpp -+++ new/qtbase/src/tools/rcc/rcc.cpp -@@ -207,7 +207,11 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib) - if (lib.formatVersion() >= 2) { - // last modified time stamp - const QDateTime lastModified = m_fileInfo.lastModified(); -- lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0)); -+ quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0); -+ static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong(); -+ if (sourceDate != 0) -+ lastmod = sourceDate; -+ lib.writeNumber8(lastmod); - if (text || pass1) - lib.writeChar('\n'); - } diff --git a/depends/patches/qt/mac-qmake.conf b/depends/patches/qt/mac-qmake.conf index 337d0eb9c..a6d0070cc 100644 --- a/depends/patches/qt/mac-qmake.conf +++ b/depends/patches/qt/mac-qmake.conf @@ -1,5 +1,6 @@ MAKEFILE_GENERATOR = UNIX CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname absolute_library_soname +DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG QMAKE_INCREMENTAL_STYLE = sublib include(../common/macx.conf) include(../common/gcc-base-mac.conf) @@ -10,15 +11,14 @@ QMAKE_XCODE_VERSION=4.3 QMAKE_XCODE_DEVELOPER_PATH=/Developer QMAKE_MACOSX_DEPLOYMENT_TARGET = $${MAC_MIN_VERSION} QMAKE_MAC_SDK=macosx -QMAKE_MAC_SDK.macosx.Path = $${MAC_SDK_PATH} +QMAKE_MAC_SDK.macosx.path = $${MAC_SDK_PATH} QMAKE_MAC_SDK.macosx.platform_name = macosx -QMAKE_MAC_SDK.macosx.SDKVersion = $${MAC_SDK_VERSION} -QMAKE_MAC_SDK.macosx.PlatformPath = /phony -QMAKE_APPLE_DEVICE_ARCHS=x86_64 -!host_build: QMAKE_CFLAGS += -target $${MAC_TARGET} -!host_build: QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS -!host_build: QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -!host_build: QMAKE_LFLAGS += -target $${MAC_TARGET} -mlinker-version=$${MAC_LD64_VERSION} +QMAKE_MAC_SDK.macosx.version = $${MAC_SDK_VERSION} +QMAKE_MAC_SDK.macosx.platform_path = /phony +QMAKE_CFLAGS += -target $${MAC_TARGET} +QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_LFLAGS += -target $${MAC_TARGET} -mlinker-version=$${MAC_LD64_VERSION} QMAKE_AR = $${CROSS_COMPILE}ar cq QMAKE_RANLIB=$${CROSS_COMPILE}ranlib QMAKE_LIBTOOL=$${CROSS_COMPILE}libtool diff --git a/depends/patches/qt/mingw-uuidof.patch b/depends/patches/qt/mingw-uuidof.patch new file mode 100644 index 000000000..975366e61 --- /dev/null +++ b/depends/patches/qt/mingw-uuidof.patch @@ -0,0 +1,44 @@ +--- old/qtbase/src/plugins/platforms/windows/qwindowscontext.cpp 2015-06-20 17:40:20.956781548 -0400 ++++ new/qtbase/src/plugins/platforms/windows/qwindowscontext.cpp 2015-06-20 17:29:32.052772416 -0400 +@@ -69,7 +69,7 @@ + #include + #include + #include +-#ifndef Q_OS_WINCE ++#if !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1)) + # include + #endif + +@@ -762,7 +762,7 @@ + HWND_MESSAGE, NULL, (HINSTANCE)GetModuleHandle(0), NULL); + } + +-#ifndef Q_OS_WINCE ++#if !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1)) + // Re-engineered from the inline function _com_error::ErrorMessage(). + // We cannot use it directly since it uses swprintf_s(), which is not + // present in the MSVCRT.DLL found on Windows XP (QTBUG-35617). +@@ -781,7 +781,7 @@ + return QStringLiteral("IDispatch error #") + QString::number(wCode); + return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16); + } +-#endif // !Q_OS_WINCE ++#endif // !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1)) + + /*! + \brief Common COM error strings. +@@ -846,12 +846,12 @@ + default: + break; + } +-#ifndef Q_OS_WINCE ++#if !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1)) + _com_error error(hr); + result += QByteArrayLiteral(" ("); + result += errorMessageFromComError(error); + result += ')'; +-#endif // !Q_OS_WINCE ++#endif // !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1)) + return result; + } + diff --git a/depends/patches/qt/pidlist_absolute.patch b/depends/patches/qt/pidlist_absolute.patch new file mode 100644 index 000000000..0b49c050d --- /dev/null +++ b/depends/patches/qt/pidlist_absolute.patch @@ -0,0 +1,37 @@ +diff -dur old/qtbase/src/plugins/platforms/windows/qwindowscontext.h new/qtbase/src/plugins/platforms/windows/qwindowscontext.h +--- old/qtbase/src/plugins/platforms/windows/qwindowscontext.h 2015-06-29 22:04:40.000000000 +0200 ++++ new/qtbase/src/plugins/platforms/windows/qwindowscontext.h 2015-11-01 12:55:59.751234846 +0100 +@@ -124,10 +124,18 @@ + inline void init(); + + typedef HRESULT (WINAPI *SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **); ++#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3) ++ typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, ITEMIDLIST **); ++#else + typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, PIDLIST_ABSOLUTE *); ++#endif + typedef HRESULT (WINAPI *SHGetStockIconInfo)(int , int , _SHSTOCKICONINFO *); + typedef HRESULT (WINAPI *SHGetImageList)(int, REFIID , void **); ++#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3) ++ typedef HRESULT (WINAPI *SHCreateItemFromIDList)(const ITEMIDLIST *, REFIID, void **); ++#else + typedef HRESULT (WINAPI *SHCreateItemFromIDList)(PCIDLIST_ABSOLUTE, REFIID, void **); ++#endif + + SHCreateItemFromParsingName sHCreateItemFromParsingName; + SHGetKnownFolderIDList sHGetKnownFolderIDList; +diff -dur old/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp new/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +--- old/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp 2015-06-29 22:04:40.000000000 +0200 ++++ new/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp 2015-11-01 13:41:09.503149772 +0100 +@@ -1008,7 +1008,11 @@ + qWarning() << __FUNCTION__ << ": Invalid CLSID: " << url.path(); + return Q_NULLPTR; + } ++#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3) ++ ITEMIDLIST *idList; ++#else + PIDLIST_ABSOLUTE idList; ++#endif + HRESULT hr = QWindowsContext::shell32dll.sHGetKnownFolderIDList(uuid, 0, 0, &idList); + if (FAILED(hr)) { + qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString())); diff --git a/depends/patches/qt/xkb-default.patch b/depends/patches/qt/xkb-default.patch deleted file mode 100644 index 165abf3e2..000000000 --- a/depends/patches/qt/xkb-default.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- old/qtbase/src/gui/configure.pri 2018-06-06 17:28:10.000000000 -0400 -+++ new/qtbase/src/gui/configure.pri 2018-08-17 18:43:01.589384567 -0400 -@@ -43,18 +43,11 @@ - } - - defineTest(qtConfTest_xkbConfigRoot) { -- qtConfTest_getPkgConfigVariable($${1}): return(true) -- -- for (dir, $$list("/usr/share/X11/xkb", "/usr/local/share/X11/xkb")) { -- exists($$dir) { -- $${1}.value = $$dir -- export($${1}.value) -- $${1}.cache += value -- export($${1}.cache) -- return(true) -- } -- } -- return(false) -+ $${1}.value = "/usr/share/X11/xkb" -+ export($${1}.value) -+ $${1}.cache += value -+ export($${1}.cache) -+ return(true) - } - - defineTest(qtConfTest_qpaDefaultPlatform) { diff --git a/depends/patches/qt46/stlfix.patch b/depends/patches/qt46/stlfix.patch new file mode 100644 index 000000000..f8f6fb04b --- /dev/null +++ b/depends/patches/qt46/stlfix.patch @@ -0,0 +1,10 @@ +--- old/config.tests/unix/stl/stltest.cpp 2011-06-23 03:45:23.000000000 -0400 ++++ new/config.tests/unix/stl/stltest.cpp 2014-08-28 00:54:04.154837604 -0400 +@@ -49,6 +49,7 @@ + #include + #include + #include ++#include + + // something mean to see if the compiler and C++ standard lib are good enough + template diff --git a/depends/patches/zeromq/0001-fix-build-with-older-mingw64.patch b/depends/patches/zeromq/0001-fix-build-with-older-mingw64.patch deleted file mode 100644 index a6c508fb8..000000000 --- a/depends/patches/zeromq/0001-fix-build-with-older-mingw64.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1a159c128c69a42d90819375c06a39994f3fbfc1 Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Tue, 28 Nov 2017 20:33:25 -0500 -Subject: [PATCH] fix build with older mingw64 - ---- - src/windows.hpp | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/windows.hpp b/src/windows.hpp -index 99e889d..e69038e 100644 ---- a/src/windows.hpp -+++ b/src/windows.hpp -@@ -55,6 +55,13 @@ - #include - #include - #include -+ -+#if defined __MINGW64_VERSION_MAJOR && __MINGW64_VERSION_MAJOR < 4 -+// Workaround for mingw-w64 < v4.0 which did not include ws2ipdef.h in iphlpapi.h. -+// Fixed in mingw-w64 by 9bd8fe9148924840d315b4c915dd099955ea89d1. -+#include -+#include -+#endif - #include - - #if !defined __MINGW32__ --- -2.7.4 - diff --git a/depends/patches/zeromq/0002-disable-pthread_set_name_np.patch b/depends/patches/zeromq/0002-disable-pthread_set_name_np.patch deleted file mode 100644 index d220b54f3..000000000 --- a/depends/patches/zeromq/0002-disable-pthread_set_name_np.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 6e6b47d5ab381c3df3b30bb0b0a6cf210dfb1eba Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Mon, 5 Mar 2018 14:22:05 -0500 -Subject: [PATCH] disable pthread_set_name_np - -pthread_set_name_np adds a Glibc requirement on >= 2.12. ---- - src/thread.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/thread.cpp b/src/thread.cpp -index 4fc59c3e..c3fdfd46 100644 ---- a/src/thread.cpp -+++ b/src/thread.cpp -@@ -220,7 +220,7 @@ void zmq::thread_t::setThreadName(const char *name_) - */ - if (!name_) - return; -- -+#if 0 - #if defined(ZMQ_HAVE_PTHREAD_SETNAME_1) - int rc = pthread_setname_np(name_); - if(rc) return; -@@ -233,6 +233,8 @@ void zmq::thread_t::setThreadName(const char *name_) - #elif defined(ZMQ_HAVE_PTHREAD_SET_NAME) - pthread_set_name_np(descriptor, name_); - #endif -+#endif -+ return; - } - - #endif --- -2.11.1 - diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index 08ff4d6ac..c58817078 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -1,13 +1,13 @@ dist_man1_MANS= if BUILD_BITCOIND - dist_man1_MANS+=bitcoind.1 + dist_man1_MANS+=lbrycrdd.1 endif if ENABLE_QT - dist_man1_MANS+=bitcoin-qt.1 + dist_man1_MANS+=lbrycrd-qt.1 endif if BUILD_BITCOIN_UTILS - dist_man1_MANS+=bitcoin-cli.1 bitcoin-tx.1 + dist_man1_MANS+=lbrycrd-cli.1 lbrycrd-tx.1 endif diff --git a/doc/man/bitcoin-cli.1 b/doc/man/lbrycrd-cli.1 similarity index 80% rename from doc/man/bitcoin-cli.1 rename to doc/man/lbrycrd-cli.1 index 9f8cb5caf..de289a6f8 100644 --- a/doc/man/bitcoin-cli.1 +++ b/doc/man/lbrycrd-cli.1 @@ -1,21 +1,21 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BITCOIN-CLI "1" "December 2018" "bitcoin-cli v0.17.1.0" "User Commands" +.TH BITCOIN-CLI "1" "December 2018" "lbrycrd-cli v0.17.1.0" "User Commands" .SH NAME -bitcoin-cli \- manual page for bitcoin-cli v0.17.1.0 +lbrycrd-cli \- manual page for lbrycrd-cli v0.17.1.0 .SH SYNOPSIS -.B bitcoin-cli -[\fI\,options\/\fR] \fI\, \/\fR[\fI\,params\/\fR] \fI\,Send command to Bitcoin Core\/\fR +.B lbrycrd-cli +[\fI\,options\/\fR] \fI\, \/\fR[\fI\,params\/\fR] \fI\,Send command to LBRYcrd Core\/\fR .br -.B bitcoin-cli -[\fI\,options\/\fR] \fI\,-named \/\fR[\fI\,name=value\/\fR]... \fI\,Send command to Bitcoin Core (with named arguments)\/\fR +.B lbrycrd-cli +[\fI\,options\/\fR] \fI\,-named \/\fR[\fI\,name=value\/\fR]... \fI\,Send command to LBRYcrd Core (with named arguments)\/\fR .br -.B bitcoin-cli +.B lbrycrd-cli [\fI\,options\/\fR] \fI\,help List commands\/\fR .br -.B bitcoin-cli +.B lbrycrd-cli [\fI\,options\/\fR] \fI\,help Get help for a command\/\fR .SH DESCRIPTION -Bitcoin Core RPC client version v0.17.1.0 +LBRYcrd Core RPC client version v0.17.1.0 .SH OPTIONS .HP \-? @@ -25,7 +25,7 @@ This help message \fB\-conf=\fR .IP Specify configuration file. Relative paths will be prefixed by datadir -location. (default: bitcoin.conf) +location. (default: lbrycrd.conf) .HP \fB\-datadir=\fR .IP @@ -76,7 +76,7 @@ Wait for RPC server to start \fB\-rpcwallet=\fR .IP Send RPC for non\-default wallet on RPC server (needs to exactly match -corresponding \fB\-wallet\fR option passed to bitcoind) +corresponding \fB\-wallet\fR option passed to lbrycrdd) .HP \fB\-stdin\fR .IP @@ -101,11 +101,11 @@ Chain selection options: .IP Use the test chain .SH COPYRIGHT -Copyright (C) 2009-2018 The Bitcoin Core developers +Copyright (C) 2009-2018 The LBRYcrd Core developers -Please contribute if you find Bitcoin Core useful. Visit - for further information about the software. -The source code is available from . +Please contribute if you find LBRYcrd Core useful. Visit + for further information about the software. +The source code is available from . This is experimental software. Distributed under the MIT software license, see the accompanying file COPYING diff --git a/doc/man/bitcoin-qt.1 b/doc/man/lbrycrd-qt.1 similarity index 97% rename from doc/man/bitcoin-qt.1 rename to doc/man/lbrycrd-qt.1 index a94bd84b3..951fc0697 100644 --- a/doc/man/bitcoin-qt.1 +++ b/doc/man/lbrycrd-qt.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BITCOIN-QT "1" "December 2018" "bitcoin-qt v0.17.1.0" "User Commands" +.TH BITCOIN-QT "1" "December 2018" "lbrycrd-qt v0.17.1.0" "User Commands" .SH NAME -bitcoin-qt \- manual page for bitcoin-qt v0.17.1.0 +lbrycrd-qt \- manual page for lbrycrd-qt v0.17.1.0 .SH SYNOPSIS -.B bitcoin-qt +.B lbrycrd-qt [\fI\,command-line options\/\fR] .SH DESCRIPTION -Bitcoin Core version v0.17.1.0 (64\-bit) +LBRYcrd Core version v0.17.1.0 (64\-bit) .SH OPTIONS .HP \-? @@ -44,7 +44,7 @@ Specify blocks directory (default: /blocks) \fB\-conf=\fR .IP Specify configuration file. Relative paths will be prefixed by datadir -location. (default: bitcoin.conf) +location. (default: lbrycrd.conf) .HP \fB\-daemon\fR .IP @@ -98,7 +98,7 @@ Whether to save the mempool on shutdown and load on restart (default: 1) \fB\-pid=\fR .IP Specify pid file. Relative paths will be prefixed by a net\-specific -datadir location. (default: bitcoind.pid) +datadir location. (default: lbrycrdd.pid) .HP \fB\-prune=\fR .IP @@ -604,11 +604,11 @@ Set SSL root certificates for payment request (default: \fB\-system\-\fR) .IP Show splash screen on startup (default: 1) .SH COPYRIGHT -Copyright (C) 2009-2018 The Bitcoin Core developers +Copyright (C) 2009-2018 The LBRYcrd Core developers -Please contribute if you find Bitcoin Core useful. Visit - for further information about the software. -The source code is available from . +Please contribute if you find LBRYcrd Core useful. Visit + for further information about the software. +The source code is available from . This is experimental software. Distributed under the MIT software license, see the accompanying file COPYING diff --git a/doc/man/bitcoin-tx.1 b/doc/man/lbrycrd-tx.1 similarity index 82% rename from doc/man/bitcoin-tx.1 rename to doc/man/lbrycrd-tx.1 index 10f8231c6..ecf312ea5 100644 --- a/doc/man/bitcoin-tx.1 +++ b/doc/man/lbrycrd-tx.1 @@ -1,15 +1,15 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BITCOIN-TX "1" "December 2018" "bitcoin-tx v0.17.1.0" "User Commands" +.TH BITCOIN-TX "1" "December 2018" "lbrycrd-tx v0.17.1.0" "User Commands" .SH NAME -bitcoin-tx \- manual page for bitcoin-tx v0.17.1.0 +lbrycrd-tx \- manual page for lbrycrd-tx v0.17.1.0 .SH SYNOPSIS -.B bitcoin-tx -[\fI\,options\/\fR] \fI\, \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded bitcoin transaction\/\fR +.B lbrycrd-tx +[\fI\,options\/\fR] \fI\, \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded lbrycrd transaction\/\fR .br -.B bitcoin-tx -[\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded bitcoin transaction\/\fR +.B lbrycrd-tx +[\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded lbrycrd transaction\/\fR .SH DESCRIPTION -Bitcoin Core bitcoin\-tx utility version v0.17.1.0 +LBRYcrd Core lbrycrd\-tx utility version v0.17.1.0 .SH OPTIONS .HP \-? @@ -105,11 +105,11 @@ set=NAME:JSON\-STRING .IP Set register NAME to given JSON\-STRING .SH COPYRIGHT -Copyright (C) 2009-2018 The Bitcoin Core developers +Copyright (C) 2009-2018 The LBRYcrd Core developers -Please contribute if you find Bitcoin Core useful. Visit - for further information about the software. -The source code is available from . +Please contribute if you find LBRYcrd Core useful. Visit + for further information about the software. +The source code is available from . This is experimental software. Distributed under the MIT software license, see the accompanying file COPYING diff --git a/doc/man/bitcoind.1 b/doc/man/lbrycrdd.1 similarity index 96% rename from doc/man/bitcoind.1 rename to doc/man/lbrycrdd.1 index 01bd67160..eb99ef777 100644 --- a/doc/man/bitcoind.1 +++ b/doc/man/lbrycrdd.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BITCOIND "1" "December 2018" "bitcoind v0.17.1.0" "User Commands" +.TH BITCOIND "1" "December 2018" "lbrycrdd v0.17.1.0" "User Commands" .SH NAME -bitcoind \- manual page for bitcoind v0.17.1.0 +lbrycrdd \- manual page for lbrycrdd v0.17.1.0 .SH SYNOPSIS -.B bitcoind -[\fI\,options\/\fR] \fI\,Start Bitcoin Core Daemon\/\fR +.B lbrycrdd +[\fI\,options\/\fR] \fI\,Start LBRYcrd Core Daemon\/\fR .SH DESCRIPTION -Bitcoin Core Daemon version v0.17.1.0 +LBRYcrd Core Daemon version v0.17.1.0 .SH OPTIONS .HP \-? @@ -44,7 +44,7 @@ Specify blocks directory (default: /blocks) \fB\-conf=\fR .IP Specify configuration file. Relative paths will be prefixed by datadir -location. (default: bitcoin.conf) +location. (default: lbrycrd.conf) .HP \fB\-daemon\fR .IP @@ -98,7 +98,7 @@ Whether to save the mempool on shutdown and load on restart (default: 1) \fB\-pid=\fR .IP Specify pid file. Relative paths will be prefixed by a net\-specific -datadir location. (default: bitcoind.pid) +datadir location. (default: lbrycrdd.pid) .HP \fB\-prune=\fR .IP @@ -578,11 +578,11 @@ Username for JSON\-RPC connections .IP Accept command line and JSON\-RPC commands .SH COPYRIGHT -Copyright (C) 2009-2018 The Bitcoin Core developers +Copyright (C) 2009-2018 The LBRYcrd Core developers -Please contribute if you find Bitcoin Core useful. Visit - for further information about the software. -The source code is available from . +Please contribute if you find LBRYcrd Core useful. Visit + for further information about the software. +The source code is available from . This is experimental software. Distributed under the MIT software license, see the accompanying file COPYING diff --git a/packaging/build_windows.sh b/packaging/build_windows.sh new file mode 100755 index 000000000..6c620bb78 --- /dev/null +++ b/packaging/build_windows.sh @@ -0,0 +1,64 @@ +#! /bin/bash + +set -euo pipefail + +sudo apt-get update +sudo apt-get install -y --no-install-recommends \ + g++-mingw-w64-i686 mingw-w64-i686-dev g++-mingw-w64-x86-64 \ + mingw-w64-x86-64-dev build-essential libtool autotools-dev automake pkg-config \ + libssl-dev libevent-dev bsdmainutils curl ca-certificates + +echo "1" | sudo update-alternatives --config x86_64-w64-mingw32-g++ +echo "1" | sudo update-alternatives --config x86_64-w64-mingw32-gcc + + +################################################################# +# Build ICU for Linux first so that we can cross compile it below +# It's a strange ICU thing in that it requries a working +# Linux build of itself to be used as part of the cross-compile +################################################################# +icu_version=63.1 +icu_release=icu4c-63_1-src.tgz +staging_dir=/tmp/icu_staging +icu_linux_dir=$staging_dir/build_icu_linux +mkdir -p $staging_dir +pushd $staging_dir +wget -c http://download.icu-project.org/files/icu4c/$icu_version/$icu_release +tar -xzf $icu_release +pushd icu/source +CC="gcc" CXX="g++" ./runConfigureICU Linux --prefix=$icu_linux_dir --enable-extras=no --enable-strict=no --enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no +make -j4 +make install +popd +popd + +export CXXFLAGS="-std=c++11" + +pushd depends +# Remove the dir saying that dependencies are built (although ccache +# is still enabled). +rm -rf built +mkdir -p sources +cp "$staging_dir/$icu_release" sources/ + +# Build and install the cross compiled ICU package. +make -j4 HOST=x86_64-w64-mingw32 NO_QT=1 ICU_ONLY=1 + +# Then build the rest of the dependencies (now that it exists and we +# can determine the location for it). +icu_mingw_dir=$(find /tmp/icu_install -name x86_64-w64-mingw32 -type d) + +make -j4 HOST=x86_64-w64-mingw32 NO_QT=1 ICU_DIR=$icu_mingw_dir V=1 +popd + +./autogen.sh +echo "Using --with-icu=$icu_mingw_dir" +PREFIX=`pwd`/depends/x86_64-w64-mingw32 +CC="x86_64-w64-mingw32-gcc" CXX="x86_64-w64-mingw32-g++" ./configure --prefix=$PREFIX --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --without-gui --with-icu=$icu_mingw_dir --enable-static --disable-shared +./configure --prefix=$PREFIX --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --without-gui --with-icu=$icu_mingw_dir --enable-static --disable-shared +make -j4 + +rm -rf $staging_dir +# Remove hardcoded cross compiled ICU package path. +rm -rf /tmp/icu_install +echo "Windows build is complete" diff --git a/packaging/remove_consensus.patch b/packaging/remove_consensus.patch new file mode 100644 index 000000000..aa16a5d9e --- /dev/null +++ b/packaging/remove_consensus.patch @@ -0,0 +1,23 @@ +diff --git a/src/Makefile.am b/src/Makefile.am +index a9f0a94..d71bfeb 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -64,12 +64,12 @@ if ENABLE_ZMQ + EXTRA_LIBRARIES += libbitcoin_zmq.a + endif + +-if BUILD_BITCOIN_LIBS +-lib_LTLIBRARIES = libbitcoinconsensus.la +-LIBBITCOINCONSENSUS=libbitcoinconsensus.la +-else +-LIBBITCOINCONSENSUS= +-endif ++# if BUILD_BITCOIN_LIBS ++# lib_LTLIBRARIES = libbitcoinconsensus.la ++# LIBBITCOINCONSENSUS=libbitcoinconsensus.la ++# else ++# LIBBITCOINCONSENSUS= ++# endif + + bin_PROGRAMS = + TESTS = diff --git a/reproducible_build.sh b/reproducible_build.sh index 2a929902f..d32ecb160 100755 --- a/reproducible_build.sh +++ b/reproducible_build.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -euo pipefail +set -euox pipefail function HELP { echo "Build lbrycrd" @@ -15,7 +15,6 @@ function HELP { echo echo "Optional arguments:" echo - echo "-c: don't clone a fresh copy of the repo" echo "-f: check formatting of committed code relative to master" echo "-r: remove intermediate files." echo "-l: build only lbrycrd" @@ -26,7 +25,6 @@ function HELP { exit 1 } -CLONE=true CLEAN=false CHECK_CODE_FORMAT=false BUILD_DEPENDENCIES=true @@ -39,15 +37,12 @@ OUTPUT_LOG=true while getopts :crfldoth:w:d: FLAG; do case $FLAG in - c) - CLONE=false - ;; r) CLEAN=true ;; - f) - CHECK_CODE_FORMAT=true - ;; + f) + CHECK_CODE_FORMAT=true + ;; l) BUILD_DEPENDENCIES=false ;; @@ -81,13 +76,11 @@ if (( EUID != 0 )); then SUDO='sudo' fi -if [ "${CLONE}" = false ]; then - if [ "$(basename "$PWD")" != "lbrycrd" ]; then - echo "Not currently in the lbrycrd directory. Cowardly refusing to go forward" - exit 1 - fi - SOURCE_DIR=$PWD +if [ "$(basename "$PWD")" != "lbrycrd" ]; then + echo "Not currently in the lbrycrd directory. Cowardly refusing to go forward" + exit 1 fi +SOURCE_DIR=$PWD if [ -z "${TRAVIS_OS_NAME+x}" ]; then if [ "$(uname -s)" = "Darwin" ]; then @@ -106,24 +99,22 @@ else # this file is created when the build starts START_TIME_FILE="$TRAVIS_BUILD_DIR/start_time" fi -if [ ! -f "${START_TIME_FILE}" ]; then - date +%s > "${START_TIME_FILE}" -fi - +rm -f ${START_TIME_FILE} +date +%s > ${START_TIME_FILE} NEXT_TIME=60 -function exit_at_40() { +function exit_at_60() { if [ -f "${START_TIME_FILE}" ]; then NOW=$(date +%s) START=$(cat "${START_TIME_FILE}") - TIMEOUT_SECS=2400 # 40 * 60 + TIMEOUT_SECS=3600 # 60 * 60 TIME=$((NOW - START)) if (( TIME > NEXT_TIME )); then echo "Build has taken $((TIME / 60)) minutes: $1" NEXT_TIME=$((TIME + 60)) fi if [ "$TIMEOUT" = true ] && (( TIME > TIMEOUT_SECS )); then - echo 'Exiting at 40 minutes to allow the cache to populate' + echo 'Exiting at 60 minutes to allow the cache to populate' OUTPUT_LOG=false exit 1 fi @@ -135,44 +126,41 @@ function exit_at_40() { # - echo message function wait_and_echo() { PID=$1 - (set -o | grep xtrace | grep -q on) - TRACE_STATUS=$? - # disable xtrace or else this will get verbose, which is what - # I'm trying to avoid by going through all of this nonsense anyway - set +o xtrace TIME=0 - SLEEP=5 + SLEEP=3 # loop until the process is no longer running # check every $SLEEP seconds, echoing a message every minute while (ps -p "${PID}" > /dev/null); do - exit_at_40 "$2" + exit_at_60 "$2" sleep "${SLEEP}" done - # restore the xtrace setting - if [ "${TRACE_STATUS}" -eq 0 ]; then - set -o xtrace - fi - wait "$PID" - return $? } # run a command ($1) in the background # logging its stdout and stderr to $2 # and wait until it completed function background() { - $1 >> "$2" 2>&1 & + eval $1 >> "$2" 2>&1 & BACKGROUND_PID=$! - wait_and_echo $BACKGROUND_PID "$3" + ( + set +xe # do not echo each sleep call in trace mode + wait_and_echo $BACKGROUND_PID "$3" + ) + wait $BACKGROUND_PID } function cleanup() { rv=$? + if [ $rv -eq 0 ]; then + return $rv + fi # cat the log file if it exists if [ -f "$2" ] && [ "${OUTPUT_LOG}" = true ]; then echo echo "Output of log file $2" echo - tail -n 1000 "$2" + cat "$2" +# tail -n 200 "$2" echo fi # delete the build directory @@ -211,7 +199,7 @@ function install_brew_packages() { brew_if_not_installed automake # something weird happened where glibtoolize was failing to find # sed, and reinstalling fixes it. - brew reinstall -s libtool + brew reinstall libtool brew_if_not_installed pkg-config brew_if_not_installed protobuf brew_if_not_installed gmp @@ -222,6 +210,10 @@ function install_brew_packages() { } function install_apt_packages() { + if [ -d "${OUTPUT_DIR}" ]; then + return 0 + fi + if [ -z "${TRAVIS+x}" ]; then # if not on travis, its nice to see progress QUIET="" @@ -244,8 +236,10 @@ function install_apt_packages() { function build_dependencies() { if [ "${OS_NAME}" = "osx" ]; then + PARALLEL="-j $(sysctl -n hw.ncpu)" install_brew_packages else + PARALLEL="-j $(grep -c processor /proc/cpuinfo)" install_apt_packages fi @@ -254,17 +248,39 @@ function build_dependencies() { rm -rf "${OUTPUT_DIR}" fi - if [ ! -d "${LBRYCRD_DEPENDENCIES}" ]; then - git clone https://github.com/lbryio/lbrycrd-dependencies.git "${LBRYCRD_DEPENDENCIES}" + mkdir -p "${LBRYCRD_DEPENDENCIES}" + + # Download required dependencies (if not already present) + pushd ${LBRYCRD_DEPENDENCIES} > /dev/null + if [ ! -f db-4.8.30.NC.zip ]; then + wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.zip + unzip -o -q db-4.8.30.NC.zip fi - # TODO: if the repo exists, make sure its clean: revert to head. + if [ ! -f libevent-2.1.8-stable.tar.gz ]; then + wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz + tar -xzf libevent-2.1.8-stable.tar.gz + fi + if [ ! -f openssl-1.0.2r.tar.gz ]; then + wget https://www.openssl.org/source/openssl-1.0.2r.tar.gz + tar -xzf openssl-1.0.2r.tar.gz + fi + if [ ! -f icu4c-63_1-src.tgz ]; then + wget http://download.icu-project.org/files/icu4c/63.1/icu4c-63_1-src.tgz + tar -xzf icu4c-63_1-src.tgz + fi + if [ ! -f boost_1_64_0.tar.bz2 ]; then + wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2 + tar -xjf boost_1_64_0.tar.bz2 + fi + mkdir -p "${LOG_DIR}" - build_dependency "${BDB_PREFIX}" "${LOG_DIR}/bdb_build.log" build_bdb build_dependency "${OPENSSL_PREFIX}" "${LOG_DIR}/openssl_build.log" build_openssl + build_dependency "${ICU_PREFIX}" "${LOG_DIR}/icu_build.log" build_icu + build_dependency "${BDB_PREFIX}" "${LOG_DIR}/bdb_build.log" build_bdb set +u - export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${OPENSSL_PREFIX}/lib/pkgconfig/" + export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${OPENSSL_PREFIX}/lib/pkgconfig" set -u build_dependency "${BOOST_PREFIX}" "${LOG_DIR}/boost_build.log" build_boost @@ -274,55 +290,82 @@ function build_dependencies() { function build_bdb() { BDB_LOG="$1" if [ "${OS_NAME}" = "osx" ]; then - patch db-4.8.30.NC/dbinc/atomic.h < atomic.patch + # TODO: make this handle already patched files + patch db-4.8.30.NC/dbinc/atomic.h < ../contrib/patches/atomic.patch fi cd db-4.8.30.NC/build_unix echo "Building bdb. tail -f $BDB_LOG to see the details and monitor progress" ../dist/configure --prefix="${BDB_PREFIX}" --enable-cxx --disable-shared --with-pic > "${BDB_LOG}" - background make "${BDB_LOG}" "Waiting for bdb to finish building" + background "make ${PARALLEL}" "${BDB_LOG}" "Waiting for bdb to finish building" make install >> "${BDB_LOG}" 2>&1 } function build_openssl() { OPENSSL_LOG="$1" mkdir -p "${OPENSSL_PREFIX}/ssl" - cd openssl-1.0.1p + cd openssl-1.0.2r echo "Building openssl. tail -f $OPENSSL_LOG to see the details and monitor progress" if [ "${OS_NAME}" = "osx" ]; then ./Configure --prefix="${OPENSSL_PREFIX}" --openssldir="${OPENSSL_PREFIX}/ssl" \ -fPIC darwin64-x86_64-cc \ no-shared no-dso no-engines > "${OPENSSL_LOG}" + make depend else [[ $(uname -m) = 'i686' ]] && OS_ARCH="linux-generic32" || OS_ARCH="linux-x86_64" ./Configure --prefix="${OPENSSL_PREFIX}" --openssldir="${OPENSSL_PREFIX}/ssl" \ ${OS_ARCH} -fPIC -static no-shared no-dso > "${OPENSSL_LOG}" fi - background make "${OPENSSL_LOG}" "Waiting for openssl to finish building" + background "make ${PARALLEL}" "${OPENSSL_LOG}" "Waiting for openssl to finish building" make install >> "${OPENSSL_LOG}" 2>&1 } function build_boost() { BOOST_LOG="$1" - cd boost_1_59_0 + cd boost_1_64_0 + + echo "int main() { return 0; }" > libs/regex/build/has_icu_test.cpp + echo "int main() { return 0; }" > libs/locale/build/has_icu_test.cpp + + export BOOST_ICU_LIBS="-L${ICU_PREFIX}/lib -licui18n -licuuc -licudata -ldl" + export BOOST_LIBRARIES="chrono,filesystem,program_options,system,locale,regex,thread,test" + echo "Building Boost. tail -f ${BOOST_LOG} to see the details and monitor progress" - ./bootstrap.sh --prefix="${BOOST_PREFIX}" > "${BOOST_LOG}" 2>&1 - background "./b2 link=static cxxflags=-fPIC install" \ - "${BOOST_LOG}" \ - "Waiting for boost to finish building" + ./bootstrap.sh --prefix="${BOOST_PREFIX}" --with-icu="${ICU_PREFIX}" --with-libraries=${BOOST_LIBRARIES} > "${BOOST_LOG}" 2>&1 + b2cmd="./b2 --reconfigure ${PARALLEL} link=static cxxflags=\"-std=c++11 -fPIC\" install boost.locale.iconv=off boost.locale.posix=off -sICU_PATH=\"${ICU_PREFIX}\" -sICU_LINK=\"${BOOST_ICU_LIBS}\"" + background "${b2cmd}" "${BOOST_LOG}" "Waiting for boost to finish building" +} + +function build_icu() { + ICU_LOG="$1" + mkdir -p "${ICU_PREFIX}/icu" + pushd icu/source > /dev/null + echo "Building icu. tail -f $ICU_LOG to see the details and monitor progress" + ./configure --prefix="${ICU_PREFIX}" --enable-draft --enable-tools \ + --disable-shared --enable-static --disable-extras --disable-icuio --disable-dyload \ + --disable-layout --disable-layoutex --disable-tests --disable-samples CFLAGS=-fPIC CPPFLAGS=-fPIC > "${ICU_LOG}" + if [ ! -z ${TARGET+x} ]; then + TMP_TARGET="${TARGET}" + unset TARGET + fi + set +e + background "make ${PARALLEL} VERBOSE=1" "${ICU_LOG}" "Waiting for icu to finish building" + make install >> "${ICU_LOG}" 2>&1 + if [ ! -z ${TARGET+x} ]; then + TARGET="${TMP_TARGET}" + fi + set -e + popd > /dev/null } function build_libevent() { LIBEVENT_LOG="$1" - if [ ! -d libevent ]; then - git clone --branch release-2.0.22-stable https://github.com/libevent/libevent.git - fi - cd libevent + cd libevent-2.1.8-stable echo "Building libevent. tail -f ${LIBEVENT_LOG} to see the details and monitor progress" ./autogen.sh > "${LIBEVENT_LOG}" 2>&1 ./configure --prefix="${LIBEVENT_PREFIX}" --enable-static --disable-shared --with-pic \ - LDFLAGS="-L${OPENSSL_PREFIX}/lib/" \ + LDFLAGS="-L${OPENSSL_PREFIX}/lib" \ CPPFLAGS="-I${OPENSSL_PREFIX}/include" >> "${LIBEVENT_LOG}" 2>&1 - background make "${LIBEVENT_LOG}" "Waiting for libevent to finish building" + background "make ${PARALLEL}" "${LIBEVENT_LOG}" "Waiting for libevent to finish building" make install >> "${LIBEVENT_LOG}" } @@ -331,42 +374,31 @@ function build_dependency() { PREFIX=$1 LOG=$2 BUILD=$3 - if [ ! -d "${PREFIX}" ]; then - trap 'cleanup "${PREFIX}" "${LOG}"' INT TERM EXIT - cd "${LBRYCRD_DEPENDENCIES}" - mkdir -p "${PREFIX}" + cd "${LBRYCRD_DEPENDENCIES}" + mkdir -p "${PREFIX}" + trap 'cleanup "${PREFIX}" "${LOG}"' INT TERM EXIT "${BUILD}" "${LOG}" trap - INT TERM EXIT - fi popd } function build_lbrycrd() { - if [ "$CLONE" == true ]; then - cd "${LBRYCRD_DEPENDENCIES}" - git clone https://github.com/lbryio/lbrycrd - cd lbrycrd - else - cd "${SOURCE_DIR}" - fi + cd "${SOURCE_DIR}" ./autogen.sh > "${LBRYCRD_LOG}" 2>&1 - LDFLAGS="-L${OPENSSL_PREFIX}/lib/ -L${BDB_PREFIX}/lib/ -L${LIBEVENT_PREFIX}/lib/ -static-libstdc++" - CPPFLAGS="-I${OPENSSL_PREFIX}/include -I${BDB_PREFIX}/include -I${LIBEVENT_PREFIX}/include/" + LDFLAGS="-L${OPENSSL_PREFIX}/lib -L${BDB_PREFIX}/lib -L${LIBEVENT_PREFIX}/lib" + OPTIONS="--enable-cxx --enable-static --disable-shared --with-pic" if [ "${OS_NAME}" = "osx" ]; then - OPTIONS="--enable-cxx --enable-static --disable-shared --with-pic" + CPPFLAGS="-I${OPENSSL_PREFIX}/include -I${BDB_PREFIX}/include -I${LIBEVENT_PREFIX}/include -I${ICU_PREFIX}/include" else - OPTIONS="" + CPPFLAGS="-I${OPENSSL_PREFIX}/include -I${BDB_PREFIX}/include -I${LIBEVENT_PREFIX}/include -I${ICU_PREFIX}/include -Wno-unused-local-typedefs -Wno-deprecated -Wno-implicit-fallthrough" fi - ./configure --without-gui ${OPTIONS} \ - --with-boost="${BOOST_PREFIX}" \ - LDFLAGS="${LDFLAGS}" \ - CPPFLAGS="${CPPFLAGS}" >> "${LBRYCRD_LOG}" 2>&1 - background make "${LBRYCRD_LOG}" "Waiting for lbrycrd to finish building" - src/test/test_lbrycrd - strip src/lbrycrdd - strip src/lbrycrd-cli - strip src/lbrycrd-tx - strip src/test/test_lbrycrd + + CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" \ + ./configure --without-gui ${OPTIONS} \ + --with-boost="${BOOST_PREFIX}" \ + --with-icu="${ICU_PREFIX}" >> "${LBRYCRD_LOG}" 2>&1 + + background "make ${PARALLEL}" "${LBRYCRD_LOG}" "Waiting for lbrycrd to finish building" } function clang_format_diff(){ @@ -379,6 +411,7 @@ function clang_format_diff(){ LBRYCRD_DEPENDENCIES="$(pwd)/lbrycrd-dependencies" OUTPUT_DIR="$(pwd)/build" LOG_DIR="$(pwd)/logs" +ICU_PREFIX="${OUTPUT_DIR}/icu" BDB_PREFIX="${OUTPUT_DIR}/bdb" OPENSSL_PREFIX="${OUTPUT_DIR}/openssl" BOOST_PREFIX="${OUTPUT_DIR}/boost" @@ -398,7 +431,7 @@ if [ "${CHECK_CODE_FORMAT}" = true ]; then fi set +u -export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${OPENSSL_PREFIX}/lib/pkgconfig/:${LIBEVENT_PREFIX}/lib/pkgconfig/" +export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${OPENSSL_PREFIX}/lib/pkgconfig:${LIBEVENT_PREFIX}/lib/pkgconfig:${ICU_PREFIX}/lib/pkgconfig" set -u if [ "${BUILD_LBRYCRD}" = true ]; then @@ -407,4 +440,12 @@ if [ "${BUILD_LBRYCRD}" = true ]; then trap 'cat_and_exit "${LBRYCRD_LOG}"' INT TERM EXIT build_lbrycrd trap - INT TERM EXIT + + ./src/test/test_lbrycrd + set +u + if [[ ! $CXXFLAGS =~ -g ]]; then + strip src/lbrycrdd + strip src/lbrycrd-cli + strip src/lbrycrd-tx + fi fi diff --git a/src/Makefile.am b/src/Makefile.am index 2eb673056..7981d5926 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,7 +19,7 @@ else LIBUNIVALUE = $(UNIVALUE_LIBS) endif -BITCOIN_INCLUDES=-I$(builddir) $(BDB_CPPFLAGS) $(ICU_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS) $(ICU_CFLAGS) +BITCOIN_INCLUDES=-I$(builddir) $(BDB_CPPFLAGS) $(ICU_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS) @@ -80,11 +80,11 @@ TESTS = BENCHMARKS = if BUILD_BITCOIND - bin_PROGRAMS += bitcoind + bin_PROGRAMS += lbrycrdd endif if BUILD_BITCOIN_UTILS - bin_PROGRAMS += bitcoin-cli bitcoin-tx + bin_PROGRAMS += lbrycrd-cli lbrycrd-tx endif .PHONY: FORCE check-symbols check-security @@ -227,6 +227,7 @@ libbitcoin_server_a_SOURCES = \ chain.cpp \ checkpoints.cpp \ claimtrie.cpp \ + claimtrieforks.cpp \ consensus/tx_verify.cpp \ httprpc.cpp \ httpserver.cpp \ @@ -411,7 +412,7 @@ libbitcoin_common_a_SOURCES = \ # This library *must* be included to make sure that the glibc # backward-compatibility objects and their sanity checks are linked. libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) $(CRYPTO_CFLAGS) libbitcoin_util_a_SOURCES = \ support/lockedpool.cpp \ chainparamsbase.cpp \ @@ -440,7 +441,7 @@ libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp AM_LDFLAGS += $(COMPAT_LDFLAGS) endif -# cli: shared between bitcoin-cli and bitcoin-qt +# cli: shared between lbrycrd-cli and bitcoin-qt libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_cli_a_SOURCES = \ @@ -451,16 +452,16 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h # # bitcoind binary # -bitcoind_SOURCES = bitcoind.cpp -bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -bitcoind_LDFLAGS = -L$(ICU_PREFIX)/lib $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +lbrycrdd_SOURCES = bitcoind.cpp +lbrycrdd_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) +lbrycrdd_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +lbrycrdd_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) if TARGET_WINDOWS -bitcoind_SOURCES += bitcoind-res.rc +lbrycrdd_SOURCES += bitcoind-res.rc endif -bitcoind_LDADD = \ +lbrycrdd_LDADD = \ $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_WALLET) \ $(LIBBITCOIN_COMMON) \ @@ -474,38 +475,38 @@ bitcoind_LDADD = \ $(LIBMEMENV) \ $(LIBSECP256K1) -bitcoind_LDADD += $(BOOST_LIBS) $(ICU_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS) +lbrycrdd_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS) -# bitcoin-cli binary # -bitcoin_cli_SOURCES = bitcoin-cli.cpp -bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) -bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +# lbrycrd-cli binary # +lbrycrd_cli_SOURCES = bitcoin-cli.cpp +lbrycrd_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) +lbrycrd_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +lbrycrd_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) if TARGET_WINDOWS -bitcoin_cli_SOURCES += bitcoin-cli-res.rc +lbrycrd_cli_SOURCES += bitcoin-cli-res.rc endif -bitcoin_cli_LDADD = \ +lbrycrd_cli_LDADD = \ $(LIBBITCOIN_CLI) \ $(LIBUNIVALUE) \ $(LIBBITCOIN_UTIL) \ $(LIBBITCOIN_CRYPTO) -bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS) +lbrycrd_cli_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) $(EVENT_LIBS) # # bitcoin-tx binary # -bitcoin_tx_SOURCES = bitcoin-tx.cpp -bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +lbrycrd_tx_SOURCES = bitcoin-tx.cpp +lbrycrd_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) +lbrycrd_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +lbrycrd_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) if TARGET_WINDOWS -bitcoin_tx_SOURCES += bitcoin-tx-res.rc +lbrycrd_tx_SOURCES += bitcoin-tx-res.rc endif -bitcoin_tx_LDADD = \ +lbrycrd_tx_LDADD = \ $(LIBUNIVALUE) \ $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_UTIL) \ @@ -513,7 +514,7 @@ bitcoin_tx_LDADD = \ $(LIBBITCOIN_CRYPTO) \ $(LIBSECP256K1) -bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS) +lbrycrd_tx_LDADD += $(BOOST_LIBS) $(ICU_LIBS) $(CRYPTO_LIBS) # # bitcoinconsensus library # diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include index f5293585a..34814781e 100644 --- a/src/Makefile.bench.include +++ b/src/Makefile.bench.include @@ -55,7 +55,7 @@ if ENABLE_WALLET bench_bench_bitcoin_SOURCES += bench/coin_selection.cpp endif -bench_bench_bitcoin_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) +bench_bench_bitcoin_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) bench_bench_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES) diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index c7a196313..98371539a 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -2,7 +2,7 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -bin_PROGRAMS += qt/bitcoin-qt +bin_PROGRAMS += qt/lbrycrd-qt EXTRA_LIBRARIES += qt/libbitcoinqt.a # bitcoin qt core # @@ -366,7 +366,7 @@ BITCOIN_RC = qt/res/bitcoin-qt-res.rc BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ - $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS) + $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS) $(SSL_CFLAGS) qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS) @@ -382,37 +382,37 @@ QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI: # Most files will depend on the forms and moc files as includes. Generate them # before anything else. $(QT_MOC): $(QT_FORMS_H) -$(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) : | $(QT_MOC) +$(qt_libbitcoinqt_a_OBJECTS) $(qt_lbrycrd_qt_OBJECTS) : | $(QT_MOC) #Generating these with a half-written protobuf header leads to wacky results. #This makes sure it's done. $(QT_MOC): $(PROTOBUF_H) $(QT_MOC_CPP): $(PROTOBUF_H) -# bitcoin-qt binary # -qt_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ +# lbrycrd-qt binary # +qt_lbrycrd_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ $(QT_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS) -qt_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) +qt_lbrycrd_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) -qt_bitcoin_qt_SOURCES = qt/bitcoin.cpp +qt_lbrycrd_qt_SOURCES = qt/bitcoin.cpp if TARGET_DARWIN - qt_bitcoin_qt_SOURCES += $(BITCOIN_MM) + qt_lbrycrd_qt_SOURCES += $(BITCOIN_MM) endif if TARGET_WINDOWS - qt_bitcoin_qt_SOURCES += $(BITCOIN_RC) + qt_lbrycrd_qt_SOURCES += $(BITCOIN_RC) endif -qt_bitcoin_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER) +qt_lbrycrd_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER) if ENABLE_WALLET -qt_bitcoin_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) +qt_lbrycrd_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) endif if ENABLE_ZMQ -qt_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) +qt_lbrycrd_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) endif -qt_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \ - $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \ +qt_lbrycrd_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \ + $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(ICU_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \ $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) -qt_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -qt_bitcoin_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX +qt_lbrycrd_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +qt_lbrycrd_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX #locale/foo.ts -> locale/foo.qm QT_QM=$(QT_TS:.ts=.qm) @@ -444,9 +444,9 @@ CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda CLEANFILES += $(CLEAN_QT) bitcoin_qt_clean: FORCE - rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) qt/bitcoin-qt$(EXEEXT) $(LIBBITCOINQT) + rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_lbrycrd_qt_OBJECTS) qt/lbrycrd-qt$(EXEEXT) $(LIBBITCOINQT) -bitcoin_qt : qt/bitcoin-qt$(EXEEXT) +bitcoin_qt : qt/lbrycrd-qt$(EXEEXT) ui_%.h: %.ui @test -f $(UIC) diff --git a/src/Makefile.qttest.include b/src/Makefile.qttest.include index 4b14212b2..450e9faf7 100644 --- a/src/Makefile.qttest.include +++ b/src/Makefile.qttest.include @@ -2,8 +2,8 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -bin_PROGRAMS += qt/test/test_bitcoin-qt -TESTS += qt/test/test_bitcoin-qt +bin_PROGRAMS += qt/test/test_lbrycrd-qt +TESTS += qt/test/test_lbrycrd-qt TEST_QT_MOC_CPP = \ qt/test/moc_compattests.cpp \ @@ -33,10 +33,10 @@ TEST_BITCOIN_CPP = \ TEST_BITCOIN_H = \ test/test_bitcoin.h -qt_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ +qt_test_test_lbrycrd_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS) -qt_test_test_bitcoin_qt_SOURCES = \ +qt_test_test_lbrycrd_qt_SOURCES = \ qt/test/compattests.cpp \ qt/test/rpcnestedtests.cpp \ qt/test/test_main.cpp \ @@ -46,37 +46,37 @@ qt_test_test_bitcoin_qt_SOURCES = \ $(TEST_BITCOIN_CPP) \ $(TEST_BITCOIN_H) if ENABLE_WALLET -qt_test_test_bitcoin_qt_SOURCES += \ +qt_test_test_lbrycrd_qt_SOURCES += \ qt/test/addressbooktests.cpp \ qt/test/paymentservertests.cpp \ qt/test/wallettests.cpp \ wallet/test/wallet_test_fixture.cpp endif -nodist_qt_test_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP) +nodist_qt_test_test_lbrycrd_qt_SOURCES = $(TEST_QT_MOC_CPP) -qt_test_test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) +qt_test_test_lbrycrd_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) if ENABLE_WALLET -qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) +qt_test_test_lbrycrd_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) endif if ENABLE_ZMQ -qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) +qt_test_test_lbrycrd_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) endif -qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \ +qt_test_test_lbrycrd_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \ $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \ - $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \ + $(QR_LIBS) $(PROTOBUF_LIBS) $(ICU_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \ $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) -qt_test_test_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -qt_test_test_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) +qt_test_test_lbrycrd_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +qt_test_test_lbrycrd_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) CLEAN_BITCOIN_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno CLEANFILES += $(CLEAN_BITCOIN_QT_TEST) -test_bitcoin_qt : qt/test/test_bitcoin-qt$(EXEEXT) +test_lbrycrd_qt : qt/test/test_bitcoin-qt$(EXEEXT) -test_bitcoin_qt_check : qt/test/test_bitcoin-qt$(EXEEXT) FORCE +test_lbrycrd_qt_check : qt/test/test_bitcoin-qt$(EXEEXT) FORCE $(MAKE) check-TESTS TESTS=$^ -test_bitcoin_qt_clean: FORCE - rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_bitcoin_qt_OBJECTS) +test_lbrycrd_qt_clean: FORCE + rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_lbrycrd_qt_OBJECTS) diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 6c9ee8227..b13c3de9c 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -112,7 +112,7 @@ BITCOIN_TEST_SUITE += \ endif test_test_lbrycrd_SOURCES = $(BITCOIN_TEST_SUITE) $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES) -test_test_lbrycrd_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(TESTDEFS) $(EVENT_CFLAGS) +test_test_lbrycrd_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(TESTDEFS) $(EVENT_CFLAGS) $(ICU_CPPFLAGS) test_test_lbrycrd_LDADD = if ENABLE_WALLET test_test_lbrycrd_LDADD += $(LIBBITCOIN_WALLET) @@ -122,7 +122,7 @@ test_test_lbrycrd_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_C $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS) test_test_lbrycrd_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -test_test_lbrycrd_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) +test_test_lbrycrd_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) $(MINIUPNPC_LIBS) test_test_lbrycrd_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static if ENABLE_ZMQ @@ -148,7 +148,7 @@ test_test_lbrycrd_fuzzy_LDADD = \ $(LIBBITCOIN_CRYPTO_SHANI) \ $(LIBSECP256K1) -test_test_lbrycrd_fuzzy_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS) +test_test_lbrycrd_fuzzy_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) # nodist_test_test_lbrycrd_SOURCES = $(GENERATED_TEST_FILES) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index db713f58d..2684399cf 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -107,10 +107,10 @@ static int AppInitRPC(int argc, char* argv[]) std::string strUsage = PACKAGE_NAME " RPC client version " + FormatFullVersion() + "\n"; if (!gArgs.IsArgSet("-version")) { strUsage += "\n" - "Usage: bitcoin-cli [options] [params] Send command to " PACKAGE_NAME "\n" - "or: bitcoin-cli [options] -named [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n" - "or: bitcoin-cli [options] help List commands\n" - "or: bitcoin-cli [options] help Get help for a command\n"; + "Usage: lbrycrd-cli [options] [params] Send command to " PACKAGE_NAME "\n" + "or: lbrycrd-cli [options] -named [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n" + "or: lbrycrd-cli [options] help List commands\n" + "or: lbrycrd-cli [options] help Get help for a command\n"; strUsage += "\n" + gArgs.GetHelpMessage(); } @@ -470,7 +470,7 @@ static int CommandLineRPC(int argc, char *argv[]) strPrint += "error message:\n"+errMsg.get_str(); if (errCode.isNum() && errCode.get_int() == RPC_WALLET_NOT_SPECIFIED) { - strPrint += "\nTry adding \"-rpcwallet=\" option to bitcoin-cli command line."; + strPrint += "\nTry adding \"-rpcwallet=\" option to lbrycrd-cli command line."; } } } else { diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 5fef4724c..f2bdeba7c 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -98,9 +98,9 @@ static int AppInitRawTx(int argc, char* argv[]) if (argc < 2 || HelpRequested(gArgs)) { // First part of help message is specific to this utility - std::string strUsage = PACKAGE_NAME " bitcoin-tx utility version " + FormatFullVersion() + "\n\n" + - "Usage: bitcoin-tx [options] [commands] Update hex-encoded bitcoin transaction\n" + - "or: bitcoin-tx [options] -create [commands] Create hex-encoded bitcoin transaction\n" + + std::string strUsage = PACKAGE_NAME " lbrycrd-tx utility version " + FormatFullVersion() + "\n\n" + + "Usage: lbrycrd-tx [options] [commands] Update hex-encoded lbrycrd transaction\n" + + "or: lbrycrd-tx [options] -create [commands] Create hex-encoded lbrycrd transaction\n" + "\n"; strUsage += gArgs.GetHelpMessage(); diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 06f862242..2da24e5e9 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -79,7 +79,7 @@ static bool AppInit(int argc, char* argv[]) } else { - strUsage += "\nUsage: bitcoind [options] Start " PACKAGE_NAME " Daemon\n"; + strUsage += "\nUsage: lbrycrdd [options] Start " PACKAGE_NAME " Daemon\n"; strUsage += "\n" + gArgs.GetHelpMessage(); } @@ -109,7 +109,7 @@ static bool AppInit(int argc, char* argv[]) // Error out when loose non-argument tokens are encountered on command line for (int i = 1; i < argc; i++) { if (!IsSwitchChar(argv[i][0])) { - fprintf(stderr, "Error: Command line contains unexpected token '%s', see bitcoind -h for a list of options.\n", argv[i]); + fprintf(stderr, "Error: Command line contains unexpected token '%s', see lbrycrdd -h for a list of options.\n", argv[i]); return false; } } @@ -141,7 +141,7 @@ static bool AppInit(int argc, char* argv[]) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif - fprintf(stdout, "Bitcoin server starting\n"); + fprintf(stdout, "LBRYcrd server starting\n"); // Daemonize if (daemon(1, 0)) { // don't chdir (1), do close FDs (0) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 6e6e38f84..08d6696d2 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -131,6 +131,7 @@ public: consensus.BIP16Exception = uint256S("0x00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22"); consensus.BIP34Height = 1; consensus.BIP34Hash = uint256S("0xdecb9e2cca03a419fd9cca0cb2b1d5ad11b088f22f8f38556d93ac4358b86c24"); + // FIXME: adjust heights consensus.BIP65Height = 600000; consensus.BIP66Height = 600000; consensus.powLimit = uint256S("0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -139,7 +140,9 @@ public: consensus.nOriginalClaimExpirationTime = 262974; consensus.nExtendedClaimExpirationTime = 2102400; consensus.nExtendedClaimExpirationForkHeight = 400155; - consensus.nNormalizedNameForkHeight = 1000000; // FIXME: pick a real fork height + consensus.nAllowMinDiffMinHeight = -1; + consensus.nAllowMinDiffMaxHeight = -1; + consensus.nNormalizedNameForkHeight = 539940; // targeting 21 March 2019 consensus.fPowAllowMinDifficultyBlocks = false; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016 @@ -155,7 +158,6 @@ public: // Deployment of SegWit (BIP141, BIP143, and BIP147) consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1; - // FIXME: Update times consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1547942400; // Jan 20, 2019 consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1548288000; // Jan 24, 2019 @@ -211,14 +213,12 @@ public: fRequireStandard = true; fMineBlocksOnDemand = false; - // FIXME: update checkpoints? checkpointData = { { { 4000, uint256S("0xa6bbb48f5343eb9b0287c22f3ea8b29f36cf10794a37f8a925a894d6f4519913") }, } }; - // FIXME: chainTxData = ChainTxData{ 1467272478, 4146, 600.0 /* // Data from rpc: getchaintxstats 4096 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8 */ @@ -244,20 +244,22 @@ public: consensus.nMajorityRejectBlockOutdated = 75; consensus.nMajorityWindow = 100; consensus.BIP16Exception = uint256S("0x00000000dd30457c001f4095d208cc1296b0eed002427aa599874af7a432b105"); - // FIXME: adjust heights consensus.BIP34Height = 21111; consensus.BIP34Hash = uint256S("0x0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8"); - consensus.BIP65Height = 581885; // 00000000007f6655f22f98e72ed80d8b06dc761d5da09df0fa1dc4be4f861eb6 - consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182 + // FIXME: adjust heights + consensus.BIP65Height = 1000000; + consensus.BIP66Height = 1000000; consensus.powLimit = uint256S("0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.nPowTargetTimespan = 150; consensus.nPowTargetSpacing = 150; consensus.nOriginalClaimExpirationTime = 262974; consensus.nExtendedClaimExpirationTime = 2102400; consensus.nExtendedClaimExpirationForkHeight = 278160; + consensus.nAllowMinDiffMinHeight = 277299; + consensus.nAllowMinDiffMaxHeight = 1100000; + consensus.nNormalizedNameForkHeight = 993380; // targeting, 21 Feb 2019 consensus.fPowAllowMinDifficultyBlocks = true; consensus.fPowNoRetargeting = false; - consensus.nNormalizedNameForkHeight = 1000000; // FIXME: pick a real fork height consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; @@ -278,7 +280,7 @@ public: consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000a0c3931735170"); // By default assume that the signatures in ancestors of this block are valid. - consensus.defaultAssumeValid = uint256S("0x0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75"); //1354312 + consensus.defaultAssumeValid = uint256S("9812b0bcb7e889e58d999c897e9eaddb2dab98122ff1cfb238ebeef5351bd48c"); // 1 pchMessageStart[0] = 0xfa; pchMessageStart[1] = 0xe4; @@ -324,7 +326,6 @@ public: } }; - // FIXME: chainTxData = ChainTxData{ // Data from rpc: getchaintxstats 4096 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 /* nTime */ 1531929919, @@ -346,9 +347,9 @@ public: strNetworkID = "lbrycrdreg"; consensus.nSubsidyLevelInterval = 1 << 5; consensus.BIP16Exception = uint256(); - // FIXME: heights consensus.BIP34Height = 1000; // BIP34 is needed for validation_block_tests consensus.BIP34Hash = uint256(); + // FIXME: update heights and add activation tests consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests) consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests) consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -357,9 +358,11 @@ public: consensus.nOriginalClaimExpirationTime = 500; consensus.nExtendedClaimExpirationTime = 600; consensus.nExtendedClaimExpirationForkHeight = 800; + consensus.nAllowMinDiffMinHeight = -1; + consensus.nAllowMinDiffMaxHeight = -1; + consensus.nNormalizedNameForkHeight = 250; // SDK depends upon this number consensus.fPowAllowMinDifficultyBlocks = false; consensus.fPowNoRetargeting = false; - consensus.nNormalizedNameForkHeight = 2000; // FIXME: pick a real fork height consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016) consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index bc4ea9d48..88372a22c 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -11,8 +11,8 @@ #include -const std::string CBaseChainParams::MAIN = "main"; -const std::string CBaseChainParams::TESTNET = "test"; +const std::string CBaseChainParams::MAIN = "lbrycrd"; +const std::string CBaseChainParams::TESTNET = "lbrycrdtest"; const std::string CBaseChainParams::REGTEST = "regtest"; void SetupChainParamsBaseOptions() diff --git a/src/claimtrie.cpp b/src/claimtrie.cpp index 89c677cf0..db6374e6a 100644 --- a/src/claimtrie.cpp +++ b/src/claimtrie.cpp @@ -1,11 +1,15 @@ -#include "claimtrie.h" -#include "coins.h" -#include "hash.h" +#include +#include +#include -#include #include #include +#include + +static const std::string rootClaimName = ""; +static const std::string rootClaimHash = "0000000000000000000000000000000000000000000000000000000000000001"; + std::vector heightToVch(int n) { std::vector vchHeight; @@ -55,15 +59,12 @@ uint256 getValueHash(COutPoint outPoint, int nHeightOfLastTakeover) bool CClaimTrieNode::insertClaim(CClaimValue claim) { - LogPrintf("%s: Inserting %s:%d (amount: %d) into the claim trie\n", __func__, claim.outPoint.hash.ToString(), claim.outPoint.n, claim.nAmount); claims.push_back(claim); return true; } bool CClaimTrieNode::removeClaim(const COutPoint& outPoint, CClaimValue& claim) { - LogPrintf("%s: Removing txid: %s, nOut: %d from the claim trie\n", __func__, outPoint.hash.ToString(), outPoint.n); - std::vector::iterator itClaims; for (itClaims = claims.begin(); itClaims != claims.end(); ++itClaims) { @@ -233,6 +234,7 @@ void CClaimTrie::clear(CClaimTrieNode* current) clear(itchildren->second); delete itchildren->second; } + current->children.clear(); } bool CClaimTrie::haveClaim(const std::string& name, const COutPoint& outPoint) const @@ -437,94 +439,11 @@ bool CClaimTrie::getLastTakeoverForName(const std::string& name, int& lastTakeov return false; } -claimsForNameType CClaimTrie::getClaimsForName(const std::string& name) const +std::vector CClaimTrie::getClaimsForName(const std::string& name) const { - std::vector claims; - std::vector supports; - int nLastTakeoverHeight = 0; + static const std::vector empty{}; const CClaimTrieNode* current = getNodeForName(name); - if (current) - { - if (!current->claims.empty()) - { - nLastTakeoverHeight = current->nHeightOfLastTakeover; - } - for (std::vector::const_iterator itClaims = current->claims.begin(); itClaims != current->claims.end(); ++itClaims) - { - claims.push_back(*itClaims); - } - } - supportMapEntryType supportNode; - if (getSupportNode(name, supportNode)) - { - for (std::vector::const_iterator itSupports = supportNode.begin(); itSupports != supportNode.end(); ++itSupports) - { - supports.push_back(*itSupports); - } - } - queueNameRowType namedClaimRow; - if (getQueueNameRow(name, namedClaimRow)) - { - for (queueNameRowType::const_iterator itClaimsForName = namedClaimRow.begin(); itClaimsForName != namedClaimRow.end(); ++itClaimsForName) - { - claimQueueRowType claimRow; - if (getQueueRow(itClaimsForName->nHeight, claimRow)) - { - for (claimQueueRowType::const_iterator itClaimRow = claimRow.begin(); itClaimRow != claimRow.end(); ++itClaimRow) - { - if (itClaimRow->first == name && itClaimRow->second.outPoint == itClaimsForName->outPoint) - { - claims.push_back(itClaimRow->second); - break; - } - } - } - } - } - queueNameRowType namedSupportRow; - if (getSupportQueueNameRow(name, namedSupportRow)) - { - for (queueNameRowType::const_iterator itSupportsForName = namedSupportRow.begin(); itSupportsForName != namedSupportRow.end(); ++itSupportsForName) - { - supportQueueRowType supportRow; - if (getSupportQueueRow(itSupportsForName->nHeight, supportRow)) - { - for (supportQueueRowType::const_iterator itSupportRow = supportRow.begin(); itSupportRow != supportRow.end(); ++itSupportRow) - { - if (itSupportRow->first == name && itSupportRow->second.outPoint == itSupportsForName->outPoint) - { - supports.push_back(itSupportRow->second); - break; - } - } - } - } - } - return { std::move(claims), std::move(supports), nLastTakeoverHeight }; -} - -//return effective amount from claim, retuns 0 if claim is not found -CAmount CClaimTrie::getEffectiveAmountForClaim(const std::string& name, const uint160& claimId, std::vector* supports) const -{ - return getEffectiveAmountForClaim(getClaimsForName(name), claimId, supports); -} - -CAmount CClaimTrie::getEffectiveAmountForClaim(const claimsForNameType& claims, const uint160& claimId, std::vector* supports) const -{ - CAmount effectiveAmount = 0; - for (std::vector::const_iterator it = claims.claims.begin(); it != claims.claims.end(); ++it) { - if (it->claimId == claimId && it->nValidAtHeight < nCurrentHeight) { - effectiveAmount += it->nAmount; - for (std::vector::const_iterator it = claims.supports.begin(); it != claims.supports.end(); ++it) { - if (it->supportedClaimId == claimId && it->nValidAtHeight < nCurrentHeight) { - effectiveAmount += it->nAmount; - if (supports) supports->push_back(*it); - } - } - break; - } - } - return effectiveAmount; + return current == nullptr ? empty : current->claims; } bool CClaimTrie::checkConsistency() const @@ -550,9 +469,7 @@ bool CClaimTrie::recursiveCheckConsistency(const CClaimTrieNode* node) const } CClaimValue claim; - bool hasClaim = node->getBestClaim(claim); - - if (hasClaim) + if (node->getBestClaim(claim)) // hasClaim { uint256 valueHash = getValueHash(claim.outPoint, node->nHeightOfLastTakeover); vchToHash.insert(vchToHash.end(), valueHash.begin(), valueHash.end()); @@ -569,13 +486,11 @@ bool CClaimTrie::recursiveCheckConsistency(const CClaimTrieNode* node) const void CClaimTrie::addToClaimIndex(const std::string& name, const CClaimValue& claim) { CClaimIndexElement element = { name, claim }; - LogPrintf("%s: ClaimIndex[%s] updated %s\n", __func__, claim.claimId.GetHex(), name); db.Write(std::make_pair(CLAIM_BY_ID, claim.claimId), element); } void CClaimTrie::removeFromClaimIndex(const CClaimValue& claim) { - LogPrintf("%s: ClaimIndex[%s] removed\n", __func__, claim.claimId.GetHex()); db.Erase(std::make_pair(CLAIM_BY_ID, claim.claimId)); } @@ -613,7 +528,6 @@ bool CClaimTrie::getQueueNameRow(const std::string& name, queueNameRowType& row) if (itQueueNameRow != dirtyQueueNameRows.end()) { row = itQueueNameRow->second; - LogPrintf("%s: Found row of size %d for %s\n", __func__, row.size(), name); return true; } return db.Read(std::make_pair(CLAIM_QUEUE_NAME_ROW, name), row); @@ -871,10 +785,9 @@ bool CClaimTrie::updateName(const std::string &name, CClaimTrieNode* updatedNode { // This character has apparently been deleted, so delete // all descendents from this child. - std::stringstream ss; - ss << name << itchild->first; - std::string newName = ss.str(); - if (!recursiveNullify(itchild->second, newName)) + std::stringstream nextName; + nextName << name << itchild->first; + if (!recursiveNullify(itchild->second, nextName.str())) return false; current->children.erase(itchild++); } @@ -884,15 +797,14 @@ bool CClaimTrie::updateName(const std::string &name, CClaimTrieNode* updatedNode return true; } -bool CClaimTrie::recursiveNullify(CClaimTrieNode* node, std::string& name) +bool CClaimTrie::recursiveNullify(CClaimTrieNode* node, const std::string& name) { assert(node != NULL); for (nodeMapType::iterator itchild = node->children.begin(); itchild != node->children.end(); ++itchild) { - std::stringstream ss; - ss << name << itchild->first; - std::string newName = ss.str(); - if (!recursiveNullify(itchild->second, newName)) + std::stringstream nextName; + nextName << name << itchild->first; + if (!recursiveNullify(itchild->second, nextName.str())) return false; } node->children.clear(); @@ -912,6 +824,7 @@ bool CClaimTrie::updateHash(const std::string& name, uint256& hash) current = itchild->second; } assert(current != NULL); + assert(!hash.IsNull()); current->hash = hash; markNodeDirty(name, current); return true; @@ -1073,7 +986,7 @@ bool CClaimTrie::WriteToDisk() bool CClaimTrie::InsertFromDisk(const std::string& name, CClaimTrieNode* node) { - if (name.size() == 0) + if (name.empty()) { root = *node; return true; @@ -1139,11 +1052,10 @@ bool CClaimTrie::ReadFromDisk(bool check) return true; } -bool CClaimTrieCache::recursiveComputeMerkleHash(CClaimTrieNode* tnCurrent, std::string sPos) const +bool CClaimTrieCacheBase::recursiveComputeMerkleHash(CClaimTrieNode* tnCurrent, const std::string& sPos, bool forceCompute) const { - if (sPos == "" && tnCurrent->empty()) - { - cacheHashes[""] = uint256S("0000000000000000000000000000000000000000000000000000000000000001"); + if ((sPos == rootClaimName) && tnCurrent->empty()) { + cacheHashes[rootClaimName] = uint256S(rootClaimHash); return true; } std::vector vchToHash; @@ -1152,33 +1064,34 @@ bool CClaimTrieCache::recursiveComputeMerkleHash(CClaimTrieNode* tnCurrent, std: for (nodeMapType::iterator it = tnCurrent->children.begin(); it != tnCurrent->children.end(); ++it) { std::stringstream ss; - ss << it->first; - std::string sNextPos = sPos + ss.str(); - if (dirtyHashes.count(sNextPos) != 0) + ss << sPos << it->first; + const std::string& sNextPos = ss.str(); + if ((dirtyHashes.count(sNextPos) != 0) || forceCompute) { // the child might be in the cache, so look for it there cachedNode = cache.find(sNextPos); if (cachedNode != cache.end()) - recursiveComputeMerkleHash(cachedNode->second, sNextPos); + recursiveComputeMerkleHash(cachedNode->second, sNextPos, forceCompute); else - recursiveComputeMerkleHash(it->second, sNextPos); + recursiveComputeMerkleHash(it->second, sNextPos, forceCompute); } - vchToHash.push_back(it->first); + vchToHash.push_back(sNextPos[sNextPos.size() - 1]); + hashMapType::iterator ithash = cacheHashes.find(sNextPos); if (ithash != cacheHashes.end()) { + assert(!ithash->second.IsNull()); // fast call if it's not actually null (as the first byte will bail) vchToHash.insert(vchToHash.end(), ithash->second.begin(), ithash->second.end()); } else { + assert(!it->second->hash.IsNull()); vchToHash.insert(vchToHash.end(), it->second->hash.begin(), it->second->hash.end()); } } CClaimValue claim; - bool hasClaim = tnCurrent->getBestClaim(claim); - - if (hasClaim) + if (tnCurrent->getBestClaim(claim)) // hasClaim { int nHeightOfLastTakeover; assert(getLastTakeoverForName(sPos, nHeightOfLastTakeover)); @@ -1187,75 +1100,60 @@ bool CClaimTrieCache::recursiveComputeMerkleHash(CClaimTrieNode* tnCurrent, std: } CHash256 hasher; - std::vector vchHash(hasher.OUTPUT_SIZE); hasher.Write(vchToHash.data(), vchToHash.size()); + std::vector vchHash(hasher.OUTPUT_SIZE); hasher.Finalize(&(vchHash[0])); cacheHashes[sPos] = uint256(vchHash); - std::set::iterator itDirty = dirtyHashes.find(sPos); - if (itDirty != dirtyHashes.end()) - dirtyHashes.erase(itDirty); + dirtyHashes.erase(sPos); + return true; } -uint256 CClaimTrieCache::getMerkleHash() const +uint256 CClaimTrieCacheBase::getMerkleHash(bool forceCompute) const { if (empty()) { - uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); + static const uint256 one(uint256S(rootClaimHash)); return one; } - if (dirty()) + if (forceCompute || dirty()) { - recursiveComputeMerkleHash(getRoot(), ""); + CClaimTrieNode* root = getRoot(); + recursiveComputeMerkleHash(root, rootClaimName, forceCompute); + dirtyHashes.clear(); } - hashMapType::iterator ithash = cacheHashes.find(""); - if (ithash != cacheHashes.end()) - return ithash->second; - else - return base->root.hash; + hashMapType::iterator ithash = cacheHashes.find(rootClaimName); + return ((ithash != cacheHashes.end()) ? ithash->second : base->root.hash); } -bool CClaimTrieCache::empty() const +bool CClaimTrieCacheBase::empty() const { return base->empty() && cache.empty(); } -CClaimTrieNode* CClaimTrieCache::addNodeToCache(const std::string& position, CClaimTrieNode* original) const +CClaimTrieNode* CClaimTrieCacheBase::addNodeToCache(const std::string& position, CClaimTrieNode* original) const { // create a copy of the node in the cache, if new node, create empty node - CClaimTrieNode* cacheCopy; - if(!original) - cacheCopy = new CClaimTrieNode(); - else - cacheCopy = new CClaimTrieNode(*original); + CClaimTrieNode* cacheCopy = (original ? new CClaimTrieNode(*original) : new CClaimTrieNode()); cache[position] = cacheCopy; // check to see if there is the original node in block_originals, // if not, add it to block_originals cache nodeCacheType::const_iterator itOriginals = block_originals.find(position); if (block_originals.end() == itOriginals) - { - CClaimTrieNode* originalCopy; - if(!original) - originalCopy = new CClaimTrieNode(); - else - originalCopy = new CClaimTrieNode(*original); - block_originals[position] = originalCopy; - } + block_originals[position] = (original ? new CClaimTrieNode(*original) : new CClaimTrieNode()); + return cacheCopy; } -bool CClaimTrieCache::getOriginalInfoForName(const std::string& name, CClaimValue& claim) const +bool CClaimTrieCacheBase::getOriginalInfoForName(const std::string& name, CClaimValue& claim) const { nodeCacheType::const_iterator itOriginalCache = block_originals.find(name); - if (itOriginalCache == block_originals.end()) - { - return base->getInfoForName(name, claim); - } - return itOriginalCache->second->getBestClaim(claim); + return ((itOriginalCache == block_originals.end()) ? base->getInfoForName(name, claim) : + itOriginalCache->second->getBestClaim(claim)); } -bool CClaimTrieCache::insertClaimIntoTrie(const std::string& name, CClaimValue claim, bool fCheckTakeover) const +bool CClaimTrieCacheBase::insertClaimIntoTrie(const std::string& name, CClaimValue claim, bool fCheckTakeover) const { assert(base); CClaimTrieNode* currentNode = getRoot(); @@ -1341,7 +1239,7 @@ bool CClaimTrieCache::insertClaimIntoTrie(const std::string& name, CClaimValue c return true; } -bool CClaimTrieCache::removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, CClaimValue& claim, bool fCheckTakeover) const +bool CClaimTrieCacheBase::removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, CClaimValue& claim, bool fCheckTakeover) const { assert(base); CClaimTrieNode* currentNode = getRoot(); @@ -1372,31 +1270,22 @@ bool CClaimTrieCache::removeClaimFromTrie(const std::string& name, const COutPoi if (cachedNode != cache.end()) assert(cachedNode->second == currentNode); else - { currentNode = addNodeToCache(name, currentNode); - } - bool fChanged = false; - assert(currentNode != NULL); - bool success = false; + assert(currentNode != NULL); if (currentNode->claims.empty()) { LogPrintf("%s: Asked to remove claim from node without claims\n", __func__); return false; } - CClaimValue currentTop = currentNode->claims.front(); - success = currentNode->removeClaim(outPoint, claim); + bool success = currentNode->removeClaim(outPoint, claim); if (!currentNode->claims.empty()) { supportMapEntryType node; getSupportsForName(name, node); currentNode->reorderClaims(node); - if (currentTop != currentNode->claims.front()) - fChanged = true; } - else - fChanged = true; if (!success) { @@ -1404,21 +1293,19 @@ bool CClaimTrieCache::removeClaimFromTrie(const std::string& name, const COutPoi return false; } - if (fChanged) + for (std::string::const_iterator itCur = name.begin(); itCur != name.end(); ++itCur) { - for (std::string::const_iterator itCur = name.begin(); itCur != name.end(); ++itCur) - { - std::string sub(name.begin(), itCur); - dirtyHashes.insert(sub); - } - dirtyHashes.insert(name); - if (fCheckTakeover) - namesToCheckForTakeover.insert(name); + std::string sub(name.begin(), itCur); + dirtyHashes.insert(sub); } + dirtyHashes.insert(name); + if (fCheckTakeover) + namesToCheckForTakeover.insert(name); + return recursivePruneName(getRoot(), 0, name); } -bool CClaimTrieCache::recursivePruneName(CClaimTrieNode* tnCurrent, unsigned int nPos, std::string sName, bool* pfNullified) const +bool CClaimTrieCacheBase::recursivePruneName(CClaimTrieNode* tnCurrent, unsigned int nPos, const std::string& sName, bool* pfNullified) const { // Recursively prune leaf node(s) without any claims in it and store // the modified nodes in the cache @@ -1492,7 +1379,7 @@ bool CClaimTrieCache::recursivePruneName(CClaimTrieNode* tnCurrent, unsigned int return true; } -claimQueueType::iterator CClaimTrieCache::getQueueCacheRow(int nHeight, bool createIfNotExists) const +claimQueueType::iterator CClaimTrieCacheBase::getQueueCacheRow(int nHeight, bool createIfNotExists) const { claimQueueType::iterator itQueueRow = claimQueueCache.find(nHeight); if (itQueueRow == claimQueueCache.end()) @@ -1513,7 +1400,7 @@ claimQueueType::iterator CClaimTrieCache::getQueueCacheRow(int nHeight, bool cre return itQueueRow; } -queueNameType::iterator CClaimTrieCache::getQueueCacheNameRow(const std::string& name, bool createIfNotExists) const +queueNameType::iterator CClaimTrieCacheBase::getQueueCacheNameRow(const std::string& name, bool createIfNotExists) const { queueNameType::iterator itQueueNameRow = claimQueueNameCache.find(name); if (itQueueNameRow == claimQueueNameCache.end()) @@ -1534,59 +1421,55 @@ queueNameType::iterator CClaimTrieCache::getQueueCacheNameRow(const std::string& return itQueueNameRow; } -bool CClaimTrieCache::addClaim(const std::string& name, const COutPoint& outPoint, uint160 claimId, CAmount nAmount, int nHeight) const +bool CClaimTrieCacheBase::addClaim(const std::string& name, const COutPoint& outPoint, uint160 claimId, CAmount nAmount, int nHeight) const { - LogPrintf("%s: name: %s, txhash: %s, nOut: %d, claimId: %s, nAmount: %d, nHeight: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, claimId.GetHex(), nAmount, nHeight, nCurrentHeight); + LogPrintf("%s: name: %s, txhash: %s, nOut: %d, claimId: %s, nAmount: %u, nHeight: %d, nCurrentHeight: %lu\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, claimId.GetHex(), nAmount, nHeight, nCurrentHeight); assert(nHeight == nCurrentHeight); - CClaimValue currentClaim; - int delayForClaim; - if (getOriginalInfoForName(name, currentClaim) && currentClaim.claimId == claimId) - { - LogPrintf("%s: This is an update to a best claim.\n", __func__); - delayForClaim = 0; - } - else - { - delayForClaim = getDelayForName(name); - } - CClaimValue newClaim(outPoint, claimId, nAmount, nHeight, nHeight + delayForClaim); - return addClaimToQueues(name, newClaim); -} -bool CClaimTrieCache::undoSpendClaim(const std::string& name, const COutPoint& outPoint, uint160 claimId, CAmount nAmount, int nHeight, int nValidAtHeight) const -{ - LogPrintf("%s: name: %s, txhash: %s, nOut: %d, claimId: %s, nAmount: %d, nHeight: %d, nValidAtHeight: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, claimId.GetHex(), nAmount, nHeight, nValidAtHeight, nCurrentHeight); - CClaimValue claim(outPoint, claimId, nAmount, nHeight, nValidAtHeight); - if (nValidAtHeight < nCurrentHeight) - { - nameOutPointType entry(name, claim.outPoint); - addToExpirationQueue(claim.nHeight + base->nExpirationTime, entry); - CClaimIndexElement element = {name, claim}; - claimsToAdd.push_back(element); - return insertClaimIntoTrie(name, claim, false); - } - else - { - return addClaimToQueues(name, claim); - } -} - -bool CClaimTrieCache::addClaimToQueues(const std::string& name, CClaimValue& claim) const -{ - LogPrintf("%s: nValidAtHeight: %d\n", __func__, claim.nValidAtHeight); - claimQueueEntryType entry(name, claim); - claimQueueType::iterator itQueueRow = getQueueCacheRow(claim.nValidAtHeight, true); - queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(name, true); - itQueueRow->second.push_back(entry); - itQueueNameRow->second.push_back(outPointHeightType(claim.outPoint, claim.nValidAtHeight)); - nameOutPointType expireEntry(name, claim.outPoint); - addToExpirationQueue(claim.nHeight + base->nExpirationTime, expireEntry); + int delayForClaim = getDelayForName(name, claimId); + CClaimValue claim(outPoint, claimId, nAmount, nHeight, nHeight + delayForClaim); + addClaimToQueues(name, claim); CClaimIndexElement element = {name, claim}; claimsToAdd.push_back(element); return true; } -bool CClaimTrieCache::removeClaimFromQueue(const std::string& name, const COutPoint& outPoint, CClaimValue& claim) const +bool CClaimTrieCacheBase::undoSpendClaim(const std::string& name, const COutPoint& outPoint, uint160 claimId, CAmount nAmount, int nHeight, int nValidAtHeight) const +{ + LogPrintf("%s: name: %s, txhash: %s, nOut: %d, claimId: %s, nAmount: %d, nHeight: %d, nValidAtHeight: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, claimId.GetHex(), nAmount, nHeight, nValidAtHeight, nCurrentHeight); + CClaimValue claim(outPoint, claimId, nAmount, nHeight, nValidAtHeight); + if (nValidAtHeight < nCurrentHeight) + { + nameOutPointType entry(adjustNameForValidHeight(name, nValidAtHeight), claim.outPoint); + addToExpirationQueue(claim.nHeight + base->nExpirationTime, entry); + CClaimIndexElement element = {name, claim}; + claimsToAdd.push_back(element); + return insertClaimIntoTrie(name, claim, false); + } + addClaimToQueues(name, claim); + CClaimIndexElement element = {name, claim}; + claimsToAdd.push_back(element); + return true; +} + +void CClaimTrieCacheBase::addClaimToQueues(const std::string& name, CClaimValue& claim) const +{ + // name is not normalized and we always keep the original name data in the queues and index + claimQueueEntryType entry(name, claim); + claimQueueType::iterator itQueueRow = getQueueCacheRow(claim.nValidAtHeight, true); + queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(name, true); + itQueueRow->second.push_back(entry); + itQueueNameRow->second.push_back(outPointHeightType(claim.outPoint, claim.nValidAtHeight)); + + nameOutPointType expireEntry(name, claim.outPoint); + addToExpirationQueue(claim.nHeight + base->nExpirationTime, expireEntry); +} + +std::string CClaimTrieCacheBase::adjustNameForValidHeight(const std::string& name, int validHeight) const { + return name; +} + +bool CClaimTrieCacheBase::removeClaimFromQueue(const std::string& name, const COutPoint& outPoint, CClaimValue& claim) const { queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(name, false); if (itQueueNameRow == claimQueueNameCache.end()) @@ -1609,9 +1492,10 @@ bool CClaimTrieCache::removeClaimFromQueue(const std::string& name, const COutPo if (itQueueRow != claimQueueCache.end()) { claimQueueRowType::iterator itQueue; + // compare normalized names for the UPDATE_OP; we allow you to change the case on an update after the fork for (itQueue = itQueueRow->second.begin(); itQueue != itQueueRow->second.end(); ++itQueue) { - if (name == itQueue->first && itQueue->second.outPoint == outPoint) + if (itQueue->second.outPoint == outPoint && name == itQueue->first) { break; } @@ -1628,40 +1512,49 @@ bool CClaimTrieCache::removeClaimFromQueue(const std::string& name, const COutPo return false; } -bool CClaimTrieCache::undoAddClaim(const std::string& name, const COutPoint& outPoint) const +bool CClaimTrieCacheBase::undoAddClaim(const std::string& name, const COutPoint& outPoint, int nHeight) const { int throwaway; - return removeClaim(name, outPoint, throwaway, false); + return removeClaim(name, outPoint, nHeight, throwaway, false); } -bool CClaimTrieCache::spendClaim(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight) const +bool CClaimTrieCacheBase::spendClaim(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight) const { - return removeClaim(name, outPoint, nValidAtHeight, true); + return removeClaim(name, outPoint, nHeight, nValidAtHeight, true); } -bool CClaimTrieCache::removeClaim(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight, bool fCheckTakeover) const +bool CClaimTrieCacheBase::removeClaim(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight, bool fCheckTakeover) const { - LogPrintf("%s: name: %s, txhash: %s, nOut: %s, nCurrentHeight: %s\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, nCurrentHeight); - + LogPrintf("%s: name: %s, txhash: %s, nOut: %s, nHeight: %s, nCurrentHeight: %s\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, nHeight, nCurrentHeight); + bool removed = false; CClaimValue claim; - if (removeClaimFromQueue(name, outPoint, claim) - || removeClaimFromTrie(name, outPoint, claim, fCheckTakeover)) { - nValidAtHeight = claim.nValidAtHeight; - int expirationHeight = claim.nHeight + base->nExpirationTime; - removeFromExpirationQueue(name, outPoint, expirationHeight); - claimsToDelete.insert(claim); - return true; + nValidAtHeight = nHeight + getDelayForName(name); + std::string adjusted = adjustNameForValidHeight(name, nValidAtHeight); + + if (removeClaimFromQueue(adjusted, outPoint, claim)) { + // assert(claim.nValidAtHeight == nValidAtHeight); probably better to leak than to crash + removed = true; } - return false; + if (removed == false && removeClaimFromTrie(name, outPoint, claim, fCheckTakeover)) { + removed = true; + } + if (removed == true) + { + int expirationHeight = claim.nHeight + base->nExpirationTime; + removeFromExpirationQueue(adjusted, outPoint, expirationHeight); + claimsToDelete.insert(claim); + nValidAtHeight = claim.nValidAtHeight; + } + return removed; } -void CClaimTrieCache::addToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const +void CClaimTrieCacheBase::addToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const { expirationQueueType::iterator itQueueRow = getExpirationQueueCacheRow(nExpirationHeight, true); itQueueRow->second.push_back(entry); } -void CClaimTrieCache::removeFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int expirationHeight) const +void CClaimTrieCacheBase::removeFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int expirationHeight) const { expirationQueueType::iterator itQueueRow = getExpirationQueueCacheRow(expirationHeight, false); expirationQueueRowType::iterator itQueue; @@ -1680,7 +1573,7 @@ void CClaimTrieCache::removeFromExpirationQueue(const std::string& name, const C } } -expirationQueueType::iterator CClaimTrieCache::getExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const +expirationQueueType::iterator CClaimTrieCacheBase::getExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const { expirationQueueType::iterator itQueueRow = expirationQueueCache.find(nHeight); if (itQueueRow == expirationQueueCache.end()) @@ -1701,7 +1594,8 @@ expirationQueueType::iterator CClaimTrieCache::getExpirationQueueCacheRow(int nH return itQueueRow; } -bool CClaimTrieCache::reorderTrieNode(const std::string& name, bool fCheckTakeover) const +// "name" is already normalized if needed +bool CClaimTrieCacheBase::reorderTrieNode(const std::string& name, bool fCheckTakeover) const { assert(base); nodeCacheType::iterator cachedNode; @@ -1764,22 +1658,20 @@ bool CClaimTrieCache::reorderTrieNode(const std::string& name, bool fCheckTakeov return true; } -bool CClaimTrieCache::getSupportsForName(const std::string& name, supportMapEntryType& node) const +bool CClaimTrieCacheBase::getSupportsForName(const std::string& name, supportMapEntryType& supports) const { supportMapType::iterator cachedNode; cachedNode = supportCache.find(name); if (cachedNode != supportCache.end()) { - node = cachedNode->second; + supports = cachedNode->second; return true; } - else - { - return base->getSupportNode(name, node); - } + + return base->getSupportNode(name, supports); } -bool CClaimTrieCache::insertSupportIntoMap(const std::string& name, CSupportValue support, bool fCheckTakeover) const +bool CClaimTrieCacheBase::insertSupportIntoMap(const std::string& name, CSupportValue support, bool fCheckTakeover) const { supportMapType::iterator cachedNode; // If this node is already in the cache, use that @@ -1799,7 +1691,7 @@ bool CClaimTrieCache::insertSupportIntoMap(const std::string& name, CSupportValu return reorderTrieNode(name, fCheckTakeover); } -bool CClaimTrieCache::removeSupportFromMap(const std::string& name, const COutPoint& outPoint, CSupportValue& support, bool fCheckTakeover) const +bool CClaimTrieCacheBase::removeSupportFromMap(const std::string& name, const COutPoint& outPoint, CSupportValue& support, bool fCheckTakeover) const { supportMapType::iterator cachedNode; cachedNode = supportCache.find(name); @@ -1832,12 +1724,12 @@ bool CClaimTrieCache::removeSupportFromMap(const std::string& name, const COutPo } else { - LogPrintf("CClaimTrieCache::%s() : asked to remove a support that doesn't exist\n", __func__); + LogPrintf("CClaimTrieCacheBase::%s() : asked to remove a support that doesn't exist\n", __func__); return false; } } -supportQueueType::iterator CClaimTrieCache::getSupportQueueCacheRow(int nHeight, bool createIfNotExists) const +supportQueueType::iterator CClaimTrieCacheBase::getSupportQueueCacheRow(int nHeight, bool createIfNotExists) const { supportQueueType::iterator itQueueRow = supportQueueCache.find(nHeight); if (itQueueRow == supportQueueCache.end()) @@ -1856,7 +1748,7 @@ supportQueueType::iterator CClaimTrieCache::getSupportQueueCacheRow(int nHeight, return itQueueRow; } -queueNameType::iterator CClaimTrieCache::getSupportQueueCacheNameRow(const std::string& name, bool createIfNotExists) const +queueNameType::iterator CClaimTrieCacheBase::getSupportQueueCacheNameRow(const std::string& name, bool createIfNotExists) const { queueNameType::iterator itQueueNameRow = supportQueueNameCache.find(name); if (itQueueNameRow == supportQueueNameCache.end()) @@ -1875,7 +1767,7 @@ queueNameType::iterator CClaimTrieCache::getSupportQueueCacheNameRow(const std:: return itQueueNameRow; } -bool CClaimTrieCache::addSupportToQueues(const std::string& name, CSupportValue& support) const +bool CClaimTrieCacheBase::addSupportToQueues(const std::string& name, CSupportValue& support) const { LogPrintf("%s: nValidAtHeight: %d\n", __func__, support.nValidAtHeight); supportQueueEntryType entry(name, support); @@ -1888,7 +1780,7 @@ bool CClaimTrieCache::addSupportToQueues(const std::string& name, CSupportValue& return true; } -bool CClaimTrieCache::removeSupportFromQueue(const std::string& name, const COutPoint& outPoint, CSupportValue& support) const +bool CClaimTrieCacheBase::removeSupportFromQueue(const std::string& name, const COutPoint& outPoint, CSupportValue& support) const { queueNameType::iterator itQueueNameRow = getSupportQueueCacheNameRow(name, false); if (itQueueNameRow == supportQueueNameCache.end()) @@ -1914,7 +1806,7 @@ bool CClaimTrieCache::removeSupportFromQueue(const std::string& name, const COut for (itQueue = itQueueRow->second.begin(); itQueue != itQueueRow->second.end(); ++itQueue) { CSupportValue& support = itQueue->second; - if (name == itQueue->first && support.outPoint == outPoint) + if (support.outPoint == outPoint && name == itQueue->first) { break; } @@ -1931,32 +1823,23 @@ bool CClaimTrieCache::removeSupportFromQueue(const std::string& name, const COut return false; } -bool CClaimTrieCache::addSupport(const std::string& name, const COutPoint& outPoint, CAmount nAmount, uint160 supportedClaimId, int nHeight) const +bool CClaimTrieCacheBase::addSupport(const std::string& name, const COutPoint& outPoint, CAmount nAmount, uint160 supportedClaimId, int nHeight) const { LogPrintf("%s: name: %s, txhash: %s, nOut: %d, nAmount: %d, supportedClaimId: %s, nHeight: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, nAmount, supportedClaimId.GetHex(), nHeight, nCurrentHeight); assert(nHeight == nCurrentHeight); - CClaimValue claim; - int delayForSupport; - if (getOriginalInfoForName(name, claim) && claim.claimId == supportedClaimId) - { - LogPrintf("%s: This is a support to a best claim.\n", __func__); - delayForSupport = 0; - } - else - { - delayForSupport = getDelayForName(name); - } + + int delayForSupport = getDelayForName(name, supportedClaimId); CSupportValue support(outPoint, supportedClaimId, nAmount, nHeight, nHeight + delayForSupport); return addSupportToQueues(name, support); } -bool CClaimTrieCache::undoSpendSupport(const std::string& name, const COutPoint& outPoint, uint160 supportedClaimId, CAmount nAmount, int nHeight, int nValidAtHeight) const +bool CClaimTrieCacheBase::undoSpendSupport(const std::string& name, const COutPoint& outPoint, uint160 supportedClaimId, CAmount nAmount, int nHeight, int nValidAtHeight) const { LogPrintf("%s: name: %s, txhash: %s, nOut: %d, nAmount: %d, supportedClaimId: %s, nHeight: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, nAmount, supportedClaimId.GetHex(), nHeight, nCurrentHeight); CSupportValue support(outPoint, supportedClaimId, nAmount, nHeight, nValidAtHeight); if (nValidAtHeight < nCurrentHeight) { - nameOutPointType entry(name, support.outPoint); + nameOutPointType entry(adjustNameForValidHeight(name, nValidAtHeight), support.outPoint); addSupportToExpirationQueue(support.nHeight + base->nExpirationTime, entry); return insertSupportIntoMap(name, support, false); } @@ -1966,26 +1849,33 @@ bool CClaimTrieCache::undoSpendSupport(const std::string& name, const COutPoint& } } -bool CClaimTrieCache::removeSupport(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight, bool fCheckTakeover) const +bool CClaimTrieCacheBase::removeSupport(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight, bool fCheckTakeover) const { + bool removed = false; CSupportValue support; - if (removeSupportFromQueue(name, outPoint, support) - || removeSupportFromMap(name, outPoint, support, fCheckTakeover)) { - int expirationHeight = support.nHeight + base->nExpirationTime; - removeSupportFromExpirationQueue(name, outPoint, expirationHeight); - nValidAtHeight = support.nValidAtHeight; - return true; + nValidAtHeight = nHeight + getDelayForName(name); + std::string adjusted = adjustNameForValidHeight(name, nValidAtHeight); + + if (removeSupportFromQueue(adjusted, outPoint, support)) + removed = true; + if (removed == false && removeSupportFromMap(name, outPoint, support, fCheckTakeover)) + removed = true; + if (removed) + { + int expirationHeight = nHeight + base->nExpirationTime; + removeSupportFromExpirationQueue(adjusted, outPoint, expirationHeight); + nValidAtHeight = support.nValidAtHeight; // might not actually match original computation if it got incorporated early } - return false; + return removed; } -void CClaimTrieCache::addSupportToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const +void CClaimTrieCacheBase::addSupportToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const { expirationQueueType::iterator itQueueRow = getSupportExpirationQueueCacheRow(nExpirationHeight, true); itQueueRow->second.push_back(entry); } -void CClaimTrieCache::removeSupportFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int expirationHeight) const +void CClaimTrieCacheBase::removeSupportFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int expirationHeight) const { expirationQueueType::iterator itQueueRow = getSupportExpirationQueueCacheRow(expirationHeight, false); expirationQueueRowType::iterator itQueue; @@ -1993,7 +1883,7 @@ void CClaimTrieCache::removeSupportFromExpirationQueue(const std::string& name, { for (itQueue = itQueueRow->second.begin(); itQueue != itQueueRow->second.end(); ++itQueue) { - if (name == itQueue->name && outPoint == itQueue->outPoint) + if (outPoint == itQueue->outPoint && name == itQueue->name) break; } } @@ -2003,7 +1893,7 @@ void CClaimTrieCache::removeSupportFromExpirationQueue(const std::string& name, } } -expirationQueueType::iterator CClaimTrieCache::getSupportExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const +expirationQueueType::iterator CClaimTrieCacheBase::getSupportExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const { expirationQueueType::iterator itQueueRow = supportExpirationQueueCache.find(nHeight); if (itQueueRow == supportExpirationQueueCache.end()) @@ -2024,26 +1914,30 @@ expirationQueueType::iterator CClaimTrieCache::getSupportExpirationQueueCacheRow return itQueueRow; } -bool CClaimTrieCache::undoAddSupport(const std::string& name, const COutPoint& outPoint) const +bool CClaimTrieCacheBase::undoAddSupport(const std::string& name, const COutPoint& outPoint, int nHeight) const { - LogPrintf("%s: name: %s, txhash: %s, nOut: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, nCurrentHeight); + LogPrintf("%s: name: %s, txhash: %s, nOut: %d, nHeight: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, nHeight, nCurrentHeight); int throwaway; - return removeSupport(name, outPoint, throwaway, false); + return removeSupport(name, outPoint, nHeight, throwaway, false); } -bool CClaimTrieCache::spendSupport(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight) const +bool CClaimTrieCacheBase::spendSupport(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight) const { - LogPrintf("%s: name: %s, txhash: %s, nOut: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, nCurrentHeight); - return removeSupport(name, outPoint, nValidAtHeight, true); + LogPrintf("%s: name: %s, txhash: %s, nOut: %d, nHeight: %d, nCurrentHeight: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, nHeight, nCurrentHeight); + return removeSupport(name, outPoint, nHeight, nValidAtHeight, true); } -bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector >& takeoverHeightUndo) const +bool CClaimTrieCacheBase::incrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, + insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, + std::vector >& takeoverHeightUndo) { - LogPrintf("%s: nCurrentHeight (before increment): %d, claimQueueCache size %d\n", __func__, nCurrentHeight, claimQueueCache.size()); + // we don't actually modify the claimTrie here; that happens in flush + LogPrintf("%s: nCurrentHeight (before increment): %d\n", __func__, nCurrentHeight); claimQueueType::iterator itQueueRow = getQueueCacheRow(nCurrentHeight, false); if (itQueueRow != claimQueueCache.end()) { + // for each claim activating right now for (claimQueueRowType::iterator itEntry = itQueueRow->second.begin(); itEntry != itQueueRow->second.end(); ++itEntry) { bool found = false; @@ -2077,6 +1971,14 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy } } assert(found); + + // error triggered by claimtriecache_normalization: + // it will cause a double remove when rolling back -- something we don't handle correctly + // (same problem exists for the insertSupportUndo below) + //for (insertUndoType::reverse_iterator itInsertUndo = insertUndo.rbegin(); itInsertUndo != insertUndo.rend(); ++itInsertUndo) + // if (itInsertUndo->name == itEntry->first && itInsertUndo->outPoint == itEntry->second.outPoint) + // throw std::runtime_error("not expected"); + insertClaimIntoTrie(itEntry->first, itEntry->second, true); insertUndo.push_back(nameOutPointHeightType(itEntry->first, itEntry->second.outPoint, itEntry->second.nValidAtHeight)); } @@ -2091,7 +1993,8 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy assert(removeClaimFromTrie(itEntry->name, itEntry->outPoint, claim, true)); claimsToDelete.insert(claim); expireUndo.push_back(std::make_pair(itEntry->name, claim)); - LogPrintf("Expiring claim %s: %s, nHeight: %d, nValidAtHeight: %d\n", claim.claimId.GetHex(), itEntry->name, claim.nHeight, claim.nValidAtHeight); + LogPrintf("Expiring claim %s: %s, nHeight: %d, nValidAtHeight: %d\n", + claim.claimId.GetHex(), itEntry->name, claim.nHeight, claim.nValidAtHeight); } itExpirationRow->second.clear(); } @@ -2143,10 +2046,30 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy CSupportValue support; assert(removeSupportFromMap(itEntry->name, itEntry->outPoint, support, true)); expireSupportUndo.push_back(std::make_pair(itEntry->name, support)); - LogPrintf("Expiring support %s: %s, nHeight: %d, nValidAtHeight: %d\n", support.supportedClaimId.GetHex(), itEntry->name, support.nHeight, support.nValidAtHeight); + LogPrintf("Expiring support %s: %s, nHeight: %d, nValidAtHeight: %d\n", + support.supportedClaimId.GetHex(), itEntry->name, support.nHeight, support.nValidAtHeight); } itSupportExpirationRow->second.clear(); } + + checkNamesForTakeover(insertUndo, insertSupportUndo, takeoverHeightUndo); + + for (nodeCacheType::const_iterator itOriginals = block_originals.begin(); itOriginals != block_originals.end(); ++itOriginals) + { + delete itOriginals->second; + } + block_originals.clear(); + for (nodeCacheType::const_iterator itCache = cache.begin(); itCache != cache.end(); ++itCache) + { + block_originals[itCache->first] = new CClaimTrieNode(*itCache->second); + } + nCurrentHeight++; + + return true; +} + +void CClaimTrieCacheBase::checkNamesForTakeover(insertUndoType& insertUndo, insertUndoType& insertSupportUndo, + std::vector >& takeoverHeightUndo) const { // check each potentially taken over name to see if a takeover occurred. // if it did, then check the claim and support insertion queues for // the names that have been taken over, immediately insert all claim and @@ -2156,8 +2079,9 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy // Run through all names that have been taken over for (std::set::iterator itNamesToCheck = namesToCheckForTakeover.begin(); itNamesToCheck != namesToCheckForTakeover.end(); ++itNamesToCheck) { + const std::string& nameToCheck = *itNamesToCheck; // Check if a takeover has occurred - nodeCacheType::iterator itCachedNode = cache.find(*itNamesToCheck); + nodeCacheType::iterator itCachedNode = cache.find(nameToCheck); // many possibilities // if this node is new, don't put it into the undo -- there will be nothing to restore, after all // if all of this node's claims were deleted, it should be put into the undo -- there could be @@ -2180,7 +2104,7 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy { haveClaimInCache = itCachedNode->second->getBestClaim(claimInCache); } - haveClaimInTrie = getOriginalInfoForName(*itNamesToCheck, claimInTrie); + haveClaimInTrie = getOriginalInfoForName(nameToCheck, claimInTrie); bool takeoverHappened = false; if (!haveClaimInTrie) { @@ -2200,21 +2124,21 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy if (takeoverHappened) { // Get all pending claims for that name and activate them all in the case that our winner is defunct. - queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(*itNamesToCheck, false); + queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(nameToCheck, false); if (itQueueNameRow != claimQueueNameCache.end()) { + // for each of those claims for (queueNameRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) { bool found = false; - // Pull those claims out of the height-based queue + // find the matching claim data from the other cache (indexed by height) claimQueueType::iterator itQueueRow = getQueueCacheRow(itQueueName->nHeight, false); claimQueueRowType::iterator itQueue; if (itQueueRow != claimQueueCache.end()) { for (itQueue = itQueueRow->second.begin(); itQueue != itQueueRow->second.end(); ++itQueue) { - if (*itNamesToCheck == itQueue->first && itQueue->second.outPoint == itQueueName->outPoint && itQueue->second.nValidAtHeight == itQueueName->nHeight) - { + if (nameToCheck == itQueue->first && itQueue->second.outPoint == itQueueName->outPoint && itQueue->second.nValidAtHeight == itQueueName->nHeight) { found = true; break; } @@ -2232,16 +2156,16 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy } else { - LogPrintf("%s(): An inconsistency was found in the claim queue. Please report this to the developers:\nClaim found in name queue but not in height based queue:\nname: %s, txid: %s, nOut: %d, nValidAtHeight in name based queue: %d, current height: %d\n", __func__, *itNamesToCheck, itQueueName->outPoint.hash.GetHex(), itQueueName->outPoint.n, itQueueName->nHeight, nCurrentHeight); + LogPrintf("%s(): An inconsistency was found in the claim queue. Please report this to the developers:\nClaim found in name queue but not in height based queue:\nname: %s, txid: %s, nOut: %d, nValidAtHeight in name based queue: %d, current height: %d\n", __func__, nameToCheck, itQueueName->outPoint.hash.GetHex(), itQueueName->outPoint.n, itQueueName->nHeight, nCurrentHeight); } - assert(found); + assert(found); // if this fails, you may have ended up with a duplicate in itQueueNameRow->second } // remove all claims from the queue for that name itQueueNameRow->second.clear(); } // // Then, get all supports in the queue for that name - queueNameType::iterator itSupportQueueNameRow = getSupportQueueCacheNameRow(*itNamesToCheck, false); + queueNameType::iterator itSupportQueueNameRow = getSupportQueueCacheNameRow(nameToCheck, false); if (itSupportQueueNameRow != supportQueueNameCache.end()) { for (queueNameRowType::iterator itSupportQueueName = itSupportQueueNameRow->second.begin(); itSupportQueueName != itSupportQueueNameRow->second.end(); ++itSupportQueueName) @@ -2253,8 +2177,7 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy supportQueueRowType::iterator itSupportQueue; for (itSupportQueue = itSupportQueueRow->second.begin(); itSupportQueue != itSupportQueueRow->second.end(); ++itSupportQueue) { - if (*itNamesToCheck == itSupportQueue->first && itSupportQueue->second.outPoint == itSupportQueueName->outPoint && itSupportQueue->second.nValidAtHeight == itSupportQueueName->nHeight) - { + if (nameToCheck == itSupportQueue->first && itSupportQueue->second.outPoint == itSupportQueueName->outPoint && itSupportQueue->second.nValidAtHeight == itSupportQueueName->nHeight) { break; } } @@ -2286,31 +2209,22 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy if (haveClaimInTrie) { int nHeightOfLastTakeover; - assert(getLastTakeoverForName(*itNamesToCheck, nHeightOfLastTakeover)); - takeoverHeightUndo.push_back(std::make_pair(*itNamesToCheck, nHeightOfLastTakeover)); + assert(getLastTakeoverForName(nameToCheck, nHeightOfLastTakeover)); + takeoverHeightUndo.push_back(std::make_pair(nameToCheck, nHeightOfLastTakeover)); } - itCachedNode = cache.find(*itNamesToCheck); + itCachedNode = cache.find(nameToCheck); if (itCachedNode != cache.end()) { - cacheTakeoverHeights[*itNamesToCheck] = nCurrentHeight; + cacheTakeoverHeights[nameToCheck] = nCurrentHeight; } } } - for (nodeCacheType::const_iterator itOriginals = block_originals.begin(); itOriginals != block_originals.end(); ++itOriginals) - { - delete itOriginals->second; - } - block_originals.clear(); - for (nodeCacheType::const_iterator itCache = cache.begin(); itCache != cache.end(); ++itCache) - { - block_originals[itCache->first] = new CClaimTrieNode(*(itCache->second)); - } namesToCheckForTakeover.clear(); - nCurrentHeight++; - return true; } -bool CClaimTrieCache::decrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector >& takeoverHeightUndo) const +bool CClaimTrieCacheBase::decrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, + insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, + std::vector >& takeoverHeightUndo) { LogPrintf("%s: nCurrentHeight (before decrement): %d\n", __func__, nCurrentHeight); nCurrentHeight--; @@ -2321,7 +2235,8 @@ bool CClaimTrieCache::decrementBlock(insertUndoType& insertUndo, claimQueueRowTy for (supportQueueRowType::iterator itSupportExpireUndo = expireSupportUndo.begin(); itSupportExpireUndo != expireSupportUndo.end(); ++itSupportExpireUndo) { insertSupportIntoMap(itSupportExpireUndo->first, itSupportExpireUndo->second, false); - itSupportExpireRow->second.push_back(nameOutPointType(itSupportExpireUndo->first, itSupportExpireUndo->second.outPoint)); + if (nCurrentHeight == itSupportExpireUndo->second.nHeight + base->nExpirationTime) + itSupportExpireRow->second.push_back(nameOutPointType(itSupportExpireUndo->first, itSupportExpireUndo->second.outPoint)); } } @@ -2371,7 +2286,7 @@ bool CClaimTrieCache::decrementBlock(insertUndoType& insertUndo, claimQueueRowTy return true; } -bool CClaimTrieCache::finalizeDecrement() const +bool CClaimTrieCacheBase::finalizeDecrement() const { for (nodeCacheType::iterator itOriginals = block_originals.begin(); itOriginals != block_originals.end(); ++itOriginals) { @@ -2385,7 +2300,7 @@ bool CClaimTrieCache::finalizeDecrement() const return true; } -bool CClaimTrieCache::getLastTakeoverForName(const std::string& name, int& nLastTakeoverForName) const +bool CClaimTrieCacheBase::getLastTakeoverForName(const std::string& name, int& nLastTakeoverForName) const { if (!fRequireTakeoverHeights) { @@ -2401,34 +2316,43 @@ bool CClaimTrieCache::getLastTakeoverForName(const std::string& name, int& nLast return true; } -int CClaimTrieCache::getNumBlocksOfContinuousOwnership(const std::string& name) const +int CClaimTrieCacheBase::getNumBlocksOfContinuousOwnership(const std::string& name) const { const CClaimTrieNode* node = getNodeForName(name); - if (node == nullptr || node->claims.empty()) - return 0; + if (!node || node->claims.empty()) return 0; int nLastTakeoverHeight; - if (!getLastTakeoverForName(name, nLastTakeoverHeight)) - return 0; + assert(getLastTakeoverForName(name, nLastTakeoverHeight)); return nCurrentHeight - nLastTakeoverHeight; } -const CClaimTrieNode* CClaimTrieCache::getNodeForName(const std::string& name) const +const CClaimTrieNode* CClaimTrieCacheBase::getNodeForName(const std::string& name) const { nodeCacheType::const_iterator itCache = cache.find(name); return ((itCache != cache.end()) ? itCache->second : base->getNodeForName(name)); } -int CClaimTrieCache::getDelayForName(const std::string& name) const +// "name" is already normalized if needed +int CClaimTrieCacheBase::getDelayForName(const std::string& name) const { if (!fRequireTakeoverHeights) - { return 0; - } + int nBlocksOfContinuousOwnership = getNumBlocksOfContinuousOwnership(name); return std::min(nBlocksOfContinuousOwnership / base->nProportionalDelayFactor, 4032); } -uint256 CClaimTrieCache::getBestBlock() +int CClaimTrieCacheBase::getDelayForName(const std::string& name, const uint160& claimId) const +{ + CClaimValue currentClaim; + int delayForClaim; + if (getOriginalInfoForName(name, currentClaim) && currentClaim.claimId == claimId) + delayForClaim = 0; + else + delayForClaim = getDelayForName(name); + return delayForClaim; +} + +uint256 CClaimTrieCacheBase::getBestBlock() { if (hashBlock.IsNull()) if (base != NULL) @@ -2436,12 +2360,12 @@ uint256 CClaimTrieCache::getBestBlock() return hashBlock; } -void CClaimTrieCache::setBestBlock(const uint256& hashBlockIn) +void CClaimTrieCacheBase::setBestBlock(const uint256& hashBlockIn) { hashBlock = hashBlockIn; } -bool CClaimTrieCache::clear() const +bool CClaimTrieCacheBase::clear() const { for (nodeCacheType::iterator itcache = cache.begin(); itcache != cache.end(); ++itcache) { @@ -2467,7 +2391,7 @@ bool CClaimTrieCache::clear() const return true; } -bool CClaimTrieCache::flush() +bool CClaimTrieCacheBase::flush() { if (dirty()) getMerkleHash(); @@ -2484,22 +2408,16 @@ bool CClaimTrieCache::flush() } bool success = base->update(cache, cacheHashes, cacheTakeoverHeights, getBestBlock(), claimQueueCache, claimQueueNameCache, expirationQueueCache, nCurrentHeight, supportCache, supportQueueCache, supportQueueNameCache, supportExpirationQueueCache); - if (success) - { - success = clear(); - } - return success; + return (success ? clear() : success); } -uint256 CClaimTrieCache::getLeafHashForProof(const std::string& currentPosition, unsigned char nodeChar, const CClaimTrieNode* currentNode) const +uint256 CClaimTrieCacheBase::getLeafHashForProof(const std::string& currentPosition, const CClaimTrieNode* currentNode) const { - std::stringstream leafPosition; - leafPosition << currentPosition << nodeChar; - hashMapType::iterator cachedHash = cacheHashes.find(leafPosition.str()); - return (cachedHash != cacheHashes.end()) ? cachedHash->second : currentNode->hash; + hashMapType::iterator cachedHash = cacheHashes.find(currentPosition); + return cachedHash == cacheHashes.end() ? currentNode->hash : cachedHash->second; } -void CClaimTrieCache::recursiveIterateTrie(std::string& name, const CClaimTrieNode* current, CNodeCallback& callback) const +void CClaimTrieCacheBase::recursiveIterateTrie(std::string& name, const CClaimTrieNode* current, CNodeCallback& callback) const { callback.visit(name, current); @@ -2515,7 +2433,7 @@ void CClaimTrieCache::recursiveIterateTrie(std::string& name, const CClaimTrieNo } } -bool CClaimTrieCache::iterateTrie(CNodeCallback& callback) const +bool CClaimTrieCacheBase::iterateTrie(CNodeCallback& callback) const { try { std::string name; @@ -2527,7 +2445,7 @@ bool CClaimTrieCache::iterateTrie(CNodeCallback& callback) const return true; } -claimsForNameType CClaimTrieCache::getClaimsForName(const std::string& name) const +claimsForNameType CClaimTrieCacheBase::getClaimsForName(const std::string& name) const { int nLastTakeoverHeight = 0; std::vector claims; @@ -2537,47 +2455,15 @@ claimsForNameType CClaimTrieCache::getClaimsForName(const std::string& name) con } supportMapEntryType supports; getSupportsForName(name, supports); - queueNameType::const_iterator itQueueNameCache = getQueueCacheNameRow(name, false); - if (itQueueNameCache != claimQueueNameCache.end()) { - const queueNameRowType& namedClaimRow = itQueueNameCache->second; - for (queueNameRowType::const_iterator itClaimsForName = namedClaimRow.begin(); itClaimsForName != namedClaimRow.end(); ++itClaimsForName) { - claimQueueType::const_iterator itQueueCache = getQueueCacheRow(itClaimsForName->nHeight, false); - if (itQueueCache != claimQueueCache.end()) { - const claimQueueRowType& claimRow = itQueueCache->second; - for (claimQueueRowType::const_iterator itClaimRow = claimRow.begin(); itClaimRow != claimRow.end(); ++itClaimRow) { - if (itClaimRow->first == name && itClaimRow->second.outPoint == itClaimsForName->outPoint) { - claims.push_back(itClaimRow->second); - break; - } - } - } - } - } - queueNameType::const_iterator itSupportQueueNameCache = getSupportQueueCacheNameRow(name, false); - if (itSupportQueueNameCache != supportQueueNameCache.end()) { - const queueNameRowType& namedSupportRow = itSupportQueueNameCache->second; - for (queueNameRowType::const_iterator itSupportsForName = namedSupportRow.begin(); itSupportsForName != namedSupportRow.end(); ++itSupportsForName) { - supportQueueType::const_iterator itSupportQueueCache = getSupportQueueCacheRow(itSupportsForName->nHeight, false); - if (itSupportQueueCache != supportQueueCache.end()) { - const supportQueueRowType& supportRow = itSupportQueueCache->second; - for (supportQueueRowType::const_iterator itSupportRow = supportRow.begin(); itSupportRow != supportRow.end(); ++itSupportRow) { - if (itSupportRow->first == name && itSupportRow->second.outPoint == itSupportsForName->outPoint) { - supports.push_back(itSupportRow->second); - break; - } - } - } - } - } - return { std::move(claims), std::move(supports), nLastTakeoverHeight }; + return claimsForNameType(claims, supports, nLastTakeoverHeight, name); } -CAmount CClaimTrieCache::getEffectiveAmountForClaim(const std::string& name, const uint160& claimId, std::vector* supports) const +CAmount CClaimTrieCacheBase::getEffectiveAmountForClaim(const std::string& name, const uint160& claimId, std::vector* supports) const { return getEffectiveAmountForClaim(getClaimsForName(name), claimId, supports); } -CAmount CClaimTrieCache::getEffectiveAmountForClaim(const claimsForNameType& claims, const uint160& claimId, std::vector* supports) const +CAmount CClaimTrieCacheBase::getEffectiveAmountForClaim(const claimsForNameType& claims, const uint160& claimId, std::vector* supports) const { CAmount effectiveAmount = 0; for (std::vector::const_iterator it = claims.claims.begin(); it != claims.claims.end(); ++it) { @@ -2595,7 +2481,7 @@ CAmount CClaimTrieCache::getEffectiveAmountForClaim(const claimsForNameType& cla return effectiveAmount; } -bool CClaimTrieCache::getInfoForName(const std::string& name, CClaimValue& claim) const +bool CClaimTrieCacheBase::getInfoForName(const std::string& name, CClaimValue& claim) const { if (dirty()) getMerkleHash(); @@ -2620,7 +2506,7 @@ bool CClaimTrieCache::getInfoForName(const std::string& name, CClaimValue& claim return false; } -bool CClaimTrieCache::getProofForName(const std::string& name, CClaimTrieProof& proof) const +bool CClaimTrieCacheBase::getProofForName(const std::string& name, CClaimTrieProof& proof) const { if (dirty()) getMerkleHash(); @@ -2651,16 +2537,19 @@ bool CClaimTrieCache::getProofForName(const std::string& name, CClaimTrieProof& CClaimTrieNode* nextCurrent = NULL; for (nodeMapType::const_iterator itChildren = current->children.begin(); itChildren != current->children.end(); ++itChildren) { - if (itName == name.end() || itChildren->first != *itName) // Leaf node + std::stringstream ss; + ss << itChildren->first; + const std::string& curStr = ss.str(); + if (itName == name.end() || curStr[0] != *itName) // Leaf node { - uint256 childHash = getLeafHashForProof(currentPosition, itChildren->first, itChildren->second); - children.push_back(std::make_pair(itChildren->first, childHash)); + uint256 childHash = getLeafHashForProof(currentPosition + curStr, itChildren->second); + children.push_back(std::make_pair(curStr[0], childHash)); } else // Full node { nextCurrent = itChildren->second; uint256 childHash; - children.push_back(std::make_pair(itChildren->first, childHash)); + children.push_back(std::make_pair(curStr[0], childHash)); } } if (currentPosition == name) @@ -2680,106 +2569,3 @@ bool CClaimTrieCache::getProofForName(const std::string& name, CClaimTrieProof& proof = CClaimTrieProof(std::move(nodes), fNameHasValue, outPoint, nHeightOfLastTakeover); return true; } - - -void CClaimTrieCache::removeAndAddToExpirationQueue(expirationQueueRowType &row, int height, bool increment) const -{ - for (expirationQueueRowType::iterator e = row.begin(); e != row.end(); ++e) - { - // remove and insert with new expiration time - removeFromExpirationQueue(e->name, e->outPoint, height); - int extend_expiration = Params().GetConsensus().nExtendedClaimExpirationTime - Params().GetConsensus().nOriginalClaimExpirationTime; - int new_expiration_height = increment ? height + extend_expiration : height - extend_expiration; - nameOutPointType entry(e->name, e->outPoint); - addToExpirationQueue(new_expiration_height, entry); - } - -} - -void CClaimTrieCache::removeAndAddSupportToExpirationQueue(expirationQueueRowType &row, int height, bool increment) const -{ - for (expirationQueueRowType::iterator e = row.begin(); e != row.end(); ++e) - { - // remove and insert with new expiration time - removeSupportFromExpirationQueue(e->name, e->outPoint, height); - int extend_expiration = Params().GetConsensus().nExtendedClaimExpirationTime - Params().GetConsensus().nOriginalClaimExpirationTime; - int new_expiration_height = increment ? height + extend_expiration : height - extend_expiration; - nameOutPointType entry(e->name, e->outPoint); - addSupportToExpirationQueue(new_expiration_height, entry); - } - -} - -bool CClaimTrieCache::forkForExpirationChange(bool increment) const -{ - /* - If increment is True, we have forked to extend the expiration time, thus items in the expiration queue - will have their expiration extended by "new expiration time - original expiration time" - - If increment is False, we are decremented a block to reverse the fork. Thus items in the expiration queue - will have their expiration extension removed. - */ - - // look through dirty expiration queues - std::set dirtyHeights; - for (expirationQueueType::const_iterator i = base->dirtyExpirationQueueRows.begin(); i != base->dirtyExpirationQueueRows.end(); ++i) - { - int height = i->first; - dirtyHeights.insert(height); - expirationQueueRowType row = i->second; - removeAndAddToExpirationQueue(row, height, increment); - } - - std::set dirtySupportHeights; - for (expirationQueueType::const_iterator i = base->dirtySupportExpirationQueueRows.begin(); i != base->dirtySupportExpirationQueueRows.end(); ++i) - { - int height = i->first; - dirtySupportHeights.insert(height); - expirationQueueRowType row = i->second; - removeAndAddSupportToExpirationQueue(row, height, increment); - } - - - //look through db for expiration queues, if we haven't already found it in dirty expiration queue - boost::scoped_ptr pcursor(const_cast(&base->db)->NewIterator()); - pcursor->SeekToFirst(); - while (pcursor->Valid()) - { - std::pair key; - if (pcursor->GetKey(key)) - { - int height = key.second; - // if we've looked through this in dirtyExprirationQueueRows, don't use it - // because its stale - if ((key.first == EXP_QUEUE_ROW) & (dirtyHeights.count(height) == 0)) - { - expirationQueueRowType row; - if (pcursor->GetValue(row)) - { - removeAndAddToExpirationQueue(row, height, increment); - } - else - { - return error("%s(): error reading expiration queue rows from disk", __func__); - } - } - else if ((key.first == SUPPORT_EXP_QUEUE_ROW) & (dirtySupportHeights.count(height) == 0)) - { - expirationQueueRowType row; - if (pcursor->GetValue(row)) - { - removeAndAddSupportToExpirationQueue(row, height, increment); - } - else - { - return error("%s(): error reading support expiration queue rows from disk", __func__); - } - } - - } - pcursor->Next(); - } - - return true; -} - diff --git a/src/claimtrie.h b/src/claimtrie.h index 3a16b8cb3..841f2a376 100644 --- a/src/claimtrie.h +++ b/src/claimtrie.h @@ -1,13 +1,13 @@ #ifndef BITCOIN_CLAIMTRIE_H #define BITCOIN_CLAIMTRIE_H -#include "amount.h" -#include "serialize.h" -#include "uint256.h" -#include "util.h" -#include "dbwrapper.h" -#include "chainparams.h" -#include "primitives/transaction.h" +#include +#include +#include +#include +#include +#include +#include #include #include @@ -321,9 +321,11 @@ struct claimsForNameType std::vector claims; std::vector supports; int nLastTakeoverHeight; + std::string name; - claimsForNameType(std::vector claims, std::vector supports, int nLastTakeoverHeight) - : claims(std::move(claims)), supports(std::move(supports)), nLastTakeoverHeight(nLastTakeoverHeight) {} + claimsForNameType(const std::vector& claims, const std::vector& supports, + int nLastTakeoverHeight, const std::string& name) + : claims(claims), supports(supports), nLastTakeoverHeight(nLastTakeoverHeight), name(name) {} claimsForNameType(const claimsForNameType&) = default; claimsForNameType(claimsForNameType&& other) @@ -331,29 +333,33 @@ struct claimsForNameType claims = std::move(other.claims); supports = std::move(other.supports); nLastTakeoverHeight = other.nLastTakeoverHeight; + name = std::move(other.name); } claimsForNameType& operator=(const claimsForNameType&) = default; claimsForNameType& operator=(claimsForNameType&& other) { - if (this != &other) { + if (this != &other) + { claims = std::move(other.claims); supports = std::move(other.supports); nLastTakeoverHeight = other.nLastTakeoverHeight; + name = std::move(other.name); } return *this; } }; -class CClaimTrieCache; +class CClaimTrieCacheBase; +class CClaimTrieCacheExpirationFork; class CClaimTrie { public: CClaimTrie(bool fMemory = false, bool fWipe = false, int nProportionalDelayFactor = 32) - : db(GetDataDir() / "claimtrie", 100, fMemory, fWipe, false) - , nCurrentHeight(0), nExpirationTime(Params().GetConsensus().nOriginalClaimExpirationTime) - , nProportionalDelayFactor(nProportionalDelayFactor) - , root(uint256S("0000000000000000000000000000000000000000000000000000000000000001")) + : db(GetDataDir() / "claimtrie", 100, fMemory, fWipe, false), nCurrentHeight(0), + nExpirationTime(Params().GetConsensus().nOriginalClaimExpirationTime), + nProportionalDelayFactor(nProportionalDelayFactor), + root(uint256S("0000000000000000000000000000000000000000000000000000000000000001")) {} uint256 getMerkleHash(); @@ -369,10 +375,7 @@ public: bool getInfoForName(const std::string& name, CClaimValue& claim) const; bool getLastTakeoverForName(const std::string& name, int& lastTakeoverHeight) const; - claimsForNameType getClaimsForName(const std::string& name) const; - - CAmount getEffectiveAmountForClaim(const std::string& name, const uint160& claimId, std::vector* supports = nullptr) const; - CAmount getEffectiveAmountForClaim(const claimsForNameType& claims, const uint160& claimId, std::vector* supports = nullptr) const; + std::vector getClaimsForName(const std::string& name) const; bool queueEmpty() const; bool supportEmpty() const; @@ -386,14 +389,6 @@ public: void removeFromClaimIndex(const CClaimValue& claim); bool getClaimById(const uint160 claimId, std::string& name, CClaimValue& claim) const; - bool getQueueRow(int nHeight, claimQueueRowType& row) const; - bool getQueueNameRow(const std::string& name, queueNameRowType& row) const; - bool getExpirationQueueRow(int nHeight, expirationQueueRowType& row) const; - bool getSupportNode(std::string name, supportMapEntryType& node) const; - bool getSupportQueueRow(int nHeight, supportQueueRowType& row) const; - bool getSupportQueueNameRow(const std::string& name, queueNameRowType& row) const; - bool getSupportExpirationQueueRow(int nHeight, expirationQueueRowType& row) const; - bool haveClaim(const std::string& name, const COutPoint& outPoint) const; bool haveClaimInQueue(const std::string& name, const COutPoint& outPoint, @@ -407,7 +402,8 @@ public: unsigned int getTotalClaimsInTrie() const; CAmount getTotalValueOfClaimsInTrie(bool fControllingOnly) const; - friend class CClaimTrieCache; + friend class CClaimTrieCacheBase; + friend class CClaimTrieCacheExpirationFork; CDBWrapper db; int nCurrentHeight; @@ -430,7 +426,7 @@ private: bool updateName(const std::string& name, CClaimTrieNode* updatedNode); bool updateHash(const std::string& name, uint256& hash); bool updateTakeoverHeight(const std::string& name, int nTakeoverHeight); - bool recursiveNullify(CClaimTrieNode* node, std::string& name); + bool recursiveNullify(CClaimTrieNode* node, const std::string& name); bool recursiveCheckConsistency(const CClaimTrieNode* node) const; @@ -441,6 +437,14 @@ private: CAmount getTotalValueOfClaimsRecursive(const CClaimTrieNode* current, bool fControllingOnly) const; + bool getQueueRow(int nHeight, claimQueueRowType& row) const; + bool getQueueNameRow(const std::string& name, queueNameRowType& row) const; + bool getExpirationQueueRow(int nHeight, expirationQueueRowType& row) const; + bool getSupportNode(std::string name, supportMapEntryType& node) const; + bool getSupportQueueRow(int nHeight, supportQueueRowType& row) const; + bool getSupportQueueNameRow(const std::string& name, queueNameRowType& row) const; + bool getSupportExpirationQueueRow(int nHeight, expirationQueueRowType& row) const; + void markNodeDirty(const std::string& name, CClaimTrieNode* node); void updateQueueRow(int nHeight, claimQueueRowType& row); void updateQueueNameRow(const std::string& name, @@ -454,8 +458,6 @@ private: void BatchWriteNode(CDBBatch& batch, const std::string& name, const CClaimTrieNode* pNode) const; - void BatchEraseNode(CDBBatch& batch, const std::string& nome) const; - void BatchWriteClaimIndex(CDBBatch& batch) const; void BatchWriteQueueRows(CDBBatch& batch); void BatchWriteQueueNameRows(CDBBatch& batch); void BatchWriteExpirationQueueRows(CDBBatch& batch); @@ -561,10 +563,10 @@ struct CNodeCallback { virtual void visit(const std::string& name, const CClaimTrieNode* node) = 0; }; -class CClaimTrieCache +class CClaimTrieCacheBase { public: - CClaimTrieCache(CClaimTrie* base, bool fRequireTakeoverHeights = true) + CClaimTrieCacheBase(CClaimTrie* base, bool fRequireTakeoverHeights = true) : base(base), fRequireTakeoverHeights(fRequireTakeoverHeights) { @@ -572,7 +574,7 @@ public: nCurrentHeight = base->nCurrentHeight; } - uint256 getMerkleHash() const; + uint256 getMerkleHash(bool forceCompute = false) const; bool empty() const; bool flush(); @@ -580,14 +582,14 @@ public: CClaimTrieNode* getRoot() const { - const auto iter = cache.find(""); + nodeCacheType::iterator iter = cache.find(""); return iter == cache.end() ? &(base->root) : iter->second; } bool addClaim(const std::string& name, const COutPoint& outPoint, uint160 claimId, CAmount nAmount, int nHeight) const; - bool undoAddClaim(const std::string& name, const COutPoint& outPoint) const; - bool spendClaim(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight) const; + bool undoAddClaim(const std::string& name, const COutPoint& outPoint, int nHeight) const; + bool spendClaim(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight) const; bool undoSpendClaim(const std::string& name, const COutPoint& outPoint, uint160 claimId, CAmount nAmount, int nHeight, int nValidAtHeight) const; @@ -595,8 +597,10 @@ public: bool addSupport(const std::string& name, const COutPoint& outPoint, CAmount nAmount, uint160 supportedClaimId, int nHeight) const; - bool undoAddSupport(const std::string& name, const COutPoint& outPoint) const; - bool spendSupport(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight) const; + bool undoAddSupport(const std::string& name, const COutPoint& outPoint, + int nHeight) const; + bool spendSupport(const std::string& name, const COutPoint& outPoint, + int nHeight, int& nValidAtHeight) const; bool undoSpendSupport(const std::string& name, const COutPoint& outPoint, uint160 supportedClaimId, CAmount nAmount, int nHeight, int nValidAtHeight) const; @@ -604,48 +608,83 @@ public: uint256 getBestBlock(); void setBestBlock(const uint256& hashBlock); - bool incrementBlock(insertUndoType& insertUndo, + virtual bool incrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, - std::vector >& takeoverHeightUndo) const; - bool decrementBlock(insertUndoType& insertUndo, + std::vector >& takeoverHeightUndo); + virtual bool decrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, - std::vector >& takeoverHeightUndo) const; + std::vector >& takeoverHeightUndo); - ~CClaimTrieCache() { clear(); } + virtual ~CClaimTrieCacheBase() { clear(); } - bool insertClaimIntoTrie(const std::string& name, CClaimValue claim, - bool fCheckTakeover = false) const; - bool removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, - CClaimValue& claim, - bool fCheckTakeover = false) const; - - bool getProofForName(const std::string& name, CClaimTrieProof& proof) const; - bool getInfoForName(const std::string& name, CClaimValue& claim) const; + virtual bool getProofForName(const std::string& name, CClaimTrieProof& proof) const; + virtual bool getInfoForName(const std::string& name, CClaimValue& claim) const; bool finalizeDecrement() const; - void removeAndAddSupportToExpirationQueue(expirationQueueRowType &row, int height, bool increment) const; - void removeAndAddToExpirationQueue(expirationQueueRowType &row, int height, bool increment) const; - - bool forkForExpirationChange(bool increment) const; - bool iterateTrie(CNodeCallback& callback) const; - claimsForNameType getClaimsForName(const std::string& name) const; + virtual claimsForNameType getClaimsForName(const std::string& name) const; - CAmount getEffectiveAmountForClaim(const std::string& name, const uint160& claimId, std::vector* supports = nullptr) const; - CAmount getEffectiveAmountForClaim(const claimsForNameType& claims, const uint160& claimId, std::vector* supports = nullptr) const; + CAmount getEffectiveAmountForClaim(const std::string& name, const uint160& claimId, std::vector* supports = NULL) const; + CAmount getEffectiveAmountForClaim(const claimsForNameType& claims, const uint160& claimId, std::vector* supports = NULL) const; protected: + // Should be private: Do not use unless you know what you're doing. + CClaimTrieNode* addNodeToCache(const std::string& position, CClaimTrieNode* original) const; + bool recursiveComputeMerkleHash(CClaimTrieNode* tnCurrent, + const std::string& sPos, + bool forceCompute = false) const; + bool recursivePruneName(CClaimTrieNode* tnCurrent, unsigned int nPos, const std::string& sName, bool* pfNullified = NULL) const; + void checkNamesForTakeover(insertUndoType& insertUndo, insertUndoType& insertSupportUndo, + std::vector >& takeoverHeightUndo) const; + + virtual bool insertClaimIntoTrie(const std::string& name, CClaimValue claim, + bool fCheckTakeover = false) const; + virtual bool removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, + CClaimValue& claim, + bool fCheckTakeover = false) const; + + virtual bool insertSupportIntoMap(const std::string& name, + CSupportValue support, + bool fCheckTakeover) const; + virtual bool removeSupportFromMap(const std::string& name, const COutPoint& outPoint, + CSupportValue& support, + bool fCheckTakeover) const; + + virtual void addClaimToQueues(const std::string& name, CClaimValue& claim) const; + virtual bool addSupportToQueues(const std::string& name, CSupportValue& support) const; + virtual std::string adjustNameForValidHeight(const std::string& name, int validHeight) const; + + void addToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const; + void removeFromExpirationQueue(const std::string& name, const COutPoint& outPoint, + int nHeight) const; + + void addSupportToExpirationQueue(int nExpirationHeight, + nameOutPointType& entry) const; + void removeSupportFromExpirationQueue(const std::string& name, + const COutPoint& outPoint, + int nHeight) const; + + bool getSupportsForName(const std::string& name, + supportMapEntryType& supports) const; + + virtual int getDelayForName(const std::string& name, const uint160& claimId) const; + + mutable nodeCacheType cache; + CClaimTrie* base; + mutable int nCurrentHeight; // Height of the block that is being worked on, which is + // one greater than the height of the chain's tip + +private: bool fRequireTakeoverHeights; - mutable nodeCacheType cache; mutable nodeCacheType block_originals; mutable std::set dirtyHashes; mutable hashMapType cacheHashes; @@ -658,31 +697,19 @@ protected: mutable expirationQueueType supportExpirationQueueCache; mutable std::set namesToCheckForTakeover; mutable std::map cacheTakeoverHeights; - mutable int nCurrentHeight; // Height of the block that is being worked on, which is - // one greater than the height of the chain's tip mutable claimIndexElementListType claimsToAdd; mutable claimIndexClaimListType claimsToDelete; uint256 hashBlock; - uint256 computeHash() const; - bool reorderTrieNode(const std::string& name, bool fCheckTakeover) const; - bool recursiveComputeMerkleHash(CClaimTrieNode* tnCurrent, - std::string sPos) const; - bool recursivePruneName(CClaimTrieNode* tnCurrent, unsigned int nPos, - std::string sName, - bool* pfNullified = NULL) const; bool clear() const; - bool removeClaim(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight, bool fCheckTakeover) const; - bool addClaimToQueues(const std::string& name, CClaimValue& claim) const; + // generally the opposite of addClaimToQueues, but they aren't perfectly symmetrical: + bool removeClaim(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight, bool fCheckTakeover) const; bool removeClaimFromQueue(const std::string& name, const COutPoint& outPoint, CClaimValue& claim) const; - void addToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const; - void removeFromExpirationQueue(const std::string& name, const COutPoint& outPoint, - int nHeight) const; claimQueueType::iterator getQueueCacheRow(int nHeight, bool createIfNotExists) const; @@ -691,40 +718,25 @@ protected: expirationQueueType::iterator getExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const; - bool removeSupport(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight, bool fCheckTakeover) const; - bool removeSupportFromMap(const std::string& name, const COutPoint& outPoint, - CSupportValue& support, - bool fCheckTakeover) const; + bool removeSupport(const std::string& name, const COutPoint& outPoint, + int nHeight, int& nValidAtHeight, + bool fCheckTakeover) const; - bool insertSupportIntoMap(const std::string& name, - CSupportValue support, - bool fCheckTakeover) const; + supportQueueType::iterator getSupportQueueCacheRow(int nHeight, + bool createIfNotExists) const; + queueNameType::iterator getSupportQueueCacheNameRow(const std::string& name, + bool createIfNotExists) const; + expirationQueueType::iterator getSupportExpirationQueueCacheRow(int nHeight, + bool createIfNotExists) const; - supportQueueType::iterator getSupportQueueCacheRow(int nHeight, bool createIfNotExists) const; - queueNameType::iterator getSupportQueueCacheNameRow(const std::string& name, bool createIfNotExists) const; - expirationQueueType::iterator getSupportExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const; - - bool addSupportToQueues(const std::string& name, CSupportValue& support) const; bool removeSupportFromQueue(const std::string& name, const COutPoint& outPoint, CSupportValue& support) const; - void addSupportToExpirationQueue(int nExpirationHeight, - nameOutPointType& entry) const; - void removeSupportFromExpirationQueue(const std::string& name, - const COutPoint& outPoint, - int nHeight) const; - - bool getSupportsForName(const std::string& name, - supportMapEntryType& node) const; - bool getLastTakeoverForName(const std::string& name, int& lastTakeoverHeight) const; int getDelayForName(const std::string& name) const; - uint256 getLeafHashForProof(const std::string& currentPosition, unsigned char nodeChar, - const CClaimTrieNode* currentNode) const; - - CClaimTrieNode* addNodeToCache(const std::string& position, CClaimTrieNode* original) const; + uint256 getLeafHashForProof(const std::string& currentPosition, const CClaimTrieNode* currentNode) const; bool getOriginalInfoForName(const std::string& name, CClaimValue& claim) const; @@ -735,4 +747,72 @@ protected: const CClaimTrieNode* getNodeForName(const std::string& name) const; }; +class CClaimTrieCacheExpirationFork: public CClaimTrieCacheBase { +public: + CClaimTrieCacheExpirationFork(CClaimTrie* base, bool fRequireTakeoverHeights = true) + : CClaimTrieCacheBase(base, fRequireTakeoverHeights) {} + + virtual ~CClaimTrieCacheExpirationFork() {} + + bool forkForExpirationChange(bool increment) const; + + // TODO: move the expiration fork code from main.cpp to overrides of increment/decrement block + +private: + void removeAndAddSupportToExpirationQueue(expirationQueueRowType &row, int height, bool increment) const; + void removeAndAddToExpirationQueue(expirationQueueRowType &row, int height, bool increment) const; +}; + +class CClaimTrieCacheNormalizationFork: public CClaimTrieCacheExpirationFork { +public: + CClaimTrieCacheNormalizationFork(CClaimTrie* base, bool fRequireTakeoverHeights = true) + : CClaimTrieCacheExpirationFork(base, fRequireTakeoverHeights), + overrideInsertNormalization(false), overrideRemoveNormalization(false) {} + + virtual ~CClaimTrieCacheNormalizationFork() {} + + bool shouldNormalize() const; + + // lower-case and normalize any input string name + // see: https://unicode.org/reports/tr15/#Norm_Forms + std::string normalizeClaimName(const std::string& name, bool force = false) const; // public only for validating name field on update op + + virtual bool incrementBlock(insertUndoType& insertUndo, + claimQueueRowType& expireUndo, + insertUndoType& insertSupportUndo, + supportQueueRowType& expireSupportUndo, + std::vector >& takeoverHeightUndo); + virtual bool decrementBlock(insertUndoType& insertUndo, + claimQueueRowType& expireUndo, + insertUndoType& insertSupportUndo, + supportQueueRowType& expireSupportUndo, + std::vector >& takeoverHeightUndo); + + virtual bool getProofForName(const std::string& name, CClaimTrieProof& proof) const; + virtual bool getInfoForName(const std::string& name, CClaimValue& claim) const; + virtual claimsForNameType getClaimsForName(const std::string& name) const; + +protected: + virtual bool insertClaimIntoTrie(const std::string& name, CClaimValue claim, bool fCheckTakeover = false) const; + virtual bool removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, + CClaimValue& claim, bool fCheckTakeover = false) const; + + virtual bool insertSupportIntoMap(const std::string& name, CSupportValue support, bool fCheckTakeover) const; + virtual bool removeSupportFromMap(const std::string& name, const COutPoint& outPoint, + CSupportValue& support, bool fCheckTakeover) const; + virtual int getDelayForName(const std::string& name, const uint160& claimId) const; + + virtual void addClaimToQueues(const std::string& name, CClaimValue& claim) const; + virtual bool addSupportToQueues(const std::string& name, CSupportValue& support) const; + virtual std::string adjustNameForValidHeight(const std::string& name, int validHeight) const; + +private: + bool overrideInsertNormalization, overrideRemoveNormalization; + bool normalizeAllNamesInTrieIfNecessary(insertUndoType& insertUndo, claimQueueRowType& removeUndo, + insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, + std::vector >& takeoverHeightUndo) const; +}; + +typedef CClaimTrieCacheNormalizationFork CClaimTrieCache; + #endif // BITCOIN_CLAIMTRIE_H diff --git a/src/claimtrieforks.cpp b/src/claimtrieforks.cpp new file mode 100644 index 000000000..0d8dc536c --- /dev/null +++ b/src/claimtrieforks.cpp @@ -0,0 +1,300 @@ +#include "claimtrie.h" + +#include +#include +#include +#include +#include +#include + +void CClaimTrieCacheExpirationFork::removeAndAddToExpirationQueue(expirationQueueRowType &row, int height, bool increment) const +{ + for (expirationQueueRowType::iterator e = row.begin(); e != row.end(); ++e) + { + // remove and insert with new expiration time + removeFromExpirationQueue(e->name, e->outPoint, height); + int extend_expiration = Params().GetConsensus().nExtendedClaimExpirationTime - Params().GetConsensus().nOriginalClaimExpirationTime; + int new_expiration_height = increment ? height + extend_expiration : height - extend_expiration; + nameOutPointType entry(e->name, e->outPoint); + addToExpirationQueue(new_expiration_height, entry); + } + +} + +void CClaimTrieCacheExpirationFork::removeAndAddSupportToExpirationQueue(expirationQueueRowType &row, int height, bool increment) const +{ + for (expirationQueueRowType::iterator e = row.begin(); e != row.end(); ++e) + { + // remove and insert with new expiration time + removeSupportFromExpirationQueue(e->name, e->outPoint, height); + int extend_expiration = Params().GetConsensus().nExtendedClaimExpirationTime - Params().GetConsensus().nOriginalClaimExpirationTime; + int new_expiration_height = increment ? height + extend_expiration : height - extend_expiration; + nameOutPointType entry(e->name, e->outPoint); + addSupportToExpirationQueue(new_expiration_height, entry); + } + +} + +bool CClaimTrieCacheExpirationFork::forkForExpirationChange(bool increment) const +{ + /* + If increment is True, we have forked to extend the expiration time, thus items in the expiration queue + will have their expiration extended by "new expiration time - original expiration time" + + If increment is False, we are decremented a block to reverse the fork. Thus items in the expiration queue + will have their expiration extension removed. + */ + + // look through dirty expiration queues + std::set dirtyHeights; + for (expirationQueueType::const_iterator i = base->dirtyExpirationQueueRows.begin(); i != base->dirtyExpirationQueueRows.end(); ++i) + { + int height = i->first; + dirtyHeights.insert(height); + expirationQueueRowType row = i->second; + removeAndAddToExpirationQueue(row, height, increment); + } + + std::set dirtySupportHeights; + for (expirationQueueType::const_iterator i = base->dirtySupportExpirationQueueRows.begin(); i != base->dirtySupportExpirationQueueRows.end(); ++i) + { + int height = i->first; + dirtySupportHeights.insert(height); + expirationQueueRowType row = i->second; + removeAndAddSupportToExpirationQueue(row, height, increment); + } + + + //look through db for expiration queues, if we haven't already found it in dirty expiration queue + boost::scoped_ptr pcursor(const_cast(&base->db)->NewIterator()); + pcursor->SeekToFirst(); + while (pcursor->Valid()) + { + std::pair key; + if (pcursor->GetKey(key)) + { + int height = key.second; + // if we've looked through this in dirtyExprirationQueueRows, don't use it + // because its stale + if ((key.first == EXP_QUEUE_ROW) & (dirtyHeights.count(height) == 0)) + { + expirationQueueRowType row; + if (pcursor->GetValue(row)) + { + removeAndAddToExpirationQueue(row, height, increment); + } + else + { + return error("%s(): error reading expiration queue rows from disk", __func__); + } + } + else if ((key.first == SUPPORT_EXP_QUEUE_ROW) & (dirtySupportHeights.count(height) == 0)) + { + expirationQueueRowType row; + if (pcursor->GetValue(row)) + { + removeAndAddSupportToExpirationQueue(row, height, increment); + } + else + { + return error("%s(): error reading support expiration queue rows from disk", __func__); + } + } + + } + pcursor->Next(); + } + + return true; +} + + +bool CClaimTrieCacheNormalizationFork::shouldNormalize() const { + return nCurrentHeight > Params().GetConsensus().nNormalizedNameForkHeight; +} + +std::string CClaimTrieCacheNormalizationFork::normalizeClaimName(const std::string& name, bool force) const { + if (!force && !shouldNormalize()) + return name; + + static std::locale utf8; + static bool initialized = false; + if (!initialized) { + static boost::locale::localization_backend_manager manager = + boost::locale::localization_backend_manager::global(); + manager.select("icu"); + + static boost::locale::generator curLocale(manager); + utf8 = curLocale("en_US.UTF8"); + initialized = true; + } + + std::string normalized; + try { + + // Check if it is a valid utf-8 string. If not, it will throw a + // boost::locale::conv::conversion_error exception which we catch later + normalized = boost::locale::conv::to_utf(name, "UTF-8", boost::locale::conv::stop); + if (normalized.empty()) + return name; + + // these methods supposedly only use the "UTF8" portion of the locale object: + normalized = boost::locale::normalize(normalized, boost::locale::norm_nfd, utf8); + normalized = boost::locale::fold_case(normalized, utf8); + } + catch (const boost::locale::conv::conversion_error& e){ + return name; + } + catch (const std::bad_cast& e) { + LogPrintf("%s() is invalid or dependencies are missing: %s\n", __func__, e.what()); + throw; + } + catch (const std::exception& e) { // TODO: change to use ... with current_exception() in c++11 + LogPrintf("%s() had an unexpected exception: %s\n", __func__, e.what()); + return name; + } + + return normalized; +} + +bool CClaimTrieCacheNormalizationFork::insertClaimIntoTrie(const std::string& name, CClaimValue claim, + bool fCheckTakeover) const { + return CClaimTrieCacheExpirationFork::insertClaimIntoTrie(normalizeClaimName(name, overrideInsertNormalization), claim, fCheckTakeover); +} + +bool CClaimTrieCacheNormalizationFork::removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, + CClaimValue& claim, bool fCheckTakeover) const { + return CClaimTrieCacheExpirationFork::removeClaimFromTrie(normalizeClaimName(name, overrideRemoveNormalization), outPoint, claim, fCheckTakeover); +} + +bool CClaimTrieCacheNormalizationFork::insertSupportIntoMap(const std::string& name, CSupportValue support, + bool fCheckTakeover) const { + return CClaimTrieCacheExpirationFork::insertSupportIntoMap(normalizeClaimName(name, overrideInsertNormalization), support, fCheckTakeover); +} +bool CClaimTrieCacheNormalizationFork::removeSupportFromMap(const std::string& name, const COutPoint& outPoint, + CSupportValue& support, bool fCheckTakeover) const { + return CClaimTrieCacheExpirationFork::removeSupportFromMap(normalizeClaimName(name, overrideRemoveNormalization), outPoint, support, fCheckTakeover); +} + +struct claimsForNormalization: public claimsForNameType { + std::string normalized; + claimsForNormalization(const std::vector& claims, const std::vector& supports, + int nLastTakeoverHeight, const std::string& name, const std::string& normalized) + : claimsForNameType(claims, supports, nLastTakeoverHeight, name), normalized(normalized) {} +}; + +bool CClaimTrieCacheNormalizationFork::normalizeAllNamesInTrieIfNecessary(insertUndoType& insertUndo, claimQueueRowType& removeUndo, + insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, + std::vector >& takeoverHeightUndo) const { + + struct CNameChangeDetector: public CNodeCallback { + std::vector hits; + const CClaimTrieCacheNormalizationFork* owner; + CNameChangeDetector(const CClaimTrieCacheNormalizationFork* owner): owner(owner) {} + void visit(const std::string& name, const CClaimTrieNode* node) { + if (node->claims.empty()) return; + const std::string normalized = owner->normalizeClaimName(name, true); + if (normalized == name) return; + + supportMapEntryType supports; + owner->getSupportsForName(name, supports); + const claimsForNormalization cfn(node->claims, supports, node->nHeightOfLastTakeover, name, normalized); + hits.push_back(cfn); + } + }; + + if (nCurrentHeight == Params().GetConsensus().nNormalizedNameForkHeight) { + + // run the one-time upgrade of all names that need to change + // it modifies the (cache) trie as it goes, so we need to grab everything to be modified first + + CNameChangeDetector detector(this); + iterateTrie(detector); + + for (std::vector::iterator it = detector.hits.begin(); it != detector.hits.end(); ++it) { + BOOST_FOREACH(CSupportValue support, it->supports) { + // if it's already going to expire just skip it + if (support.nHeight + base->nExpirationTime <= nCurrentHeight) + continue; + + bool success = removeSupportFromMap(it->name, support.outPoint, support, false); + assert(success); + expireSupportUndo.push_back(std::make_pair(it->name, support)); + success = insertSupportIntoMap(it->normalized, support, false); + assert(success); + insertSupportUndo.push_back(nameOutPointHeightType(it->name, support.outPoint, -1)); + } + + BOOST_FOREACH(CClaimValue claim, it->claims) { + if (claim.nHeight + base->nExpirationTime <= nCurrentHeight) + continue; + + bool success = removeClaimFromTrie(it->name, claim.outPoint, claim, false); + assert(success); + removeUndo.push_back(std::make_pair(it->name, claim)); + + success = insertClaimIntoTrie(it->normalized, claim, true); + assert(success); + insertUndo.push_back(nameOutPointHeightType(it->name, claim.outPoint, -1)); + } + + takeoverHeightUndo.push_back(std::make_pair(it->name, it->nLastTakeoverHeight)); + } + return true; + } + return false; +} + +bool CClaimTrieCacheNormalizationFork::incrementBlock(insertUndoType& insertUndo, + claimQueueRowType& expireUndo, + insertUndoType& insertSupportUndo, + supportQueueRowType& expireSupportUndo, + std::vector >& takeoverHeightUndo) { + overrideInsertNormalization = normalizeAllNamesInTrieIfNecessary(insertUndo, expireUndo, insertSupportUndo, + expireSupportUndo, takeoverHeightUndo); + BOOST_SCOPE_EXIT(&overrideInsertNormalization) { overrideInsertNormalization = false; } BOOST_SCOPE_EXIT_END + return CClaimTrieCacheExpirationFork::incrementBlock(insertUndo, expireUndo, insertSupportUndo, + expireSupportUndo, takeoverHeightUndo); +} + +bool CClaimTrieCacheNormalizationFork::decrementBlock(insertUndoType& insertUndo, + claimQueueRowType& expireUndo, + insertUndoType& insertSupportUndo, + supportQueueRowType& expireSupportUndo, + std::vector >& takeoverHeightUndo) { + + overrideRemoveNormalization = shouldNormalize(); + BOOST_SCOPE_EXIT(&overrideRemoveNormalization) { overrideRemoveNormalization = false; } BOOST_SCOPE_EXIT_END + return CClaimTrieCacheExpirationFork::decrementBlock(insertUndo, expireUndo, insertSupportUndo, + expireSupportUndo, takeoverHeightUndo); +} + +bool CClaimTrieCacheNormalizationFork::getProofForName(const std::string& name, CClaimTrieProof& proof) const { + return CClaimTrieCacheExpirationFork::getProofForName(normalizeClaimName(name), proof); +} + +bool CClaimTrieCacheNormalizationFork::getInfoForName(const std::string& name, CClaimValue& claim) const { + return CClaimTrieCacheExpirationFork::getInfoForName(normalizeClaimName(name), claim); +} + +claimsForNameType CClaimTrieCacheNormalizationFork::getClaimsForName(const std::string& name) const { + return CClaimTrieCacheExpirationFork::getClaimsForName(normalizeClaimName(name)); +} + +int CClaimTrieCacheNormalizationFork::getDelayForName(const std::string& name, const uint160& claimId) const { + return CClaimTrieCacheExpirationFork::getDelayForName(normalizeClaimName(name), claimId); +} + +void CClaimTrieCacheNormalizationFork::addClaimToQueues(const std::string& name, CClaimValue& claim) const { + return CClaimTrieCacheExpirationFork::addClaimToQueues(normalizeClaimName(name, + claim.nValidAtHeight > Params().GetConsensus().nNormalizedNameForkHeight), claim); +} + +bool CClaimTrieCacheNormalizationFork::addSupportToQueues(const std::string& name, CSupportValue& support) const { + return CClaimTrieCacheExpirationFork::addSupportToQueues(normalizeClaimName(name, + support.nValidAtHeight > Params().GetConsensus().nNormalizedNameForkHeight), support); +} + +std::string CClaimTrieCacheNormalizationFork::adjustNameForValidHeight(const std::string& name, int validHeight) const { + return normalizeClaimName(name, validHeight > Params().GetConsensus().nNormalizedNameForkHeight); +} \ No newline at end of file diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 5d9eaea6d..76d689caa 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -12,7 +12,7 @@ * for both bitcoind and bitcoin-qt, to make it harder for attackers to * target servers or GUI users specifically. */ -const std::string CLIENT_NAME("Satoshi"); +const std::string CLIENT_NAME("LBRY"); /** * Client version number diff --git a/src/consensus/params.h b/src/consensus/params.h index 3cbfba033..85dd75a82 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -74,6 +74,8 @@ struct Params { uint256 powLimit; bool fPowAllowMinDifficultyBlocks; bool fPowNoRetargeting; + int nAllowMinDiffMinHeight; + int nAllowMinDiffMaxHeight; int nNormalizedNameForkHeight; int64_t nPowTargetSpacing; int64_t nPowTargetTimespan; diff --git a/src/consensus/validation.h b/src/consensus/validation.h index 008eda69b..e650d00c9 100644 --- a/src/consensus/validation.h +++ b/src/consensus/validation.h @@ -18,7 +18,7 @@ static const unsigned char REJECT_INVALID = 0x10; static const unsigned char REJECT_OBSOLETE = 0x11; static const unsigned char REJECT_DUPLICATE = 0x12; static const unsigned char REJECT_NONSTANDARD = 0x40; -// static const unsigned char REJECT_DUST = 0x41; // part of BIP 61 +static const unsigned char REJECT_DUST = 0x41; // part of BIP 61 static const unsigned char REJECT_INSUFFICIENTFEE = 0x42; static const unsigned char REJECT_CHECKPOINT = 0x43; diff --git a/src/dbwrapper.h b/src/dbwrapper.h index c20b64bc7..52f9efe17 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -225,7 +225,7 @@ public: ~CDBWrapper(); CDBWrapper(const CDBWrapper&) = delete; - /* CDBWrapper& operator=(const CDBWrapper&) = delete; */ + CDBWrapper& operator=(const CDBWrapper&) = delete; template bool Read(const K& key, V& value) const diff --git a/src/init.cpp b/src/init.cpp index 87ea6c5ce..20ba62015 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -197,7 +197,7 @@ void Shutdown() /// for example if the data directory was found to be locked. /// Be sure that anything that writes files or flushes caches only does this if the respective /// module was initialized. - RenameThread("bitcoin-shutoff"); + RenameThread("lbrycrd-shutoff"); mempool.AddTransactionsUpdated(1); StopHTTPRPC(); @@ -531,8 +531,8 @@ void SetupServerArgs() std::string LicenseInfo() { - const std::string URL_SOURCE_CODE = ""; - const std::string URL_WEBSITE = ""; + const std::string URL_SOURCE_CODE = ""; + const std::string URL_WEBSITE = ""; return CopyrightHolders(strprintf(_("Copyright (C) %i-%i"), 2009, COPYRIGHT_YEAR) + " ") + "\n" + "\n" + @@ -637,7 +637,7 @@ static void CleanupBlockRevFiles() static void ThreadImport(std::vector vImportFiles) { const CChainParams& chainparams = Params(); - RenameThread("bitcoin-loadblk"); + RenameThread("lbrycrd-loadblk"); ScheduleBatchPriority(); { @@ -1254,9 +1254,9 @@ bool AppInitMain() // Warn about relative -datadir path. if (gArgs.IsArgSet("-datadir") && !fs::path(gArgs.GetArg("-datadir", "")).is_absolute()) { LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */ - "current working directory '%s'. This is fragile, because if bitcoin is started in the future " + "current working directory '%s'. This is fragile, because if lbrycrd is started in the future " "from a different location, it will be unable to locate the current data files. There could " - "also be data loss if bitcoin is started while in a temporary directory.\n", + "also be data loss if lbrycrd is started while in a temporary directory.\n", gArgs.GetArg("-datadir", ""), fs::current_path().string()); } diff --git a/src/miner.cpp b/src/miner.cpp index edd6c55d8..3e994e372 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -437,6 +437,7 @@ void BlockAssembler::addPackageTxs(int &nPackagesSelected, int &nDescendantsUpda { CCoinsViewCache view(pcoinsTip.get()); const Coin& coin = view.AccessCoin(txin.prevout); + int nTxinHeight = coin.nHeight; CScript scriptPubKey; if (coin.out.IsNull()) { auto it = std::find_if(txs.begin(), txs.end(), [&txin](const CTransactionRef& tx) { @@ -469,7 +470,7 @@ void BlockAssembler::addPackageTxs(int &nPackagesSelected, int &nDescendantsUpda } std::string name(vvchParams[0].begin(), vvchParams[0].end()); int throwaway; - if (trieCache.spendClaim(name, COutPoint(txin.prevout.hash, txin.prevout.n), throwaway)) + if (trieCache.spendClaim(name, COutPoint(txin.prevout.hash, txin.prevout.n), nTxinHeight, throwaway)) { std::pair entry(name, claimId); spentClaims.push_back(entry); @@ -484,7 +485,7 @@ void BlockAssembler::addPackageTxs(int &nPackagesSelected, int &nDescendantsUpda assert(vvchParams.size() == 2); std::string name(vvchParams[0].begin(), vvchParams[0].end()); int throwaway; - if (!trieCache.spendSupport(name, COutPoint(txin.prevout.hash, txin.prevout.n), throwaway)) + if (!trieCache.spendSupport(name, COutPoint(txin.prevout.hash, txin.prevout.n), nTxinHeight, throwaway)) { LogPrintf("%s(): The support was not found in the trie or queue\n", __func__); } diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 03b3f54d4..88999ba73 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1549,7 +1549,6 @@ bool static ProcessHeadersMessage(CNode *pfrom, CConnman *connman, const std::ve // nMinimumChainWork, even if a peer has a chain past our tip, // as an anti-DoS measure. if (IsOutboundDisconnectionCandidate(pfrom)) { - LogPrintf("Disconnecting outbound peer %d (%s < %s) -- headers chain has insufficient work\n", pfrom->GetId(), nodestate->pindexBestKnownBlock->nChainWork.GetHex(), nMinimumChainWork.GetHex()); LogPrintf("Disconnecting outbound peer %d -- headers chain has insufficient work\n", pfrom->GetId()); pfrom->fDisconnect = true; } @@ -1648,8 +1647,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr vRecv >> nVersion >> nServiceInt >> nTime >> addrMe; nSendVersion = std::min(nVersion, PROTOCOL_VERSION); nServices = ServiceFlags(nServiceInt); - LogPrint(BCLog::NET, "peer=%d services (%08x offered, %08x expected);\n", pfrom->GetId(), nServices, GetDesirableServiceFlags(nServices)); - if (!pfrom->fInbound) { connman->SetServices(pfrom->addr, nServices); @@ -2017,7 +2014,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr else if (strCommand == NetMsgType::GETBLOCKS) { - LogPrintf("%s: Got GETBLOCKS message\n", __func__); CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; @@ -3520,24 +3516,17 @@ bool PeerLogicValidation::SendMessages(CNode* pto) std::vector vInv; { LOCK(pto->cs_inventory); - /* vInv.reserve(std::max(pto->vInventoryBlockToSend.size(), INVENTORY_BROADCAST_MAX)); */ - // FIXME: Bitcoin bug?! - vInv.reserve(std::min(pto->vInventoryBlockToSend.size(), INVENTORY_BROADCAST_MAX)); + vInv.reserve(std::max(pto->vInventoryBlockToSend.size(), INVENTORY_BROADCAST_MAX)); // Add blocks - size_t count = 0; for (const uint256& hash : pto->vInventoryBlockToSend) { vInv.push_back(CInv(MSG_BLOCK, hash)); if (vInv.size() == MAX_INV_SZ) { connman->PushMessage(pto, msgMaker.Make(NetMsgType::INV, vInv)); vInv.clear(); } - if (++count >= INVENTORY_BROADCAST_MAX) - break; } - pto->vInventoryBlockToSend.erase(pto->vInventoryBlockToSend.begin(), - pto->vInventoryBlockToSend.begin() + count); - //pto->vInventoryBlockToSend.clear(); + pto->vInventoryBlockToSend.clear(); // Check whether periodic sends should happen bool fSendTrickle = pto->fWhitelisted; diff --git a/src/policy/feerate.cpp b/src/policy/feerate.cpp index 14be6192f..6ec244392 100644 --- a/src/policy/feerate.cpp +++ b/src/policy/feerate.cpp @@ -7,7 +7,7 @@ #include -const std::string CURRENCY_UNIT = "BTC"; +const std::string CURRENCY_UNIT = "LBC"; CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nBytes_) { diff --git a/src/pow.cpp b/src/pow.cpp index 35fd95ae1..62f037997 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -31,36 +31,6 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead } } - /* // Only change once per difficulty adjustment interval */ - /* if ((pindexLast->nHeight+1) % params.DifficultyAdjustmentInterval() != 0) */ - /* { */ - /* if (params.fPowAllowMinDifficultyBlocks) */ - /* { */ - /* // Special difficulty rule for testnet: */ - /* // If the new block's timestamp is more than 2* 10 minutes */ - /* // then allow mining of a min-difficulty block. */ - /* if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2) */ - /* return nProofOfWorkLimit; */ - /* else */ - /* { */ - /* // Return the last non-special-min-difficulty-rules-block */ - /* const CBlockIndex* pindex = pindexLast; */ - /* while (pindex->pprev && pindex->nHeight % params.DifficultyAdjustmentInterval() != 0 && pindex->nBits == nProofOfWorkLimit) */ - /* pindex = pindex->pprev; */ - /* return pindex->nBits; */ - /* } */ - /* } */ - /* return pindexLast->nBits; */ - /* } */ - - /* // Go back by what we want to be 14 days worth of blocks */ - /* int nHeightFirst = pindexLast->nHeight - (params.DifficultyAdjustmentInterval()-1); */ - /* assert(nHeightFirst >= 0); */ - /* const CBlockIndex* pindexFirst = pindexLast->GetAncestor(nHeightFirst); */ - /* assert(pindexFirst); */ - - /* return CalculateNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params); */ - // Go back the full period unless it's the first retarget after genesis. int blockstogoback = params.DifficultyAdjustmentInterval()-1; if ((pindexLast->nHeight+1) != params.DifficultyAdjustmentInterval()) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 6726019a3..5a7181a82 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -24,7 +24,7 @@ class AmountSpinBox: public QAbstractSpinBox public: explicit AmountSpinBox(QWidget *parent): QAbstractSpinBox(parent), - currentUnit(BitcoinUnits::BTC), + currentUnit(BitcoinUnits::LBC), singleStep(100000) // satoshis { setAlignment(Qt::AlignRight); @@ -99,7 +99,7 @@ public: const QFontMetrics fm(fontMetrics()); int h = lineEdit()->minimumSizeHint().height(); - int w = fm.width(BitcoinUnits::format(BitcoinUnits::BTC, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways)); + int w = fm.width(BitcoinUnits::format(BitcoinUnits::LBC, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways)); w += 2; // cursor blinking space QStyleOptionSpinBox opt; diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index 8aa1fdba4..92717665e 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -17,9 +17,9 @@ BitcoinUnits::BitcoinUnits(QObject *parent): QList BitcoinUnits::availableUnits() { QList unitlist; - unitlist.append(BTC); - unitlist.append(mBTC); - unitlist.append(uBTC); + unitlist.append(LBC); + unitlist.append(mLBC); + unitlist.append(uLBC); unitlist.append(SAT); return unitlist; } @@ -28,9 +28,9 @@ bool BitcoinUnits::valid(int unit) { switch(unit) { - case BTC: - case mBTC: - case uBTC: + case LBC: + case mLBC: + case uLBC: case SAT: return true; default: @@ -42,9 +42,9 @@ QString BitcoinUnits::longName(int unit) { switch(unit) { - case BTC: return QString("BTC"); - case mBTC: return QString("mBTC"); - case uBTC: return QString::fromUtf8("µBTC (bits)"); + case LBC: return QString("LBC"); + case mLBC: return QString("mLBC"); + case uLBC: return QString::fromUtf8("µLBC (bits)"); case SAT: return QString("Satoshi (sat)"); default: return QString("???"); } @@ -54,7 +54,7 @@ QString BitcoinUnits::shortName(int unit) { switch(unit) { - case uBTC: return QString::fromUtf8("bits"); + case uLBC: return QString::fromUtf8("bits"); case SAT: return QString("sat"); default: return longName(unit); } @@ -64,9 +64,9 @@ QString BitcoinUnits::description(int unit) { switch(unit) { - case BTC: return QString("Bitcoins"); - case mBTC: return QString("Milli-Bitcoins (1 / 1" THIN_SP_UTF8 "000)"); - case uBTC: return QString("Micro-Bitcoins (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)"); + case LBC: return QString("Bitcoins"); + case mLBC: return QString("Milli-Bitcoins (1 / 1" THIN_SP_UTF8 "000)"); + case uLBC: return QString("Micro-Bitcoins (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)"); case SAT: return QString("Satoshi (sat) (1 / 100" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)"); default: return QString("???"); } @@ -76,9 +76,9 @@ qint64 BitcoinUnits::factor(int unit) { switch(unit) { - case BTC: return 100000000; - case mBTC: return 100000; - case uBTC: return 100; + case LBC: return 100000000; + case mLBC: return 100000; + case uLBC: return 100; case SAT: return 1; default: return 100000000; } @@ -88,9 +88,9 @@ int BitcoinUnits::decimals(int unit) { switch(unit) { - case BTC: return 8; - case mBTC: return 5; - case uBTC: return 2; + case LBC: return 8; + case mLBC: return 5; + case uLBC: return 2; case SAT: return 0; default: return 0; } diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h index 06a1544fa..ea52a8aad 100644 --- a/src/qt/bitcoinunits.h +++ b/src/qt/bitcoinunits.h @@ -56,9 +56,9 @@ public: */ enum Unit { - BTC, - mBTC, - uBTC, + LBC, + mLBC, + uLBC, SAT }; diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index ca3598334..149374ce2 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -529,7 +529,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) } // actually update labels - int nDisplayUnit = BitcoinUnits::BTC; + int nDisplayUnit = BitcoinUnits::LBC; if (model && model->getOptionsModel()) nDisplayUnit = model->getOptionsModel()->getDisplayUnit(); diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 0d8065143..69719dc3f 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -129,7 +129,7 @@ void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent) bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) { // return if URI is not valid or is no bitcoin: URI - if(!uri.isValid() || uri.scheme() != QString("bitcoin")) + if(!uri.isValid() || uri.scheme() != QString("lbry")) return false; SendCoinsRecipient rv; @@ -165,7 +165,7 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) { if(!i->second.isEmpty()) { - if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount)) + if(!BitcoinUnits::parse(BitcoinUnits::LBC, i->second, &rv.amount)) { return false; } @@ -191,12 +191,12 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out) QString formatBitcoinURI(const SendCoinsRecipient &info) { - QString ret = QString("bitcoin:%1").arg(info.address); + QString ret = QString("lbry:%1").arg(info.address); int paramCount = 0; if (info.amount) { - ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, info.amount, false, BitcoinUnits::separatorNever)); + ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::LBC, info.amount, false, BitcoinUnits::separatorNever)); paramCount++; } diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index da048d321..fdf469b0a 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -15,8 +15,8 @@ static const struct { const int iconColorSaturationReduction; const char *titleAddText; } network_styles[] = { - {"main", QAPP_APP_NAME_DEFAULT, 0, 0, ""}, - {"test", QAPP_APP_NAME_TESTNET, 70, 30, QT_TRANSLATE_NOOP("SplashScreen", "[testnet]")}, + {"lbrycrd", QAPP_APP_NAME_DEFAULT, 0, 0, ""}, + {"lbrycrdtest", QAPP_APP_NAME_TESTNET, 70, 30, QT_TRANSLATE_NOOP("SplashScreen", "[testnet]")}, {"regtest", QAPP_APP_NAME_REGTEST, 160, 30, "[regtest]"} }; static const unsigned network_styles_count = sizeof(network_styles)/sizeof(*network_styles); diff --git a/src/qt/openuridialog.cpp b/src/qt/openuridialog.cpp index 48db95679..f8403cddd 100644 --- a/src/qt/openuridialog.cpp +++ b/src/qt/openuridialog.cpp @@ -15,7 +15,7 @@ OpenURIDialog::OpenURIDialog(QWidget *parent) : ui(new Ui::OpenURIDialog) { ui->setupUi(this); - ui->uriEdit->setPlaceholderText("bitcoin:"); + ui->uriEdit->setPlaceholderText("lbry:"); } OpenURIDialog::~OpenURIDialog() @@ -46,5 +46,5 @@ void OpenURIDialog::on_selectFileButton_clicked() if(filename.isEmpty()) return; QUrl fileUri = QUrl::fromLocalFile(filename); - ui->uriEdit->setText("bitcoin:?r=" + QUrl::toPercentEncoding(fileUri.toString())); + ui->uriEdit->setText("lbry:?r=" + QUrl::toPercentEncoding(fileUri.toString())); } diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index d04a2cf86..42ca9b5f3 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -68,7 +68,7 @@ void OptionsModel::Init(bool resetSettings) // Display if (!settings.contains("nDisplayUnit")) - settings.setValue("nDisplayUnit", BitcoinUnits::BTC); + settings.setValue("nDisplayUnit", BitcoinUnits::LBC); nDisplayUnit = settings.value("nDisplayUnit").toInt(); if (!settings.contains("strThirdPartyTxUrls")) diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index ba4793519..49bf4c793 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -28,7 +28,7 @@ class TxViewDelegate : public QAbstractItemDelegate Q_OBJECT public: explicit TxViewDelegate(const PlatformStyle *_platformStyle, QObject *parent=nullptr): - QAbstractItemDelegate(parent), unit(BitcoinUnits::BTC), + QAbstractItemDelegate(parent), unit(BitcoinUnits::LBC), platformStyle(_platformStyle) { @@ -235,7 +235,7 @@ void OverviewPage::setWalletModel(WalletModel *model) connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyLabels(bool))); } - // update the display unit, to not use the default ("BTC") + // update the display unit, to not use the default ("LBC") updateDisplayUnit(); } diff --git a/src/qt/paymentrequest.proto b/src/qt/paymentrequest.proto index d2721a34b..1b6c5129e 100644 --- a/src/qt/paymentrequest.proto +++ b/src/qt/paymentrequest.proto @@ -18,7 +18,7 @@ message Output { required bytes script = 2; // usually one of the standard Script forms } message PaymentDetails { - optional string network = 1 [default = "main"]; // "main" or "test" + optional string network = 1 [default = "lbrycrd"]; // "lbrycrd" or "lbrycrdtest" repeated Output outputs = 2; // Where payment should be sent required uint64 time = 3; // Timestamp; when payment request created optional uint64 expires = 4; // Timestamp; when this request should be considered invalid diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 5bf2bb8a0..35a536b26 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -44,7 +44,7 @@ #include const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds -const QString BITCOIN_IPC_PREFIX("bitcoin:"); +const QString BITCOIN_IPC_PREFIX("lbry:"); // BIP70 payment protocol messages const char* BIP70_MESSAGE_PAYMENTACK = "PaymentACK"; const char* BIP70_MESSAGE_PAYMENTREQUEST = "PaymentRequest"; @@ -228,11 +228,11 @@ void PaymentServer::ipcParseCommandLine(interfaces::Node& node, int argc, char* PaymentRequestPlus request; if (readPaymentRequestFromFile(arg, request)) { - if (request.getDetails().network() == "main") + if (request.getDetails().network() == "lbrycrd") { node.selectParams(CBaseChainParams::MAIN); } - else if (request.getDetails().network() == "test") + else if (request.getDetails().network() == "lbrycrdtest") { node.selectParams(CBaseChainParams::TESTNET); } @@ -315,7 +315,7 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : if (!uriServer->listen(name)) { // constructor is called early in init, so don't use "Q_EMIT message()" here QMessageBox::critical(0, tr("Payment request error"), - tr("Cannot start bitcoin: click-to-pay handler")); + tr("Cannot start lbry: click-to-pay handler")); } else { connect(uriServer, SIGNAL(newConnection()), this, SLOT(handleURIConnection())); @@ -395,9 +395,9 @@ void PaymentServer::handleURIOrFile(const QString& s) return; } - if (s.startsWith("bitcoin://", Qt::CaseInsensitive)) + if (s.startsWith("lbry://", Qt::CaseInsensitive)) { - Q_EMIT message(tr("URI handling"), tr("'bitcoin://' is not a valid URI. Use 'bitcoin:' instead."), + Q_EMIT message(tr("URI handling"), tr("'lbry://' is not a valid URI. Use 'lbry:' instead."), CClientUIInterface::MSG_ERROR); } else if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index d53f91dff..4a33ec507 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -106,7 +106,7 @@ void SendCoinsEntry::clear() ui->memoTextLabel_s->clear(); ui->payAmount_s->clear(); - // update the display unit, to not use the default ("BTC") + // update the display unit, to not use the default ("LBC") updateDisplayUnit(); } diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp index e92f9d7a5..c106523ee 100644 --- a/src/qt/test/paymentservertests.cpp +++ b/src/qt/test/paymentservertests.cpp @@ -202,7 +202,9 @@ void PaymentServerTests::paymentServerTests() for (const std::pair& sendingTo : sendingTos) { CTxDestination dest; if (ExtractDestination(sendingTo.first, dest)) - QCOMPARE(PaymentServer::verifyAmount(sendingTo.second), false); + // LBRY has a max money defined as 1000x bitcoin's, so we + // modify the value here to fail this test properly. + QCOMPARE(PaymentServer::verifyAmount(sendingTo.second * 1000), false); } delete server; diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp index 2e321c1ba..271845c61 100644 --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -48,7 +48,7 @@ void RPCNestedTests::rpcNestedTests() std::string filtered; auto node = interfaces::MakeNode(); RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo()[chain]", &filtered); //simple result filtering with path - QVERIFY(result=="main"); + QVERIFY(result=="lbrycrd"); QVERIFY(filtered == "getblockchaininfo()[chain]"); RPCConsole::RPCExecuteCommandLine(*node, result, "getblock(getbestblockhash())"); //simple 2 level nesting @@ -75,7 +75,7 @@ void RPCNestedTests::rpcNestedTests() QVERIFY(result == result2); RPCConsole::RPCExecuteCommandLine(*node, result, "getblock(getbestblockhash())[tx][0]", &filtered); - QVERIFY(result == "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"); + QVERIFY(result == "b8211c82c3d15bcd78bba57005b86fed515149a53a425eb592c07af99fe559cc"); QVERIFY(filtered == "getblock(getbestblockhash())[tx][0]"); RPCConsole::RPCParseCommandLine(nullptr, result, "importprivkey", false, &filtered); diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index fdbcb46f5..bcd16e8ef 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -254,5 +254,7 @@ void WalletTests::walletTests() return; } #endif - TestGUI(); + //TestGUI(); + QWARN("Skipping WalletTests with 'minimal' platform set due to Qt bugs. To run AppTests, invoke " + "with 'test_bitcoin-qt -platform cocoa' on mac, or else use a linux or windows build."); } diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 28af63788..f52dda764 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1026,8 +1026,8 @@ UniValue gettxout(const JSONRPCRequest& request) " \"hex\" : \"hex\", (string) \n" " \"reqSigs\" : n, (numeric) Number of required signatures\n" " \"type\" : \"pubkeyhash\", (string) The type, eg pubkeyhash\n" - " \"addresses\" : [ (array of string) array of bitcoin addresses\n" - " \"address\" (string) bitcoin address\n" + " \"addresses\" : [ (array of string) array of lbrycrd addresses\n" + " \"address\" (string) lbrycrd address\n" " ,...\n" " ]\n" " },\n" diff --git a/src/rpc/claimtrie.cpp b/src/rpc/claimtrie.cpp index 61ec51c81..a8a9e8b09 100644 --- a/src/rpc/claimtrie.cpp +++ b/src/rpc/claimtrie.cpp @@ -504,7 +504,8 @@ UniValue getclaimbyid(const JSONRPCRequest& request) if (claimValue.claimId == claimId) { std::vector supports; - CAmount effectiveAmount = pclaimTrie->getEffectiveAmountForClaim(name, claimValue.claimId, &supports); + CClaimTrieCache trieCache(pclaimTrie); + CAmount effectiveAmount = trieCache.getEffectiveAmountForClaim(name, claimValue.claimId, &supports); std::string sValue; claim.pushKV("name", name); diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 0622e3b72..80e0257fa 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -159,7 +159,7 @@ static UniValue generatetoaddress(const JSONRPCRequest& request) "\nMine blocks immediately to a specified address (before the RPC call returns)\n" "\nArguments:\n" "1. nblocks (numeric, required) How many blocks are generated immediately.\n" - "2. address (string, required) The address to send the newly generated bitcoin to.\n" + "2. address (string, required) The address to send the newly generated lbry to.\n" "3. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n" "\nResult:\n" "[ blockhashes ] (array) hashes of blocks generated\n" @@ -436,10 +436,10 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); if (g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0) - throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Bitcoin is not connected!"); + throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "LBRYcrd is not connected!"); if (IsInitialBlockDownload()) - throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Bitcoin is downloading blocks..."); + throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "LBRYcrd is downloading blocks..."); static unsigned int nTransactionsUpdatedLast; diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 88d662878..c4408bf06 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -38,17 +38,17 @@ static UniValue validateaddress(const JSONRPCRequest& request) if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "validateaddress \"address\"\n" - "\nReturn information about the given bitcoin address.\n" + "\nReturn information about the given lbry address.\n" "DEPRECATION WARNING: Parts of this command have been deprecated and moved to getaddressinfo. Clients must\n" "transition to using getaddressinfo to access this information before upgrading to v0.18. The following deprecated\n" "fields have moved to getaddressinfo and will only be shown here with -deprecatedrpc=validateaddress: ismine, iswatchonly,\n" "script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.\n" "\nArguments:\n" - "1. \"address\" (string, required) The bitcoin address to validate\n" + "1. \"address\" (string, required) The lbry address to validate\n" "\nResult:\n" "{\n" " \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n" - " \"address\" : \"address\", (string) The bitcoin address validated\n" + " \"address\" : \"address\", (string) The lbry address validated\n" " \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n" " \"isscript\" : true|false, (boolean) If the key is a script\n" " \"iswitness\" : true|false, (boolean) If the address is a witness address\n" @@ -162,7 +162,7 @@ static UniValue verifymessage(const JSONRPCRequest& request) "verifymessage \"address\" \"signature\" \"message\"\n" "\nVerify a signed message\n" "\nArguments:\n" - "1. \"address\" (string, required) The bitcoin address to use for the signature.\n" + "1. \"address\" (string, required) The lbry address to use for the signature.\n" "2. \"signature\" (string, required) The signature provided by the signer in base 64 encoding (see signmessage).\n" "3. \"message\" (string, required) The message that was signed.\n" "\nResult:\n" @@ -450,7 +450,7 @@ static UniValue echo(const JSONRPCRequest& request) "echo|echojson \"message\" ...\n" "\nSimply echo back the input arguments. This command is for testing.\n" "\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in" - "bitcoin-cli and the GUI. There is no server-side difference." + "lbrycrd-cli and the GUI. There is no server-side difference." ); return request.params; @@ -464,7 +464,7 @@ static UniValue getinfo_deprecated(const JSONRPCRequest& request) "- getblockchaininfo: blocks, difficulty, chain\n" "- getnetworkinfo: version, protocolversion, timeoffset, connections, proxy, relayfee, warnings\n" "- getwalletinfo: balance, keypoololdest, keypoolsize, paytxfee, unlocked_until, walletversion\n" - "\nbitcoin-cli has the option -getinfo to collect and format these in the old format." + "\nlbrycrd-cli has the option -getinfo to collect and format these in the old format." ); } diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 610a1fee6..bcd9747e0 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -296,7 +296,7 @@ static UniValue getaddednodeinfo(const JSONRPCRequest& request) " \"connected\" : true|false, (boolean) If connected\n" " \"addresses\" : [ (list of objects) Only when connected = true\n" " {\n" - " \"address\" : \"192.168.0.201:8333\", (string) The bitcoin server IP and port we're connected to\n" + " \"address\" : \"192.168.0.201:8333\", (string) The lbrycrd server IP and port we're connected to\n" " \"connected\" : \"outbound\" (string) connection, inbound or outbound\n" " }\n" " ]\n" diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 4258ce2e7..fbc139899 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -122,7 +122,7 @@ static UniValue getrawtransaction(const JSONRPCRequest& request) " \"reqSigs\" : n, (numeric) The required sigs\n" " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n" " \"addresses\" : [ (json array of string)\n" - " \"address\" (string) bitcoin address\n" + " \"address\" (string) lbry address\n" " ,...\n" " ]\n" " }\n" @@ -429,7 +429,7 @@ CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniVal } else { CTxDestination destination = DecodeDestination(name_); if (!IsValidDestination(destination)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Bitcoin address: ") + name_); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid LBRY address: ") + name_); } if (!destinations.insert(destination).second) { @@ -477,7 +477,7 @@ static UniValue createrawtransaction(const JSONRPCRequest& request) "That is, each address can only appear once and there can only be one 'data' object.\n" " [\n" " {\n" - " \"address\": x.xxx, (obj, optional) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + "\n" + " \"address\": x.xxx, (obj, optional) A key-value pair. The key (string) is the lbry address, the value (float or string) is the amount in " + CURRENCY_UNIT + "\n" " },\n" " {\n" " \"data\": \"hex\" (obj, optional) A key-value pair. The key must be \"data\", the value is hex encoded data\n" @@ -557,7 +557,7 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request) " \"reqSigs\" : n, (numeric) The required sigs\n" " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n" " \"addresses\" : [ (json array of string)\n" - " \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) bitcoin address\n" + " \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) lbry address\n" " ,...\n" " ]\n" " }\n" @@ -604,7 +604,7 @@ static UniValue decodescript(const JSONRPCRequest& request) " \"type\":\"type\", (string) The output type\n" " \"reqSigs\": n, (numeric) The required signatures\n" " \"addresses\": [ (json array of string)\n" - " \"address\" (string) bitcoin address\n" + " \"address\" (string) lbry address\n" " ,...\n" " ],\n" " \"p2sh\",\"address\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n" @@ -1056,7 +1056,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request) if (!IsDeprecatedRPCEnabled("signrawtransaction")) { throw JSONRPCError(RPC_METHOD_DEPRECATED, "signrawtransaction is deprecated and will be fully removed in v0.18. " - "To use signrawtransaction in v0.17, restart bitcoind with -deprecatedrpc=signrawtransaction.\n" + "To use signrawtransaction in v0.17, restart lbrycrd with -deprecatedrpc=signrawtransaction.\n" "Projects should transition to using signrawtransactionwithkey and signrawtransactionwithwallet before upgrading to v0.18"); } @@ -1287,7 +1287,7 @@ UniValue decodepsbt(const JSONRPCRequest& request) if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "decodepsbt \"psbt\"\n" - "\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n" + "\nReturn a JSON object representing the serialized, base64-encoded partially signed LBRY transaction.\n" "\nArguments:\n" "1. \"psbt\" (string, required) The PSBT base64 string\n" @@ -1312,7 +1312,7 @@ UniValue decodepsbt(const JSONRPCRequest& request) " \"asm\" : \"asm\", (string) The asm\n" " \"hex\" : \"hex\", (string) The hex\n" " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n" - " \"address\" : \"address\" (string) Bitcoin address if there is one\n" + " \"address\" : \"address\" (string) LBRY address if there is one\n" " }\n" " },\n" " \"partial_signatures\" : { (json object, optional)\n" @@ -1569,7 +1569,7 @@ UniValue combinepsbt(const JSONRPCRequest& request) if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "combinepsbt [\"psbt\",...]\n" - "\nCombine multiple partially signed Bitcoin transactions into one transaction.\n" + "\nCombine multiple partially signed LBRY transactions into one transaction.\n" "Implements the Combiner role.\n" "\nArguments:\n" "1. \"txs\" (string) A json array of base64 strings of partially signed transactions\n" @@ -1703,7 +1703,7 @@ UniValue createpsbt(const JSONRPCRequest& request) "That is, each address can only appear once and there can only be one 'data' object.\n" " [\n" " {\n" - " \"address\": x.xxx, (obj, optional) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + "\n" + " \"address\": x.xxx, (obj, optional) A key-value pair. The key (string) is the lbry address, the value (float or string) is the amount in " + CURRENCY_UNIT + "\n" " },\n" " {\n" " \"data\": \"hex\" (obj, optional) A key-value pair. The key must be \"data\", the value is hex encoded data\n" diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index e46bf2f76..b6ff03ad9 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -232,11 +232,11 @@ UniValue stop(const JSONRPCRequest& jsonRequest) if (jsonRequest.fHelp || jsonRequest.params.size() > 1) throw std::runtime_error( "stop\n" - "\nStop Bitcoin server."); + "\nStop lbrycrd server."); // Event loop will exit after current HTTP requests have been handled, so // this reply will get back to the client. StartShutdown(); - return "Bitcoin server stopping"; + return "LBRYcrd server stopping"; } static UniValue uptime(const JSONRPCRequest& jsonRequest) @@ -515,7 +515,7 @@ std::vector CRPCTable::listCommands() const std::string HelpExampleCli(const std::string& methodname, const std::string& args) { - return "> bitcoin-cli " + methodname + " " + args + "\n"; + return "> lbrycrd-cli " + methodname + " " + args + "\n"; } std::string HelpExampleRpc(const std::string& methodname, const std::string& args) diff --git a/src/test/amount_tests.cpp b/src/test/amount_tests.cpp index b274c1465..ad77e8744 100644 --- a/src/test/amount_tests.cpp +++ b/src/test/amount_tests.cpp @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(ToStringTest) { CFeeRate feeRate; feeRate = CFeeRate(1); - BOOST_CHECK_EQUAL(feeRate.ToString(), "0.00000001 BTC/kB"); + BOOST_CHECK_EQUAL(feeRate.ToString(), "0.00000001 LBC/kB"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/claimtriebranching_tests.cpp b/src/test/claimtriebranching_tests.cpp index f8f08243d..2815c2efe 100644 --- a/src/test/claimtriebranching_tests.cpp +++ b/src/test/claimtriebranching_tests.cpp @@ -2,21 +2,21 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://opensource.org/licenses/mit-license.php -#include "chainparams.h" -#include "claimtrie.h" -#include "coins.h" -#include "consensus/merkle.h" -#include "consensus/validation.h" -#include "miner.h" -#include "nameclaim.h" -#include "policy/policy.h" -#include "pow.h" -#include "primitives/transaction.h" -#include "rpc/server.h" -#include "streams.h" -#include "test/test_bitcoin.h" -#include "txmempool.h" -#include "validation.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -65,8 +65,8 @@ boost::test_tools::predicate_result best_claim_effective_amount_equals(std::string name, CAmount amount) { CClaimValue val; - bool have_info = pclaimTrie->getInfoForName(name, val); - if (!have_info) + CClaimTrieCache trieCache(pclaimTrie); + if (!trieCache.getInfoForName(name, val)) { boost::test_tools::predicate_result res(false); res.message()<<"No claim found"; @@ -74,7 +74,7 @@ best_claim_effective_amount_equals(std::string name, CAmount amount) } else { - CAmount effective_amount = pclaimTrie->getEffectiveAmountForClaim(name, val.claimId); + CAmount effective_amount = trieCache.getEffectiveAmountForClaim(name, val.claimId); if (effective_amount != amount) { boost::test_tools::predicate_result res(false); @@ -91,8 +91,8 @@ best_claim_effective_amount_equals(std::string name, CAmount amount) CMutableTransaction BuildTransaction(const CTransaction& prev, uint32_t prevout=0, unsigned int numOutputs=1) { CMutableTransaction tx; - tx.nVersion = 1; - tx.nLockTime = 0; + tx.nVersion = CTransaction::CURRENT_VERSION; + tx.nLockTime = 1 << 31; // Disable BIP68 tx.vin.resize(1); tx.vout.resize(numOutputs); tx.vin[0].prevout.hash = prev.GetHash(); @@ -203,6 +203,9 @@ struct ClaimTrieChainFixture{ assert(0); } + /* TestMemPoolEntryHelper entry; */ + /* LOCK(mempool.cs); */ + /* mempool.addUnchecked(tx.GetHash(), entry.Fee(0).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); */ CValidationState state; CAmount txFeeRate = CAmount(0); LOCK(cs_main); @@ -363,12 +366,12 @@ BOOST_AUTO_TEST_CASE(claim_test) CMutableTransaction tx3 = fixture.MakeClaim(fixture.GetCoinbase(),"test","one",2); fixture.IncrementBlocks(1); BOOST_CHECK(is_best_claim("test",tx3)); - BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").claims.size()); + BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").size()); fixture.DecrementBlocks(1); BOOST_CHECK(!is_best_claim("test",tx2)); BOOST_CHECK(!is_best_claim("test",tx3)); - BOOST_CHECK_EQUAL(0U, pclaimTrie->getClaimsForName("test").claims.size()); + BOOST_CHECK_EQUAL(0U, pclaimTrie->getClaimsForName("test").size()); // make two claims , one older CMutableTransaction tx4 = fixture.MakeClaim(fixture.GetCoinbase(),"test","one",1); @@ -380,7 +383,7 @@ BOOST_AUTO_TEST_CASE(claim_test) BOOST_CHECK(is_best_claim("test", tx4)); fixture.IncrementBlocks(1); BOOST_CHECK(is_best_claim("test",tx4)); - BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").claims.size()); + BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").size()); fixture.DecrementBlocks(1); BOOST_CHECK(is_best_claim("test", tx4)); @@ -400,7 +403,7 @@ BOOST_AUTO_TEST_CASE(claim_test) BOOST_CHECK(is_best_claim("test", tx6)); fixture.IncrementBlocks(10); BOOST_CHECK(is_best_claim("test",tx7)); - BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").claims.size()); + BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").size()); fixture.DecrementBlocks(10); BOOST_CHECK(is_claim_in_queue("test",tx7)); @@ -595,20 +598,19 @@ BOOST_AUTO_TEST_CASE(support_spend_test) fixture.DecrementBlocks(1); // spend a support on txin[i] where i is not 0 - CMutableTransaction tx3 = fixture.MakeClaim(fixture.GetCoinbase(),"x","one",3); CMutableTransaction tx4 = fixture.MakeClaim(fixture.GetCoinbase(),"test","two",2); CMutableTransaction tx5 = fixture.MakeClaim(fixture.GetCoinbase(),"test","three",1); CMutableTransaction s2 = fixture.MakeSupport(fixture.GetCoinbase(),tx5,"test",2); fixture.IncrementBlocks(1); BOOST_CHECK(is_best_claim("test",tx5)); - BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").claims.size()); + BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").size()); // build the spend where s2 is sppent on txin[1] and tx3 is spent on txin[0] uint32_t prevout = 0; CMutableTransaction tx; - tx.nVersion = 1; - tx.nLockTime = 0; + tx.nVersion = CTransaction::CURRENT_VERSION; + tx.nLockTime = 1 << 31; // Disable BIP68 tx.vin.resize(2); tx.vout.resize(1); tx.vin[0].prevout.hash = tx3.GetHash(); @@ -667,7 +669,7 @@ BOOST_AUTO_TEST_CASE(claimtrie_update_test) CMutableTransaction u3 = fixture.MakeUpdate(tx3, "test", "one", ClaimIdHash(tx3.GetHash(), 0), 2); fixture.IncrementBlocks(1); BOOST_CHECK(is_best_claim("test",u3)); - BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").claims.size()); + BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").size()); fixture.DecrementBlocks(11); // losing update on winning claim happens without delay @@ -675,7 +677,7 @@ BOOST_AUTO_TEST_CASE(claimtrie_update_test) CMutableTransaction tx6 = fixture.MakeClaim(fixture.GetCoinbase(),"test","one",2); fixture.IncrementBlocks(10); BOOST_CHECK(is_best_claim("test", tx5)); - BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").claims.size()); + BOOST_CHECK_EQUAL(2U, pclaimTrie->getClaimsForName("test").size()); CMutableTransaction u4 = fixture.MakeUpdate(tx5, "test", "one", ClaimIdHash(tx5.GetHash(), 0), 1); fixture.IncrementBlocks(1); BOOST_CHECK(is_best_claim("test",tx6)); @@ -691,8 +693,8 @@ BOOST_AUTO_TEST_CASE(claimtrie_update_test) BOOST_CHECK(is_best_claim("test", tx7)); CMutableTransaction tx; - tx.nVersion = 1; - tx.nLockTime = 0; + tx.nVersion = CTransaction::CURRENT_VERSION; + tx.nLockTime = 1 << 31; // Disable BIP68 tx.vin.resize(2); tx.vout.resize(1); tx.vin[0].prevout.hash = tx8.GetHash(); @@ -794,38 +796,38 @@ BOOST_AUTO_TEST_CASE(claimtriebranching_get_effective_amount_for_claim) uint160 claimId = ClaimIdHash(claimtx.GetHash(), 0); fixture.IncrementBlocks(1); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("test", claimId), 2); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("inexistent", claimId), 0); //not found returns 0 + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("test", claimId) == 2); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("inexistent", claimId) == 0); //not found returns 0 // one claim, one support fixture.MakeSupport(fixture.GetCoinbase(), claimtx, "test", 40); fixture.IncrementBlocks(1); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("test", claimId), 42); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("test", claimId) == 42); // Two claims, first one with supports CMutableTransaction claimtx2 = fixture.MakeClaim(fixture.GetCoinbase(), "test", "two", 1); uint160 claimId2 = ClaimIdHash(claimtx2.GetHash(), 0); fixture.IncrementBlocks(10); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("test", claimId), 42); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("test", claimId2), 1); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("inexistent", claimId), 0); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("inexistent", claimId2), 0); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("test", claimId) == 42); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("test", claimId2) == 1); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("inexistent", claimId) == 0); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("inexistent", claimId2) == 0); // Two claims, both with supports, second claim effective amount being less than first claim fixture.MakeSupport(fixture.GetCoinbase(), claimtx2, "test", 6); fixture.IncrementBlocks(13); //delay - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("test", claimId), 42); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("test", claimId2), 7); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("test", claimId) == 42); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("test", claimId2) == 7); // Two claims, both with supports, second one taking over fixture.MakeSupport(fixture.GetCoinbase(), claimtx2, "test", 1330); fixture.IncrementBlocks(26); //delay - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("test", claimId), 42); - BOOST_CHECK_EQUAL(pclaimTrie->getEffectiveAmountForClaim("test", claimId2), 1337); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("test", claimId) == 42); + BOOST_CHECK(CClaimTrieCache(pclaimTrie).getEffectiveAmountForClaim("test", claimId2) == 1337); } /* @@ -3344,12 +3346,10 @@ BOOST_AUTO_TEST_CASE(getclaimsforname_test) UniValue results = getclaimsforname(req); UniValue claims = results["claims"]; - BOOST_CHECK_EQUAL(claims.size(), 2U); + BOOST_CHECK_EQUAL(claims.size(), 1U); BOOST_CHECK_EQUAL(results["nLastTakeoverHeight"].get_int(), height + 1); - BOOST_CHECK_EQUAL(claims[0]["nEffectiveAmount"].get_int(), 0); - BOOST_CHECK_EQUAL(claims[1]["nEffectiveAmount"].get_int(), 2); + BOOST_CHECK_EQUAL(claims[0]["nEffectiveAmount"].get_int(), 2); BOOST_CHECK_EQUAL(claims[0]["supports"].size(), 0U); - BOOST_CHECK_EQUAL(claims[1]["supports"].size(), 0U); fixture.IncrementBlocks(1); diff --git a/src/test/claimtriecache_tests.cpp b/src/test/claimtriecache_tests.cpp index 0492e6a9b..616aba540 100644 --- a/src/test/claimtriecache_tests.cpp +++ b/src/test/claimtriecache_tests.cpp @@ -1,9 +1,9 @@ -#include "claimtrie.h" -#include "nameclaim.h" -#include "uint256.h" -#include "validation.h" +#include +#include +#include +#include -#include "test/test_bitcoin.h" +#include #include using namespace std; @@ -38,6 +38,17 @@ public: return cache.find(key); } + bool insertClaimIntoTrie(const std::string& name, CClaimValue claim, + bool fCheckTakeover = false) const + { + return CClaimTrieCache::insertClaimIntoTrie(name, claim, fCheckTakeover); + } + + bool removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, + CClaimValue& claim, bool fCheckTakeover = false) const + { + return CClaimTrieCache::removeClaimFromTrie(name, outPoint, claim, fCheckTakeover); + } }; CMutableTransaction BuildTransaction(const uint256& prevhash) @@ -105,91 +116,91 @@ BOOST_AUTO_TEST_CASE(merkle_hash_multiple_test) BOOST_CHECK(pclaimTrie->empty()); - CClaimTrieCache ntState(pclaimTrie, false); + CClaimTrieCacheTest ntState(pclaimTrie); ntState.insertClaimIntoTrie(std::string("test"), CClaimValue(tx1OutPoint, hash160, 50, 100, 200)); ntState.insertClaimIntoTrie(std::string("test2"), CClaimValue(tx2OutPoint, hash160, 50, 100, 200)); BOOST_CHECK(pclaimTrie->empty()); BOOST_CHECK(!ntState.empty()); - BOOST_CHECK_EQUAL(ntState.getMerkleHash(), hash1); + BOOST_CHECK(ntState.getMerkleHash() == hash1); ntState.insertClaimIntoTrie(std::string("test"), CClaimValue(tx3OutPoint, hash160, 50, 101, 201)); - BOOST_CHECK_EQUAL(ntState.getMerkleHash(), hash1); + BOOST_CHECK(ntState.getMerkleHash() == hash1); ntState.insertClaimIntoTrie(std::string("tes"), CClaimValue(tx4OutPoint, hash160, 50, 100, 200)); - BOOST_CHECK_EQUAL(ntState.getMerkleHash(), hash2); + BOOST_CHECK(ntState.getMerkleHash() == hash2); ntState.insertClaimIntoTrie(std::string("testtesttesttest"), CClaimValue(tx5OutPoint, hash160, 50, 100, 200)); ntState.removeClaimFromTrie(std::string("testtesttesttest"), tx5OutPoint, unused); - BOOST_CHECK_EQUAL(ntState.getMerkleHash(), hash2); + BOOST_CHECK(ntState.getMerkleHash() == hash2); ntState.flush(); BOOST_CHECK(!pclaimTrie->empty()); - BOOST_CHECK_EQUAL(pclaimTrie->getMerkleHash(), hash2); + BOOST_CHECK(pclaimTrie->getMerkleHash() == hash2); BOOST_CHECK(pclaimTrie->checkConsistency()); - CClaimTrieCache ntState1(pclaimTrie, false); + CClaimTrieCacheTest ntState1(pclaimTrie); ntState1.removeClaimFromTrie(std::string("test"), tx1OutPoint, unused); ntState1.removeClaimFromTrie(std::string("test2"), tx2OutPoint, unused); ntState1.removeClaimFromTrie(std::string("test"), tx3OutPoint, unused); ntState1.removeClaimFromTrie(std::string("tes"), tx4OutPoint, unused); - BOOST_CHECK_EQUAL(ntState1.getMerkleHash(), hash0); + BOOST_CHECK(ntState1.getMerkleHash() == hash0); - CClaimTrieCache ntState2(pclaimTrie, false); + CClaimTrieCacheTest ntState2(pclaimTrie); ntState2.insertClaimIntoTrie(std::string("abab"), CClaimValue(tx6OutPoint, hash160, 50, 100, 200)); ntState2.removeClaimFromTrie(std::string("test"), tx1OutPoint, unused); - BOOST_CHECK_EQUAL(ntState2.getMerkleHash(), hash3); + BOOST_CHECK(ntState2.getMerkleHash() == hash3); ntState2.flush(); BOOST_CHECK(!pclaimTrie->empty()); - BOOST_CHECK_EQUAL(pclaimTrie->getMerkleHash(), hash3); + BOOST_CHECK(pclaimTrie->getMerkleHash() == hash3); BOOST_CHECK(pclaimTrie->checkConsistency()); - CClaimTrieCache ntState3(pclaimTrie, false); + CClaimTrieCacheTest ntState3(pclaimTrie); ntState3.insertClaimIntoTrie(std::string("test"), CClaimValue(tx1OutPoint, hash160, 50, 100, 200)); - BOOST_CHECK_EQUAL(ntState3.getMerkleHash(), hash4); + BOOST_CHECK(ntState3.getMerkleHash() == hash4); ntState3.flush(); BOOST_CHECK(!pclaimTrie->empty()); - BOOST_CHECK_EQUAL(pclaimTrie->getMerkleHash(), hash4); + BOOST_CHECK(pclaimTrie->getMerkleHash() == hash4); BOOST_CHECK(pclaimTrie->checkConsistency()); - CClaimTrieCache ntState4(pclaimTrie, false); + CClaimTrieCacheTest ntState4(pclaimTrie); ntState4.removeClaimFromTrie(std::string("abab"), tx6OutPoint, unused); - BOOST_CHECK_EQUAL(ntState4.getMerkleHash(), hash2); + BOOST_CHECK(ntState4.getMerkleHash() == hash2); ntState4.flush(); BOOST_CHECK(!pclaimTrie->empty()); - BOOST_CHECK_EQUAL(pclaimTrie->getMerkleHash(), hash2); + BOOST_CHECK(pclaimTrie->getMerkleHash() == hash2); BOOST_CHECK(pclaimTrie->checkConsistency()); - CClaimTrieCache ntState5(pclaimTrie, false); + CClaimTrieCacheTest ntState5(pclaimTrie); ntState5.removeClaimFromTrie(std::string("test"), tx3OutPoint, unused); - BOOST_CHECK_EQUAL(ntState5.getMerkleHash(), hash2); + BOOST_CHECK(ntState5.getMerkleHash() == hash2); ntState5.flush(); BOOST_CHECK(!pclaimTrie->empty()); - BOOST_CHECK_EQUAL(pclaimTrie->getMerkleHash(), hash2); + BOOST_CHECK(pclaimTrie->getMerkleHash() == hash2); BOOST_CHECK(pclaimTrie->checkConsistency()); - CClaimTrieCache ntState6(pclaimTrie, false); + CClaimTrieCacheTest ntState6(pclaimTrie); ntState6.insertClaimIntoTrie(std::string("test"), CClaimValue(tx3OutPoint, hash160, 50, 101, 201)); - BOOST_CHECK_EQUAL(ntState6.getMerkleHash(), hash2); + BOOST_CHECK(ntState6.getMerkleHash() == hash2); ntState6.flush(); BOOST_CHECK(!pclaimTrie->empty()); - BOOST_CHECK_EQUAL(pclaimTrie->getMerkleHash(), hash2); + BOOST_CHECK(pclaimTrie->getMerkleHash() == hash2); BOOST_CHECK(pclaimTrie->checkConsistency()); - CClaimTrieCache ntState7(pclaimTrie, false); + CClaimTrieCacheTest ntState7(pclaimTrie); ntState7.removeClaimFromTrie(std::string("test"), tx3OutPoint, unused); ntState7.removeClaimFromTrie(std::string("test"), tx1OutPoint, unused); ntState7.removeClaimFromTrie(std::string("tes"), tx4OutPoint, unused); ntState7.removeClaimFromTrie(std::string("test2"), tx2OutPoint, unused); - BOOST_CHECK_EQUAL(ntState7.getMerkleHash(), hash0); + BOOST_CHECK(ntState7.getMerkleHash() == hash0); ntState7.flush(); BOOST_CHECK(pclaimTrie->empty()); - BOOST_CHECK_EQUAL(pclaimTrie->getMerkleHash(), hash0); + BOOST_CHECK(pclaimTrie->getMerkleHash() == hash0); BOOST_CHECK(pclaimTrie->checkConsistency()); } @@ -200,7 +211,6 @@ BOOST_AUTO_TEST_CASE(basic_insertion_info_test) CClaimTrieCacheTest ctc(pclaimTrie); // create and insert claim - CClaimValue unused; uint256 hash0(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); CMutableTransaction tx1 = BuildTransaction(hash0); uint160 claimId = ClaimIdHash(tx1.GetHash(), 0); @@ -213,14 +223,14 @@ BOOST_AUTO_TEST_CASE(basic_insertion_info_test) // try getClaimsForName, getEffectiveAmountForClaim, getInfoForName claimsForNameType res = ctc.getClaimsForName("test"); - BOOST_CHECK_EQUAL(res.claims.size(), 1); - BOOST_CHECK_EQUAL(res.claims[0], claimVal); + BOOST_CHECK(res.claims.size() == 1); + BOOST_CHECK(res.claims[0] == claimVal); BOOST_CHECK_EQUAL(10, ctc.getEffectiveAmountForClaim("test", claimId)); CClaimValue claim; BOOST_CHECK(ctc.getInfoForName("test", claim)); - BOOST_CHECK_EQUAL(claim, claimVal); + BOOST_CHECK(claim == claimVal); // insert a support CAmount supportAmount(10); @@ -285,7 +295,6 @@ BOOST_AUTO_TEST_CASE(iteratetrie_test) CClaimValue claimVal(COutPoint(txhash, 0), ClaimIdHash(txhash, 0), CAmount(10), 0, 0); ctc.insertClaimIntoTrie("test", claimVal); - int count = 0; struct TestCallBack : public CNodeCallback { diff --git a/src/test/data/key_io_valid.json b/src/test/data/key_io_valid.json index 8418a6002..9ace9ec6b 100644 --- a/src/test/data/key_io_valid.json +++ b/src/test/data/key_io_valid.json @@ -4,7 +4,7 @@ "76a91465a16059864a2fdbc7c99a4723a8395bc6f188eb88ac", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -12,7 +12,7 @@ "a91474f209f6ea907e2ea48f74fae05782ae8a66525787", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -20,7 +20,7 @@ "76a91453c0307d6851aa0ce7825ba883c6bd9ad242b48688ac", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -36,7 +36,7 @@ "a9146349a418fc4578d10a372b54b45c280cc8c4382f87", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -45,7 +45,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -54,7 +54,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -63,7 +63,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -81,7 +81,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -98,7 +98,7 @@ "76a9146d23156cbbdcc82a5a47eee4c2c7c583c18b6bf488ac", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -106,7 +106,7 @@ "a914fcc5460dd6e2487c7d75b1963625da0e8f4c597587", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -114,7 +114,7 @@ "76a914f1d470f9b02370fdec2e6b708b08ac431bf7a5f788ac", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -122,7 +122,7 @@ "a914c579342c2c4c9220205e2cdc285617040c924a0a87", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -131,7 +131,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -140,7 +140,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -149,7 +149,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -158,7 +158,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -166,7 +166,7 @@ "76a9147987ccaa53d02c8873487ef919677cd3db7a691288ac", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -174,7 +174,7 @@ "a91463bcc565f9e68ee0189dd5cc67f1b0e5f02f45cb87", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -182,7 +182,7 @@ "76a914ef66444b5b17f14e8fae6e7e19b045a78c54fd7988ac", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -190,7 +190,7 @@ "a914c3e55fceceaa4391ed2a9677f4a4d34eacd021a087", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -199,7 +199,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -208,7 +208,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -217,7 +217,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -226,7 +226,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -234,7 +234,7 @@ "76a914adc1cc2081a27206fae25792f28bbc55b831549d88ac", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -242,7 +242,7 @@ "a914188f91a931947eddd7432d6e614387e32b24470987", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -250,7 +250,7 @@ "76a9141694f5bc1a7295b600f40018a618a6ea48eeb49888ac", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -258,7 +258,7 @@ "a9143b9b3fd7a50d4f08d1a5b0f62f644fa7115ae2f387", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -267,7 +267,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -276,7 +276,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -285,7 +285,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -303,7 +303,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -311,7 +311,7 @@ "76a914c4c1b72491ede1eedaca00618407ee0b772cad0d88ac", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -319,7 +319,7 @@ "a914f6fe69bcb548a829cce4c57bf6fff8af3a5981f987", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -327,7 +327,7 @@ "76a914261f83568a098a8638844bd7aeca039d5f2352c088ac", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -335,7 +335,7 @@ "a914e930e1834a4d234702773951d627cce82fbb5d2e87", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -344,7 +344,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -353,7 +353,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -362,7 +362,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -371,7 +371,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -379,7 +379,7 @@ "76a9145eadaf9bb7121f0f192561a5a62f5e5f5421029288ac", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -387,7 +387,7 @@ "a9143f210e7277c899c3a155cc1c90f4106cbddeec6e87", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -395,7 +395,7 @@ "76a914c8a3c2a09a298592c3e180f02487cd91ba3400b588ac", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -403,7 +403,7 @@ "a91499b31df7c9068d1481b596578ddbb4d3bd90baeb87", { "isPrivkey": false, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -412,7 +412,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -421,7 +421,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -430,7 +430,7 @@ { "isCompressed": false, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -439,7 +439,7 @@ { "isCompressed": true, "isPrivkey": true, - "chain": "test" + "chain": "lbrycrdtest" } ], [ @@ -447,7 +447,7 @@ "76a9141ed467017f043e91ed4c44b4e8dd674db211c4e688ac", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -455,7 +455,7 @@ "a9145ece0cadddc415b1980f001785947120acdb36fc87", { "isPrivkey": false, - "chain": "main" + "chain": "lbrycrd" } ], [ @@ -463,7 +463,7 @@ "0014751e76e8199196d454941c45d1b3a323f1433bd6", { "isPrivkey": false, - "chain": "main", + "chain": "lbrycrd", "tryCaseFlip": true } ], @@ -481,7 +481,7 @@ "00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262", { "isPrivkey": false, - "chain": "test", + "chain": "lbrycrdtest", "tryCaseFlip": true } ], @@ -490,7 +490,7 @@ "5128751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f1433bd6", { "isPrivkey": false, - "chain": "main", + "chain": "lbrycrd", "tryCaseFlip": true } ], @@ -499,7 +499,7 @@ "6002751e", { "isPrivkey": false, - "chain": "main", + "chain": "lbrycrd", "tryCaseFlip": true } ], @@ -508,7 +508,7 @@ "5210751e76e8199196d454941c45d1b3a323", { "isPrivkey": false, - "chain": "main", + "chain": "lbrycrd", "tryCaseFlip": true } ], @@ -517,7 +517,7 @@ "0020000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433", { "isPrivkey": false, - "chain": "test", + "chain": "lbrycrdtest", "tryCaseFlip": true } ], diff --git a/src/test/denialofservice_tests.cpp b/src/test/denialofservice_tests.cpp index 91ab10e57..c43fadd92 100644 --- a/src/test/denialofservice_tests.cpp +++ b/src/test/denialofservice_tests.cpp @@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management) // we use maximum value of STALE_CHECK_INTERVAL and nPowTargetSpacing // NOTE: STALE_CHECK_INTERVAL is static that why we use raw value 10 * 60, sync may need in future - auto time = std::max(long(10) * 60, 3 * consensusParams.nPowTargetSpacing); + auto time = std::max({static_cast(10 * 60), 3 * consensusParams.nPowTargetSpacing}); SetMockTime(GetTime() + time + 1); diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index dff5845e7..fc20b84a8 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -48,54 +48,31 @@ static BlockAssembler AssemblerForTest(const CChainParams& params) { return BlockAssembler(params, options); } -/*static -struct { - unsigned char extranonce; - unsigned int nonce; -} blockinfo[] = { - {4, 0xa4a3e223}, {2, 0x15c32f9e}, {1, 0x0375b547}, {1, 0x7004a8a5}, - {2, 0xce440296}, {2, 0x52cfe198}, {1, 0x77a72cd0}, {2, 0xbb5d6f84}, - {2, 0x83f30c2c}, {1, 0x48a73d5b}, {1, 0xef7dcd01}, {2, 0x6809c6c4}, - {2, 0x0883ab3c}, {1, 0x087bbbe2}, {2, 0x2104a814}, {2, 0xdffb6daa}, - {1, 0xee8a0a08}, {2, 0xba4237c1}, {1, 0xa70349dc}, {1, 0x344722bb}, - {3, 0xd6294733}, {2, 0xec9f5c94}, {2, 0xca2fbc28}, {1, 0x6ba4f406}, - {2, 0x015d4532}, {1, 0x6e119b7c}, {2, 0x43e8f314}, {2, 0x27962f38}, - {2, 0xb571b51b}, {2, 0xb36bee23}, {2, 0xd17924a8}, {2, 0x6bc212d9}, - {1, 0x630d4948}, {2, 0x9a4c4ebb}, {2, 0x554be537}, {1, 0xd63ddfc7}, - {2, 0xa10acc11}, {1, 0x759a8363}, {2, 0xfb73090d}, {1, 0xe82c6a34}, - {1, 0xe33e92d7}, {3, 0x658ef5cb}, {2, 0xba32ff22}, {5, 0x0227a10c}, - {1, 0xa9a70155}, {5, 0xd096d809}, {1, 0x37176174}, {1, 0x830b8d0f}, - {1, 0xc6e3910e}, {2, 0x823f3ca8}, {1, 0x99850849}, {1, 0x7521fb81}, - {1, 0xaacaabab}, {1, 0xd645a2eb}, {5, 0x7aea1781}, {5, 0x9d6e4b78}, - {1, 0x4ce90fd8}, {1, 0xabdc832d}, {6, 0x4a34f32a}, {2, 0xf2524c1c}, - {2, 0x1bbeb08a}, {1, 0xad47f480}, {1, 0x9f026aeb}, {1, 0x15a95049}, - {2, 0xd1cb95b2}, {2, 0xf84bbda5}, {1, 0x0fa62cd1}, {1, 0xe05f9169}, - {1, 0x78d194a9}, {5, 0x3e38147b}, {5, 0x737ba0d4}, {1, 0x63378e10}, - {1, 0x6d5f91cf}, {2, 0x88612eb8}, {2, 0xe9639484}, {1, 0xb7fabc9d}, - {2, 0x19b01592}, {1, 0x5a90dd31}, {2, 0x5bd7e028}, {2, 0x94d00323}, - {1, 0xa9b9c01a}, {1, 0x3a40de61}, {1, 0x56e7eec7}, {5, 0x859f7ef6}, - {1, 0xfd8e5630}, {1, 0x2b0c9f7f}, {1, 0xba700e26}, {1, 0x7170a408}, - {1, 0x70de86a8}, {1, 0x74d64cd5}, {1, 0x49e738a1}, {2, 0x6910b602}, - {0, 0x643c565f}, {1, 0x54264b3f}, {2, 0x97ea6396}, {2, 0x55174459}, - {2, 0x03e8779a}, {1, 0x98f34d8f}, {1, 0xc07b2b07}, {1, 0xdfe29668}, - {1, 0x3141c7c1}, {1, 0xb3b595f4}, {1, 0x735abf08}, {5, 0x623bfbce}, - {2, 0xd351e722}, {1, 0xf4ca48c9}, {1, 0x5b19c670}, {1, 0xa164bf0e}, - {2, 0xbbbeb305}, {2, 0xfe1c810a}, -}; - const unsigned int nonces[] = { -9875, 95807, 31359, 234335, 145717, 80791, 112145, 24413, 180722, 9910, -43622, 8531, 6247, 21164, 31399, 115014, 6240, 11855, 15380, 16059, -151773, 42247, 258112, 33467, 66678, 118631, 31485, 53636, 74882, 4123, -86392, 11386, 58121, 27870, 76602, 17616, 80966, 37064, 84547, 58182, -169550, 11965, 63424, 245620, 4710, 6134, 77310, 100050, 134882, 44029, -3970, 175316, 56994, 23523, 12055, 15866, 25422, 71227, 105999, 107878, -75188, 17820, 54863, 74022, 81834, 121376, 67397, 10857, 22081, 33061, -65027, 46272, 56681, 1209, 151028, 82788, 7817, 92273, 55392, 15714, -94174, 21541, 33833, 30596, 93204, 53265, 51495, 59980, 91955, 57202, -40559, 23761, 75982, 4582, 3207, 109694, 12944, 93689, 47593, 20997, -194095, 112324, 146676, 66180, 33360, 140817, 731, 19918, 31681, 19541, -};*/ + 56564, 72380, 128907, 2182, 184471, 63950, 34000, 9478, 59377, 10829, + 66034, 37442, 89195, 26592, 26566, 53604, 125840, 89873, 28210, 13648, + 65365, 100838, 146064, 9575, 124878, 75942, 24172, 234386, 163091, 4967, + 10462, 22895, 143012, 26772, 98584, 50257, 76046, 56716, 63762, 20472, + 27042, 11610, 117648, 59446, 95391, 13726, 72678, 54999, 15643, 66372, + 159975, 34190, 3253, 3817, 3249, 19231, 287, 14293, 56344, 1314, 24596, + 39278, 42371, 204220, 17374, 32391, 4980, 127690, 13713, 66198, 89787, + 33360, 8777, 33257, 194167, 25918, 20999, 165920, 55226, 158831, 13566, + 37669, 264730, 44469, 57778, 40117, 61777, 196161, 107084, 69370, 49739, + 168694, 181818, 58959, 48614, 1646, 52654, 13423, 89689, 67406, 126841, + 22148, 59206, 76962, 77648, 2215, 162303, 137215, 37951, 30207, 53220, + 34221, 14213, 100990, 24457, 181162, 1451, 14573, 10467, 24983, 262822, + 167979, 25163, 68559, 88074, 135052, 30256, 24860, 25890, 191606, 307582, + 41542, 15231, 296998, 87388, 275976, 26110, 42669, 12916, 3833, 10375, + 9826, 37676, 163341, 168130, 3209, 55275, 140779, 33289, 68881, 18576, + 136275, 536, 25789, 16372, 51618, 12954, 3584, 235289, 5003, 135396, + 107987, 871, 29290, 29457, 59987, 36795, 27771, 105636, 68229, 7266, + 37970, 31076, 9463, 5272, 47100, 5844, 55508, 35003, 7540, 27079, + 56325, 59682, 22508, 24828, 42895, 69580, 71361, 83950, 8510, 21211, + 26562, 65709, 122140, 23400, 79693, 36035, 50444, 70005, 36025, 135185, + 71536, 4941, 11151, 3816, 45028, 45271, 90086, 94324, 18419, 108975, + 17221, 108672, 166833, 40212, 168684, 21230, 22513, 73286, 43347, 101454, + 418017, 71718, 93728, 214959, 31443, 31111, 41327, 74140, 25836 +}; static CBlockIndex CreateBlockIndex(int nHeight) { @@ -240,7 +217,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) // Therefore, load 100 blocks :) int baseheight = 0; std::vector txFirst; - for (unsigned int i = 0; i < 110; ++i) + for (unsigned int i = 0; i < sizeof(nonces)/sizeof(unsigned int); ++i) { BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey)); CBlock *pblock = &pblocktemplate->block; // pointer for convenience @@ -259,13 +236,21 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) if (txFirst.size() < 4) txFirst.push_back(pblock->vtx[0]); pblock->hashMerkleRoot = BlockMerkleRoot(*pblock); + pblock->nNonce = nonces[i]; - for (uint32_t i = 0;; ++i) { - pblock->nNonce = i; - if (CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus())) { +//Use below code to find nonces, in case we change hashing or difficulty retargeting algo +//#define NEED_NEW_NONCES_MINER_TEST +#ifdef NEED_NEW_NONCES_MINER_TEST + for (int j = 0;; j++) + { + pblock->nNonce = j; + if (CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus())) + { + std::cout << "Nonce is " << pblock->nNonce << std::endl; break; } } +#endif } std::shared_ptr shared_pblock = std::make_shared(*pblock); BOOST_CHECK(ProcessNewBlock(chainparams, shared_pblock, true, nullptr)); @@ -385,6 +370,40 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) BOOST_CHECK_EXCEPTION(AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey), std::runtime_error, HasReason("bad-txns-inputs-missingorspent")); mempool.clear(); + // subsidy changing + int nHeight = chainActive.Height(); + // Create an actual 209999-long block chain (without valid blocks). + BOOST_CHECK(pclaimTrie); + CClaimTrieCache trieCache(pclaimTrie); + BOOST_CHECK(chainActive.Tip()->GetBlockHash() == trieCache.getBestBlock()); + while (chainActive.Tip()->nHeight < 209999) { + CBlockIndex* prev = chainActive.Tip(); + CBlockIndex* next = new CBlockIndex(); + next->phashBlock = new uint256(InsecureRand256()); + pcoinsTip->SetBestBlock(next->GetBlockHash()); + trieCache.setBestBlock(next->GetBlockHash()); + trieCache.flush(); + next->pprev = prev; + next->nHeight = prev->nHeight + 1; + next->BuildSkip(); + chainActive.SetTip(next); + } + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey)); + // Extend to a 210000-long block chain. + while (chainActive.Tip()->nHeight < 210000) { + CBlockIndex* prev = chainActive.Tip(); + CBlockIndex* next = new CBlockIndex(); + next->phashBlock = new uint256(InsecureRand256()); + pcoinsTip->SetBestBlock(next->GetBlockHash()); + trieCache.setBestBlock(next->GetBlockHash()); + trieCache.flush(); + next->pprev = prev; + next->nHeight = prev->nHeight + 1; + next->BuildSkip(); + chainActive.SetTip(next); + } + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey)); + // invalid p2sh txn in mempool, template creation fails tx.vin[0].prevout.hash = txFirst[0]->GetHash(); tx.vin[0].prevout.n = 0; @@ -403,6 +422,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) BOOST_CHECK_EXCEPTION(AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey), std::runtime_error, HasReason("block-validation-failed")); mempool.clear(); + // Delete the dummy blocks again. + while (chainActive.Tip()->nHeight > nHeight) { + CBlockIndex* del = chainActive.Tip(); + chainActive.SetTip(del->pprev); + pcoinsTip->SetBestBlock(del->pprev->GetBlockHash()); + trieCache.setBestBlock(del->pprev->GetBlockHash()); + trieCache.flush(); + delete del->phashBlock; + delete del; + } + // non-final txs in mempool SetMockTime(chainActive.Tip()->GetMedianTimePast()+1); int flags = LOCKTIME_VERIFY_SEQUENCE|LOCKTIME_MEDIAN_TIME_PAST; @@ -410,7 +440,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) std::vector prevheights; // relative height locked - tx.nVersion = 2; + tx.nVersion = CTransaction::CURRENT_VERSION; tx.vin.resize(1); prevheights.resize(1); tx.vin[0].prevout.hash = txFirst[0]->GetHash(); // only 1 transaction @@ -423,6 +453,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) tx.vout[0].scriptPubKey = CScript() << OP_1; tx.nLockTime = 0; hash = tx.GetHash(); + mempool.addUnchecked(hash, entry.Fee(HIGHFEE).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); BOOST_CHECK(CheckFinalTx(tx, flags)); // Locktime passes BOOST_CHECK(!TestSequenceLocks(tx, flags)); // Sequence locks fail diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index b2960446e..5bcfd4b99 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -558,27 +558,27 @@ BOOST_AUTO_TEST_CASE(util_GetChainName) std::string error; test_args.ParseParameters(0, (char**)argv_testnet, error); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "main"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrd"); test_args.ParseParameters(2, (char**)argv_testnet, error); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); test_args.ParseParameters(2, (char**)argv_regtest, error); BOOST_CHECK_EQUAL(test_args.GetChainName(), "regtest"); test_args.ParseParameters(3, (char**)argv_test_no_reg, error); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); test_args.ParseParameters(3, (char**)argv_both, error); BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error); test_args.ParseParameters(0, (char**)argv_testnet, error); test_args.ReadConfigString(testnetconf); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); test_args.ParseParameters(2, (char**)argv_testnet, error); test_args.ReadConfigString(testnetconf); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); test_args.ParseParameters(2, (char**)argv_regtest, error); test_args.ReadConfigString(testnetconf); @@ -586,7 +586,7 @@ BOOST_AUTO_TEST_CASE(util_GetChainName) test_args.ParseParameters(3, (char**)argv_test_no_reg, error); test_args.ReadConfigString(testnetconf); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); test_args.ParseParameters(3, (char**)argv_both, error); test_args.ReadConfigString(testnetconf); @@ -598,11 +598,11 @@ BOOST_AUTO_TEST_CASE(util_GetChainName) test_args.ParseParameters(0, (char**)argv_testnet, error); test_args.ReadConfigString(testnetconf); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); test_args.ParseParameters(2, (char**)argv_testnet, error); test_args.ReadConfigString(testnetconf); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); test_args.ParseParameters(2, (char**)argv_regtest, error); test_args.ReadConfigString(testnetconf); @@ -610,7 +610,7 @@ BOOST_AUTO_TEST_CASE(util_GetChainName) test_args.ParseParameters(2, (char**)argv_test_no_reg, error); test_args.ReadConfigString(testnetconf); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); test_args.ParseParameters(3, (char**)argv_both, error); test_args.ReadConfigString(testnetconf); diff --git a/src/util.cpp b/src/util.cpp index b704ca7a5..ec3bb39b4 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -73,9 +73,6 @@ #include #include -#include -#include -#include #include // Application startup time (used for uptime calculation) @@ -88,54 +85,6 @@ ArgsManager gArgs; CTranslationInterface translationInterface; -/** Init OpenSSL library multithreading support */ -static std::unique_ptr ppmutexOpenSSL; -void locking_callback(int mode, int i, const char* file, int line) NO_THREAD_SAFETY_ANALYSIS -{ - if (mode & CRYPTO_LOCK) { - ENTER_CRITICAL_SECTION(ppmutexOpenSSL[i]); - } else { - LEAVE_CRITICAL_SECTION(ppmutexOpenSSL[i]); - } -} - -// Singleton for wrapping OpenSSL setup/teardown. -class CInit -{ -public: - CInit() - { - // Init OpenSSL library multithreading support - ppmutexOpenSSL.reset(new CCriticalSection[CRYPTO_num_locks()]); - CRYPTO_set_locking_callback(locking_callback); - - // OpenSSL can optionally load a config file which lists optional loadable modules and engines. - // We don't use them so we don't require the config. However some of our libs may call functions - // which attempt to load the config file, possibly resulting in an exit() or crash if it is missing - // or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be - // that the config appears to have been loaded and there are no modules/engines available. - OPENSSL_no_config(); - -#ifdef WIN32 - // Seed OpenSSL PRNG with current contents of the screen - RAND_screen(); -#endif - - // Seed OpenSSL PRNG with performance counter - RandAddSeed(); - } - ~CInit() - { - // Securely erase the memory used by the PRNG - RAND_cleanup(); - // Shutdown OpenSSL library multithreading support - CRYPTO_set_locking_callback(nullptr); - // Clear the set of locks now to maintain symmetry with the constructor. - ppmutexOpenSSL.reset(); - } -} -instance_of_cinit; - /** A map that contains all the currently held directory locks. After * successful locking, these will be held here until the global destructor * cleans them up and thus automatically unlocks them, or ReleaseDirectoryLocks @@ -691,7 +640,7 @@ static std::string FormatException(const std::exception* pex, const char* pszThr char pszModule[MAX_PATH] = ""; GetModuleFileNameA(nullptr, pszModule, sizeof(pszModule)); #else - const char* pszModule = "bitcoin"; + const char* pszModule = "lbrycrd"; #endif if (pex) return strprintf( @@ -1230,6 +1179,7 @@ std::string CopyrightHolders(const std::string& strPrefix) // Check for untranslated substitution to make sure Bitcoin Core copyright is not removed by accident if (strprintf(COPYRIGHT_HOLDERS, COPYRIGHT_HOLDERS_SUBSTITUTION).find("Bitcoin Core") == std::string::npos) { strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers"; + strCopyrightHolders += "\n" + strPrefix + "The LBRY Core developers"; } return strCopyrightHolders; } diff --git a/src/validation.cpp b/src/validation.cpp index 365fd1cb5..fa8aa459e 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -49,7 +49,7 @@ #include #if defined(NDEBUG) -# error "Bitcoin cannot be compiled without assertions." +# error "LBRYcrd cannot be compiled without assertions." #endif #define MICRO 0.000001 @@ -429,15 +429,15 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool // Rather not work on nonstandard transactions (unless -testnet/-regtest) std::string reason; if (fRequireStandard && !IsStandardTx(tx, reason)) - return state.DoS(0, false, REJECT_NONSTANDARD, reason); + return state.DoS(0, false, (reason == "dust" ? REJECT_DUST : REJECT_NONSTANDARD), reason); // Do not work on transactions that are too small. // A transaction with 1 segwit input and 1 P2WPHK output has non-witness size of 82 bytes. // Transactions smaller than this are not relayed to reduce unnecessary malloc overhead. - - // TODO: do we need this? - // if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) < MIN_STANDARD_TX_NONWITNESS_SIZE) - // return state.DoS(0, false, REJECT_NONSTANDARD, "tx-size-small"); + // + // NOTE: LBRY does not honor this node rule. + /* if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) < MIN_STANDARD_TX_NONWITNESS_SIZE) */ + /* return state.DoS(0, false, REJECT_NONSTANDARD, "tx-size-small"); */ // Only accept nLockTime-using transactions that can be mined in the next // block; we don't want our mempool filled up with transactions that can't @@ -794,7 +794,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool // Remove conflicting transactions from the mempool for (CTxMemPool::txiter it : allConflicting) { - LogPrint(BCLog::MEMPOOL, "replacing tx %s with %s for %s BTC additional fees, %d delta bytes\n", + LogPrint(BCLog::MEMPOOL, "replacing tx %s with %s for %s LBC additional fees, %d delta bytes\n", it->GetTx().GetHash().ToString(), hash.ToString(), FormatMoney(nModifiedFees - nConflictingFees), @@ -1589,21 +1589,19 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI { assert(vvchParams.size() == 2); claimId = ClaimIdHash(hash, j); - LogPrintf("--- %s[%lu]: OP_CLAIM_NAME \"%s\" = \"%s\" with claimId %s and tx prevout %s at index %d\n", - __func__, pindex->nHeight, name, SanitizeString(value), - claimId.GetHex(), hash.ToString(), j); + LogPrintf("--- %s[%lu]: OP_CLAIM_NAME \"%s\" with claimId %s and tx prevout %s at index %d\n", + __func__, pindex->nHeight, name, claimId.GetHex(), hash.ToString(), j); } else if (op == OP_UPDATE_CLAIM) { assert(vvchParams.size() == 3); claimId = uint160(vvchParams[1]); - LogPrintf("--- %s[%lu]: OP_UPDATE_CLAIM \"%s\" = \"%s\" with claimId %s and tx prevout %s at index %d\n", - __func__, pindex->nHeight, name, SanitizeString(value), - claimId.GetHex(), hash.ToString(), j); + LogPrintf("--- %s[%lu]: OP_UPDATE_CLAIM \"%s\" with claimId %s and tx prevout %s at index %d\n", + __func__, pindex->nHeight, name, claimId.GetHex(), hash.ToString(), j); } LogPrintf("%s: (txid: %s, nOut: %d) Trying to remove %s from the claim trie due to its block being disconnected\n", __func__, hash.ToString(), j, name); - if (!trieCache.undoAddClaim(name, COutPoint(hash, j))) + if (!trieCache.undoAddClaim(name, COutPoint(hash, j), pindex->nHeight)) { LogPrintf("%s: Could not find the claim in the trie or the cache\n", __func__); } @@ -1617,7 +1615,7 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI __func__, pindex->nHeight, name, supportedClaimId.GetHex(), hash.ToString(), j); LogPrintf("%s: (txid: %s, nOut: %d) Removing support for claim id %s on %s due to its block being disconnected\n", __func__, hash.ToString(), j, supportedClaimId.ToString(), name); - if (!trieCache.undoAddSupport(name, COutPoint(hash, j))) + if (!trieCache.undoAddSupport(name, COutPoint(hash, j), pindex->nHeight)) LogPrintf("%s: Something went wrong removing support for name %s in hash %s\n", __func__, name.c_str(), hash.ToString()); } } @@ -1712,7 +1710,7 @@ static bool WriteUndoDataForBlock(const CBlockUndo& blockundo, CValidationState& static CCheckQueue scriptcheckqueue(128); void ThreadScriptCheck() { - RenameThread("bitcoin-scriptch"); + RenameThread("lbrycrd-scriptch"); scriptcheckqueue.Thread(); } @@ -2116,22 +2114,20 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl { assert(vvchParams.size() == 2); claimId = ClaimIdHash(txin.prevout.hash, txin.prevout.n); - LogPrintf("+++ %s[%lu]: OP_CLAIM_NAME \"%s\" = \"%s\" with claimId %s and tx prevout %s at index %d\n", - __func__, pindex->nHeight, name, SanitizeString(value), - claimId.GetHex(), txin.prevout.hash.GetHex(), txin.prevout.n); + LogPrintf("+++ %s[%lu]: OP_CLAIM_NAME \"%s\"with claimId %s and tx prevout %s at index %d\n", + __func__, pindex->nHeight, name, claimId.GetHex(), txin.prevout.hash.GetHex(), txin.prevout.n); } else if (op == OP_UPDATE_CLAIM) { assert(vvchParams.size() == 3); claimId = uint160(vvchParams[1]); - LogPrintf("+++ %s[%lu]: OP_UPDATE_CLAIM \"%s\" = \"%s\" with claimId %s and tx prevout %s at index %d\n", - __func__, pindex->nHeight, name, SanitizeString(value), - claimId.GetHex(), txin.prevout.hash.GetHex(), txin.prevout.n); + LogPrintf("+++ %s[%lu]: OP_UPDATE_CLAIM \"%s\" with claimId %s and tx prevout %s at index %d\n", + __func__, pindex->nHeight, name, claimId.GetHex(), txin.prevout.hash.GetHex(), txin.prevout.n); } int nValidAtHeight; LogPrintf("%s: Removing %s (%s) from the claim trie. Tx: %s, nOut: %d\n", __func__, name, claimId.GetHex(), txin.prevout.hash.GetHex(), txin.prevout.n); - if (trieCache.spendClaim(name, COutPoint(txin.prevout.hash, txin.prevout.n), nValidAtHeight)) + if (trieCache.spendClaim(name, COutPoint(txin.prevout.hash, txin.prevout.n), coin.nHeight, nValidAtHeight)) { mClaimUndoHeights[j] = nValidAtHeight; std::pair entry(name, claimId); @@ -2154,7 +2150,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl LogPrintf("%s: Removing support for %s in %s. Tx: %s, nOut: %d, removed txid: %s\n", __func__, supportedClaimId.ToString(), name, txin.prevout.hash.ToString(), txin.prevout.n, tx.GetHash().ToString()); - if (trieCache.spendSupport(name, COutPoint(txin.prevout.hash, txin.prevout.n), nValidAtHeight)) + if (trieCache.spendSupport(name, COutPoint(txin.prevout.hash, txin.prevout.n), coin.nHeight, nValidAtHeight)) { mClaimUndoHeights[j] = nValidAtHeight; } diff --git a/test/util/data/bitcoin-util-test.json b/test/util/data/bitcoin-util-test.json index f2213f4f2..da29b45ff 100644 --- a/test/util/data/bitcoin-util-test.json +++ b/test/util/data/bitcoin-util-test.json @@ -1,108 +1,108 @@ [ - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "nversion=1"], "output_cmp": "blanktxv1.hex", "description": "Creates a blank v1 transaction" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json","-create", "nversion=1"], "output_cmp": "blanktxv1.json", "description": "Creates a blank v1 transaction (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-"], "input": "blanktxv2.hex", "output_cmp": "blanktxv2.hex", - "description": "Creates a blank transaction when nothing is piped into bitcoin-tx" + "description": "Creates a blank transaction when nothing is piped into lbrycrd-tx" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json","-create"], "output_cmp": "blanktxv2.json", "description": "Creates a blank transaction (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json","-"], "input": "blanktxv2.hex", "output_cmp": "blanktxv2.json", - "description": "Creates a blank transaction when nothing is piped into bitcoin-tx (output in json)" + "description": "Creates a blank transaction when nothing is piped into lbrycrd-tx (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "nversion=1foo"], "return_code": 1, "error_txt": "error: Invalid TX version requested", "description": "Tests the check for invalid nversion value" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-", "delin=1"], "input": "tx394b54bb.hex", "output_cmp": "tt-delin1-out.hex", "description": "Deletes a single input from a transaction" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-", "delin=1"], "input": "tx394b54bb.hex", "output_cmp": "tt-delin1-out.json", "description": "Deletes a single input from a transaction (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-", "delin=31"], "input": "tx394b54bb.hex", "return_code": 1, "error_txt": "error: Invalid TX input index '31'", "description": "Attempts to delete an input with a bad index from a transaction. Expected to fail." }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-", "delin=1foo"], "input": "tx394b54bb.hex", "return_code": 1, "error_txt": "error: Invalid TX input index", "description": "Tests the check for an invalid input index with delin" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-", "delout=1"], "input": "tx394b54bb.hex", "output_cmp": "tt-delout1-out.hex", "description": "Deletes a single output from a transaction" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-", "delout=1"], "input": "tx394b54bb.hex", "output_cmp": "tt-delout1-out.json", "description": "Deletes a single output from a transaction (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-", "delout=2"], "input": "tx394b54bb.hex", "return_code": 1, "error_txt": "error: Invalid TX output index '2'", "description": "Attempts to delete an output with a bad index from a transaction. Expected to fail." }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-", "delout=1foo"], "input": "tx394b54bb.hex", "return_code": 1, "error_txt": "error: Invalid TX output index", "description": "Tests the check for an invalid output index with delout" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-", "locktime=317000"], "input": "tx394b54bb.hex", "output_cmp": "tt-locktime317000-out.hex", "description": "Adds an nlocktime to a transaction" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-", "locktime=317000"], "input": "tx394b54bb.hex", "output_cmp": "tt-locktime317000-out.json", "description": "Adds an nlocktime to a transaction (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "locktime=317000foo"], "return_code": 1, "error_txt": "error: Invalid TX locktime requested", "description": "Tests the check for invalid locktime value" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0", @@ -111,7 +111,7 @@ "error_txt": "error: Invalid TX input index", "description": "Tests the check for an invalid input index with replaceable" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0x"], @@ -119,7 +119,7 @@ "error_txt": "error: invalid TX input vout", "description": "Tests the check for an invalid vout value when adding an input" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outaddr=1"], @@ -127,7 +127,7 @@ "error_txt": "error: TX output missing or too many separators", "description": "Malformed outaddr argument (no address specified). Expected to fail." }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outaddr=1:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o:garbage"], @@ -135,7 +135,7 @@ "error_txt": "error: TX output missing or too many separators", "description": "Malformed outaddr argument (too many separators). Expected to fail." }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outpubkey=0"], @@ -143,7 +143,7 @@ "error_txt": "error: TX output missing or too many separators", "description": "Malformed outpubkey argument (no pubkey specified). Expected to fail." }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W:non53nse"], @@ -151,7 +151,7 @@ "error_txt": "error: TX output missing or too many separators", "description": "Malformed outpubkey argument (too many separators). Expected to fail." }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0", @@ -162,7 +162,7 @@ "output_cmp": "txcreate1.hex", "description": "Creates a new transaction with three inputs and two outputs" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", @@ -174,67 +174,67 @@ "output_cmp": "txcreate1.json", "description": "Creates a new transaction with three inputs and two outputs (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outscript=0:"], "output_cmp": "txcreate2.hex", "description": "Creates a new transaction with a single empty output script" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outscript=0:"], "output_cmp": "txcreate2.json", "description": "Creates a new transaction with a single empty output script (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["02000000000100000000000000000000000000"], "output_cmp": "txcreate2.hex", "description": "Parses a transaction with no inputs and a single output script" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "02000000000100000000000000000000000000"], "output_cmp": "txcreate2.json", "description": "Parses a transaction with no inputs and a single output script (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outscript=0:OP_DROP", "nversion=1"], "output_cmp": "txcreatescript1.hex", "description": "Create a new transaction with a single output script (OP_DROP)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outscript=0:OP_DROP", "nversion=1"], "output_cmp": "txcreatescript1.json", "description": "Create a new transaction with a single output script (OP_DROP) (output as json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outscript=0:OP_DROP:S", "nversion=1"], "output_cmp": "txcreatescript2.hex", "description": "Create a new transaction with a single output script (OP_DROP) in a P2SH" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outscript=0:OP_DROP:S", "nversion=1"], "output_cmp": "txcreatescript2.json", "description": "Create a new transaction with a single output script (OP_DROP) in a P2SH (output as json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outscript=0:OP_DROP:W", "nversion=1"], "output_cmp": "txcreatescript3.hex", "description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outscript=0:OP_DROP:W", "nversion=1"], "output_cmp": "txcreatescript3.json", "description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH (output as json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outscript=0:OP_DROP:WS", "nversion=1"], "output_cmp": "txcreatescript4.hex", "description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH, wrapped in a P2SH" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outscript=0:OP_DROP:WS", "nversion=1"], "output_cmp": "txcreatescript4.json", "description": "Create a new transaction with a single output script (OP_DROP) in a P2SH, wrapped in a P2SH (output as json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "nversion=1", "in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0", @@ -245,7 +245,7 @@ "output_cmp": "txcreatesignv1.hex", "description": "Creates a new v1 transaction with a single input and a single output, and then signs the transaction" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "nversion=1", @@ -257,7 +257,7 @@ "output_cmp": "txcreatesignv1.json", "description": "Creates a new v1 transaction with a single input and a single output, and then signs the transaction (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0", @@ -268,7 +268,7 @@ "output_cmp": "txcreatesignv2.hex", "description": "Creates a new transaction with a single input and a single output, and then signs the transaction" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0", @@ -280,50 +280,50 @@ "error_txt": "error: prevtxs internal object typecheck fail", "description": "Tests the check for invalid vout index in prevtxs for sign" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397", "nversion=1"], "output_cmp": "txcreateoutpubkey1.hex", "description": "Creates a new transaction with a single pay-to-pubkey output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397", "nversion=1"], "output_cmp": "txcreateoutpubkey1.json", "description": "Creates a new transaction with a single pay-to-pubkey output (output as json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W", "nversion=1"], "output_cmp": "txcreateoutpubkey2.hex", "description": "Creates a new transaction with a single pay-to-witness-pubkey output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W", "nversion=1"], "output_cmp": "txcreateoutpubkey2.json", "description": "Creates a new transaction with a single pay-to-witness-pubkey output (output as json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:WS", "nversion=1"], "output_cmp": "txcreateoutpubkey3.hex", "description": "Creates a new transaction with a single pay-to-witness-pubkey, wrapped in P2SH output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:WS", "nversion=1"], "output_cmp": "txcreateoutpubkey3.json", "description": "Creates a new transaction with a single pay-to-pub-key output, wrapped in P2SH (output as json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outpubkey=0:047d1368ba7ae01c94bc32293efd70bd7e3be7aa7912d07d0b1c659c1008d179b8642f5fb90f47580feb29f045e216ff5a4716d3a0fed36da414d332046303c44a:WS", "nversion=1"], "return_code": 1, "error_txt": "error: Uncompressed pubkeys are not useable for SegWit outputs", "description": "Creates a new transaction with a single pay-to-pub-key output, wrapped in P2SH (output as json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0", @@ -332,7 +332,7 @@ "error_txt": "error: invalid TX output data", "description": "Attempts to create a new transaction with one input and an output with malformed hex data. Expected to fail" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0", @@ -341,7 +341,7 @@ "error_txt": "error: invalid TX output data", "description": "Attempts to create a new transaction with one input and an output with no value and malformed hex data. Expected to fail" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0", @@ -350,7 +350,7 @@ "output_cmp": "txcreatedata1.hex", "description": "Creates a new transaction with one input, one address output and one data output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "nversion=1", @@ -360,7 +360,7 @@ "output_cmp": "txcreatedata1.json", "description": "Creates a new v1 transaction with one input, one address output and one data output (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0", @@ -369,7 +369,7 @@ "output_cmp": "txcreatedata2.hex", "description": "Creates a new transaction with one input, one address output and one data (zero value) output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", @@ -379,7 +379,7 @@ "output_cmp": "txcreatedata2.json", "description": "Creates a new transaction with one input, one address output and one data (zero value) output (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:4294967293", @@ -387,7 +387,7 @@ "output_cmp": "txcreatedata_seq0.hex", "description": "Creates a new transaction with one input with sequence number and one address output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", @@ -396,14 +396,14 @@ "output_cmp": "txcreatedata_seq0.json", "description": "Creates a new transaction with one input with sequence number and one address output (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["01000000011f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000fdffffff0180a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac00000000", "in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:1"], "output_cmp": "txcreatedata_seq1.hex", "description": "Adds a new input with sequence number to a transaction" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "01000000011f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000fdffffff0180a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac00000000", @@ -411,52 +411,52 @@ "output_cmp": "txcreatedata_seq1.json", "description": "Adds a new input with sequence number to a transaction (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"], "output_cmp": "txcreatemultisig1.hex", "description": "Creates a new transaction with a single 2-of-3 multisig output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"], "output_cmp": "txcreatemultisig1.json", "description": "Creates a new transaction with a single 2-of-3 multisig output (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S", "nversion=1"], "output_cmp": "txcreatemultisig2.hex", "description": "Creates a new transaction with a single 2-of-3 multisig in a P2SH output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S", "nversion=1"], "output_cmp": "txcreatemultisig2.json", "description": "Creates a new transaction with a single 2-of-3 multisig in a P2SH output (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:W", "nversion=1"], "output_cmp": "txcreatemultisig3.hex", "description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:W", "nversion=1"], "output_cmp": "txcreatemultisig3.json", "description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS", "nversion=1"], "output_cmp": "txcreatemultisig4.hex", "description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS", "nversion=1"], "output_cmp": "txcreatemultisig4.json", "description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH (output in json)" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:047d1368ba7ae01c94bc32293efd70bd7e3be7aa7912d07d0b1c659c1008d179b8642f5fb90f47580feb29f045e216ff5a4716d3a0fed36da414d332046303c44a:S"], "output_cmp": "txcreatemultisig5.json", "description": "Uncompressed pubkeys should work just fine for non-witness outputs" }, - { "exec": "./bitcoin-tx", + { "exec": "./lbrycrd-tx", "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:047d1368ba7ae01c94bc32293efd70bd7e3be7aa7912d07d0b1c659c1008d179b8642f5fb90f47580feb29f045e216ff5a4716d3a0fed36da414d332046303c44a:WS"], "return_code": 1, "error_txt": "error: Uncompressed pubkeys are not useable for SegWit outputs",