diff --git a/contrib/gitian-win32.yml b/contrib/gitian-win32.yml new file mode 100644 index 00000000..0c804af3 --- /dev/null +++ b/contrib/gitian-win32.yml @@ -0,0 +1,83 @@ +--- +name: "bitcoin" +suites: +- "lucid" +architectures: +- "i386" +packages: +- "mingw32" +- "git-core" +- "unzip" +- "nsis" +reference_datetime: "2011-01-30 00:00:00" +remotes: +- "url": "https://github.com/bitcoin/bitcoin.git" + "dir": "bitcoin" +files: +- "wxWidgets-2.9.1.tar.bz2" +- "boost_1_43_0.tar.bz2" +- "openssl-1.0.0d.tar.gz" +- "db-4.7.25.NC.tar.gz" +- "upnpc-exe-win32-20110215.zip" +- "miniupnpc-1.5.20110215.tar.gz" +- "WSPiApi.h" +script: | + # + tar xjf wxWidgets-2.9.1.tar.bz2 + cd wxWidgets-2.9.1 + ./configure --host=i586-mingw32msvc --build=i686-linux --disable-shared --enable-monolithic --without-libpng --disable-svg + perl -i -p -e "s/__TIME__/\"$REFERENCE_TIME\"/;s/__DATE__/\"$REFERENCE_DATE\"/" include/wx/chartype.h + make $MAKEOPTS + cd .. + # + tar xzf openssl-1.0.0d.tar.gz + cd openssl-1.0.0d + ./Configure --cross-compile-prefix=i586-mingw32msvc- mingw + make + cd .. + # + tar xzf db-4.7.25.NC.tar.gz + cd db-4.7.25.NC/build_unix + ../dist/configure --enable-mingw --enable-cxx --host=i586-mingw32msvc CFLAGS="-I/usr/i586-mingw32msvc/include" + make $MAKEOPTS + cd ../.. + # + tar xjf boost_1_43_0.tar.bz2 + cd boost_1_43_0 + echo "using gcc : 4.4 : i586-mingw32msvc-g++ + : + i586-mingw32msvc-windres + i586-mingw32msvc-ar + ;" > user-config.jam + ./bootstrap.sh --without-icu + ./bjam toolset=gcc target-os=windows threadapi=win32 threading=multi --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete $MAKEOPTS stage + cd .. + # + mkdir upnpc-exe-win32-20110215 + cd upnpc-exe-win32-20110215 + unzip ../upnpc-exe-win32-20110215.zip + mkdir miniupnpc + cd miniupnpc + tar xzf ../../miniupnpc-1.5.20110215.tar.gz + mv ./miniupnpc-1.5.20110215/* ./ + cd ../.. + # + cp WSPiApi.h $HOME/build + # + cd bitcoin + mkdir -p $OUTDIR/src + cp -a . $OUTDIR/src + rm -rf $OUTDIR/src/.git + cp -a $OUTDIR/src/locale $OUTDIR + cp $OUTDIR/src/doc/README_windows.txt $OUTDIR/readme.txt + cp $OUTDIR/src/COPYING $OUTDIR/license.txt + cd src + sed 's/$(DEBUGFLAGS)//' < makefile.linux-mingw > makefile.linux-mingw.2 && mv makefile.linux-mingw.2 makefile.linux-mingw + sed 's|//#include |#include |' < net.cpp > net.cpp.2 && mv net.cpp.2 net.cpp + make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoin.exe bitcoind.exe + i586-mingw32msvc-strip bitcoin.exe + i586-mingw32msvc-strip bitcoind.exe + makensis ../share/setup.nsi + cp bitcoin.exe ../share/bitcoin-*-win32-setup.exe $OUTDIR/ + mkdir $OUTDIR/daemon + cp bitcoind.exe $OUTDIR/daemon diff --git a/contrib/gitian.yml b/contrib/gitian.yml index bf997503..cff4cce2 100644 --- a/contrib/gitian.yml +++ b/contrib/gitian.yml @@ -6,7 +6,7 @@ architectures: - "i386" - "amd64" packages: -- "libdb4.8++-dev" +- "libdb4.7++-dev - "libxxf86vm-dev" - "libgtk2.0-dev" - "libboost-all-dev" @@ -19,6 +19,8 @@ remotes: files: - "wxWidgets-2.9.1.tar.bz2" - "miniupnpc-1.5.tar.gz" +- "toplevel.h.diff" +- "toplevel.cpp.diff" script: | INSTDIR="$HOME/install" export LIBRARY_PATH="$INSTDIR/lib" @@ -30,6 +32,11 @@ script: | # tar xjf wxWidgets-2.9.1.tar.bz2 cd wxWidgets-2.9.1 + cd include/wx/gtk + patch < ../../../../toplevel.h.diff + cd ../../../src/gtk + patch < ../../../toplevel.cpp.diff + cd ../.. ./configure --prefix=$INSTDIR --enable-monolithic --disable-shared perl -i -p -e "s/__TIME__/\"$REFERENCE_TIME\"/;s/__DATE__/\"$REFERENCE_DATE\"/" include/wx/chartype.h make $MAKEOPTS install @@ -43,6 +50,7 @@ script: | cp $OUTDIR/src/doc/README $OUTDIR cp $OUTDIR/src/COPYING $OUTDIR cd src + sed 's/$(DEBUGFLAGS)//' < makefile.unix > makefile.unix.2 && mv makefile.unix.2 makefile.unix PATH=$INSTDIR/bin:$PATH make -f makefile.unix CXX="g++ -I$INSTDIR/include -L$INSTDIR/lib" $MAKEOPTS bitcoin bitcoind mkdir -p $OUTDIR/bin/$GBUILD_BITS install -s bitcoin bitcoind $OUTDIR/bin/$GBUILD_BITS diff --git a/contrib/wx-patches/README b/contrib/wx-patches/README new file mode 100644 index 00000000..2afb4a9e --- /dev/null +++ b/contrib/wx-patches/README @@ -0,0 +1,4 @@ +This folder contains two patches which are applied to wxWidgets +2.9.1 before building the wxWidgets which is used for release +versions of bitcoin. They make the GUI show up on newer OSs +with new libgtks, such as Ubuntu 11.04. diff --git a/contrib/wx-patches/toplevel.cpp.diff b/contrib/wx-patches/toplevel.cpp.diff new file mode 100644 index 00000000..359abf28 --- /dev/null +++ b/contrib/wx-patches/toplevel.cpp.diff @@ -0,0 +1,86 @@ +--- /wxWidgets/trunk/src/gtk/toplevel.cpp (revision 67326) ++++ /wxWidgets/trunk/src/gtk/toplevel.cpp (revision 67496) +@@ -72,4 +72,8 @@ + // send any activate events at all + static int g_sendActivateEvent = -1; ++ ++// Whether _NET_REQUEST_FRAME_EXTENTS support is working ++// 0 == not tested yet, 1 == working, 2 == broken ++static int gs_requestFrameExtentsStatus; + + //----------------------------------------------------------------------------- +@@ -432,4 +436,12 @@ + if (event->state == GDK_PROPERTY_NEW_VALUE && event->atom == property) + { ++ if (win->m_netFrameExtentsTimerId) ++ { ++ // WM support for _NET_REQUEST_FRAME_EXTENTS is working ++ gs_requestFrameExtentsStatus = 1; ++ g_source_remove(win->m_netFrameExtentsTimerId); ++ win->m_netFrameExtentsTimerId = 0; ++ } ++ + wxSize decorSize = win->m_decorSize; + int left, right, top, bottom; +@@ -439,4 +451,22 @@ + win->GTKUpdateDecorSize(decorSize); + } ++ return false; ++} ++} ++ ++extern "C" { ++static gboolean request_frame_extents_timeout(void* data) ++{ ++ // WM support for _NET_REQUEST_FRAME_EXTENTS is broken ++ gs_requestFrameExtentsStatus = 2; ++ gdk_threads_enter(); ++ wxTopLevelWindowGTK* win = static_cast(data); ++ win->m_netFrameExtentsTimerId = 0; ++ wxSize decorSize = win->m_decorSize; ++ int left, right, top, bottom; ++ if (wxGetFrameExtents(gtk_widget_get_window(win->m_widget), &left, &right, &top, &bottom)) ++ decorSize.Set(left + right, top + bottom); ++ win->GTKUpdateDecorSize(decorSize); ++ gdk_threads_leave(); + return false; + } +@@ -459,4 +489,5 @@ + m_deferShowAllowed = true; + m_updateDecorSize = true; ++ m_netFrameExtentsTimerId = 0; + + m_urgency_hint = -2; +@@ -811,5 +842,6 @@ + if (deferShow) + { +- deferShow = m_deferShowAllowed && !GTK_WIDGET_REALIZED(m_widget); ++ deferShow = gs_requestFrameExtentsStatus != 2 && ++ m_deferShowAllowed && !gtk_widget_get_realized(m_widget); + if (deferShow) + { +@@ -829,11 +861,4 @@ + // GetSize()/SetSize() because it makes window bigger between each + // restore and save. +- m_updateDecorSize = deferShow; +- } +- if (deferShow) +- { +- // Fluxbox support for _NET_REQUEST_FRAME_EXTENTS is broken +- const char* name = gdk_x11_screen_get_window_manager_name(screen); +- deferShow = strcmp(name, "Fluxbox") != 0; + m_updateDecorSize = deferShow; + } +@@ -875,4 +900,12 @@ + (XEvent*)&xevent); + ++ if (gs_requestFrameExtentsStatus == 0) ++ { ++ // if WM does not respond to request within 1 second, ++ // we assume support for _NET_REQUEST_FRAME_EXTENTS is not working ++ m_netFrameExtentsTimerId = ++ g_timeout_add(1000, request_frame_extents_timeout, this); ++ } ++ + // defer calling gtk_widget_show() + m_isShown = true; diff --git a/contrib/wx-patches/toplevel.h.diff b/contrib/wx-patches/toplevel.h.diff new file mode 100644 index 00000000..c2718d46 --- /dev/null +++ b/contrib/wx-patches/toplevel.h.diff @@ -0,0 +1,9 @@ +--- /wxWidgets/trunk/include/wx/gtk/toplevel.h (revision 65373) ++++ /wxWidgets/trunk/include/wx/gtk/toplevel.h (revision 67496) +@@ -114,4 +114,6 @@ + // wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle. + int m_urgency_hint; ++ // timer for detecting WM with broken _NET_REQUEST_FRAME_EXTENTS handling ++ unsigned m_netFrameExtentsTimerId; + + // return the size of the window without WM decorations diff --git a/doc/release-process.txt b/doc/release-process.txt index 0e15e1da..4940afef 100644 --- a/doc/release-process.txt +++ b/doc/release-process.txt @@ -20,7 +20,10 @@ * perform gitian builds - { insert useful info here } + * From the bitcoin source dir + $ cd ../gitian-builder + $ ./bin/gbuild --commit bitcoin=v0.3.23 ../bitcoin/contrib/gitian.yml + $ ./bin/gbuild --commit bitcoin=v0.3.23 ../bitcoin/contrib/gitian-win32.yml Build output expected: 1. linux 32-bit and 64-bit binaries + source diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw new file mode 100644 index 00000000..3fb18ff2 --- /dev/null +++ b/src/makefile.linux-mingw @@ -0,0 +1,111 @@ +# Copyright (c) 2009-2010 Satoshi Nakamoto +# Distributed under the MIT/X11 software license, see the accompanying +# file license.txt or http://www.opensource.org/licenses/mit-license.php. + +DEPSDIR:=/usr/i586-mingw32msvc + +INCLUDEPATHS= \ + -I"$(DEPSDIR)/boost_1_43_0" \ + -I"$(DEPSDIR)/db-4.7.25.NC/build_unix" \ + -I"$(DEPSDIR)/openssl-1.0.0d/include" \ + -I"$(DEPSDIR)/wxWidgets-2.9.1/lib/gcc_lib/mswud" \ + -I"$(DEPSDIR)/wxWidgets-2.9.1/include" \ + -I"$(DEPSDIR)/wxWidgets-2.9.1/lib/wx/include/i586-mingw32msvc-msw-unicode-static-2.9/" \ + -I"$(DEPSDIR)" + +LIBPATHS= \ + -L"$(DEPSDIR)/boost_1_43_0/stage/lib" \ + -L"$(DEPSDIR)/db-4.7.25.NC/build_unix" \ + -L"$(DEPSDIR)/openssl-1.0.0d" \ + -L"$(DEPSDIR)/wxWidgets-2.9.1/lib" + +WXLIBS= -l wx_mswu-2.9-i586-mingw32msvc + +LIBS= \ + -l boost_system-mt-s \ + -l boost_filesystem-mt-s \ + -l boost_program_options-mt-s \ + -l boost_thread_win32-mt-s \ + -l db_cxx \ + -l ssl \ + -l crypto + +DEFS=-D_MT -DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL +DEBUGFLAGS=-g -D__WXDEBUG__ +CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) +HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \ + script.h db.h net.h irc.h keystore.h main.h wallet.h rpc.h uibase.h ui.h noui.h init.h + +bitcoin.exe: USE_UPNP:=1 + ifdef USE_UPNP + INCLUDEPATHS += -I"$(DEPSDIR)/upnpc-exe-win32-20110215" + LIBPATHS += -L"$(DEPSDIR)/upnpc-exe-win32-20110215" + LIBS += -l miniupnpc -l iphlpapi + DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) + endif + +bitcoind.exe: USE_UPNP:=0 + ifdef USE_UPNP + INCLUDEPATHS += -I"$(DEPSDIR)/upnpc-exe-win32-20110215" + LIBPATHS += -L"$(DEPSDIR)/upnpc-exe-win32-20110215" + LIBS += -l miniupnpc -l iphlpapi + DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) + endif + +LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi + +OBJS= \ + obj/util.o \ + obj/script.o \ + obj/db.o \ + obj/net.o \ + obj/irc.o \ + obj/keystore.o \ + obj/main.o \ + obj/wallet.o \ + obj/rpc.o \ + obj/init.o \ + cryptopp/obj/sha.o \ + cryptopp/obj/cpu.o + + +all: bitcoin.exe + + +obj/%.o: %.cpp $(HEADERS) + i586-mingw32msvc-g++ -c $(CFLAGS) -DGUI -o $@ $< + +cryptopp/obj/%.o: cryptopp/%.cpp + i586-mingw32msvc-g++ -c $(CFLAGS) -O3 -DCRYPTOPP_DISABLE_ASM -o $@ $< + +obj/ui_res.o: ../share/ui.rc ../share/pixmaps/bitcoin.ico ../share/pixmaps/check.ico ../share/pixmaps/send16.bmp ../share/pixmaps/send16mask.bmp ../share/pixmaps/send16masknoshadow.bmp ../share/pixmaps/send20.bmp ../share/pixmaps/send20mask.bmp ../share/pixmaps/addressbook16.bmp ../share/pixmaps/addressbook16mask.bmp ../share/pixmaps/addressbook20.bmp ../share/pixmaps/addressbook20mask.bmp + i586-mingw32msvc-windres $(DEFS) $(INCLUDEPATHS) -o $@ -i $< + +bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/ui_res.o + i586-mingw32msvc-g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS) + + +obj/nogui/%.o: %.cpp $(HEADERS) + i586-mingw32msvc-g++ -c $(CFLAGS) -o $@ $< + +bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/ui_res.o + i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) + + +obj/test/%.o: obj/test/%.cpp $(HEADERS) + i586-mingw32msvc-g++ -c $(CFLAGS) -o $@ $< + +test_bitcoin.exe: obj/test/test_bitcoin.o + i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) -lboost_unit_test_framework-mt-s + + +clean: + -rm -f obj/*.o + -rm -f obj/nogui/*.o + -rm -f obj/test/*.o + -rm -f cryptopp/obj/*.o + -rm -f test/*.o + -rm -f headers.h.gch + -rm -f bitcoin.exe + -rm -f bitcoind.exe + -rm -f test_bitcoin.exe diff --git a/src/net.cpp b/src/net.cpp index 23b40f97..0d3348da 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -11,6 +11,11 @@ #ifdef __WXMSW__ #include +// This file can be downloaded as a part of the Windows Platform SDK +// and is required for Bitcoin binaries to work properly on versions +// of Windows before XP. If you are doing builds of Bitcoin for +// public release, you should uncomment this line. +//#include #endif #ifdef USE_UPNP