diff --git a/README.md b/README.md index cc4b8d0..18b3a50 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,25 @@ NewEnglandcoin What is NewEnglandcoin? ---------------- -NewEnglandcoin is a clone of Bitcoin using scrypt as a proof-of-work algorithm. +NewEnglandcoin is a clone of Bitcoin using scrypt as a proof-of-work algorithm with enhanced features to protect against 51% attack +and decentralize on mining to allow diversified mining rigs across CPUs, GPUs, ASICs and Android phones. - 1 minute block targets - subsidy halves in 2.1m blocks (~4 years) - ~84 billion total maximum coins - 20000 coins per block +Major releases features: + - v0.8.7.5 litecoin clone, ASIC dominant mining + - v1.1.x support CPU Minings on Windows, Linux or MacOS + - v1.2.x start restrictions on big ASIC rigs + - v1.3.x scrypt randomSpike release + - v1.4.x enable mobile mining on android phones (both 64 bits arm64 and 32 bits arm) + +Note: all above versions have "0.8.7.5" version tag in QT wallet. The downloaded files should have correct version on file names. + Bitcointalk Ann: https://bitcointalk.org/index.php?topic=5027091.0 -Marinecoin Forum Ann: https://talk.marinecoin.info/index.php?topic=137.0 +Reddit: https://www.reddit.com/r/NewEnglandCoin/ DISCORD: https://discordapp.com/invite/UPeBwgs diff --git a/bitcoin-qt.pro.debian b/bitcoin-qt.pro.debian new file mode 100644 index 0000000..e8be373 --- /dev/null +++ b/bitcoin-qt.pro.debian @@ -0,0 +1,447 @@ +TEMPLATE = app +TARGET = newenglandcoin-qt +macx:TARGET = "NewEnglandcoin-Qt" +VERSION = 0.8.7.5 +INCLUDEPATH += src src/json src/qt +QT += core gui network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE +CONFIG += no_include_pwd +CONFIG += thread + +# for boost 1.37, add -mt to the boost libraries +# use: qmake BOOST_LIB_SUFFIX=-mt +# for boost thread win32 with _win32 sufix +# use: BOOST_THREAD_LIB_SUFFIX=_win32-... +# or when linking against a specific BerkelyDB version: BDB_LIB_SUFFIX=-4.8 + +# Dependency library locations can be customized with: +# BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH, +# BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively + +BDB_INCLUDE_PATH=/opt/db-4.8.30.NC/build_unix +BDB_LIB_PATH=/opt/db-4.8.30.NC/build_unix +OBJECTS_DIR = build +MOC_DIR = build +UI_DIR = build + +# use: qmake "RELEASE=1" +contains(RELEASE, 1) { + # Mac: compile for maximum compatibility (10.5, 32-bit) + macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk + macx:QMAKE_CFLAGS += -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk + macx:QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk + + !win32:!macx { + # Linux: static link and extra security (see: https://wiki.debian.org/Hardening) + LIBS += -Wl,-Bstatic -Wl,-z,relro -Wl,-z,now + } +} + +!win32 { + # for extra security against potential buffer overflows: enable GCCs Stack Smashing Protection + QMAKE_CXXFLAGS *= -fstack-protector-all + QMAKE_LFLAGS *= -fstack-protector-all + # Exclude on Windows cross compile with MinGW 4.2.x, as it will result in a non-working executable! + # This can be enabled for Windows, when we switch to MinGW >= 4.4.x. +} +# for extra security (see: https://wiki.debian.org/Hardening): this flag is GCC compiler-specific +QMAKE_CXXFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +# for extra security on Windows: enable ASLR and DEP via GCC linker flags +win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat +# on Windows: enable GCC large address aware linker flag +win32:QMAKE_LFLAGS *= -Wl,--large-address-aware +# i686-w64-mingw32 +win32:QMAKE_LFLAGS *= -static-libgcc -static-libstdc++ + +# use: qmake "USE_QRCODE=1" +# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support +contains(USE_QRCODE, 1) { + message(Building with QRCode support) + DEFINES += USE_QRCODE + LIBS += -lqrencode +} + +# use: qmake "USE_UPNP=1" ( enabled by default; default) +# or: qmake "USE_UPNP=0" (disabled by default) +# or: qmake "USE_UPNP=-" (not supported) +# miniupnpc (http://miniupnp.free.fr/files/) must be installed for support +contains(USE_UPNP, -) { + message(Building without UPNP support) +} else { + message(Building with UPNP support) + count(USE_UPNP, 0) { + USE_UPNP=1 + } + DEFINES += USE_UPNP=$$USE_UPNP STATICLIB + INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH + LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc + win32:LIBS += -liphlpapi +} + +# use: qmake "USE_DBUS=1" +contains(USE_DBUS, 1) { + message(Building with DBUS (Freedesktop notifications) support) + DEFINES += USE_DBUS + QT += dbus +} + +# use: qmake "USE_IPV6=1" ( enabled by default; default) +# or: qmake "USE_IPV6=0" (disabled by default) +# or: qmake "USE_IPV6=-" (not supported) +contains(USE_IPV6, -) { + message(Building without IPv6 support) +} else { + count(USE_IPV6, 0) { + USE_IPV6=1 + } + DEFINES += USE_IPV6=$$USE_IPV6 +} + +contains(BITCOIN_NEED_QT_PLUGINS, 1) { + DEFINES += BITCOIN_NEED_QT_PLUGINS + QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets +} + +INCLUDEPATH += src/leveldb/include src/leveldb/helpers +LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a +!win32 { + # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences + genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a +} else { + # make an educated guess about what the ranlib command is called + isEmpty(QMAKE_RANLIB) { + QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib) + } + LIBS += -lshlwapi + genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a +} +genleveldb.target = $$PWD/src/leveldb/libleveldb.a +genleveldb.depends = FORCE +PRE_TARGETDEPS += $$PWD/src/leveldb/libleveldb.a +QMAKE_EXTRA_TARGETS += genleveldb +# Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it. +QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb ; $(MAKE) clean + +# regenerate src/build.h +!win32|contains(USE_BUILD_INFO, 1) { + genbuild.depends = FORCE + genbuild.commands = cd $$PWD; /bin/sh share/genbuild.sh $$OUT_PWD/build/build.h + genbuild.target = $$OUT_PWD/build/build.h + PRE_TARGETDEPS += $$OUT_PWD/build/build.h + QMAKE_EXTRA_TARGETS += genbuild + DEFINES += HAVE_BUILD_INFO +} + +QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector + +# Input +DEPENDPATH += src src/json src/qt +HEADERS += src/qt/bitcoingui.h \ + src/qt/transactiontablemodel.h \ + src/qt/addresstablemodel.h \ + src/qt/optionsdialog.h \ + src/qt/sendcoinsdialog.h \ + src/qt/coincontroldialog.h \ + src/qt/coincontroltreewidget.h \ + src/qt/addressbookpage.h \ + src/qt/signverifymessagedialog.h \ + src/qt/aboutdialog.h \ + src/qt/editaddressdialog.h \ + src/qt/bitcoinaddressvalidator.h \ + src/alert.h \ + src/addrman.h \ + src/base58.h \ + src/bignum.h \ + src/checkpoints.h \ + src/coincontrol.h \ + src/compat.h \ + src/sync.h \ + src/util.h \ + src/hash.h \ + src/uint256.h \ + src/serialize.h \ + src/main.h \ + src/net.h \ + src/key.h \ + src/db.h \ + src/walletdb.h \ + src/script.h \ + src/init.h \ + src/bloom.h \ + src/mruset.h \ + src/checkqueue.h \ + src/json/json_spirit_writer_template.h \ + src/json/json_spirit_writer.h \ + src/json/json_spirit_value.h \ + src/json/json_spirit_utils.h \ + src/json/json_spirit_stream_reader.h \ + src/json/json_spirit_reader_template.h \ + src/json/json_spirit_reader.h \ + src/json/json_spirit_error_position.h \ + src/json/json_spirit.h \ + src/qt/clientmodel.h \ + src/qt/guiutil.h \ + src/qt/transactionrecord.h \ + src/qt/guiconstants.h \ + src/qt/optionsmodel.h \ + src/qt/monitoreddatamapper.h \ + src/qt/transactiondesc.h \ + src/qt/transactiondescdialog.h \ + src/qt/bitcoinamountfield.h \ + src/wallet.h \ + src/keystore.h \ + src/qt/transactionfilterproxy.h \ + src/qt/transactionview.h \ + src/qt/walletmodel.h \ + src/qt/walletview.h \ + src/qt/walletstack.h \ + src/qt/walletframe.h \ + src/bitcoinrpc.h \ + src/qt/overviewpage.h \ + src/qt/csvmodelwriter.h \ + src/crypter.h \ + src/qt/sendcoinsentry.h \ + src/qt/qvalidatedlineedit.h \ + src/qt/bitcoinunits.h \ + src/qt/qvaluecombobox.h \ + src/qt/askpassphrasedialog.h \ + src/protocol.h \ + src/qt/notificator.h \ + src/qt/paymentserver.h \ + src/allocators.h \ + src/ui_interface.h \ + src/qt/rpcconsole.h \ + src/scrypt.h \ + src/version.h \ + src/netbase.h \ + src/clientversion.h \ + src/txdb.h \ + src/leveldb.h \ + src/threadsafety.h \ + src/limitedmap.h \ + src/qt/macnotificationhandler.h \ + src/qt/splashscreen.h + +SOURCES += src/qt/bitcoin.cpp \ + src/qt/bitcoingui.cpp \ + src/qt/transactiontablemodel.cpp \ + src/qt/addresstablemodel.cpp \ + src/qt/optionsdialog.cpp \ + src/qt/sendcoinsdialog.cpp \ + src/qt/coincontroldialog.cpp \ + src/qt/coincontroltreewidget.cpp \ + src/qt/addressbookpage.cpp \ + src/qt/signverifymessagedialog.cpp \ + src/qt/aboutdialog.cpp \ + src/qt/editaddressdialog.cpp \ + src/qt/bitcoinaddressvalidator.cpp \ + src/alert.cpp \ + src/version.cpp \ + src/sync.cpp \ + src/util.cpp \ + src/hash.cpp \ + src/netbase.cpp \ + src/key.cpp \ + src/script.cpp \ + src/main.cpp \ + src/init.cpp \ + src/net.cpp \ + src/bloom.cpp \ + src/checkpoints.cpp \ + src/addrman.cpp \ + src/db.cpp \ + src/walletdb.cpp \ + src/qt/clientmodel.cpp \ + src/qt/guiutil.cpp \ + src/qt/transactionrecord.cpp \ + src/qt/optionsmodel.cpp \ + src/qt/monitoreddatamapper.cpp \ + src/qt/transactiondesc.cpp \ + src/qt/transactiondescdialog.cpp \ + src/qt/bitcoinstrings.cpp \ + src/qt/bitcoinamountfield.cpp \ + src/wallet.cpp \ + src/keystore.cpp \ + src/qt/transactionfilterproxy.cpp \ + src/qt/transactionview.cpp \ + src/qt/walletmodel.cpp \ + src/qt/walletview.cpp \ + src/qt/walletstack.cpp \ + src/qt/walletframe.cpp \ + src/bitcoinrpc.cpp \ + src/rpcdump.cpp \ + src/rpcnet.cpp \ + src/rpcmining.cpp \ + src/rpcwallet.cpp \ + src/rpcblockchain.cpp \ + src/rpcrawtransaction.cpp \ + src/qt/overviewpage.cpp \ + src/qt/csvmodelwriter.cpp \ + src/crypter.cpp \ + src/qt/sendcoinsentry.cpp \ + src/qt/qvalidatedlineedit.cpp \ + src/qt/bitcoinunits.cpp \ + src/qt/qvaluecombobox.cpp \ + src/qt/askpassphrasedialog.cpp \ + src/protocol.cpp \ + src/qt/notificator.cpp \ + src/qt/paymentserver.cpp \ + src/qt/rpcconsole.cpp \ + src/scrypt.cpp \ + src/noui.cpp \ + src/leveldb.cpp \ + src/txdb.cpp \ + src/qt/splashscreen.cpp + +RESOURCES += src/qt/bitcoin.qrc + +FORMS += src/qt/forms/sendcoinsdialog.ui \ + src/qt/forms/coincontroldialog.ui \ + src/qt/forms/addressbookpage.ui \ + src/qt/forms/signverifymessagedialog.ui \ + src/qt/forms/aboutdialog.ui \ + src/qt/forms/editaddressdialog.ui \ + src/qt/forms/transactiondescdialog.ui \ + src/qt/forms/overviewpage.ui \ + src/qt/forms/sendcoinsentry.ui \ + src/qt/forms/askpassphrasedialog.ui \ + src/qt/forms/rpcconsole.ui \ + src/qt/forms/optionsdialog.ui + +contains(USE_QRCODE, 1) { +HEADERS += src/qt/qrcodedialog.h +SOURCES += src/qt/qrcodedialog.cpp +FORMS += src/qt/forms/qrcodedialog.ui +} + +contains(BITCOIN_QT_TEST, 1) { +SOURCES += src/qt/test/test_main.cpp \ + src/qt/test/uritests.cpp +HEADERS += src/qt/test/uritests.h +DEPENDPATH += src/qt/test +QT += testlib +TARGET = newenglandcoin-qt_test +DEFINES += BITCOIN_QT_TEST + macx: CONFIG -= app_bundle +} + +contains(USE_SSE2, 1) { +DEFINES += USE_SSE2 +gccsse2.input = SOURCES_SSE2 +gccsse2.output = $$PWD/build/${QMAKE_FILE_BASE}.o +gccsse2.commands = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} -msse2 -mstackrealign +QMAKE_EXTRA_COMPILERS += gccsse2 +SOURCES_SSE2 += src/scrypt-sse2.cpp +} + +# Todo: Remove this line when switching to Qt5, as that option was removed +CODECFORTR = UTF-8 + +# for lrelease/lupdate +# also add new translations to src/qt/bitcoin.qrc under translations/ +TRANSLATIONS = $$files(src/qt/locale/bitcoin_*.ts) + +isEmpty(QMAKE_LRELEASE) { + win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe + else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease +} +isEmpty(QM_DIR):QM_DIR = $$PWD/src/qt/locale +# automatically build translations, so they can be included in resource file +TSQM.name = lrelease ${QMAKE_FILE_IN} +TSQM.input = TRANSLATIONS +TSQM.output = $$QM_DIR/${QMAKE_FILE_BASE}.qm +TSQM.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} +TSQM.CONFIG = no_link +QMAKE_EXTRA_COMPILERS += TSQM + +# "Other files" to show in Qt Creator +OTHER_FILES += README.md \ + doc/*.rst \ + doc/*.txt \ + doc/*.md \ + src/qt/res/bitcoin-qt.rc \ + src/test/*.cpp \ + src/test/*.h \ + src/qt/test/*.cpp \ + src/qt/test/*.h + +# platform specific defaults, if not overridden on command line +isEmpty(BOOST_LIB_SUFFIX) { + macx:BOOST_LIB_SUFFIX = -mt + win32:BOOST_LIB_SUFFIX = -mgw44-mt-s-1_50 +} + +isEmpty(BOOST_THREAD_LIB_SUFFIX) { + BOOST_THREAD_LIB_SUFFIX = $$BOOST_LIB_SUFFIX +} + +isEmpty(BDB_LIB_PATH) { + macx:BDB_LIB_PATH = /opt/local/lib/db48 +} + +isEmpty(BDB_LIB_SUFFIX) { + macx:BDB_LIB_SUFFIX = -4.8 +} + +isEmpty(BDB_INCLUDE_PATH) { + macx:BDB_INCLUDE_PATH = /opt/local/include/db48 +} + +isEmpty(BOOST_LIB_PATH) { + macx:BOOST_LIB_PATH = /opt/local/lib +} + +isEmpty(BOOST_INCLUDE_PATH) { + macx:BOOST_INCLUDE_PATH = /opt/local/include +} + +win32:DEFINES += WIN32 +win32:RC_FILE = src/qt/res/bitcoin-qt.rc + +win32:!contains(MINGW_THREAD_BUGFIX, 0) { + # At least qmake's win32-g++-cross profile is missing the -lmingwthrd + # thread-safety flag. GCC has -mthreads to enable this, but it doesn't + # work with static linking. -lmingwthrd must come BEFORE -lmingw, so + # it is prepended to QMAKE_LIBS_QT_ENTRY. + # It can be turned off with MINGW_THREAD_BUGFIX=0, just in case it causes + # any problems on some untested qmake profile now or in the future. + DEFINES += _MT + QMAKE_LIBS_QT_ENTRY = -lmingwthrd $$QMAKE_LIBS_QT_ENTRY +} + +!win32:!macx { + DEFINES += LINUX + LIBS += -lrt + # _FILE_OFFSET_BITS=64 lets 32-bit fopen transparently support large files. + DEFINES += _FILE_OFFSET_BITS=64 +} + +macx:HEADERS += src/qt/macdockiconhandler.h src/qt/macnotificationhandler.h +macx:OBJECTIVE_SOURCES += src/qt/macdockiconhandler.mm src/qt/macnotificationhandler.mm +macx:LIBS += -framework Foundation -framework ApplicationServices -framework AppKit -framework CoreServices +macx:DEFINES += MAC_OSX MSG_NOSIGNAL=0 +macx:ICON = src/qt/res/icons/newenglandcoin.icns +macx:QMAKE_CFLAGS_THREAD += -pthread +macx:QMAKE_LFLAGS_THREAD += -pthread +macx:QMAKE_CXXFLAGS_THREAD += -pthread +macx:QMAKE_INFO_PLIST = share/qt/Info.plist + +# Set libraries and includes at end, to use platform-defined defaults if not overridden +INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH +LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,) +LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX +# -lgdi32 has to happen after -lcrypto (see #681) +win32:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32 +LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX +win32:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX +macx:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX + +contains(RELEASE, 1) { + !win32:!macx { + # Linux: turn dynamic linking back on for c/c++ runtime libraries + LIBS += -Wl,-Bdynamic + } +} + +system($$QMAKE_LRELEASE -silent $$TRANSLATIONS) diff --git a/doc/Dockerfile-ubuntu b/doc/Dockerfile-ubuntu new file mode 100644 index 0000000..17d58f4 --- /dev/null +++ b/doc/Dockerfile-ubuntu @@ -0,0 +1,33 @@ +FROM ubuntu:16.04 +RUN apt-get update && apt-get clean + +#install libbost, gcc and g++ compilers +RUN apt-get -y install build-essential +RUN apt-get -y install wget unzip +RUN apt-get -y install g++ libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils +RUN apt-get -y install libboost-all-dev +RUN apt-get -y install software-properties-common +RUN add-apt-repository -y ppa:bitcoin/bitcoin +RUN apt-get update +RUN apt-get -y install libdb4.8-dev libdb4.8++-dev +RUN apt-get -y install libzmq3-dev libbz2-dev zlib1g libminiupnpc-dev + +# install and compile NENG Core CLI wallet +WORKDIR /usr/local/ + +RUN apt-get -y install git +RUN git clone https://github.com/ShorelineCrypto/NewEnglandCoin.git + +WORKDIR /usr/local/NewEnglandCoin/src +RUN make -f makefile.unix USE_UPNP=1 +RUN strip newenglandcoind && cp newenglandcoind /usr/local/bin/ + +# install and compile GUI QT wallet +RUN apt-get -y install libqt4-dev libprotobuf-dev protobuf-compiler +WORKDIR /usr/local/NewEnglandCoin +RUN qmake USE_UPNP=1 +RUN make && cp newenglandcoin-qt /usr/local/bin/ + +WORKDIR /usr/local/ +RUN rm -rf NewEnglandCoin + diff --git a/doc/android_fullnode_GNUroot_arm/README.md b/doc/android_fullnode_GNUroot_arm/README.md new file mode 100644 index 0000000..ef092d5 --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/README.md @@ -0,0 +1,165 @@ +# Mobile Full Node on Android 32 bits phone (armel or armhf) with GNUroot App + +This folder describes how to set up full node of NewEnglandcoin (NENG) on 32 bits android phone on arm CPUs. + +This full node on old android phone can be used for android CPU mining or as solo server for +futurebit moonlander2 ASIC USB stick for two nodes rotation setup on base difficulty reset day. + +Please read high level overview first from pdf report: +https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/NENG_2020_Q3_report/NENG_2020_Q3_report.pdf + +## From Desktop Linux in Virtualbox +### Step 1: Intall a Linux desktop server with bridged IPs to allow ssh remote login + +As described in the pdf report, a desktop linux server (or equivalent mac or windows ssh server) is required +for ssh remote login into the phone. The phone terminal is small and difficult to type in linux command. +Virtualbox installation of Ubuntu 20.04 or 18.04 with bridged networking setup will work. In this desktop +linux terminal, run below commands: +``` + sudo apt-get update + sudo apt-get install ssh openssh-server + hostname -I +``` + Remember your above IPs. In home environment, 192.168.* or 10.* are common IPs to be used by router. In our +example below 192.168.1.103 is the router assigned IPs for this linux server. + +## From Android phone +### Step 2: Install and setup GNUroot app from Google Play Store + +First install free "GNUroot" and "GNUroot Wheezy" app from google play store into phone. After both are working in phone, Create New Rootfs on Wheezy, Launch Rootfs on Wheezy . You will enter +a linux terminal inside GNUroot app, which runs either armel or armhf version of Debian 7 (wheezy). Note what version +of arm you are running when you apt-get software below. We will upgrade this version to Debian 8 (jessie) below. + + +### Step 3: Upgrade Debian to Jessie +Download the shell scripts and copy them to the linux server to be easily copied over to phone below. +Run below inside linux terminal of GNUroot app in phone: + +``` + cd /etc/apt + sed -i 's/ftp/archive/g' sources.list + apt-get update + apt-get autoremove + apt-get upgrade + + apt-get install ssh + scp hlu@192.168.1.103:~/sources.list /etc/apt/ + apt-get update + +``` + you may encounter error above, re-type in the commands in phone to make sure the upgrade + to debian jessie is completed. + +### step 4, correct permission for tmp log + assign proper permisison including Sticky bit on tmp +``` + chmod 1777 /tmp + chmod a+trwx /var/tmp + chmod -R a+rx /var + chmod -R a+rwx /var/log + chmod -R 777 /var/run +``` + + +### step 5, setup proper ssh ntworking + + Prepare to use another port 2222 for ssh. The GNUroot does not allow + any port below 1024 for external ssh login + +``` + apt-get install ssh wget curl + + ssh-keygen + cp -r /root/.ssh /home/ + passwd + ssh-copy-id hlu@192.168.1.103 + scp hlu@192.168.1.103:~/sshd_config . + mv sshd_config /etc/ssh/ +``` + +## Step 6: set up ssh tunnel to the desktop linux server + +Type below commands in linux terminal of phone: + +``` + scp hlu@192.168.1.103:~/prepare_ssh.sh . + bash prepare_ssh.sh +``` + +## From Linux Desktop in Virtualbox +### Step 7: remote login from desktop linux through ssh tunnel + + You have changed the root password to a new password above, and fix any error above steps. + Now move to the linux server (IP=192.168.1.103 as example) terminal: +``` + ssh root@localhost -p 2222 +``` + + You should now be able to login into android phone with above command. + + +### Step 8: Install locales + + locales is missing in GNUroot debian which cause unstable OS. Please run below to install locales for regular US +english keyboard: + +``` + apt-get install locales + export LANGUAGE=en_US.UTF-8 + export LANG=en_US.UTF-8 + export LC_ALL=en_US.UTF-8 + locale-gen en_US.UTF-8 + dpkg-reconfigure locales +``` + +### Step 9: install some tools, prepare NENG required library + + screen is useful tools to run in background. busybox top or uptime is better tool for +than the default ones. "busybox top" can see NENG mining command and android processes. + + Check out UserLand guide which provide simple commands for screen. + +``` + apt-get update + apt-get install screen + apt-get install fakeroot + apt-get install busybox + nohup bash prepare_neng.sh +``` + + nohup.out file will record all the errors in the compiling installing process. Run below to find and fix all errors: + "grep -i error nohup.out" "grep -i fail nohup.out". + +## From Desktop Linux in Virtualbox +### Step 10: Compile NENG wallet in QEMU + The armel/armhf NENG binary from our download is unlikely to work well if your phone hardware is different. + Explained in pdf report, you should compile Berkley DB libary above successfully, but likely to fail on NENG core compilation. Extract and copy DB library files into QEMU and compile NENG core wallet following cloud boot from below guide: + + debian armel, upgrade wheezy to jessie in QEMU: + https://people.debian.org/~aurel32/qemu/armel/ + + debian armhf, upgrade wheezy to jessie in QEMU: + https://people.debian.org/~aurel32/qemu/armhf/ + + After successfully compiling the NENG wallet files, copy the files into the android phone for use. + + +## From Android Phone +### Step 11: Install Cheetah_Cpuminer: + +``` + git clone https://github.com/ShorelineCrypto/cheetah_cpuminer.git + sudo pip install python-bitcoinrpc + more /proc/cpuinfo +``` + + "lowmemory_neng.sh" script file is used to reduce memory usage when the phone is on cheetah cpu mining. + This script also print log file into screen so that you can watch what is going on. + NENG full node can run in one screen session, the cheetah runs in another screen session. + +### optional - solo server for futurebit moonlander2 ASIC USB + + It appears that the full node running in old android can sever better as solo server for USB ASIC that needs + two full nodes to rotate around. Example config file and solo server script are provided for this usage. + + diff --git a/doc/android_fullnode_GNUroot_arm/bitcoin.conf b/doc/android_fullnode_GNUroot_arm/bitcoin.conf new file mode 100644 index 0000000..5a3dff9 --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/bitcoin.conf @@ -0,0 +1 @@ +/opt/db-4.8.30.NC/build_unix diff --git a/doc/android_fullnode_GNUroot_arm/lowmemory_neng.sh b/doc/android_fullnode_GNUroot_arm/lowmemory_neng.sh new file mode 100644 index 0000000..7ecea98 --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/lowmemory_neng.sh @@ -0,0 +1,4 @@ +#! /bin/bash + +./newenglandcoind -printtoconsole -par=1 -maxconnections=2 -rpcthreads=1 + diff --git a/doc/android_fullnode_GNUroot_arm/newenglandcoin.conf-soloserver b/doc/android_fullnode_GNUroot_arm/newenglandcoin.conf-soloserver new file mode 100644 index 0000000..cb543ee --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/newenglandcoin.conf-soloserver @@ -0,0 +1,14 @@ +rpcuser=youruser +rpcpassword=yourpassword +rpcallowip=192.168.1.103 +rpcport=8378 +server=1 +daemon=1 +addnode=144.202.22.19 +addnode=76.28.105.88 +addnode=110.232.113.233 +addnode=68.151.225.158 +addnode=85.15.179.171 +addnode=50.245.85.73 +addnode=95.111.248.174 +addnode=73.147.208.44 diff --git a/doc/android_fullnode_GNUroot_arm/prepare_neng.sh b/doc/android_fullnode_GNUroot_arm/prepare_neng.sh new file mode 100755 index 0000000..67db6de --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/prepare_neng.sh @@ -0,0 +1,47 @@ +apt-get update +apt-get --yes --force-yes install build-essential +apt-get --yes --force-yes install g++ libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils +apt-get --yes --force-yes install libboost-all-dev + +apt-get --yes --force-yes install software-properties-common +apt-get --yes --force-yes install python-software-properties +apt-get update + + +apt-get --yes --force-yes install libzmq3-dev libbz2-dev + +## sometimes zlib will generate error, reinstall this +apt-get --yes --force-yes install --reinstall zlib1g + +apt-get --yes --force-yes install openssl +apt-get --yes --force-yes install libminiupnpc-dev + +apt-get --yes --force-yes install python-pip +pip install --upgrade --index-url=https://pypi.python.org/simple/ pip==8.1.2 +apt-get --yes --force-yes remove python-pip +pip install python-bitcoinrpc + +apt-get --yes --force-yes install git +#git clone https://github.com/ShorelineCrypto/NewEnglandCoin.git +#git clone https://github.com/ShorelineCrypto/cheetah_cpuminer.git + + +# Berkeley DB: http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz +# We'll use version 4.8 to preserve binary wallet compatibility. +# From a MinGW shell unpack the source archive, configure and make: +# Code: + +cd /opt +wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz +tar xvfz db-4.8.30.NC.tar.gz +cd db-4.8.30.NC/build_unix +../dist/configure --enable-cxx --disable-shared --disable-replication +make + + +cat >> ~/.bashrc << EOF + +export LDFLAGS="-L/opt/db-4.8.30.NC/build_unix" +export CPPFLAGS="-I/opt/db-4.8.30.NC/build_unix" + +EOF diff --git a/doc/android_fullnode_GNUroot_arm/prepare_ssh.sh b/doc/android_fullnode_GNUroot_arm/prepare_ssh.sh new file mode 100755 index 0000000..5ef2ed0 --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/prepare_ssh.sh @@ -0,0 +1,15 @@ +## set password for root +passwd +## copy sshd_config to /etc/ssh/sshd_config +## change port to 2222 +apt-get install ssh openssh-server +apt-get install autossh + +service ssh restart + +## using ssh tunel to allow remote ssh login +## https://www.perpetual-beta.org/weblog/bulletproof-firewall-busting-ssh-back-to-your-computer.html + +## ssh -f -N -R 2222:localhost:2222 hlu@192.168.1.103 +autossh -f -N -R 2222:localhost:2222 hlu@192.168.1.103 + diff --git a/doc/android_fullnode_GNUroot_arm/solo_server.sh b/doc/android_fullnode_GNUroot_arm/solo_server.sh new file mode 100644 index 0000000..c014f30 --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/solo_server.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./newenglandcoind -printtoconsole -maxconnections=2 diff --git a/doc/android_fullnode_GNUroot_arm/sources.list b/doc/android_fullnode_GNUroot_arm/sources.list new file mode 100644 index 0000000..b9355d4 --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/sources.list @@ -0,0 +1,6 @@ +# deb http://snapshot.debian.org/archive/debian/20200607T000000Z jessie main +deb http://deb.debian.org/debian jessie main +# deb http://snapshot.debian.org/archive/debian-security/20200607T000000Z jessie/updates main +deb http://security.debian.org/debian-security jessie/updates main +# deb http://snapshot.debian.org/archive/debian/20200607T000000Z jessie-updates main +deb http://deb.debian.org/debian jessie-updates main diff --git a/doc/android_fullnode_GNUroot_arm/sshd_config b/doc/android_fullnode_GNUroot_arm/sshd_config new file mode 100644 index 0000000..317a940 --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/sshd_config @@ -0,0 +1,87 @@ +# Package generated configuration file +# See the sshd_config(5) manpage for details + +# What ports, IPs and protocols we listen for +Port 2222 +# Use these options to restrict which interfaces/protocols sshd will bind to +#ListenAddress :: +#ListenAddress 0.0.0.0 +Protocol 2 +# HostKeys for protocol version 2 +HostKey /etc/ssh/ssh_host_rsa_key +HostKey /etc/ssh/ssh_host_dsa_key +HostKey /etc/ssh/ssh_host_ecdsa_key +#Privilege Separation is turned on for security +UsePrivilegeSeparation no + +# Lifetime and size of ephemeral version 1 server key +KeyRegenerationInterval 3600 +ServerKeyBits 768 + +# Logging +SyslogFacility AUTH +LogLevel INFO + +# Authentication: +LoginGraceTime 120 +PermitRootLogin yes +StrictModes yes + +RSAAuthentication yes +PubkeyAuthentication yes +#AuthorizedKeysFile %h/.ssh/authorized_keys + +# Don't read the user's ~/.rhosts and ~/.shosts files +IgnoreRhosts yes +# For this to work you will also need host keys in /etc/ssh_known_hosts +RhostsRSAAuthentication no +# similar for protocol version 2 +HostbasedAuthentication no +# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication +#IgnoreUserKnownHosts yes + +# To enable empty passwords, change to yes (NOT RECOMMENDED) +PermitEmptyPasswords no + +# Change to yes to enable challenge-response passwords (beware issues with +# some PAM modules and threads) +ChallengeResponseAuthentication no + +# Change to no to disable tunnelled clear text passwords +#PasswordAuthentication yes + +# Kerberos options +#KerberosAuthentication no +#KerberosGetAFSToken no +#KerberosOrLocalPasswd yes +#KerberosTicketCleanup yes + +# GSSAPI options +#GSSAPIAuthentication no +#GSSAPICleanupCredentials yes + +X11Forwarding yes +X11DisplayOffset 10 +PrintMotd no +PrintLastLog yes +TCPKeepAlive yes +#UseLogin no + +#MaxStartups 10:30:60 +#Banner /etc/issue.net + +# Allow client to pass locale environment variables +AcceptEnv LANG LC_* + +Subsystem sftp /usr/lib/openssh/sftp-server + +# Set this to 'yes' to enable PAM authentication, account processing, +# and session processing. If this is enabled, PAM authentication will +# be allowed through the ChallengeResponseAuthentication and +# PasswordAuthentication. Depending on your PAM configuration, +# PAM authentication via ChallengeResponseAuthentication may bypass +# the setting of "PermitRootLogin without-password". +# If you just want the PAM account and session checks to run without +# PAM authentication, then enable this but set PasswordAuthentication +# and ChallengeResponseAuthentication to 'no'. +UsePAM yes diff --git a/doc/android_fullnode_GNUroot_arm/start_autossh.sh b/doc/android_fullnode_GNUroot_arm/start_autossh.sh new file mode 100755 index 0000000..483e31d --- /dev/null +++ b/doc/android_fullnode_GNUroot_arm/start_autossh.sh @@ -0,0 +1,8 @@ +## + +## using ssh tunel to allow remote ssh login +## https://www.perpetual-beta.org/weblog/bulletproof-firewall-busting-ssh-back-to-your-computer.html + +## ssh -f -N -R 2222:localhost:2222 hlu@192.168.1.103 +autossh -f -N -R 2222:localhost:2222 hlu@192.168.1.103 + diff --git a/doc/android_mining_Userland_arm64/README.md b/doc/android_mining_Userland_arm64/README.md new file mode 100644 index 0000000..d498697 --- /dev/null +++ b/doc/android_mining_Userland_arm64/README.md @@ -0,0 +1,100 @@ +# Mobile Mining on Android 64 bits phone (arm64) with UserLand App + +This folder describe how to CPU mine NewEnglandcoin (NENG) on 64 bits android phone (arm64). + +Please read high level overview first from pdf report: +https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/NENG_2020_Q3_report/NENG_2020_Q3_report.pdf + + +### Step 1: Install and setup UserLand app from Google Play Store + +First install free "UserLand" app from google play store. After installation, click Distribution +"Ubuntu", pick a username, password, and VNC password (which could be same password). You will enter +a linux terminal inside UserLand app, which runs a arm64 version of Ubuntu 18.04 + +### Step 2: prepare UserLand + +Type below commands in linux terminal inside Userland: + +``` + sudo apt-get update + sudo apt-get install wget + sudo apt-get install ssh + hostname -I +``` + +### Step 3: Remember IP of phone from above step, remote login from desktop computer + +For windows 10 desktop machine, install a free software "PuTTY", login into phone with your +username/password picked at port 2022 + +A screen shot of putty was provided. + +For linux or MacOS, you can remote login with ssh from command line at port 2022. For example +IP = 192.168.1.4 with user "hlu" like below +``` + ssh hlu@192.168.1.4 -p 2022 +``` + +## Now you can run below commands from putty from windows 10 or ssh from MacOS or Linux +### Step 4: Install library files +Please run below shell script in Userland Ubuntu for installing depencies and library files: +``` + wget https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/v1.4.0/newenglandcoin_v1.4.0_android_arm64_userland.tgz + tar xvfz newenglandcoin_v1.4.0_android_arm64_userland.tgz + cd newenglandcoin_v1.4.0_android_arm64_userland + bash prepare_userland.sh + bash prepare_neng.sh + bash prepare_nengX.sh +``` + +### Step 5: download the binary wallet and boost: +``` + wget https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/v1.4.0/ubuntu16.04_boost1.58_arm64.tgz + tar xvfz ubuntu16.04_boost1.58_arm64.tgz + sudo mv boost1.58 /opt/ + sudo mv boost1.58.conf /etc/ld.so.conf.d/ + sudo ldconfig + + wget https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/v1.4.0/newenglandcoin_v1.4.0_u16_arm64.tgz + tar xvfz newenglandcoin_v1.4.0_u16_arm64.tgz +``` + +### Step 6: Install Cheetah_Cpuminer: + +``` + git clone https://github.com/ShorelineCrypto/cheetah_cpuminer.git + sudo pip install python-bitcoinrpc + more /proc/cpuinfo +``` + + Try to find how much cpu threads you have on the phone, for quad core phone, 8 cpu threads were found + +### optional - screen command to run cheeta + screen is useful linux command for background running in linux, you can start screen session job in the phone and log out. +When you re-login into phone, you can re-attach the screen session with a command. Useful keyboards commands to be remembered: +#### start a screen session: type "screen" command in linux terminal +#### detach screen: Ctrl-A-D +#### re-attach screen: type "screen -r" command +#### re-attach specfic screen session when multiple sessions are running (say 3145.pts-1.localhost session): screen -r 31 + + Inside screen, run below in cheetah to mine NENG, detach screen +``` + screen + + python main.py --interval 10 --cpu 6 + + CTRL-A-D + +``` + +### optional - load QT wallet in windows 10 remotely + + free software "VcXsrv" can be installed in windows 10 to allow QT GUI NENG wallet + running in phone and display in windows 10 remotely. Check the screenshot2 of putty for enabling + "Enable X11 forwarding" for the userland login setting. Once the login with X11 enabled, start VcXsrv in windows, + re-login into phone into linux command line, type "./newenglandcoin-qt & " in phone linux terminal will + pop the QT GUI wallet in windows 10 running VcXsrv and control the wallet inside phone from windows. + + + diff --git a/doc/android_mining_Userland_arm64/boost1.58.conf b/doc/android_mining_Userland_arm64/boost1.58.conf new file mode 100644 index 0000000..67f6365 --- /dev/null +++ b/doc/android_mining_Userland_arm64/boost1.58.conf @@ -0,0 +1 @@ +/opt/boost1.58/lib diff --git a/doc/android_mining_Userland_arm64/prepare_neng.sh b/doc/android_mining_Userland_arm64/prepare_neng.sh new file mode 100755 index 0000000..f1192d3 --- /dev/null +++ b/doc/android_mining_Userland_arm64/prepare_neng.sh @@ -0,0 +1,20 @@ +sudo apt-get -y install build-essential g++ libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libboost-all-dev + +sudo apt-get -y install software-properties-common + +sudo add-apt-repository -y ppa:bitcoin/bitcoin + +sudo apt-get -y update + +sudo apt-get -y install libdb4.8-dev libdb4.8++-dev + +sudo apt-get -y install libzmq3-dev libbz2-dev + +## sometimes zlib will generate error, reinstall this +sudo apt-get -y install --reinstall zlib1g + +sudo apt-get -y install libminiupnpc-dev + +sudo apt -y install git +sudo apt -y install python-pip +sudo pip install python-bitcoinrpc diff --git a/doc/android_mining_Userland_arm64/prepare_nengX.sh b/doc/android_mining_Userland_arm64/prepare_nengX.sh new file mode 100755 index 0000000..ab3c2f8 --- /dev/null +++ b/doc/android_mining_Userland_arm64/prepare_nengX.sh @@ -0,0 +1,3 @@ +sudo apt-get update +sudo apt-get -y install libqt4-dev libprotobuf-dev protobuf-compiler + diff --git a/doc/android_mining_Userland_arm64/prepare_userland.sh b/doc/android_mining_Userland_arm64/prepare_userland.sh new file mode 100755 index 0000000..b3deb01 --- /dev/null +++ b/doc/android_mining_Userland_arm64/prepare_userland.sh @@ -0,0 +1,24 @@ +## Productivity tools +sudo apt-get update +sudo apt -y install ssh +sudo apt -y install wget +sudo apt -y install screen +sudo apt -y install vim +sudo apt -y install nano + +## fix proc and permission errors causing top ps to fail, workaround +## toybox-aarch64 workaround provided at: +## https://github.com/CypherpunkArmory/UserLAnd/issues/87 + +wget http://landley.net/toybox/bin/toybox-aarch64 +chmod a+rx toybox-aarch64 +sudo mv toybox-aarch64 /usr/local/bin/ + +cat >> ~/.bashrc << EOF + +alias top="toybox-aarch64 top" +alias ps="toybox-aarch64 ps" +alias uptime="toybox-aarch64 uptime" +alias reset="toybox-aarch64 reset" + +EOF diff --git a/doc/android_mining_Userland_arm64/putty_screenshot1.gif b/doc/android_mining_Userland_arm64/putty_screenshot1.gif new file mode 100755 index 0000000..67e70a7 Binary files /dev/null and b/doc/android_mining_Userland_arm64/putty_screenshot1.gif differ diff --git a/doc/android_mining_Userland_arm64/putty_screenshot2.gif b/doc/android_mining_Userland_arm64/putty_screenshot2.gif new file mode 100755 index 0000000..ea86ff1 Binary files /dev/null and b/doc/android_mining_Userland_arm64/putty_screenshot2.gif differ diff --git a/doc/android_mining_Userland_arm64/ssh_userland.sh b/doc/android_mining_Userland_arm64/ssh_userland.sh new file mode 100755 index 0000000..2504aff --- /dev/null +++ b/doc/android_mining_Userland_arm64/ssh_userland.sh @@ -0,0 +1,2 @@ +ssh hlu@192.168.1.4 -p 2022 + diff --git a/doc/android_mining_Userland_arm64/trunc_log.sh b/doc/android_mining_Userland_arm64/trunc_log.sh new file mode 100755 index 0000000..4f5bacc --- /dev/null +++ b/doc/android_mining_Userland_arm64/trunc_log.sh @@ -0,0 +1,17 @@ +#! /bin/bash + +if (test $# != 1) +then + echo "trunc_log.sh " + exit +fi + + +# truncate useless full node log file hourly + +for dir in newenglandcoin +do + truncate -s 0 ~/.${dir}/debug.log +done + + diff --git a/doc/build-unix.md b/doc/build-unix.md index 90a8ee7..ab28bdd 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -87,13 +87,13 @@ symbols, which reduces the executable size by about 90%. -## NewEnglandcoin Linux BUILD NOTES +## NewEnglandcoin Linux BUILD NOTES on Ubuntu 16.04 Headless newenglandcoin CLI ``` cd src -make -f makefile.unix +make -f makefile.unix USE_UPNP=1 strip newenglandcoind ``` @@ -101,16 +101,17 @@ strip newenglandcoind Qt GUI Wallet ``` cd .. - qmake + qmake USE_UPNP=1 make ``` -# Ubuntu 18.04 +# Ubuntu 18.04 Compile from source -There are two ways to obtain Ubuntu 18.04 compatible binary. The first approach is to follow similar steps above to compile everything -in Ubuntu 18.04. This could be complicated. Without custome method, a simple apt-get and same steps like Ubuntu 16.04 will fail on boost. +There are three ways to obtain Ubuntu 18.04 compatible binary. The first approach is to follow similar steps above to compile everything in Ubuntu 18.04. This could be complicated. Without custome method, a simple apt-get and same steps like Ubuntu 16.04 will fail on boost version incompatible with NENG wallet. -An easier way is simply using Ubuntu 16.04 compiled binary files, then compile a boost library version 1.58.0 in Ubuntu 18.04 +The easiest way is to take Ubuntu 16.04 compiled binary files including the boost libary files version 1.58.0 and use it in Ubuntu 18.04. This should work in AMD64 and ARM64 64 bits machines. However this approach is likely to fail on 32 bits arm android hardware because of hardware incompatibility issue. + +A third way in the middle ground is simply using Ubuntu 16.04 compiled NENG binary files only, then compile a boost library version 1.58.0 in Ubuntu 18.04 tailored to hardware in Ubuntu 18.04. This is likely to be useful in arm 32 bits hardware where hardware compatibility on boost or library is issue across different Ubuntu version even on same hardware platform. Detailed steps: * (1) Download Ubuntu 16.04 binary files from release from https://github.com/ShorelineCrypto/NewEnglandCoin/releases @@ -127,3 +128,8 @@ An easier way is simply using Ubuntu 16.04 compiled binary files, then compile a ``` * (3) Re-run either QT or command line Ubuntu 16.04 files, all should work in Ubuntu 18.04 + +# Ubuntu 20.04 Binary Download + +NENG core wallet can not be easily compiled on Ubuntu 20.04. Please download binary wallet files for x86_64 hardware from v1.4.0 release. +The instructions on Ubuntu 20.04 can also be found at "doc/ubuntu_20.04" subfolder below this directory. diff --git a/doc/ubuntu_20.04/README.md b/doc/ubuntu_20.04/README.md new file mode 100644 index 0000000..dbe808f --- /dev/null +++ b/doc/ubuntu_20.04/README.md @@ -0,0 +1,15 @@ +# Ubuntu 20.04 on x86_64 + +This folder describe a binary support from v1.4.0 NENG core release for Ubuntu 20.04 on AMD64 platform + +## Step 1: Install library files +Please run below shell script in Ubuntu 20.04 for installing depencies and library files: +``` + bash prepare_neng.sh +``` + +## Step 2: download the binary wallet and enjoy: +``` + wget https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/v1.3.0.1/newenglandcoin_v1.3.0.1_ubuntu16.04.tgz + tar xvfz newenglandcoin_v1.3.0.1_ubuntu16.04.tgz +``` diff --git a/doc/ubuntu_20.04/bitcoin.conf b/doc/ubuntu_20.04/bitcoin.conf new file mode 100644 index 0000000..5a3dff9 --- /dev/null +++ b/doc/ubuntu_20.04/bitcoin.conf @@ -0,0 +1 @@ +/opt/db-4.8.30.NC/build_unix diff --git a/doc/ubuntu_20.04/boost1.58.conf b/doc/ubuntu_20.04/boost1.58.conf new file mode 100644 index 0000000..67f6365 --- /dev/null +++ b/doc/ubuntu_20.04/boost1.58.conf @@ -0,0 +1 @@ +/opt/boost1.58/lib diff --git a/doc/ubuntu_20.04/miniupnpc.conf b/doc/ubuntu_20.04/miniupnpc.conf new file mode 100644 index 0000000..b40fc67 --- /dev/null +++ b/doc/ubuntu_20.04/miniupnpc.conf @@ -0,0 +1 @@ +/opt/miniupnpc diff --git a/doc/ubuntu_20.04/openssl.conf b/doc/ubuntu_20.04/openssl.conf new file mode 100644 index 0000000..7260edd --- /dev/null +++ b/doc/ubuntu_20.04/openssl.conf @@ -0,0 +1 @@ +/opt/openssl diff --git a/doc/ubuntu_20.04/prepare_neng.sh b/doc/ubuntu_20.04/prepare_neng.sh new file mode 100755 index 0000000..a6dd695 --- /dev/null +++ b/doc/ubuntu_20.04/prepare_neng.sh @@ -0,0 +1,57 @@ +sudo apt-get update +sudo apt-get -y install build-essential +sudo apt-get -y install g++ libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils +sudo apt-get -y install libboost-all-dev + +sudo apt-get -y install software-properties-common +sudo apt-get update + + +sudo apt-get -y install libzmq3-dev libbz2-dev zlib1g +sudo apt-get -y install libprotobuf-dev protobuf-compiler +sudo apt-get -y install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler +sudo apt-get -y install openssl + +sudo apt-get -y install python-pip +pip install python-bitcoinrpc + +sudo apt-get -y install git +#git clone https://github.com/ShorelineCrypto/NewEnglandCoin.git +git clone https://github.com/ShorelineCrypto/cheetah_cpuminer.git + + +# Berkeley DB: http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz +# This can not be compiled and used for NENG wallet +# we obtained binaries from Ubuntu 18.04 and bundled in one folder + +wget https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/v1.4.0/ubuntu20.04_x86_64_db-4.8.30.NC.tgz +tar xvfz ubuntu20.04_x86_64_db-4.8.30.NC.tgz +sudo mv db-4.8.30.NC /opt/ +sudo mv bitcoin.conf /etc/ld.so.conf.d/ + +wget https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/v1.4.0/ubuntu20.04_x86_64_miniupnpc.tgz +tar xvfz ubuntu20.04_x86_64_miniupnpc.tgz +sudo mv miniupnpc /opt/ +sudo mv miniupnpc.conf /etc/ld.so.conf.d/ + +wget https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/v1.4.0/ubuntu20.04_x86_64_openssl-1.0.0.tgz +tar xvfz ubuntu20.04_x86_64_openssl-1.0.0.tgz +sudo mv openssl /opt/ +sudo mv openssl.conf /etc/ld.so.conf.d/ + +## reuse prior compiled boost libary for Ubuntu 18.04 +wget https://github.com/ShorelineCrypto/NewEnglandCoin/releases/download/v1.2.1.1/ubuntu18.04_boost1.58.tgz +tar xvfz ubuntu18.04_boost1.58.tgz +sudo mv boost1.58 /opt/ +sudo mv boost1.58.conf /etc/ld.so.conf.d/ +## link all libary files +sudo ldconfig + +## Qt4 was removed in Ubuntu 20.04 +## workaround from: https://askubuntu.com/questions/1234786/qt4-libqt4-in-ubuntu-20-04 + +sudo add-apt-repository ppa:rock-core/qt4 +sudo apt-get update +sudo apt-get install libqtcore4 + + diff --git a/src/leveldb/port/atomic_pointer.h b/src/leveldb/port/atomic_pointer.h index 844fba2..3eb8fa8 100644 --- a/src/leveldb/port/atomic_pointer.h +++ b/src/leveldb/port/atomic_pointer.h @@ -36,8 +36,12 @@ #define ARCH_CPU_X86_FAMILY 1 #elif defined(__ARMEL__) #define ARCH_CPU_ARM_FAMILY 1 +#elif defined(__aarch64__) +#define ARCH_CPU_ARM64_FAMILY 1 #elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) #define ARCH_CPU_PPC_FAMILY 1 +#elif defined(__mips__) +#define ARCH_CPU_MIPS_FAMILY 1 #endif namespace leveldb { @@ -93,6 +97,13 @@ inline void MemoryBarrier() { } #define LEVELDB_HAVE_MEMORY_BARRIER +// ARM64 +#elif defined(ARCH_CPU_ARM64_FAMILY) +inline void MemoryBarrier() { + asm volatile("dmb sy" : : : "memory"); +} +#define LEVELDB_HAVE_MEMORY_BARRIER + // PPC #elif defined(ARCH_CPU_PPC_FAMILY) && defined(__GNUC__) inline void MemoryBarrier() { @@ -102,6 +113,13 @@ inline void MemoryBarrier() { } #define LEVELDB_HAVE_MEMORY_BARRIER +// MIPS +#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__) +inline void MemoryBarrier() { + __asm__ __volatile__("sync" : : : "memory"); +} +#define LEVELDB_HAVE_MEMORY_BARRIER + #endif // AtomicPointer built using platform-specific MemoryBarrier() @@ -216,8 +234,9 @@ class AtomicPointer { #undef LEVELDB_HAVE_MEMORY_BARRIER #undef ARCH_CPU_X86_FAMILY #undef ARCH_CPU_ARM_FAMILY +#undef ARCH_CPU_ARM64_FAMILY #undef ARCH_CPU_PPC_FAMILY - +#undef ARCH_CPU_MIPS_FAMILY } // namespace port } // namespace leveldb diff --git a/src/makefile.debian b/src/makefile.debian new file mode 100644 index 0000000..72fc4a2 --- /dev/null +++ b/src/makefile.debian @@ -0,0 +1,221 @@ +# Copyright (c) 2009-2010 Satoshi Nakamoto +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +## below compiling is based on debian wheezy/jessie in amd64 and arm/arm64 platform in the cloud +## qemu environment. +BDB_INCLUDE_PATH=/opt/db-4.8.30.NC/build_unix +BDB_LIB_PATH=/opt/db-4.8.30.NC/build_unix + +# :=0 --> UPnP support turned off by default at runtime +# :=1 --> UPnP support turned on by default at runtime +# :=- --> No UPnP support - miniupnp not required +USE_UPNP:=0 + +# :=1 --> Enable IPv6 support +# :=0 --> Disable IPv6 support +USE_IPV6:=1 + +LINK:=$(CXX) + +DEFS=-DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 + +DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH)) +LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) + +TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) + +LMODE = dynamic +LMODE2 = dynamic +ifdef STATIC + LMODE = static + ifeq (${STATIC}, all) + LMODE2 = static + endif +else + TESTDEFS += -DBOOST_TEST_DYN_LINK +endif + +# for boost 1.37, add -mt to the boost libraries +LIBS += \ + -Wl,-B$(LMODE) \ + -l boost_system$(BOOST_LIB_SUFFIX) \ + -l boost_filesystem$(BOOST_LIB_SUFFIX) \ + -l boost_program_options$(BOOST_LIB_SUFFIX) \ + -l boost_thread$(BOOST_LIB_SUFFIX) \ + -l db_cxx$(BDB_LIB_SUFFIX) \ + -l ssl \ + -l crypto + +TESTLIBS += \ + -Wl,-B$(LMODE) \ + -l boost_unit_test_framework$(BOOST_LIB_SUFFIX) + +ifndef USE_UPNP + override USE_UPNP = - +endif +ifneq (${USE_UPNP}, -) + LIBS += -l miniupnpc + DEFS += -DUSE_UPNP=$(USE_UPNP) +endif + +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6=$(USE_IPV6) +endif + +LIBS+= \ + -Wl,-B$(LMODE2) \ + -l z \ + -l dl \ + -l pthread + + +# Hardening +# Make some classes of vulnerabilities unexploitable in case one is discovered. +# + # This is a workaround for Ubuntu bug #691722, the default -fstack-protector causes + # -fstack-protector-all to be ignored unless -fno-stack-protector is used first. + # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722 + HARDENING=-fno-stack-protector + + # Stack Canaries + # Put numbers at the beginning of each stack frame and check that they are the same. + # If a stack buffer if overflowed, it writes over the canary number and then on return + # when that number is checked, it won't be the same and the program will exit with + # a "Stack smashing detected" error instead of being exploited. + HARDENING+=-fstack-protector-all -Wstack-protector + + # Make some important things such as the global offset table read only as soon as + # the dynamic linker is finished building it. This will prevent overwriting of addresses + # which would later be jumped to. + LDHARDENING+=-Wl,-z,relro -Wl,-z,now + + # Build position independent code to take advantage of Address Space Layout Randomization + # offered by some kernels. + # see doc/build-unix.txt for more information. + ifdef PIE + HARDENING+=-fPIE + LDHARDENING+=-pie + endif + + # -D_FORTIFY_SOURCE=2 does some checking for potentially exploitable code patterns in + # the source such overflowing a statically defined buffer. + HARDENING+=-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +# + + +DEBUGFLAGS=-g + +# CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only +# adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work. +xCXXFLAGS=-O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \ + $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS) + +# LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only +# adds some defaults in front. Unfortunately, LDFLAGS=... $(LDFLAGS) does not work. +xLDFLAGS=$(LDHARDENING) $(LDFLAGS) + +OBJS= \ + leveldb/libleveldb.a \ + obj/alert.o \ + obj/version.o \ + obj/checkpoints.o \ + obj/netbase.o \ + obj/addrman.o \ + obj/crypter.o \ + obj/key.o \ + obj/db.o \ + obj/init.o \ + obj/keystore.o \ + obj/main.o \ + obj/net.o \ + obj/protocol.o \ + obj/bitcoinrpc.o \ + obj/rpcdump.o \ + obj/rpcnet.o \ + obj/rpcmining.o \ + obj/rpcwallet.o \ + obj/rpcblockchain.o \ + obj/rpcrawtransaction.o \ + obj/script.o \ + obj/scrypt.o \ + obj/sync.o \ + obj/util.o \ + obj/wallet.o \ + obj/walletdb.o \ + obj/hash.o \ + obj/bloom.o \ + obj/noui.o \ + obj/leveldb.o \ + obj/txdb.o + + +ifdef USE_SSE2 +DEFS += -DUSE_SSE2 +OBJS_SSE2= obj/scrypt-sse2.o +OBJS += $(OBJS_SSE2) +endif + +all: newenglandcoind + +test check: test_newenglandcoin FORCE + ./test_newenglandcoin + +# +# LevelDB support +# +MAKEOVERRIDES = +LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a +DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) +DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) +leveldb/libleveldb.a: + @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd .. + +# auto-generated dependencies: +-include obj/*.P +-include obj-test/*.P + +obj/build.h: FORCE + /bin/sh ../share/genbuild.sh obj/build.h +version.cpp: obj/build.h +DEFS += -DHAVE_BUILD_INFO + +obj/%-sse2.o: %-sse2.cpp + $(CXX) -c $(xCXXFLAGS) -msse2 -MMD -MF $(@:%.o=%.d) -o $@ $< + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) + +obj/%.o: %.cpp + $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) + +newenglandcoind: $(OBJS:obj/%=obj/%) + $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS) + +TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) + +obj-test/%.o: test/%.cpp + $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) + +test_newenglandcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) + $(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS) + +clean: + -rm -f newenglandcoind test_newenglandcoin + -rm -f obj/*.o + -rm -f obj-test/*.o + -rm -f obj/*.P + -rm -f obj-test/*.P + -rm -f obj/build.h + -cd leveldb && $(MAKE) clean || true + +FORCE: diff --git a/src/makefile.ubuntu20 b/src/makefile.ubuntu20 new file mode 100644 index 0000000..2d98dd7 --- /dev/null +++ b/src/makefile.ubuntu20 @@ -0,0 +1,227 @@ +# Copyright (c) 2009-2010 Satoshi Nakamoto +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +## below compiling is based on debian wheezy/jessie in amd64 and arm/arm64 platform in the cloud +## qemu environment. +BDB_INCLUDE_PATH=/opt/db-4.8.30.NC/build_unix +BDB_LIB_PATH=/opt/db-4.8.30.NC/build_unix +OPENSSL_INCLUDE_PATH=/opt/openssl-1.0.1l/include +OPENSSL_LIB_PATH=/opt/openssl-1.0.1l/lib +BOOST_INCLUDE_PATH=/opt/boost1.58/include +BOOST_LIB_PATH=/opt/boost1.58/lib +MINIUPNPC_INCLUDE_PATH=/opt +MINIUPNPC_LIB_PATH=/opt/miniupnpc + +# :=0 --> UPnP support turned off by default at runtime +# :=1 --> UPnP support turned on by default at runtime +# :=- --> No UPnP support - miniupnp not required +USE_UPNP:=0 + +# :=1 --> Enable IPv6 support +# :=0 --> Disable IPv6 support +USE_IPV6:=1 + +LINK:=$(CXX) + +DEFS=-DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 + +DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(MINIUPNPC_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH)) +LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(MINIUPNPC_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) + +TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) + +LMODE = dynamic +LMODE2 = dynamic +ifdef STATIC + LMODE = static + ifeq (${STATIC}, all) + LMODE2 = static + endif +else + TESTDEFS += -DBOOST_TEST_DYN_LINK +endif + +# for boost 1.37, add -mt to the boost libraries +LIBS += \ + -Wl,-B$(LMODE) \ + -l boost_system$(BOOST_LIB_SUFFIX) \ + -l boost_filesystem$(BOOST_LIB_SUFFIX) \ + -l boost_program_options$(BOOST_LIB_SUFFIX) \ + -l boost_thread$(BOOST_LIB_SUFFIX) \ + -l db_cxx$(BDB_LIB_SUFFIX) \ + -l ssl \ + -l crypto + +TESTLIBS += \ + -Wl,-B$(LMODE) \ + -l boost_unit_test_framework$(BOOST_LIB_SUFFIX) + +ifndef USE_UPNP + override USE_UPNP = - +endif +ifneq (${USE_UPNP}, -) + LIBS += -l miniupnpc + DEFS += -DUSE_UPNP=$(USE_UPNP) +endif + +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6=$(USE_IPV6) +endif + +LIBS+= \ + -Wl,-B$(LMODE2) \ + -l z \ + -l dl \ + -l pthread + + +# Hardening +# Make some classes of vulnerabilities unexploitable in case one is discovered. +# + # This is a workaround for Ubuntu bug #691722, the default -fstack-protector causes + # -fstack-protector-all to be ignored unless -fno-stack-protector is used first. + # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722 + HARDENING=-fno-stack-protector + + # Stack Canaries + # Put numbers at the beginning of each stack frame and check that they are the same. + # If a stack buffer if overflowed, it writes over the canary number and then on return + # when that number is checked, it won't be the same and the program will exit with + # a "Stack smashing detected" error instead of being exploited. + HARDENING+=-fstack-protector-all -Wstack-protector + + # Make some important things such as the global offset table read only as soon as + # the dynamic linker is finished building it. This will prevent overwriting of addresses + # which would later be jumped to. + LDHARDENING+=-Wl,-z,relro -Wl,-z,now + + # Build position independent code to take advantage of Address Space Layout Randomization + # offered by some kernels. + # see doc/build-unix.txt for more information. + ifdef PIE + HARDENING+=-fPIE + LDHARDENING+=-pie + endif + + # -D_FORTIFY_SOURCE=2 does some checking for potentially exploitable code patterns in + # the source such overflowing a statically defined buffer. + HARDENING+=-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +# + + +DEBUGFLAGS=-g + +# CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only +# adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work. +xCXXFLAGS=-O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \ + $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS) + +# LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only +# adds some defaults in front. Unfortunately, LDFLAGS=... $(LDFLAGS) does not work. +xLDFLAGS=$(LDHARDENING) $(LDFLAGS) + +OBJS= \ + leveldb/libleveldb.a \ + obj/alert.o \ + obj/version.o \ + obj/checkpoints.o \ + obj/netbase.o \ + obj/addrman.o \ + obj/crypter.o \ + obj/key.o \ + obj/db.o \ + obj/init.o \ + obj/keystore.o \ + obj/main.o \ + obj/net.o \ + obj/protocol.o \ + obj/bitcoinrpc.o \ + obj/rpcdump.o \ + obj/rpcnet.o \ + obj/rpcmining.o \ + obj/rpcwallet.o \ + obj/rpcblockchain.o \ + obj/rpcrawtransaction.o \ + obj/script.o \ + obj/scrypt.o \ + obj/sync.o \ + obj/util.o \ + obj/wallet.o \ + obj/walletdb.o \ + obj/hash.o \ + obj/bloom.o \ + obj/noui.o \ + obj/leveldb.o \ + obj/txdb.o + + +ifdef USE_SSE2 +DEFS += -DUSE_SSE2 +OBJS_SSE2= obj/scrypt-sse2.o +OBJS += $(OBJS_SSE2) +endif + +all: newenglandcoind + +test check: test_newenglandcoin FORCE + ./test_newenglandcoin + +# +# LevelDB support +# +MAKEOVERRIDES = +LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a +DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) +DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) +leveldb/libleveldb.a: + @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd .. + +# auto-generated dependencies: +-include obj/*.P +-include obj-test/*.P + +obj/build.h: FORCE + /bin/sh ../share/genbuild.sh obj/build.h +version.cpp: obj/build.h +DEFS += -DHAVE_BUILD_INFO + +obj/%-sse2.o: %-sse2.cpp + $(CXX) -c $(xCXXFLAGS) -msse2 -MMD -MF $(@:%.o=%.d) -o $@ $< + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) + +obj/%.o: %.cpp + $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) + +newenglandcoind: $(OBJS:obj/%=obj/%) + $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS) + +TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) + +obj-test/%.o: test/%.cpp + $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) + +test_newenglandcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) + $(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS) + +clean: + -rm -f newenglandcoind test_newenglandcoin + -rm -f obj/*.o + -rm -f obj-test/*.o + -rm -f obj/*.P + -rm -f obj-test/*.P + -rm -f obj/build.h + -cd leveldb && $(MAKE) clean || true + +FORCE: