From 5f8fbe70937d0b4e502b21df853565f0d01940ea Mon Sep 17 00:00:00 2001 From: Martin Honermeyer Date: Thu, 3 Jul 2014 19:23:59 +0200 Subject: [PATCH 01/20] show credentials for http auth in twister-on-docker output --- twister-on-docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twister-on-docker b/twister-on-docker index bbe91c8c..c452a18e 100755 --- a/twister-on-docker +++ b/twister-on-docker @@ -29,7 +29,7 @@ run) fi echo Running $IMAGE_NAME docker run -d -p 28332:28332 -v $HOME/.twister:/root/.twister $IMAGE_NAME "$@" - echo Twister should now be running at http://localhost:28332 + echo "Twister should now be running at http://localhost:28332 (access with \"user\" / \"pwd\")" ;; stop) From 7b5bf210ac3a73a88d4a73b12bcee652dbbfed9a Mon Sep 17 00:00:00 2001 From: Martin Honermeyer Date: Thu, 3 Jul 2014 20:24:55 +0200 Subject: [PATCH 02/20] change pre-built docker image to the one from miguelfreitas --- README.md | 2 +- twister-on-docker | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dfdfab88..3999abfa 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Or, alternatively, you can run Twister on an isolated Linux container, using [do # Prepend "sudo -E" if you are not logged in as root ./twister-on-docker run --remote -The above command downloads and runs a [pre-built image](https://index.docker.io/u/mazzolino/twister/) from the Docker index. You can also build and run your own container: +The above command downloads and runs a [pre-built image](https://registry.hub.docker.com/u/miguelfreitas/twister) from the Docker index. You can also build and run your own container: ./twister-on-docker build ./twister-on-docker run diff --git a/twister-on-docker b/twister-on-docker index c452a18e..d56dd377 100755 --- a/twister-on-docker +++ b/twister-on-docker @@ -7,7 +7,7 @@ ACTION=${1:-run} MODE=${2:---local} IMAGE_NAME=twister -REMOTE_IMAGE_NAME=mazzolino/twister +REMOTE_IMAGE_NAME=miguelfreitas/twister set -e From e4267649f4420060764cf22a6e524341557f12dc Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Thu, 3 Jul 2014 23:49:32 -0300 Subject: [PATCH 03/20] replace showmyip.com (down) with wtfismyip.com --- src/net.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index d7553579..cc701f83 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -375,20 +375,29 @@ bool GetMyExternalIP(CNetAddr& ipRet) } else if (nHost == 2) { - addrConnect = CService("74.208.43.192", 80); // www.showmyip.com + //addrConnect = CService("74.208.43.192", 80); // www.showmyip.com + addrConnect = CService("54.200.182.206", 80); // wtfismyip.com if (nLookup == 1) { - CService addrIP("www.showmyip.com", 80, true); + //CService addrIP("www.showmyip.com", 80, true); + CService addrIP("wtfismyip.com", 80, true); if (addrIP.IsValid()) addrConnect = addrIP; } + /* pszGet = "GET /simple/ HTTP/1.1\r\n" "Host: www.showmyip.com\r\n" "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n" "Connection: close\r\n" "\r\n"; + */ + pszGet = "GET /text HTTP/1.1\r\n" + "Host: wtfismyip.com\r\n" + "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n" + "Connection: close\r\n" + "\r\n"; pszKeyword = NULL; // Returns just IP address } From 2168e3467756e8a6e73c8a59ee78ba44789c1f9d Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Fri, 4 Jul 2014 00:03:06 -0300 Subject: [PATCH 04/20] miniupnp dependency removed, yes! :-) fix #130 libtorrent implements a upnp client: use it to map the other twisterd port. --- Makefile.am | 6 +---- configure.ac | 27 ------------------- doc/build-unix.md | 26 +----------------- .../include/libtorrent/aux_/session_impl.hpp | 1 + libtorrent/src/session_impl.cpp | 11 ++++++++ src/init.cpp | 6 ----- src/main.h | 5 ---- src/makefile.android | 13 --------- src/makefile.freebsd | 12 --------- src/makefile.mingw | 8 ------ src/makefile.osx | 12 --------- src/makefile.unix | 13 --------- src/twister.cpp | 12 +++++---- twister-qt.pro | 17 ------------ 14 files changed, 21 insertions(+), 148 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1feac2b2..21d779a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -162,17 +162,13 @@ BITCOIN_TWISTER_SOURCES = \ src/twister_utils.cpp \ $(SSE2_SOURCES) -if USE_UPNP -UPNP_LIB = -lminiupnpc -endif - twisterd_SOURCES = $(LIBTORRENT_SOURCES) $(BITCOIN_TWISTER_SOURCES) twisterd_LDFLAGS = @OPENSSL_LDFLAGS@ @DB_CXX_LDFLAGS@ twisterd_DEPENDENCIES = $(LEVELDB_LIB) -twisterd_LDADD = $(LEVELDB_LIB) $(UPNP_LIB) \ +twisterd_LDADD = $(LEVELDB_LIB) \ @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_THREAD_LIB@ @BOOST_CHRONO_LIB@ @BOOST_LOCALE_LIB@ \ @BOOST_REGEX_LIB@ @DB_CXX_LIBS@ @OPENSSL_LIBS@ diff --git a/configure.ac b/configure.ac index bc8f41d0..1d4b94f1 100644 --- a/configure.ac +++ b/configure.ac @@ -205,16 +205,6 @@ AC_ARG_ENABLE( [[ARG_ENABLE_SSE2=yes]] ) -AC_ARG_ENABLE( - [upnp], - [AS_HELP_STRING( - [--enable-upnp], - [enable miniupnp support [default=yes]])], - [[ARG_ENABLE_UPNP=$enableval]], - [[ARG_ENABLE_UPNP=yes]] -) - - AC_ARG_ENABLE( [pool-allocators], [AS_HELP_STRING( @@ -474,21 +464,6 @@ AS_CASE(["$ARG_ENABLE_SSE2"], AC_MSG_ERROR([Unknown option "$ARG_ENABLE_SSE2". Use either "yes" or "no".])] ) -AC_MSG_CHECKING([whether miniupnp should be enabled]) -AS_CASE(["$ARG_ENABLE_UPNP"], - ["yes"|"on"], [ - AC_MSG_RESULT([yes]) - AC_DEFINE([USE_UPNP],[1],[Enable miniupnp]) - COMPILETIME_OPTIONS="$COMPILETIME_OPTIONS -DUSE_UPNP=1 " - ], - ["no"|"off"], [ - AC_MSG_RESULT([no]) - ], - [AC_MSG_RESULT([$ARG_ENABLE_UPNP]) - AC_MSG_ERROR([Unknown option "$ARG_ENABLE_UPNP". Use either "yes" or "no".])] -) - - AC_MSG_CHECKING([whether geoip support should be enabled]) AS_CASE(["$ARG_ENABLE_GEOIP"], ["yes"], [ @@ -652,7 +627,6 @@ AM_CONDITIONAL([ENABLE_PYTHON_BINDING], [test "x$ARG_ENABLE_PYTHON_BINDING" = "x AM_CONDITIONAL([WITH_SHIPPED_GEOIP], [test "x$ARG_WITH_LIBGEOIP" = "xno" ]) AM_CONDITIONAL([WITH_OPENSSL], [test "x$ARG_ENABLE_ENCRYPTION" = "xyes" -o "x$ARG_ENABLE_ENCRYPTION" = "xon" ]) AM_CONDITIONAL([USE_SSE2], [test "x$ARG_ENABLE_SSE2" = "xyes" -o "x$ARG_ENABLE_SSE2" = "xon" ]) -AM_CONDITIONAL([USE_UPNP], [test "x$ARG_ENABLE_UPNP" = "xyes" -o "x$ARG_ENABLE_UPNP" = "xon" ]) ############################################################################### # Other useful stuff @@ -751,7 +725,6 @@ Build options: Features: encryption support: ${ARG_ENABLE_ENCRYPTION:-yes} SSE2 Scrypt: ${ARG_ENABLE_SSE2:-yes} - miniupnp support: ${ARG_ENABLE_UPNP:-yes} geoip support: ${ARG_ENABLE_GEOIP:-yes} dht support: ${ARG_ENABLE_DHT:-yes} pool allocators: ${ARG_ENABLE_POOL_ALLOC:-yes} diff --git a/doc/build-unix.md b/doc/build-unix.md index 0b9e4cf1..29db039d 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -18,15 +18,6 @@ Dependencies libssl SSL Support Secure communications libdb4.8 Berkeley DB Blockchain & wallet storage libboost Boost C++ Library - miniupnpc UPnP Support Optional firewall-jumping support - -[miniupnpc](http://miniupnp.free.fr/) may be used for UPnP port mapping. It can be downloaded from [here]( -http://miniupnp.tuxfamily.org/files/). UPnP support is compiled in and -turned off by default. Set USE_UPNP to a different value to control this: - - USE_UPNP= No UPnP support miniupnp not required - USE_UPNP=0 (the default) UPnP support turned off by default at runtime - USE_UPNP=1 UPnP support turned on by default at runtime IPv6 support may be disabled by setting: @@ -36,14 +27,12 @@ Licenses of statically linked libraries: Berkeley DB New BSD license with additional requirement that linked software must be free open source Boost MIT-like license - miniupnpc New (3-clause) BSD license - Versions used in this release: - GCC 4.3.3 - OpenSSL 1.0.1c - Berkeley DB 4.8.30.NC - Boost 1.37 -- miniupnpc 1.6 Dependency Build Instructions: Ubuntu & Debian ---------------------------------------------- @@ -69,10 +58,6 @@ for other Ubuntu & Debian: (If using Boost 1.37, append -mt to the boost libraries in the makefile) -Optional: - - sudo apt-get install libminiupnpc-dev (see USE_UPNP compile flag) - Dependency Build Instructions: Gentoo ------------------------------------- @@ -85,7 +70,7 @@ Note: If you just want to install bitcoind on Gentoo, you can add the Bitcoin ov Take the following steps to build (no UPnP support): cd ${BITCOIN_DIR}/src - make -f makefile.unix USE_UPNP= USE_IPV6=1 BDB_INCLUDE_PATH='/usr/include/db4.8' + make -f makefile.unix USE_IPV6=1 BDB_INCLUDE_PATH='/usr/include/db4.8' strip bitcoind @@ -95,15 +80,6 @@ The release is built with GCC and then "strip bitcoind" to strip the debug symbols, which reduces the executable size by about 90%. -miniupnpc ---------- - tar -xzvf miniupnpc-1.6.tar.gz - cd miniupnpc-1.6 - make - sudo su - make install - - Berkeley DB ----------- You need Berkeley DB 4.8. If you have to build Berkeley DB yourself: diff --git a/libtorrent/include/libtorrent/aux_/session_impl.hpp b/libtorrent/include/libtorrent/aux_/session_impl.hpp index 0d269a41..1724749b 100644 --- a/libtorrent/include/libtorrent/aux_/session_impl.hpp +++ b/libtorrent/include/libtorrent/aux_/session_impl.hpp @@ -957,6 +957,7 @@ namespace libtorrent // 0 is natpmp 1 is upnp int m_tcp_mapping[2]; + int m_twister_tcp_mapping[2]; int m_udp_mapping[2]; #ifdef TORRENT_USE_OPENSSL int m_ssl_mapping[2]; diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index 9ca2cfd7..7a7cc281 100644 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -85,6 +85,8 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/random.hpp" #include "libtorrent/magnet_uri.hpp" +#include "twister.h" // for LIBTORRENT_PORT_OFFSET + #if defined TORRENT_STATS && defined __MACH__ #include #endif @@ -766,6 +768,8 @@ namespace aux { m_tcp_mapping[0] = -1; m_tcp_mapping[1] = -1; + m_twister_tcp_mapping[0] = -1; + m_twister_tcp_mapping[1] = -1; m_udp_mapping[0] = -1; m_udp_mapping[1] = -1; #ifdef TORRENT_USE_OPENSSL @@ -2463,6 +2467,9 @@ retry: { if (m_tcp_mapping[0] != -1) m_natpmp->delete_mapping(m_tcp_mapping[0]); m_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, tcp_port, tcp_port); + if (m_twister_tcp_mapping[0] != -1) m_natpmp->delete_mapping(m_twister_tcp_mapping[0]); + m_twister_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, + tcp_port-LIBTORRENT_PORT_OFFSET, tcp_port-LIBTORRENT_PORT_OFFSET); #ifdef TORRENT_USE_OPENSSL if (m_ssl_mapping[0] != -1) m_natpmp->delete_mapping(m_ssl_mapping[0]); m_ssl_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, ssl_port, ssl_port); @@ -2472,6 +2479,9 @@ retry: { if (m_tcp_mapping[1] != -1) m_upnp->delete_mapping(m_tcp_mapping[1]); m_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp, tcp_port, tcp_port); + if (m_twister_tcp_mapping[1] != -1) m_upnp->delete_mapping(m_twister_tcp_mapping[1]); + m_twister_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp, + tcp_port-LIBTORRENT_PORT_OFFSET, tcp_port-LIBTORRENT_PORT_OFFSET); #ifdef TORRENT_USE_OPENSSL if (m_ssl_mapping[1] != -1) m_upnp->delete_mapping(m_ssl_mapping[1]); m_ssl_mapping[1] = m_upnp->add_mapping(upnp::tcp, ssl_port, ssl_port); @@ -6249,6 +6259,7 @@ retry: m_upnp->close(); m_udp_mapping[1] = -1; m_tcp_mapping[1] = -1; + m_twister_tcp_mapping[1] = -1; #ifdef TORRENT_USE_OPENSSL m_ssl_mapping[1] = -1; #endif diff --git a/src/init.cpp b/src/init.cpp index 41bb2950..88dce88b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -211,13 +211,7 @@ std::string HelpMessage() strUsage += " -bantime= " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n"; strUsage += " -maxreceivebuffer= " + _("Maximum per-connection receive buffer, *1000 bytes (default: 5000)") + "\n"; strUsage += " -maxsendbuffer= " + _("Maximum per-connection send buffer, *1000 bytes (default: 1000)") + "\n"; -#ifdef USE_UPNP -#if USE_UPNP strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n"; -#else - strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n"; -#endif -#endif strUsage += " -paytxfee= " + _("Fee per KB to add to transactions you send") + "\n"; if (fHaveGUI) strUsage += " -server " + _("Accept command line and JSON-RPC commands") + "\n"; diff --git a/src/main.h b/src/main.h index 6a0d56e1..153c97a1 100644 --- a/src/main.h +++ b/src/main.h @@ -54,11 +54,6 @@ static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 static const int MAX_SCRIPTCHECK_THREADS = 16; /** Default amount of block size reserved for high-priority transactions (in bytes) */ static const int DEFAULT_BLOCK_PRIORITY_SIZE = 27000; -#ifdef USE_UPNP -static const int fHaveUPnP = true; -#else -static const int fHaveUPnP = false; -#endif /** The maximum size for spam messages */ static const int MAX_SPAM_MSG_SIZE = 140; /** The maximum size for username */ diff --git a/src/makefile.android b/src/makefile.android index a2eb23a2..978f9711 100644 --- a/src/makefile.android +++ b/src/makefile.android @@ -2,11 +2,6 @@ # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -# :=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:=- - # :=1 --> Enable IPv6 support # :=0 --> Disable IPv6 support USE_IPV6:=0 @@ -36,14 +31,6 @@ 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 diff --git a/src/makefile.freebsd b/src/makefile.freebsd index 9a48e80c..5022d0c1 100644 --- a/src/makefile.freebsd +++ b/src/makefile.freebsd @@ -2,11 +2,6 @@ # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -# :=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:=1 - # :=1 --> Enable IPv6 support # :=0 --> Disable IPv6 support USE_IPV6:=1 @@ -48,13 +43,6 @@ 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) diff --git a/src/makefile.mingw b/src/makefile.mingw index 431bf0d7..008966dc 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -17,7 +17,6 @@ CXX ?= g++ -USE_UPNP:=- USE_IPV6:=1 DEPSDIR?=/usr/local @@ -52,13 +51,6 @@ LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) -ifndef USE_UPNP - override USE_UPNP = - -endif -ifneq (${USE_UPNP}, -) - LIBS += -l miniupnpc -l iphlpapi - DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) -endif ifneq (${USE_IPV6}, -) DEFS += -DUSE_IPV6=$(USE_IPV6) diff --git a/src/makefile.osx b/src/makefile.osx index adf842d2..7d18597c 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -2,11 +2,6 @@ # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -# :=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:=1 - # :=1 --> Enable IPv6 support # :=0 --> Disable IPv6 support USE_IPV6:=1 @@ -48,13 +43,6 @@ TESTLIBS += \ -l boost_unit_test_framework$(BOOST_LIB_SUFFIX) # -Wl,-B$(LMODE) // does not work on OSX -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) diff --git a/src/makefile.unix b/src/makefile.unix index 1fae0e65..a07be7b2 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -2,11 +2,6 @@ # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -# :=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:=1 - # :=1 --> Enable IPv6 support # :=0 --> Disable IPv6 support USE_IPV6:=1 @@ -48,14 +43,6 @@ 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 diff --git a/src/twister.cpp b/src/twister.cpp index 2aaff17a..07cc28b9 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -254,8 +254,8 @@ void ThreadWaitExtIP() std::string ipStr; - // wait up to 5 seconds for bitcoin to get the external IP - for( int i = 0; i < 10; i++ ) { + // wait up to 10 seconds for bitcoin to get the external IP + for( int i = 0; i < 20; i++ ) { const CNetAddr paddrPeer("8.8.8.8"); CAddress addr( GetLocalAddress(&paddrPeer) ); if( addr.IsValid() ) { @@ -309,8 +309,10 @@ void ThreadWaitExtIP() } if( !m_usingProxy ) { - ses->start_upnp(); - ses->start_natpmp(); + if( GetBoolArg("-upnp", true) ) { + ses->start_upnp(); + ses->start_natpmp(); + } ses->listen_on(std::make_pair(listen_port, listen_port) , ec, bind_to_interface.c_str()); @@ -334,7 +336,7 @@ void ThreadWaitExtIP() } } - session_settings settings; + session_settings settings("twisterd/"+FormatFullVersion()); // settings to test local connections settings.allow_multiple_connections_per_ip = true; //settings.enable_outgoing_utp = false; // (false to see connections in netstat) diff --git a/twister-qt.pro b/twister-qt.pro index 6f496341..3cbc0603 100644 --- a/twister-qt.pro +++ b/twister-qt.pro @@ -58,23 +58,6 @@ contains(USE_QRCODE, 1) { 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) From 6cae25e7abf7acd5bfde120aa3285dd5a681ed9e Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Fri, 4 Jul 2014 08:44:26 -0300 Subject: [PATCH 05/20] fix dht count when using proxy (fix #231) --- src/dhtproxy.cpp | 4 +++- src/dhtproxy.h | 2 ++ src/twister.cpp | 23 +++++++++++++++++------ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/dhtproxy.cpp b/src/dhtproxy.cpp index 6e45729c..f3dc863f 100644 --- a/src/dhtproxy.cpp +++ b/src/dhtproxy.cpp @@ -74,7 +74,7 @@ namespace DhtProxy } } - vector getRandomDhtProxies() + vector getRandomDhtProxies(int *totalProxyNodes) { // (cs_vNodes) lock must be held! vector vNodesProxy; @@ -83,6 +83,8 @@ namespace DhtProxy vNodesProxy.push_back(pnode); } } + if( totalProxyNodes ) + *totalProxyNodes = (int) vNodesProxy.size(); std::random_shuffle(vNodesProxy.begin(),vNodesProxy.end()); if(vNodesProxy.size() > numProxiesToUse) { vNodesProxy.resize(numProxiesToUse); diff --git a/src/dhtproxy.h b/src/dhtproxy.h index 55d2e36e..0ec5f148 100644 --- a/src/dhtproxy.h +++ b/src/dhtproxy.h @@ -86,6 +86,8 @@ namespace DhtProxy // Handle a dhtput request received from TCP. send request to UDP. (server side) // return true if accepted. bool dhtputRequestReceived(const CDHTPutRequest& req, CNode* pfrom); + + vector getRandomDhtProxies(int *totalProxyNodes = NULL); } class CDHTTarget diff --git a/src/twister.cpp b/src/twister.cpp index 07cc28b9..24a19f21 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -459,13 +459,24 @@ void lockAndSaveUserData() int getDhtNodes(boost::int64_t *dht_global_nodes) { - boost::shared_ptr ses(m_ses); - if( !ses ) - return 0; - session_status ss = ses->status(); + int dhtNodes = 0; + if( dht_global_nodes ) - *dht_global_nodes = ss.dht_global_nodes; - return ss.dht_nodes; + *dht_global_nodes = 0; + + if( !DhtProxy::fEnabled ) { + boost::shared_ptr ses(m_ses); + if( ses ) { + session_status ss = ses->status(); + if( dht_global_nodes ) + *dht_global_nodes = ss.dht_global_nodes; + dhtNodes = ss.dht_nodes; + } + } else { + LOCK(cs_vNodes); + DhtProxy::getRandomDhtProxies(&dhtNodes); + } + return dhtNodes; } void torrentManualTrackerUpdate(const std::string &username) From 2d96c08f498ef82a60d3efe447ebf4df639c0063 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Fri, 4 Jul 2014 12:58:10 -0300 Subject: [PATCH 06/20] no boost-locale in android? at least not here. --- src/makefile.android | 1 - 1 file changed, 1 deletion(-) diff --git a/src/makefile.android b/src/makefile.android index 978f9711..df8408d9 100644 --- a/src/makefile.android +++ b/src/makefile.android @@ -163,7 +163,6 @@ LIBS += \ -l boost_filesystem$(BOOST_LIB_SUFFIX) \ -l boost_program_options$(BOOST_LIB_SUFFIX) \ -l boost_thread$(BOOST_LIB_SUFFIX) \ - -l boost_locale$(BOOST_LIB_SUFFIX) \ -l db_cxx$(BDB_LIB_SUFFIX) \ -L$(NDK_BASE)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/ -lgnustl_static #-l ssl_static -l crypto_static From b6ca41f8332b35afa18e3913b9ea7ff94955b522 Mon Sep 17 00:00:00 2001 From: Martin Honermeyer Date: Sun, 6 Jul 2014 14:09:18 +0200 Subject: [PATCH 07/20] clean up Docker documentation, add sudo to the the commandlines --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3999abfa..52d100d7 100644 --- a/README.md +++ b/README.md @@ -28,17 +28,17 @@ Please follow the instructions for your platform: - [Mac OS X](https://github.com/miguelfreitas/twister-core/blob/master/doc/build-osx.md) - [Windows (untested)](https://github.com/miguelfreitas/twister-core/wiki/Compiling-for-Windows) -Or, alternatively, you can run Twister on an isolated Linux container, using [docker](http://docker.io/). Quickstart: +> According to our tests, at least 1GB of RAM is needed to compile Twister. - # Prepend "sudo -E" if you are not logged in as root - ./twister-on-docker run --remote +Alternatively, you can run Twister on an isolated Linux container, using [Docker](http://docker.io/). First, [install Docker on your system](https://docs.docker.com/installation/#installation). Then run: + + # Leave out the "sudo -E" if you added yourself to the "docker" group + sudo -E ./twister-on-docker run --remote The above command downloads and runs a [pre-built image](https://registry.hub.docker.com/u/miguelfreitas/twister) from the Docker index. You can also build and run your own container: - ./twister-on-docker build - ./twister-on-docker run - -> According to our tests, at least 1GB of RAM is needed to compile Twister. + sudo -E ./twister-on-docker build + sudo -E ./twister-on-docker run ## License From 99cb2fa99bba81d8cac3f40776aa4290dc9a13f2 Mon Sep 17 00:00:00 2001 From: Martin Honermeyer Date: Sun, 6 Jul 2014 14:28:18 +0200 Subject: [PATCH 08/20] Fix twister-on-docker script for bash compatibility --- twister-on-docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twister-on-docker b/twister-on-docker index d56dd377..c5b35e0f 100755 --- a/twister-on-docker +++ b/twister-on-docker @@ -21,7 +21,7 @@ build) ;; run) - if [ $MODE == "--remote" ]; then + if [ "$MODE" = "--remote" ]; then shift IMAGE_NAME=$REMOTE_IMAGE_NAME echo Pulling new version of $IMAGE_NAME From d49d5fc4e367a99a9cf1cb94136eb32b0ff11044 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 7 Jul 2014 09:22:23 -0300 Subject: [PATCH 09/20] additional mingw libs --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1d4b94f1..9ac392b3 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,7 @@ AC_CHECK_FUNCS([gethostbyname], [], [AC_CHECK_LIB([socket], [gethostbyname], [], [AC_CHECK_LIB([ws2_32], [main], [AC_CHECK_LIB([wsock32], [main], - [LIBS="-lws2_32 -lwsock32 $LIBS"], + [LIBS="-lws2_32 -lwsock32 -lgdi32 -lcrypt32 $LIBS"], [AC_MSG_ERROR([wsock32 function not found.])])], [AC_MSG_ERROR([gethostbyname function not found.])])])])])] ) From 92ea5ff97af903c0ce849327050adced44798077 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 7 Jul 2014 21:29:00 -0300 Subject: [PATCH 10/20] merge upstream patch r8983 (merged mingw build fixes from RC_0_16) --- libtorrent/src/allocator.cpp | 17 +++++++++++++---- libtorrent/src/file.cpp | 22 +++++++++++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/libtorrent/src/allocator.cpp b/libtorrent/src/allocator.cpp index 2161dc38..e98710f9 100644 --- a/libtorrent/src/allocator.cpp +++ b/libtorrent/src/allocator.cpp @@ -34,18 +34,27 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/assert.hpp" -#ifdef TORRENT_WINDOWS -#include -#elif defined TORRENT_BEOS +#if defined TORRENT_BEOS #include #include // malloc/free -#else +#elif !defined TORRENT_WINDOWS #include // valloc/free #include // _SC_PAGESIZE #endif #if TORRENT_USE_MEMALIGN || TORRENT_USE_POSIX_MEMALIGN #include // memalign +#include // _aligned_malloc on mingw +#endif + +#ifdef TORRENT_WINDOWS +// windows.h must be included after stdlib.h under mingw +#include +#endif + +#ifdef TORRENT_MINGW +#define _aligned_malloc __mingw_aligned_malloc +#define _aligned_free __mingw_aligned_free #endif #ifdef TORRENT_DEBUG_BUFFERS diff --git a/libtorrent/src/file.cpp b/libtorrent/src/file.cpp index 63545bd4..acd7704f 100644 --- a/libtorrent/src/file.cpp +++ b/libtorrent/src/file.cpp @@ -1986,22 +1986,30 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { if ((m_open_mode & sparse) == 0) { - typedef DWORD (WINAPI *GetCompressedFileSizeW_t)(LPCWSTR lpFileName, LPDWORD lpFileSizeHigh); +#if TORRENT_USE_WSTRING + typedef DWORD (WINAPI *GetCompressedFileSize_t)(LPCWSTR lpFileName, LPDWORD lpFileSizeHigh); +#else + typedef DWORD (WINAPI *GetCompressedFileSize_t)(LPCSTR lpFileName, LPDWORD lpFileSizeHigh); +#endif typedef BOOL (WINAPI *SetFileValidData_t)(HANDLE hFile, LONGLONG ValidDataLength); - static GetCompressedFileSizeW_t GetCompressedFileSizeW = NULL; + static GetCompressedFileSize_t GetCompressedFileSize_ = NULL; static SetFileValidData_t SetFileValidData = NULL; static bool failed_kernel32 = false; - if ((GetCompressedFileSizeW == NULL) && !failed_kernel32) + if ((GetCompressedFileSize_ == NULL) && !failed_kernel32) { HMODULE kernel32 = LoadLibraryA("kernel32.dll"); if (kernel32) { - GetCompressedFileSizeW = (GetCompressedFileSizeW_t)GetProcAddress(kernel32, "GetCompressedFileSizeW"); +#if TORRENT_USE_WSTRING + GetCompressedFileSize_ = (GetCompressedFileSize_t)GetProcAddress(kernel32, "GetCompressedFileSizeW"); +#else + GetCompressedFileSize_ = (GetCompressedFileSize_t)GetProcAddress(kernel32, "GetCompressedFileSizeA"); +#endif SetFileValidData = (SetFileValidData_t)GetProcAddress(kernel32, "SetFileValidData"); - if ((GetCompressedFileSizeW == NULL) || (SetFileValidData == NULL)) + if ((GetCompressedFileSize_ == NULL) || (SetFileValidData == NULL)) { failed_kernel32 = true; } @@ -2012,12 +2020,12 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { } } - if (!failed_kernel32 && GetCompressedFileSizeW && SetFileValidData) + if (!failed_kernel32 && GetCompressedFileSize_ && SetFileValidData) { // only allocate the space if the file // is not fully allocated DWORD high_dword = 0; - offs.LowPart = GetCompressedFileSize(m_path.c_str(), &high_dword); + offs.LowPart = GetCompressedFileSize_(m_path.c_str(), &high_dword); offs.HighPart = high_dword; ec.assign(GetLastError(), get_system_category()); if (ec) return false; From ec2694bf0dad892796869b1d07e9d964295854e1 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 7 Jul 2014 21:43:02 -0300 Subject: [PATCH 11/20] win32 doesn't like pid_t --- src/util.cpp | 2 ++ src/util.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/util.cpp b/src/util.cpp index b6a0339b..e4eb4f29 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1147,6 +1147,7 @@ boost::filesystem::path GetPidFile() return pathPidFile; } +#ifndef WIN32 void CreatePidFile(const boost::filesystem::path &path, pid_t pid) { FILE* file = fopen(path.string().c_str(), "w"); @@ -1156,6 +1157,7 @@ void CreatePidFile(const boost::filesystem::path &path, pid_t pid) fclose(file); } } +#endif bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest) { diff --git a/src/util.h b/src/util.h index 81c7116a..3025f977 100644 --- a/src/util.h +++ b/src/util.h @@ -209,7 +209,9 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific = true); boost::filesystem::path GetHTMLDir(); boost::filesystem::path GetConfigFile(); boost::filesystem::path GetPidFile(); +#ifndef WIN32 void CreatePidFile(const boost::filesystem::path &path, pid_t pid); +#endif void ReadConfigFile(std::map& mapSettingsRet, std::map >& mapMultiSettingsRet); #ifdef WIN32 boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true); From 0c03bb2ff21b7a59ea67a1468aa4bd68fd10bfaf Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 7 Jul 2014 22:45:29 -0300 Subject: [PATCH 12/20] win32 has no pthread_self --- src/util.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util.cpp b/src/util.cpp index e4eb4f29..28169b5f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -98,7 +98,11 @@ void locking_callback(int mode, int i, const char* file, int line) static unsigned long id_callback(void) { +#if defined(WIN32) + return ((unsigned long)GetCurrentThreadId()); +#else return ((unsigned long)pthread_self()); +#endif } LockedPageManager LockedPageManager::instance; From a358a677abfb5c80369e36c45e2d0066834f2f3b Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 8 Jul 2014 08:14:22 -0300 Subject: [PATCH 13/20] host checks from bitcoin upstream needed to cross-compile leveldb. (OSX users must check if i didn't break anything) --- Makefile.am | 22 ++++++++++++--- configure.ac | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 21d779a4..e3815e53 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,8 +3,16 @@ ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ COPYING -SUBDIRS = src/leveldb -LEVELDB_LIB = src/leveldb/libleveldb.a src/leveldb/libmemenv.a +LIBLEVELDB = src/leveldb/libleveldb.a +LIBMEMENV = src/leveldb/libmemenv.a + +# NOTE: This dependency is not strictly necessary, but without it make may try to build both in parallel, which breaks the LevelDB build system in a race +$(LIBLEVELDB): $(LIBMEMENV) + +$(LIBLEVELDB) $(LIBMEMENV): + @echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \ + CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \ + OPT="$(CXXFLAGS) $(CPPFLAGS)" bin_PROGRAMS = twisterd @@ -166,9 +174,9 @@ twisterd_SOURCES = $(LIBTORRENT_SOURCES) $(BITCOIN_TWISTER_SOURCES) twisterd_LDFLAGS = @OPENSSL_LDFLAGS@ @DB_CXX_LDFLAGS@ -twisterd_DEPENDENCIES = $(LEVELDB_LIB) +twisterd_DEPENDENCIES = $(LIBLEVELDB) $(LIBMEMENV) -twisterd_LDADD = $(LEVELDB_LIB) \ +twisterd_LDADD = $(LIBLEVELDB) $(LIBMEMENV) \ @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_THREAD_LIB@ @BOOST_CHRONO_LIB@ @BOOST_LOCALE_LIB@ \ @BOOST_REGEX_LIB@ @DB_CXX_LIBS@ @OPENSSL_LIBS@ @@ -179,3 +187,9 @@ AM_CPPFLAGS = -ftemplate-depth-100 -DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS @DEBUGFLAGS@ @OPENSSL_INCLUDES@ @DB_CXX_CPPFLAGS@ AM_LDFLAGS = @OPENSSL_LDFLAGS@ + +CLEANFILES = $(LIBLEVELDB) $(LIBMEMENV) + +clean-local: + -$(MAKE) -C src/leveldb clean + rm -f src/leveldb/*/*.gcno src/leveldb/helpers/memenv/*.gcno diff --git a/configure.ac b/configure.ac index 9ac392b3..d6634f9a 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,82 @@ AS_ECHO "Initializing Libtool:" LT_PREREQ([2.2.6]) LT_INIT +# host checks from bitcoin's configure.ac +case $host in + *mingw*) + TARGET_OS=windows + AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(lib missing)) + + CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB" + LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE" + if test "x$CXXFLAGS_overridden" = "xno"; then + CXXFLAGS="$CXXFLAGS -w" + fi + case $host in + i?86-*) WINDOWS_BITS=32 ;; + x86_64-*) WINDOWS_BITS=64 ;; + *) AC_MSG_ERROR("Could not determine win32/win64 for installer") ;; + esac + AC_SUBST(WINDOWS_BITS) + ;; + *darwin*) + TARGET_OS=darwin + LEVELDB_TARGET_FLAGS="TARGET_OS=Darwin" + if test x$cross_compiling != xyes; then + BUILD_OS=darwin + AC_CHECK_PROG([PORT],port, port) + if test x$PORT = xport; then + dnl add default macports paths + CPPFLAGS="$CPPFLAGS -isystem /opt/local/include -I/opt/local/include/db48" + LIBS="$LIBS -L/opt/local/lib -L/opt/local/lib/db48" + fi + + AC_CHECK_PROG([BREW],brew, brew) + if test x$BREW = xbrew; then + dnl add default homebrew paths + openssl_prefix=`$BREW --prefix openssl` + bdb_prefix=`$BREW --prefix berkeley-db4` + export PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include" + LIBS="$LIBS -L$bdb_prefix/lib" + fi + else + case $build_os in + *darwin*) + BUILD_OS=darwin + ;; + *) + AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool) + AC_PATH_TOOL([OTOOL], [otool], otool) + AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage) + ;; + esac + fi + + CPPFLAGS="$CPPFLAGS -DMAC_OSX" + ;; + *) + ;; +esac + ############################################################################### # Checking for needed base libraries @@ -659,6 +735,7 @@ AS_IF([test "x$enable_shared" = "xyes"], AC_SUBST(DEBUGFLAGS) AC_SUBST(PYTHON_INSTALL_PARAMS) AC_SUBST(COMPILETIME_OPTIONS) +AC_SUBST(LEVELDB_TARGET_FLAGS) # Try to guess real svn revision if any, fallback to hardcoded otherwise From f457d9d863bb8a56385ced4e43507f92f133c9c8 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 8 Jul 2014 22:02:35 -0300 Subject: [PATCH 14/20] mingw fix --- src/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compat.h b/src/compat.h index fa6d3f29..127b1370 100644 --- a/src/compat.h +++ b/src/compat.h @@ -28,12 +28,12 @@ #endif #endif -typedef u_int SOCKET; #ifdef WIN32 #define MSG_NOSIGNAL 0 #define MSG_DONTWAIT 0 typedef int socklen_t; #else +typedef u_int SOCKET; #include "errno.h" #define WSAGetLastError() errno #define WSAEINVAL EINVAL From ac9e5f5d30e6376d4118014d8af186fb21958fba Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 8 Jul 2014 23:19:09 -0300 Subject: [PATCH 15/20] native windows executables using gitian. win32 and win64. --- contrib/gitian-descriptors/README | 86 --------------- contrib/gitian-descriptors/README.md | 67 ++++++++++++ contrib/gitian-descriptors/boost-linux.yml | 55 ++++++++++ contrib/gitian-descriptors/boost-win.yml | 86 +++++++++++++++ contrib/gitian-descriptors/boost-win32.yml | 38 ------- contrib/gitian-descriptors/deps-linux.yml | 62 +++++++++++ contrib/gitian-descriptors/deps-win.yml | 81 ++++++++++++++ contrib/gitian-descriptors/deps-win32.yml | 72 ------------- contrib/gitian-descriptors/gitian-win.yml | 77 ++++++++++++++ contrib/gitian-descriptors/gitian-win32.yml | 74 ------------- contrib/gitian-descriptors/gitian.yml | 55 ---------- contrib/gitian-descriptors/qt-win32.yml | 54 ---------- doc/release-process.md | 110 ++++++++++++++++++++ 13 files changed, 538 insertions(+), 379 deletions(-) delete mode 100644 contrib/gitian-descriptors/README create mode 100644 contrib/gitian-descriptors/README.md create mode 100644 contrib/gitian-descriptors/boost-linux.yml create mode 100644 contrib/gitian-descriptors/boost-win.yml delete mode 100644 contrib/gitian-descriptors/boost-win32.yml create mode 100644 contrib/gitian-descriptors/deps-linux.yml create mode 100644 contrib/gitian-descriptors/deps-win.yml delete mode 100644 contrib/gitian-descriptors/deps-win32.yml create mode 100644 contrib/gitian-descriptors/gitian-win.yml delete mode 100644 contrib/gitian-descriptors/gitian-win32.yml delete mode 100644 contrib/gitian-descriptors/gitian.yml delete mode 100644 contrib/gitian-descriptors/qt-win32.yml create mode 100644 doc/release-process.md diff --git a/contrib/gitian-descriptors/README b/contrib/gitian-descriptors/README deleted file mode 100644 index 46c7668a..00000000 --- a/contrib/gitian-descriptors/README +++ /dev/null @@ -1,86 +0,0 @@ -Gavin's notes on getting gitian builds up and running using KVM: - -These instructions distilled from: - https://help.ubuntu.com/community/KVM/Installation -... see there for complete details. - -You need the right hardware: you need a 64-bit-capable CPU with hardware virtualization support (Intel VT-x or AMD-V). Not all modern CPUs support hardware virtualization. - -You probably need to enable hardware virtualization in your machine's BIOS. - -You need to be running a recent version of 64-bit-Ubuntu, and you need to install several prerequisites: - sudo apt-get install ruby apache2 git apt-cacher-ng python-vm-builder qemu-kvm - -Sanity checks: - sudo service apt-cacher-ng status # Should return apt-cacher-ng is running - ls -l /dev/kvm # Should show a /dev/kvm device - - -Once you've got the right hardware and software: - - git clone git://github.com/bitcoin/bitcoin.git - git clone git://github.com/devrandom/gitian-builder.git - mkdir gitian-builder/inputs - cd gitian-builder/inputs - # Inputs for Linux and Win32: - wget -O miniupnpc-1.6.tar.gz 'http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.6.tar.gz' - wget 'http://fukuchi.org/works/qrencode/qrencode-3.2.0.tar.bz2' - # Inputs for Win32: (Linux has packages for these) - wget 'https://downloads.sourceforge.net/project/boost/boost/1.50.0/boost_1_50_0.tar.bz2' - wget 'http://www.openssl.org/source/openssl-1.0.1c.tar.gz' - wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz' - wget 'https://downloads.sourceforge.net/project/libpng/zlib/1.2.6/zlib-1.2.6.tar.gz' - wget 'https://downloads.sourceforge.net/project/libpng/libpng15/older-releases/1.5.9/libpng-1.5.9.tar.gz' - wget 'http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.3.tar.gz' - cd ../.. - - cd gitian-builder - bin/make-base-vm --arch i386 - bin/make-base-vm --arch amd64 - cd .. - - # Build Linux release: - cd bitcoin - git pull - cd ../gitian-builder - git pull - ./bin/gbuild --commit bitcoin=HEAD ../bitcoin/contrib/gitian-descriptors/gitian.yml - - # Build Win32 dependencies: (only needs to be done once, or when dependency versions change) - ./bin/gbuild --commit bitcoin=HEAD ../bitcoin/contrib/gitian-descriptors/boost-win32.yml - ./bin/gbuild --commit bitcoin=HEAD ../bitcoin/contrib/gitian-descriptors/deps-win32.yml - ./bin/gbuild --commit bitcoin=HEAD ../bitcoin/contrib/gitian-descriptors/qt-win32.yml - - # Build Win32 release: - ./bin/gbuild --commit bitcoin=HEAD ../bitcoin/contrib/gitian-descriptors/gitian-win32.yml - ---------------------- - -gitian-builder now also supports building using LXC. See - https://help.ubuntu.com/12.04/serverguide/lxc.html -... for how to get LXC up and running under Ubuntu. - -If your main machine is a 64-bit Mac or PC with a few gigabytes of memory -and at least 10 gigabytes of free disk space, you can gitian-build using -LXC running inside a virtual machine. - -Here's a description of Gavin's setup on OSX 10.6: - -1. Download and install VirtualBox from https://www.virtualbox.org/ - -2. Download the 64-bit Ubuntu Desktop 12.04 LTS .iso CD image from - http://www.ubuntu.com/ - -3. Run VirtualBox and create a new virtual machine, using the - Ubuntu .iso (see the VirtualBox documentation for details). - Create it with at least 2 gigabytes of memory and a disk - that is at least 20 gigabytes big. - -4. Inside the running Ubuntu desktop, install: - sudo apt-get install debootstrap lxc ruby apache2 git apt-cacher-ng python-vm-builder - -5. Still inside Ubuntu, tell gitian-builder to use LXC, then follow the "Once you've got the right - hardware and software" instructions above: - export USE_LXC=1 - git clone git://github.com/bitcoin/bitcoin.git - ... etc diff --git a/contrib/gitian-descriptors/README.md b/contrib/gitian-descriptors/README.md new file mode 100644 index 00000000..7a67263e --- /dev/null +++ b/contrib/gitian-descriptors/README.md @@ -0,0 +1,67 @@ +### Gavin's notes on getting gitian builds up and running using KVM:### + +These instructions distilled from: +[ https://help.ubuntu.com/community/KVM/Installation]( https://help.ubuntu.com/community/KVM/Installation) +... see there for complete details. + +You need the right hardware: you need a 64-bit-capable CPU with hardware virtualization support (Intel VT-x or AMD-V). Not all modern CPUs support hardware virtualization. + +You probably need to enable hardware virtualization in your machine's BIOS. + +You need to be running a recent version of 64-bit-Ubuntu, and you need to install several prerequisites: + + sudo apt-get install ruby apache2 git apt-cacher-ng python-vm-builder qemu-kvm + +Sanity checks: + + sudo service apt-cacher-ng status # Should return apt-cacher-ng is running + ls -l /dev/kvm # Should show a /dev/kvm device + + +Once you've got the right hardware and software: + + git clone git://github.com/bitcoin/bitcoin.git + git clone git://github.com/devrandom/gitian-builder.git + mkdir gitian-builder/inputs + cd gitian-builder/inputs + + # Create base images + cd gitian-builder + bin/make-base-vm --suite precise --arch i386 + bin/make-base-vm --suite precise --arch amd64 + cd .. + + # Get inputs (see doc/release-process.md for exact inputs needed and where to get them) + ... + + # For further build instructions see doc/release-notes.md + ... + +--------------------- + +`gitian-builder` now also supports building using LXC. See +[ https://help.ubuntu.com/12.04/serverguide/lxc.html]( https://help.ubuntu.com/12.04/serverguide/lxc.html) +... for how to get LXC up and running under Ubuntu. + +If your main machine is a 64-bit Mac or PC with a few gigabytes of memory +and at least 10 gigabytes of free disk space, you can `gitian-build` using +LXC running inside a virtual machine. + +Here's a description of Gavin's setup on OSX 10.6: + +1. Download and install VirtualBox from [https://www.virtualbox.org/](https://www.virtualbox.org/) + +2. Download the 64-bit Ubuntu Desktop 12.04 LTS .iso CD image from + [http://www.ubuntu.com/](http://www.ubuntu.com/) + +3. Run VirtualBox and create a new virtual machine, using the Ubuntu .iso (see the [VirtualBox documentation](https://www.virtualbox.org/wiki/Documentation) for details). Create it with at least 2 gigabytes of memory and a disk that is at least 20 gigabytes big. + +4. Inside the running Ubuntu desktop, install: + + sudo apt-get install debootstrap lxc ruby apache2 git apt-cacher-ng python-vm-builder + +5. Still inside Ubuntu, tell gitian-builder to use LXC, then follow the "Once you've got the right hardware and software" instructions above: + + export USE_LXC=1 + git clone git://github.com/bitcoin/bitcoin.git + ... etc diff --git a/contrib/gitian-descriptors/boost-linux.yml b/contrib/gitian-descriptors/boost-linux.yml new file mode 100644 index 00000000..bd353463 --- /dev/null +++ b/contrib/gitian-descriptors/boost-linux.yml @@ -0,0 +1,55 @@ +--- +name: "boost" +suites: +- "precise" +architectures: +- "i386" +- "amd64" +packages: +- "g++" +- "unzip" +- "pkg-config" +- "libtool" +- "faketime" +- "bsdmainutils" +- "zip" +- "libz-dev" +reference_datetime: "2011-01-30 00:00:00" +remotes: [] +files: +- "boost_1_55_0.tar.bz2" +script: | + STAGING="$HOME/install" + TEMPDIR="$HOME/tmp" + export LIBRARY_PATH="$STAGING/lib" + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + # Input Integrity Check + echo "fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52 boost_1_55_0.tar.bz2" | shasum -c + + mkdir -p "$STAGING" + tar --warning=no-timestamp -xjf boost_1_55_0.tar.bz2 + cd boost_1_55_0 + GCCVERSION=$(g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2) + # note: bjam with -d+2 reveals that -O3 is implied by default, no need to provide it in cxxflags + echo "using gcc : $GCCVERSION : g++ + : + \"-frandom-seed=boost1 -fPIC\" + ;" > user-config.jam + + ./bootstrap.sh --without-icu + + ./bjam toolset=gcc threadapi=pthread threading=multi variant=release link=static runtime-link=shared --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 --layout=tagged --build-type=complete --prefix="$STAGING" $MAKEOPTS -d+2 install + + # post-process all generated libraries to be deterministic + # extract them to a temporary directory then re-build them deterministically + for LIB in $(find $STAGING -name \*.a); do + rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR + ar xv $LIB | cut -b5- > /tmp/list.txt + rm $LIB + ar crsD $LIB $(cat /tmp/list.txt) + done + # + cd "$STAGING" + find | sort | zip -X@ $OUTDIR/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip diff --git a/contrib/gitian-descriptors/boost-win.yml b/contrib/gitian-descriptors/boost-win.yml new file mode 100644 index 00000000..db5d6bab --- /dev/null +++ b/contrib/gitian-descriptors/boost-win.yml @@ -0,0 +1,86 @@ +--- +name: "boost" +suites: +- "precise" +architectures: +- "amd64" +packages: +- "mingw-w64" +- "g++-mingw-w64" +- "faketime" +- "zip" +reference_datetime: "2011-01-30 00:00:00" +remotes: [] +files: +- "boost_1_55_0.tar.bz2" +- "boost-mingw-gas-cross-compile-2013-03-03.patch" +script: | + # Defines + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + INDIR=$HOME/build + TEMPDIR=$HOME/tmp + # Input Integrity Check + echo "fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52 boost_1_55_0.tar.bz2" | shasum -c + echo "d2b7f6a1d7051faef3c9cf41a92fa3671d905ef1e1da920d07651a43299f6268 boost-mingw-gas-cross-compile-2013-03-03.patch" | shasum -c + + for BITS in 32 64; do # for architectures + # + INSTALLPREFIX=$HOME/staging${BITS} + BUILDDIR=$HOME/build${BITS} + if [ "$BITS" == "32" ]; then + HOST=i686-w64-mingw32 + else + HOST=x86_64-w64-mingw32 + fi + # + mkdir -p $INSTALLPREFIX $BUILDDIR + cd $BUILDDIR + # + tar --warning=no-timestamp -xjf $INDIR/boost_1_55_0.tar.bz2 + cd boost_1_55_0 + GCCVERSION=$($HOST-g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2) + echo "using gcc : $GCCVERSION : $HOST-g++ + : + $HOST-windres + $HOST-ar + -frandom-seed=boost1 + $HOST-ranlib + ;" > user-config.jam + ./bootstrap.sh --without-icu + + # Workaround: Upstream boost dev refuses to include patch that would allow Free Software cross-compile toolchain to work + # This patch was authored by the Fedora package developer and ships in Fedora's mingw32-boost. + # Please obtain the exact patch that matches the above sha256sum from one of the following mirrors. + # + # Read History: https://svn.boost.org/trac/boost/ticket/7262 + # History Mirror: http://rose.makesad.us/~paulproteus/mirrors/7262%20Boost.Context%20fails%20to%20build%20using%20MinGW.html + # + # Patch: https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch + # Patch Mirror: http://wtogami.fedorapeople.org/boost-mingw-gas-cross-compile-2013-03-03.patch + # Patch Mirror: http://mindstalk.net/host/boost-mingw-gas-cross-compile-2013-03-03.patch + # Patch Mirror: http://rose.makesad.us/~paulproteus/mirrors/boost-mingw-gas-cross-compile-2013-03-03.patch + patch -p0 < $INDIR/boost-mingw-gas-cross-compile-2013-03-03.patch + + # Bug Workaround: boost-1.54.0 broke the ability to disable zlib, still broken in 1.55 + # https://svn.boost.org/trac/boost/ticket/9156 + sed -i 's^\[ ac.check-library /zlib//zlib : /zlib//zlib^^' libs/iostreams/build/Jamfile.v2 + sed -i 's^zlib.cpp gzip.cpp \]^^' libs/iostreams/build/Jamfile.v2 + + # http://statmt.org/~s0565741/software/boost_1_52_0/libs/context/doc/html/context/requirements.html + # "For cross-compiling the lib you must specify certain additional properties at bjam command line: target-os, abi, binary-format, architecture and address-model." + ./bjam toolset=gcc binary-format=pe target-os=windows threadapi=win32 address-model=$BITS threading=multi variant=release link=static runtime-link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install + # post-process all generated libraries to be deterministic + # extract them to a temporary directory then re-build them deterministically + for LIB in $(find $INSTALLPREFIX -name \*.a); do + rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR + $HOST-ar xv $LIB | cut -b5- > /tmp/list.txt + rm $LIB + $HOST-ar crsD $LIB $(cat /tmp/list.txt) + done + # + cd "$INSTALLPREFIX" + find | sort | zip -X@ $OUTDIR/boost-win$BITS-1.55.0-gitian-r6.zip + done # for BITS in + diff --git a/contrib/gitian-descriptors/boost-win32.yml b/contrib/gitian-descriptors/boost-win32.yml deleted file mode 100644 index 1eeb9eaa..00000000 --- a/contrib/gitian-descriptors/boost-win32.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: "boost" -suites: -- "lucid" -architectures: -- "i386" -packages: -- "mingw32" -- "faketime" -- "zip" -reference_datetime: "2011-01-30 00:00:00" -remotes: [] -files: -- "boost_1_50_0.tar.bz2" -script: | - TMPDIR="$HOME/tmpdir" - mkdir -p $TMPDIR/bin/$GBUILD_BITS $TMPDIR/include - tar xjf boost_1_50_0.tar.bz2 - cd boost_1_50_0 - echo "using gcc : 4.4 : i586-mingw32msvc-g++ - : - i586-mingw32msvc-windres - i586-mingw32msvc-ar - -frandom-seed=boost1 - ;" > user-config.jam - ./bootstrap.sh --without-icu - ./bjam toolset=gcc target-os=windows threadapi=win32 threading=multi variant=release link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete $MAKEOPTS stage - for lib in chrono date_time exception filesystem graph iostreams math_c99f math_c99l math_c99 math_tr1f math_tr1l math_tr1 prg_exec_monitor program_options random regex serialization signals system test_exec_monitor thread_win32 unit_test_framework wave wserialization; do - mkdir $lib - (cd $lib ; ar xf ../stage/lib/libboost_${lib}-mt-s.a) - mv $lib $TMPDIR/bin/$GBUILD_BITS - done - cp -a boost $TMPDIR/include - cd $TMPDIR - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME - zip -r boost-win32-1.50.0-gitian2.zip * - cp boost-win32-1.50.0-gitian2.zip $OUTDIR diff --git a/contrib/gitian-descriptors/deps-linux.yml b/contrib/gitian-descriptors/deps-linux.yml new file mode 100644 index 00000000..337416ec --- /dev/null +++ b/contrib/gitian-descriptors/deps-linux.yml @@ -0,0 +1,62 @@ +--- +name: "twister" +suites: +- "precise" +architectures: +- "i386" +- "amd64" +packages: +- "g++" +- "unzip" +- "zip" +- "pkg-config" +- "libtool" +- "faketime" +- "bsdmainutils" +reference_datetime: "2013-06-01 00:00:00" +remotes: [] +files: +- "openssl-1.0.1h.tar.gz" +- "db-4.8.30.NC.tar.gz" +script: | + STAGING="$HOME/install" + TEMPDIR="$HOME/tmp" + OPTFLAGS='-O2' + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + export LIBRARY_PATH="$STAGING/lib" + # Integrity Check + echo "9d1c8a9836aa63e2c6adb684186cbd4371c9e9dcc01d6e3bb447abf2d4d3d093 openssl-1.0.1h.tar.gz" | sha256sum -c + echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c + + # + tar xzf openssl-1.0.1h.tar.gz + cd openssl-1.0.1h + # need -fPIC to avoid relocation error in 64 bit builds + ./config no-shared no-zlib no-dso no-krb5 --openssldir=$STAGING -fPIC + # need to build OpenSSL with faketime because a timestamp is embedded into cversion.o + make + make install_sw + cd .. + # + tar xzf db-4.8.30.NC.tar.gz + cd db-4.8.30.NC/build_unix + # need --with-pic to avoid relocation error in 64 bit builds + ../dist/configure --prefix=$STAGING --enable-cxx --disable-shared --with-pic + # Workaround to prevent re-configuring by make; make all files have a date in the past + find . -print0 | xargs -r0 touch -t 200001010000 + make $MAKEOPTS library_build + make install_lib install_include + cd ../.. + # post-process all generated libraries to be deterministic + # extract them to a temporary directory then re-build them deterministically + for LIB in $(find $STAGING -name \*.a); do + rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR + ar xv $LIB | cut -b5- > /tmp/list.txt + rm $LIB + ar crsD $LIB $(cat /tmp/list.txt) + done + # + cd $STAGING + find include lib bin host | sort | zip -X@ $OUTDIR/twister-deps-linux${GBUILD_BITS}-gitian-r6.zip diff --git a/contrib/gitian-descriptors/deps-win.yml b/contrib/gitian-descriptors/deps-win.yml new file mode 100644 index 00000000..04b479db --- /dev/null +++ b/contrib/gitian-descriptors/deps-win.yml @@ -0,0 +1,81 @@ +--- +name: "twister-deps" +suites: +- "precise" +architectures: +- "amd64" +packages: +- "mingw-w64" +- "g++-mingw-w64" +- "git-core" +- "zip" +- "faketime" +- "psmisc" +reference_datetime: "2011-01-30 00:00:00" +remotes: [] +files: +- "openssl-1.0.1h.tar.gz" +- "db-4.8.30.NC.tar.gz" +- "zlib-1.2.8.tar.gz" +script: | + # + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + INDIR=$HOME/build + TEMPDIR=$HOME/tmp + # Input Integrity Check + echo "9d1c8a9836aa63e2c6adb684186cbd4371c9e9dcc01d6e3bb447abf2d4d3d093 openssl-1.0.1h.tar.gz" | sha256sum -c + echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c + echo "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d zlib-1.2.8.tar.gz" | sha256sum -c + + for BITS in 32 64; do # for architectures + # + INSTALLPREFIX=$HOME/staging${BITS} + BUILDDIR=$HOME/build${BITS} + if [ "$BITS" == "32" ]; then + HOST=i686-w64-mingw32 + else + HOST=x86_64-w64-mingw32 + fi + # + mkdir -p $INSTALLPREFIX $BUILDDIR + cd $BUILDDIR + # + tar xzf $INDIR/openssl-1.0.1h.tar.gz + cd openssl-1.0.1h + if [ "$BITS" == "32" ]; then + OPENSSL_TGT=mingw + else + OPENSSL_TGT=mingw64 + fi + ./Configure --cross-compile-prefix=$HOST- ${OPENSSL_TGT} no-shared no-dso --openssldir=$INSTALLPREFIX + make + make install_sw + cd .. + # + tar xzf $INDIR/db-4.8.30.NC.tar.gz + cd db-4.8.30.NC/build_unix + ../dist/configure --prefix=$INSTALLPREFIX --enable-mingw --enable-cxx --host=$HOST --disable-shared + make $MAKEOPTS library_build + make install_lib install_include + cd ../.. + # + tar xzf $INDIR/zlib-1.2.8.tar.gz + cd zlib-1.2.8 + CROSS_PREFIX=$HOST- ./configure --prefix=$INSTALLPREFIX --static + make + make install + cd .. + # post-process all generated libraries to be deterministic + # extract them to a temporary directory then re-build them deterministically + for LIB in $(find $INSTALLPREFIX -name \*.a); do + rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR + $HOST-ar xv $LIB | cut -b5- > /tmp/list.txt + rm $LIB + $HOST-ar crsD $LIB $(cat /tmp/list.txt) + done + # + cd $INSTALLPREFIX + find include lib | sort | zip -X@ $OUTDIR/twister-deps-win$BITS-gitian-r13.zip + done # for BITS in diff --git a/contrib/gitian-descriptors/deps-win32.yml b/contrib/gitian-descriptors/deps-win32.yml deleted file mode 100644 index 90f4c6c4..00000000 --- a/contrib/gitian-descriptors/deps-win32.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -name: "bitcoin-deps" -suites: -- "lucid" -architectures: -- "i386" -packages: -- "mingw32" -- "git-core" -- "zip" -- "faketime" -- "wine" -- "psmisc" -reference_datetime: "2011-01-30 00:00:00" -remotes: [] -files: -- "openssl-1.0.1c.tar.gz" -- "db-4.8.30.NC.tar.gz" -- "miniupnpc-1.6.tar.gz" -- "zlib-1.2.6.tar.gz" -- "libpng-1.5.9.tar.gz" -- "qrencode-3.2.0.tar.bz2" -script: | - # - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME - export TZ=UTC - # - tar xzf openssl-1.0.1c.tar.gz - cd openssl-1.0.1c - ./Configure --cross-compile-prefix=i586-mingw32msvc- mingw - make - cd .. - # - tar xzf db-4.8.30.NC.tar.gz - cd db-4.8.30.NC/build_unix - ../dist/configure --enable-mingw --enable-cxx --host=i586-mingw32msvc CFLAGS="-I/usr/i586-mingw32msvc/include" - make $MAKEOPTS - cd ../.. - # - tar xzf miniupnpc-1.6.tar.gz - cd miniupnpc-1.6 - sed 's/dllwrap -k --driver-name gcc/$(DLLWRAP) -k --driver-name $(CC)/' -i Makefile.mingw - sed 's|wingenminiupnpcstrings $< $@|./wingenminiupnpcstrings $< $@|' -i Makefile.mingw - make -f Makefile.mingw DLLWRAP=i586-mingw32msvc-dllwrap CC=i586-mingw32msvc-gcc AR=i586-mingw32msvc-ar - cd .. - mv miniupnpc-1.6 miniupnpc - # - tar xzf zlib-1.2.6.tar.gz - cd zlib-1.2.6 - make -f win32/Makefile.gcc PREFIX=i586-mingw32msvc- $MAKEOPTS - cd .. - # - tar xzf libpng-1.5.9.tar.gz - cd libpng-1.5.9 - ./configure -disable-shared CC=i586-mingw32msvc-cc AR=i586-mingw32msvc-ar STRIP=i586-mingw32msvc-strip RANLIB=i586-mingw32msvc-ranlib OBJDUMP=i586-mingw32msvc-objdump LD=i586-mingw32msvc-ld LDFLAGS="-L../zlib-1.2.6/" CFLAGS="-I../zlib-1.2.6/" - make $MAKEOPTS - cd .. - # - tar xjf qrencode-3.2.0.tar.bz2 - cd qrencode-3.2.0 - ./configure CC=i586-mingw32msvc-cc AR=i586-mingw32msvc-ar STRIP=i586-mingw32msvc-strip RANLIB=i586-mingw32msvc-ranlib OBJDUMP=i586-mingw32msvc-objdump LD=i586-mingw32msvc-ld png_LIBS="../libpng-1.5.9/.libs/libpng15.a ../zlib-1.2.6/libz.a" png_CFLAGS="-I../libpng-1.5.9" - make $MAKEOPTS - cd .. - # - zip -r $OUTDIR/bitcoin-deps-0.0.5.zip \ - $(ls qrencode-*/{qrencode.h,.libs/libqrencode.{,l}a} | sort) \ - $(ls db-*/build_unix/{libdb_cxx.a,db.h,db_cxx.h,libdb.a,.libs/libdb_cxx-?.?.a} | sort) \ - $(find openssl-* -name '*.a' -o -name '*.h' | sort) \ - $(find miniupnpc -name '*.h' -o -name 'libminiupnpc.a' | sort) - # Kill wine processes as gitian won't figure out we are done otherwise - killall wineserver services.exe explorer.exe winedevice.exe diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml new file mode 100644 index 00000000..cbc5f96a --- /dev/null +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -0,0 +1,77 @@ +--- +name: "twister" +suites: +- "precise" +architectures: +- "amd64" +packages: +- "mingw-w64" +- "g++-mingw-w64" +- "git-core" +- "unzip" +- "zip" +- "nsis" +- "faketime" +- "autoconf2.13" +- "libtool" +- "automake" +- "pkg-config" +- "bsdmainutils" + +reference_datetime: "2013-06-01 00:00:00" +remotes: +- "url": "https://github.com/miguelfreitas/twister-core.git" + "dir": "twister-core" +files: +- "boost-win32-1.55.0-gitian-r6.zip" +- "boost-win64-1.55.0-gitian-r6.zip" +- "twister-deps-win32-gitian-r13.zip" +- "twister-deps-win64-gitian-r13.zip" +script: | + # Defines + export TZ=UTC + INDIR=$HOME/build + OPTFLAGS='-O2' + TEMPDIR="$HOME/tempdir" + for BITS in 32 64; do # for architectures + # + STAGING=$HOME/staging${BITS} + BUILDDIR=$HOME/build${BITS} + BINDIR=$OUTDIR/$BITS + if [ "$BITS" == "32" ]; then + HOST=i686-w64-mingw32 + else + HOST=x86_64-w64-mingw32 + fi + export PATH=$STAGING/host/bin:$PATH + mkdir -p $STAGING $BUILDDIR $BINDIR + # + cd $STAGING + unzip $INDIR/boost-win${BITS}-1.55.0-gitian-r6.zip + unzip $INDIR/twister-deps-win${BITS}-gitian-r13.zip + # Build platform-dependent executables from source archive + cd $BUILDDIR + rm -rf distsrc + cp -a $HOME/build/twister-core distsrc + mkdir -p distsrc + cd distsrc + ./bootstrap.sh --bindir=$BINDIR --prefix=$STAGING --host=$HOST --with-boost=$STAGING --with-openssl=$STAGING CPPFLAGS=-I$STAGING/include LDFLAGS=-L$STAGING/lib --without-boost-locale + #export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + #export FAKETIME=$REFERENCE_DATETIME + make $MAKEOPTS + strip .libs/twisterd.exe + cp -f .libs/twisterd.exe $BINDIR/ + unset LD_PRELOAD + unset FAKETIME + done # for BITS in + + # sort distribution tar file and normalize user/group/mtime information for deterministic output + mkdir -p $OUTDIR/src + rm -rf $TEMPDIR + mkdir -p $TEMPDIR + cd $TEMPDIR + #tar -xvf $HOME/build/twister/$DISTNAME | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/src/$DISTNAME + cd $OUTDIR + find $OUTDIR | sort | zip -X@ /home/ubuntu/out/twister-win-gitian.zip + + diff --git a/contrib/gitian-descriptors/gitian-win32.yml b/contrib/gitian-descriptors/gitian-win32.yml deleted file mode 100644 index fd3b5532..00000000 --- a/contrib/gitian-descriptors/gitian-win32.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -name: "bitcoin" -suites: -- "lucid" -architectures: -- "i386" -packages: -- "mingw32" -- "git-core" -- "unzip" -- "nsis" -- "faketime" -reference_datetime: "2011-01-30 00:00:00" -remotes: -- "url": "https://github.com/bitcoin/bitcoin.git" - "dir": "bitcoin" -files: -- "qt-win32-4.8.3-gitian-r1.zip" -- "boost-win32-1.50.0-gitian2.zip" -- "bitcoin-deps-0.0.5.zip" -script: | - # - mkdir $HOME/qt - cd $HOME/qt - unzip ../build/qt-win32-4.8.3-gitian-r1.zip - cd $HOME/build/ - export PATH=$HOME/qt/bin/:$PATH - # - mkdir boost_1_50_0 - cd boost_1_50_0 - mkdir -p stage/lib - unzip ../boost-win32-1.50.0-gitian2.zip - cd bin/$GBUILD_BITS - for lib in *; do - i586-mingw32msvc-ar rc ../../stage/lib/libboost_${lib}-mt-s.a $lib/*.o - i586-mingw32msvc-ranlib ../../stage/lib/libboost_${lib}-mt-s.a - done - cd ../.. - mv include/boost . - cd .. - # - unzip bitcoin-deps-0.0.5.zip - # - find -type f | xargs touch --date="$REFERENCE_DATETIME" - # - cd bitcoin - mkdir -p $OUTDIR/src - git archive HEAD | tar -x -C $OUTDIR/src - cp $OUTDIR/src/doc/README_windows.txt $OUTDIR/readme.txt - cp $OUTDIR/src/COPYING $OUTDIR/COPYING.txt - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME - export TZ=UTC - $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_50_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_50_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.1c OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.1c/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin USE_BUILD_INFO=1 - make $MAKEOPTS - cp release/bitcoin-qt.exe $OUTDIR/ - # - cd src - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME - export TZ=UTC - make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_UPNP=0 DEBUGFLAGS="-frandom-seed=bitcoin" - i586-mingw32msvc-strip bitcoind.exe - mkdir $OUTDIR/daemon - cp bitcoind.exe $OUTDIR/daemon - cd .. - mkdir nsis - git archive HEAD | tar -x -C nsis - cd nsis/src - mkdir ../release - cp ../../release/* ../release/ - cp ../../src/*.exe . - makensis ../share/setup.nsi - cp ../share/bitcoin-*-win32-setup.exe $OUTDIR/ diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml deleted file mode 100644 index 195d0e36..00000000 --- a/contrib/gitian-descriptors/gitian.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- -name: "bitcoin" -suites: -- "lucid" -architectures: -- "i386" -- "amd64" -packages: -- "libdb4.8++-dev" -- "qt4-qmake" -- "libqt4-dev" -- "libboost-system-dev" -- "libboost-filesystem-dev" -- "libboost-program-options-dev" -- "libboost-thread-dev" -- "libssl-dev" -- "git-core" -- "unzip" -- "pkg-config" -- "libpng12-dev" -reference_datetime: "2011-01-30 00:00:00" -remotes: -- "url": "https://github.com/bitcoin/bitcoin.git" - "dir": "bitcoin" -files: -- "miniupnpc-1.6.tar.gz" -- "qrencode-3.2.0.tar.bz2" -script: | - INSTDIR="$HOME/install" - export LIBRARY_PATH="$INSTDIR/lib" - # - tar xzf miniupnpc-1.6.tar.gz - cd miniupnpc-1.6 - INSTALLPREFIX=$INSTDIR make $MAKEOPTS install - cd .. - # - tar xjf qrencode-3.2.0.tar.bz2 - cd qrencode-3.2.0 - ./configure --prefix=$INSTDIR --enable-static --disable-shared - make $MAKEOPTS install - cd .. - # - cd bitcoin - mkdir -p $OUTDIR/src - git archive HEAD | tar -x -C $OUTDIR/src - cp $OUTDIR/src/doc/README.md $OUTDIR - cp $OUTDIR/src/COPYING $OUTDIR - cd src - make -f makefile.unix STATIC=1 OPENSSL_INCLUDE_PATH="$INSTDIR/include" OPENSSL_LIB_PATH="$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0 DEBUGFLAGS= - mkdir -p $OUTDIR/bin/$GBUILD_BITS - install -s bitcoind $OUTDIR/bin/$GBUILD_BITS - cd .. - qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 USE_QRCODE=1 - make $MAKEOPTS - install bitcoin-qt $OUTDIR/bin/$GBUILD_BITS diff --git a/contrib/gitian-descriptors/qt-win32.yml b/contrib/gitian-descriptors/qt-win32.yml deleted file mode 100644 index 0b711790..00000000 --- a/contrib/gitian-descriptors/qt-win32.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -name: "qt" -suites: -- "lucid" -architectures: -- "i386" -packages: -- "mingw32" -- "zip" -- "faketime" -reference_datetime: "2011-01-30 00:00:00" -remotes: [] -files: -- "qt-everywhere-opensource-src-4.8.3.tar.gz" -script: | - INSTDIR="$HOME/qt/" - mkdir $INSTDIR - SRCDIR="$INSTDIR/src/" - mkdir $SRCDIR - # - tar xzf qt-everywhere-opensource-src-4.8.3.tar.gz - cd qt-everywhere-opensource-src-4.8.3 - sed 's/$TODAY/2011-01-30/' -i configure - sed 's/i686-pc-mingw32-/i586-mingw32msvc-/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed --posix 's|QMAKE_CFLAGS\t\t= -pipe|QMAKE_CFLAGS\t\t= -pipe -isystem /usr/i586-mingw32msvc/include/ -frandom-seed=qtbuild|' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed 's/QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads/QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed 's/QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads/QMAKE_LFLAGS_EXCEPTIONS_ON = -lmingwthrd/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed --posix 's/QMAKE_MOC\t\t= i586-mingw32msvc-moc/QMAKE_MOC\t\t= moc/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed --posix 's/QMAKE_RCC\t\t= i586-mingw32msvc-rcc/QMAKE_RCC\t\t= rcc/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed --posix 's/QMAKE_UIC\t\t= i586-mingw32msvc-uic/QMAKE_UIC\t\t= uic/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - # ar adds timestamps to every object file included in the static library - # providing -D as ar argument is supposed to solve it, but doesn't work as qmake strips off the arguments and adds -M to pass a script... - # which somehow cannot be combined with other flags. - # use faketime only for ar, as it confuses make/qmake into hanging sometimes - sed --posix "s|QMAKE_LIB\t\t= i586-mingw32msvc-ar -ru|QMAKE_LIB\t\t= $HOME/ar -Dr|" -i mkspecs/unsupported/win32-g++-cross/qmake.conf - echo '#!/bin/bash' > $HOME/ar - echo 'export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1' >> $HOME/ar - echo 'i586-mingw32msvc-ar "$@"' >> $HOME/ar - chmod +x $HOME/ar - #export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME - export TZ=UTC - ./configure -prefix $INSTDIR -confirm-license -release -opensource -static -no-qt3support -xplatform unsupported/win32-g++-cross -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -no-script -no-scripttools -no-javascript-jit -no-webkit -no-svg -no-xmlpatterns -no-sql-sqlite -no-nis -no-cups -no-iconv -no-dbus -no-gif -no-libtiff -no-opengl -nomake examples -nomake demos -nomake docs -no-feature-style-plastique -no-feature-style-cleanlooks -no-feature-style-motif -no-feature-style-cde -no-feature-style-windowsce -no-feature-style-windowsmobile -no-feature-style-s60 - find . -name *.prl | xargs -l sed 's|/\.||' -i - find . -name *.prl | xargs -l sed 's|/$||' -i - make $MAKEOPTS install - cp -a bin $SRCDIR/ - cd $INSTDIR - find . -name *.prl | xargs -l sed 's|/$||' -i - #sed 's|QMAKE_PRL_LIBS.*|QMAKE_PRL_LIBS = -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lQtXmlPatterns -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtNetwork -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32|' -i imports/Qt/labs/particles/qmlparticlesplugin.prl - - # as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - zip -r $OUTDIR/qt-win32-4.8.3-gitian-r1.zip * diff --git a/doc/release-process.md b/doc/release-process.md new file mode 100644 index 00000000..738bb2ac --- /dev/null +++ b/doc/release-process.md @@ -0,0 +1,110 @@ +Release Process +==================== + +* update translations (ping wumpus, Diapolo or tcatm on IRC) +* see https://github.com/bitcoin/bitcoin/blob/master/doc/translation_process.md#syncing-with-transifex + +* * * + +###update (commit) version in sources + + doc/README* + src/clientversion.h (change CLIENT_VERSION_IS_RELEASE to true) + +###tag version in git + + git tag -s v(new version, e.g. 0.8.0) + +###write release notes. git shortlog helps a lot, for example: + + git shortlog --no-merges v(current version, e.g. 0.7.2)..v(new version, e.g. 0.8.0) + +* * * + +###perform gitian builds + + From a directory containing the twister source, gitian-builder and gitian.sigs + +# export SIGNER=(your gitian key, ie bluematt, sipa, etc) + export VERSION=(new version, e.g. 0.8.0) + pushd ./twister-core + git checkout v${VERSION} + popd + pushd ./gitian-builder + +###fetch and build inputs: (first time, or when dependency versions change) + + mkdir -p inputs; cd inputs/ + + Register and download the Apple SDK: (see OSX Readme for details) + + https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg + + Using a Mac, create a tarball for the 10.7 SDK and copy it to the inputs directory: + + tar -C /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ -czf MacOSX10.7.sdk.tar.gz MacOSX10.7.sdk + + Download remaining inputs, and build everything: + + wget 'https://www.openssl.org/source/openssl-1.0.1h.tar.gz' + wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz' + wget 'http://zlib.net/zlib-1.2.8.tar.gz' + wget 'https://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2' + wget 'https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch' -O boost-mingw-gas-cross-compile-2013-03-03.patch + wget 'https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2' + wget 'https://github.com/mingwandroid/toolchain4/archive/10cc648683617cca8bcbeae507888099b41b530c.tar.gz' + wget 'http://www.opensource.apple.com/tarballs/cctools/cctools-809.tar.gz' + wget 'http://www.opensource.apple.com/tarballs/dyld/dyld-195.5.tar.gz' + wget 'http://www.opensource.apple.com/tarballs/ld64/ld64-127.2.tar.gz' + wget 'https://github.com/theuni/libdmg-hfsplus/archive/libdmg-hfsplus-v0.1.tar.gz' + wget 'http://llvm.org/releases/3.2/clang+llvm-3.2-x86-linux-ubuntu-12.04.tar.gz' -O clang-llvm-3.2-x86-linux-ubuntu-12.04.tar.gz + cd .. + ./bin/gbuild ../twister-core/contrib/gitian-descriptors/boost-linux.yml + mv build/out/boost-*.zip inputs/ + ./bin/gbuild ../twister-core/contrib/gitian-descriptors/deps-linux.yml + mv build/out/twister-deps-*.zip inputs/ + ./bin/gbuild ../twister-core/contrib/gitian-descriptors/boost-win.yml + mv build/out/boost-*.zip inputs/ + ./bin/gbuild ../twister-core/contrib/gitian-descriptors/deps-win.yml + mv build/out/twister-deps-*.zip inputs/ + ./bin/gbuild ../twister-core/contrib/gitian-descriptors/protobuf-win.yml + mv build/out/protobuf-*.zip inputs/ + ./bin/gbuild ../twister-core/contrib/gitian-descriptors/gitian-osx-native.yml + mv build/out/osx-*.tar.gz inputs/ + ./bin/gbuild ../twister-core/contrib/gitian-descriptors/gitian-osx-depends.yml + mv build/out/osx-*.tar.gz inputs/ + ./bin/gbuild ../twister-core/contrib/gitian-descriptors/gitian-osx-qt.yml + mv build/out/osx-*.tar.gz inputs/ + + The expected SHA256 hashes of the intermediate inputs are: + + f29b7d9577417333fb56e023c2977f5726a7c297f320b175a4108cf7cd4c2d29 boost-linux32-1.55.0-gitian-r1.zip + 88232451c4104f7eb16e469ac6474fd1231bd485687253f7b2bdf46c0781d535 boost-linux64-1.55.0-gitian-r1.zip + 60dc2d3b61e9c7d5dbe2f90d5955772ad748a47918ff2d8b74e8db9b1b91c909 boost-win32-1.55.0-gitian-r6.zip + f65fcaf346bc7b73bc8db3a8614f4f6bee2f61fcbe495e9881133a7c2612a167 boost-win64-1.55.0-gitian-r6.zip + e2e403e1a08869c7eed4d4293bce13d51ec6a63592918b90ae215a0eceb44cb4 protobuf-win32-2.5.0-gitian-r4.zip + a0999037e8b0ef9ade13efd88fee261ba401f5ca910068b7e0cd3262ba667db0 protobuf-win64-2.5.0-gitian-r4.zip + + + Build twister-core for Linux, Windows, and OS X: + +# ./bin/gbuild --commit twister-core=v${VERSION} ../twister-core/contrib/gitian-descriptors/gitian-win.yml + ./bin/gbuild --commit twister-core=HEAD ../twister-core/contrib/gitian-descriptors/gitian-win.yml +# ./bin/gsign --signer $SIGNER --release ${VERSION}-win --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-win.yml + pushd build/out + zip -r bitcoin-${VERSION}-win-gitian.zip * + mv bitcoin-${VERSION}-win-gitian.zip ../../../ + popd + + Build output expected: + +# 1. linux 32-bit and 64-bit binaries + source (bitcoin-${VERSION}-linux-gitian.zip) + 2. windows 32-bit and 64-bit binaries + installer + source (bitcoin-${VERSION}-win-gitian.zip) +# 3. OSX installer (Bitcoin-Qt.dmg) +# 4. Gitian signatures (in gitian.sigs/${VERSION}-/(your gitian key)/ + +repackage gitian builds for release as stand-alone zip/tar/installer exe + +###Next steps: + + From b21af7d18b956a291439c8566326cfdc5dd579ab Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 9 Jul 2014 22:19:17 -0300 Subject: [PATCH 16/20] compile mingw executables static --- contrib/gitian-descriptors/gitian-win.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index cbc5f96a..5ba765ca 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -31,7 +31,7 @@ script: | # Defines export TZ=UTC INDIR=$HOME/build - OPTFLAGS='-O2' + OPTFLAGS='-O2 -static -static-libgcc -static-libstdc++' TEMPDIR="$HOME/tempdir" for BITS in 32 64; do # for architectures # @@ -55,12 +55,13 @@ script: | cp -a $HOME/build/twister-core distsrc mkdir -p distsrc cd distsrc - ./bootstrap.sh --bindir=$BINDIR --prefix=$STAGING --host=$HOST --with-boost=$STAGING --with-openssl=$STAGING CPPFLAGS=-I$STAGING/include LDFLAGS=-L$STAGING/lib --without-boost-locale + ./autotool.sh + ./configure --bindir=$BINDIR --prefix=$STAGING --host=$HOST --with-boost=$STAGING --with-openssl=$STAGING CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="${OPTFLAGS}" --without-boost-locale #export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 #export FAKETIME=$REFERENCE_DATETIME make $MAKEOPTS - strip .libs/twisterd.exe - cp -f .libs/twisterd.exe $BINDIR/ + strip twisterd.exe + cp -f twisterd.exe $BINDIR/ unset LD_PRELOAD unset FAKETIME done # for BITS in From b0e35d2c7fe21b565b767ce63045b3b472d5715e Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 9 Jul 2014 22:59:57 -0300 Subject: [PATCH 17/20] change order for static lib compatibility --- m4/ax_berkeley_db_cxx.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/ax_berkeley_db_cxx.m4 b/m4/ax_berkeley_db_cxx.m4 index 42b47223..36a63e72 100644 --- a/m4/ax_berkeley_db_cxx.m4 +++ b/m4/ax_berkeley_db_cxx.m4 @@ -100,7 +100,7 @@ AC_DEFUN([AX_BERKELEY_DB_CXX], try_headers="db$version/db_cxx.h db`echo $version | sed -e 's,\..*,,g'`/db_cxx.h" fi - LIBS="$old_LIBS $db_cxx_lib" + LIBS="$db_cxx_lib $old_LIBS" for db_cxx_hdr in $try_headers ; do if test -z $DB_CXX_HEADER ; then From acb6f8ea62dae7917a13b1ff92fa2ccd9ad54fc5 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 9 Jul 2014 23:22:53 -0300 Subject: [PATCH 18/20] gitian linux static building --- contrib/gitian-descriptors/gitian-linux.yml | 65 +++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 contrib/gitian-descriptors/gitian-linux.yml diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml new file mode 100644 index 00000000..0657a73b --- /dev/null +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -0,0 +1,65 @@ +--- +name: "twister" +suites: +- "precise" +architectures: +- "i386" +- "amd64" +packages: +- "g++" +- "git-core" +- "zip" +- "unzip" +- "pkg-config" +- "autoconf2.13" +- "libtool" +- "automake" +- "faketime" +- "bsdmainutils" +reference_datetime: "2013-06-01 00:00:00" +remotes: +- "url": "https://github.com/miguelfreitas/twister-core.git" + "dir": "twister-core" +files: +- "twister-deps-linux32-gitian-r6.zip" +- "twister-deps-linux64-gitian-r6.zip" +- "boost-linux32-1.55.0-gitian-r1.zip" +- "boost-linux64-1.55.0-gitian-r1.zip" +script: | + STAGING="$HOME/install" + OPTFLAGS='-O2' #-static -static-libgcc -static-libstdc++' + BINDIR="${OUTDIR}/bin/${GBUILD_BITS}" # 32/64 bit build specific output directory + TEMPDIR="$HOME/tempdir" + export TZ=UTC + export LIBRARY_PATH="$STAGING/lib" + export PATH="$STAGING/bin:$PATH" + mkdir -p ${BINDIR} + # + mkdir -p $STAGING + cd $STAGING + unzip ../build/twister-deps-linux${GBUILD_BITS}-gitian-r6.zip + unzip ../build/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip + cd ../build + + # + cd $HOME/build/ + rm -rf distsrc + cp -a $HOME/build/twister-core distsrc + + cd distsrc + ./autotool.sh + ./configure --bindir=$BINDIR --prefix=$STAGING --with-boost=$STAGING --with-openssl=$STAGING PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" --with-libdb=$STAGING CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" --without-boost-locale + make $MAKEOPTS + strip twisterd + cp -f twisterd $BINDIR/ + + # sort distribution tar file and normalize user/group/mtime information for deterministic output + mkdir -p $OUTDIR/src + rm -rf $TEMPDIR + mkdir -p $TEMPDIR + cd $TEMPDIR + #tar -xvf $HOME/build/twister/$DISTNAME | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 --mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/src/$DISTNAME + cd $OUTDIR + find . | sort | zip -X@ $OUTDIR/twister-linux${GBUILD_BITS}.zip + + From c9d6b2d0af8f64627cf122b191a2dd11bcd96527 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 13 Jul 2014 16:08:06 -0300 Subject: [PATCH 19/20] fix mingw32 sse2 crash and assertion failure (winxp) --- configure.ac | 2 +- libtorrent/src/utp_stream.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d6634f9a..7d559909 100644 --- a/configure.ac +++ b/configure.ac @@ -531,7 +531,7 @@ AS_CASE(["$ARG_ENABLE_SSE2"], ["yes"|"on"], [ AC_MSG_RESULT([yes]) AC_DEFINE([USE_SSE2],[1],[Enable SSE2]) - CXXFLAGS="$CXXFLAGS -DUSE_SSE2 -msse2 " + CXXFLAGS="$CXXFLAGS -DUSE_SSE2 -msse2 -mstackrealign " ], ["no"|"off"], [ AC_MSG_RESULT([no]) diff --git a/libtorrent/src/utp_stream.cpp b/libtorrent/src/utp_stream.cpp index fb38f208..c6d10c49 100644 --- a/libtorrent/src/utp_stream.cpp +++ b/libtorrent/src/utp_stream.cpp @@ -2161,7 +2161,7 @@ void utp_socket_impl::ack_packet(packet* p, ptime const& receive_time rtt = 100000; // the clock for this plaform is not monotonic! - TORRENT_ASSERT(false); + //TORRENT_ASSERT(false); } UTP_LOGV("%8p: acked packet %d (%d bytes) (rtt:%u)\n" From 7240fee4e960916c7f6c287495d261f786d148a4 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 14 Jul 2014 22:20:33 -0300 Subject: [PATCH 20/20] update time.cpp/ptime from upstream (r10083) trying to fix non-monotonic time issues with win32. still one assert from disk_io_thread must be commented out to avoid aborting. --- libtorrent/include/libtorrent/ptime.hpp | 23 +++++++--- libtorrent/include/libtorrent/time.hpp | 31 ++++++++++---- libtorrent/src/disk_io_thread.cpp | 2 +- .../src/kademlia/traversal_algorithm.cpp | 2 +- libtorrent/src/time.cpp | 42 ++++++++----------- libtorrent/src/tracker_manager.cpp | 4 +- 6 files changed, 61 insertions(+), 43 deletions(-) diff --git a/libtorrent/include/libtorrent/ptime.hpp b/libtorrent/include/libtorrent/ptime.hpp index cbbe1dcf..444bbb67 100644 --- a/libtorrent/include/libtorrent/ptime.hpp +++ b/libtorrent/include/libtorrent/ptime.hpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2009-2012, Arvid Norberg +Copyright (c) 2009-2014, Arvid Norberg All rights reserved. Redistribution and use in source and binary forms, with or without @@ -57,14 +57,21 @@ namespace libtorrent // libtorrent time_duration type struct TORRENT_EXPORT time_duration { + // hidden time_duration() {} + + // all operators have the same semantics as a 64 bit signed integer time_duration operator/(int rhs) const { return time_duration(diff / rhs); } explicit time_duration(boost::int64_t d) : diff(d) {} - time_duration& operator-=(time_duration const& c) { diff -= c.diff; return *this; } - time_duration& operator+=(time_duration const& c) { diff += c.diff; return *this; } + time_duration& operator-=(time_duration const& c) + { diff -= c.diff; return *this; } + time_duration& operator+=(time_duration const& c) + { diff += c.diff; return *this; } time_duration& operator*=(int v) { diff *= v; return *this; } - time_duration operator+(time_duration const& c) { return time_duration(diff + c.diff); } - time_duration operator-(time_duration const& c) { return time_duration(diff - c.diff); } + time_duration operator+(time_duration const& c) + { return time_duration(diff + c.diff); } + time_duration operator-(time_duration const& c) + { return time_duration(diff - c.diff); } // internal boost::int64_t diff; @@ -73,8 +80,11 @@ namespace libtorrent // This type represents a point in time. struct TORRENT_EXPORT ptime { + // hidden ptime() {} explicit ptime(boost::uint64_t t): time(t) {} + + // these operators have the same semantics as signed 64 bit integers ptime& operator+=(time_duration rhs) { time += rhs.diff; return *this; } ptime& operator-=(time_duration rhs) { time -= rhs.diff; return *this; } @@ -82,8 +92,10 @@ namespace libtorrent boost::uint64_t time; }; + // returns true of the time duration is less than 0 inline bool is_negative(time_duration dt) { return dt.diff < 0; } + // all operators have the same semantics as signed 64 bit integers inline bool operator>(ptime lhs, ptime rhs) { return lhs.time > rhs.time; } inline bool operator>=(ptime lhs, ptime rhs) @@ -110,7 +122,6 @@ namespace libtorrent { return time_duration(boost::int64_t(lhs.diff * rhs)); } inline time_duration operator*(int lhs, time_duration rhs) { return time_duration(boost::int64_t(lhs * rhs.diff)); } - inline time_duration operator-(ptime lhs, ptime rhs) { return time_duration(lhs.time - rhs.time); } inline ptime operator+(ptime lhs, time_duration rhs) diff --git a/libtorrent/include/libtorrent/time.hpp b/libtorrent/include/libtorrent/time.hpp index 4285a09a..1b3382cb 100644 --- a/libtorrent/include/libtorrent/time.hpp +++ b/libtorrent/include/libtorrent/time.hpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2007-2012, Arvid Norberg +Copyright (c) 2007-2014, Arvid Norberg All rights reserved. Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE. // OVERVIEW // -// This section contains fundamental time types used internall by +// This section contains fundamental time types used internally by // libtorrent and exposed through various places in the API. The two // basic types are ``ptime`` and ``time_duration``. The first represents // a point in time and the second the difference between two points @@ -56,28 +56,41 @@ POSSIBILITY OF SUCH DAMAGE. // .. note:: // In a future version of libtorrent, these types will be replaced // by the standard timer types from ``std::chrono``. +// namespace libtorrent { TORRENT_EXTRA_EXPORT char const* time_now_string(); std::string log_time(); + // returns the current time, as represented by ptime. The + // resolution of this timer is about 100 ms. TORRENT_EXPORT ptime const& time_now(); + + // returns the current time as represented by ptime. This is + // more expensive than time_now(), but provides as high resolution + // as the operating system can provide. TORRENT_EXPORT ptime time_now_hires(); + // the earliest and latest possible time points + // representable by ptime. TORRENT_EXPORT ptime min_time(); TORRENT_EXPORT ptime max_time(); #if defined TORRENT_USE_BOOST_DATE_TIME || defined TORRENT_USE_QUERY_PERFORMANCE_TIMER - TORRENT_EXPORT time_duration seconds(int s); - TORRENT_EXPORT time_duration milliseconds(int s); - TORRENT_EXPORT time_duration microsec(int s); - TORRENT_EXPORT time_duration minutes(int s); - TORRENT_EXPORT time_duration hours(int s); + // returns a time_duration representing the specified number of seconds, milliseconds + // microseconds, minutes and hours. + TORRENT_EXPORT time_duration seconds(boost::int64_t s); + TORRENT_EXPORT time_duration milliseconds(boost::int64_t s); + TORRENT_EXPORT time_duration microsec(boost::int64_t s); + TORRENT_EXPORT time_duration minutes(boost::int64_t s); + TORRENT_EXPORT time_duration hours(boost::int64_t s); - TORRENT_EXPORT int total_seconds(time_duration td); - TORRENT_EXPORT int total_milliseconds(time_duration td); + // returns the number of seconds, milliseconds and microseconds + // a time_duration represents. + TORRENT_EXPORT boost::int64_t total_seconds(time_duration td); + TORRENT_EXPORT boost::int64_t total_milliseconds(time_duration td); TORRENT_EXPORT boost::int64_t total_microseconds(time_duration td); #elif TORRENT_USE_CLOCK_GETTIME || TORRENT_USE_SYSTEM_TIME || TORRENT_USE_ABSOLUTE_TIME diff --git a/libtorrent/src/disk_io_thread.cpp b/libtorrent/src/disk_io_thread.cpp index 59eeac9e..a866aa66 100644 --- a/libtorrent/src/disk_io_thread.cpp +++ b/libtorrent/src/disk_io_thread.cpp @@ -2392,7 +2392,7 @@ namespace libtorrent for (int processed = 0; processed < 4 * 1024 * 1024; processed += piece_size) { ptime now = time_now_hires(); - TORRENT_ASSERT(now >= m_last_file_check); + //TORRENT_ASSERT(now >= m_last_file_check); // this happens sometimes on windows for some reason if (now < m_last_file_check) now = m_last_file_check; diff --git a/libtorrent/src/kademlia/traversal_algorithm.cpp b/libtorrent/src/kademlia/traversal_algorithm.cpp index 116e7718..0248d31c 100644 --- a/libtorrent/src/kademlia/traversal_algorithm.cpp +++ b/libtorrent/src/kademlia/traversal_algorithm.cpp @@ -449,7 +449,7 @@ void traversal_algorithm::status(dht_lookup& l) observer& o = **i; if (o.flags & observer::flag_queried) { - last_sent = (std::min)(last_sent, total_seconds(now - o.sent())); + last_sent = (std::min)(last_sent, int(total_seconds(now - o.sent()))); if (o.has_short_timeout()) ++l.first_timeout; continue; } diff --git a/libtorrent/src/time.cpp b/libtorrent/src/time.cpp index 84b1855d..bea93856 100644 --- a/libtorrent/src/time.cpp +++ b/libtorrent/src/time.cpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2009-2012, Arvid Norberg +Copyright (c) 2009-2014, Arvid Norberg All rights reserved. Redistribution and use in source and binary forms, with or without @@ -58,12 +58,6 @@ namespace libtorrent char const* time_now_string() { -// time_t t = std::time(0); -// tm* timeinfo = std::localtime(&t); -// static char str[200]; -// std::strftime(str, 200, "%b %d %X", timeinfo); -// return str; - static const ptime start = time_now_hires(); static char ret[200]; int t = total_milliseconds(time_now_hires() - start); @@ -82,7 +76,7 @@ namespace libtorrent { static const ptime start = time_now_hires(); char ret[200]; - snprintf(ret, sizeof(ret), "%"PRId64, total_microseconds(time_now_hires() - start)); + snprintf(ret, sizeof(ret), "%" PRId64, total_microseconds(time_now_hires() - start)); return ret; } } @@ -99,15 +93,15 @@ namespace libtorrent { return boost::posix_time::ptime(boost::posix_time::min_date_time); } ptime max_time() { return boost::posix_time::ptime(boost::posix_time::max_date_time); } - time_duration seconds(int s) { return boost::posix_time::seconds(s); } - time_duration milliseconds(int s) { return boost::posix_time::milliseconds(s); } - time_duration microsec(int s) { return boost::posix_time::microsec(s); } - time_duration minutes(int s) { return boost::posix_time::minutes(s); } - time_duration hours(int s) { return boost::posix_time::hours(s); } + time_duration seconds(boost::int64_t s) { return boost::posix_time::seconds(s); } + time_duration milliseconds(boost::int64_t s) { return boost::posix_time::milliseconds(s); } + time_duration microsec(boost::int64_t s) { return boost::posix_time::microsec(s); } + time_duration minutes(boost::int64_t s) { return boost::posix_time::minutes(s); } + time_duration hours(boost::int64_t s) { return boost::posix_time::hours(s); } - int total_seconds(time_duration td) + boost::int64_t total_seconds(time_duration td) { return td.total_seconds(); } - int total_milliseconds(time_duration td) + boost::int64_t total_milliseconds(time_duration td) { return td.total_milliseconds(); } boost::int64_t total_microseconds(time_duration td) { return td.total_microseconds(); } @@ -188,14 +182,14 @@ namespace libtorrent return ptime(now.QuadPart); } - int total_seconds(time_duration td) + boost::int64_t total_seconds(time_duration td) { - return int(performance_counter_to_microseconds(td.diff) + return boost::int64_t(performance_counter_to_microseconds(td.diff) / 1000000); } - int total_milliseconds(time_duration td) + boost::int64_t total_milliseconds(time_duration td) { - return int(performance_counter_to_microseconds(td.diff) + return boost::uint64_t(performance_counter_to_microseconds(td.diff) / 1000); } boost::int64_t total_microseconds(time_duration td) @@ -203,26 +197,26 @@ namespace libtorrent return performance_counter_to_microseconds(td.diff); } - time_duration microsec(int s) + time_duration microsec(boost::int64_t s) { return time_duration(microseconds_to_performance_counter(s)); } - time_duration milliseconds(int s) + time_duration milliseconds(boost::int64_t s) { return time_duration(microseconds_to_performance_counter( s * 1000)); } - time_duration seconds(int s) + time_duration seconds(boost::int64_t s) { return time_duration(microseconds_to_performance_counter( s * 1000000)); } - time_duration minutes(int s) + time_duration minutes(boost::int64_t s) { return time_duration(microseconds_to_performance_counter( s * 1000000 * 60)); } - time_duration hours(int s) + time_duration hours(boost::int64_t s) { return time_duration(microseconds_to_performance_counter( s * 1000000 * 60 * 60)); diff --git a/libtorrent/src/tracker_manager.cpp b/libtorrent/src/tracker_manager.cpp index 91e8cfe9..60eef590 100644 --- a/libtorrent/src/tracker_manager.cpp +++ b/libtorrent/src/tracker_manager.cpp @@ -133,8 +133,8 @@ namespace libtorrent if (m_completion_timeout > 0) { timeout = timeout == 0 - ? m_completion_timeout - total_seconds(m_read_time - m_start_time) - : (std::min)(m_completion_timeout - total_seconds(m_read_time - m_start_time), timeout); + ? int(m_completion_timeout - total_seconds(m_read_time - m_start_time)) + : (std::min)(int(m_completion_timeout - total_seconds(m_read_time - m_start_time)), timeout); } #if defined TORRENT_ASIO_DEBUGGING add_outstanding_async("timeout_handler::timeout_callback");