From c546dc05bb5f0e6020a7e3ecf5cda70f0f472d76 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Wed, 18 Sep 2013 17:09:11 -0400 Subject: [PATCH 1/4] autotools: fix subdir m4 check, never let it return -I If BDB_CPPFLAGS returns only "-I", the next argument sent to the preprocessor is treated as a path. There are 2 fixes here: 1. Check in CPPFLAGS, as a user might have manually passed a path to check. 2. Ensure the value is not empty before setting BDB_CPPFLAGS to "-I value" --- src/m4/bitcoin_subdir_to_include.m4 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/m4/bitcoin_subdir_to_include.m4 b/src/m4/bitcoin_subdir_to_include.m4 index 9b37a75ef0..66f106c7d4 100644 --- a/src/m4/bitcoin_subdir_to_include.m4 +++ b/src/m4/bitcoin_subdir_to_include.m4 @@ -5,8 +5,10 @@ AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[ AC_MSG_RESULT([default]) else echo "#include <$2$3.h>" >conftest.cpp - newinclpath=`${CXXCPP} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`] + newinclpath=`${CXXCPP} ${CPPFLAGS} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`] AC_MSG_RESULT([${newinclpath}]) - eval "$1=\"\$$1\"' -I${newinclpath}'" + if test "x${newinclpath}" != "x"; then + eval "$1=\"\$$1\"' -I${newinclpath}'" + fi fi ]) From 7a3df1cd9406ef0f46af518974c1e87aa1d5cb5f Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Wed, 18 Sep 2013 15:45:31 -0400 Subject: [PATCH 2/4] autotools: fix the Makefile.include to be safely included anywhere. This way we can reuse rules rather than duplicating them. --- src/Makefile.am | 2 +- src/Makefile.include | 6 ++---- src/qt/Makefile.am | 4 ++-- src/qt/test/Makefile.am | 4 ++-- src/test/Makefile.am | 4 ++-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 3b0f096744..08ebc575b3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \ - -I$(builddir) $(BOOST_INCLUDES) + -I$(builddir) $(BOOST_INCLUDES) $(BDB_CPPFLAGS) AM_LDFLAGS = $(PTHREAD_CFLAGS) noinst_LIBRARIES = libbitcoin.a diff --git a/src/Makefile.include b/src/Makefile.include index d002e8ed6f..352471061d 100644 --- a/src/Makefile.include +++ b/src/Makefile.include @@ -1,13 +1,11 @@ -.PHONY: FORCE +# Helper for rules and subdir Makefiles to find parent targets. +# Flags and other non-target variables should not be set here. LIBBITCOIN=$(top_builddir)/src/libbitcoin.a LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a LIBMEMENV=$(top_builddir)/src/leveldb/libmemenv.a LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a -INCLUDES += $(BDB_CPPFLAGS) -LIBBITCOIN += $(BDB_LIBS) - $(LIBBITCOIN): $(MAKE) -C $(top_builddir)/src $(@F) diff --git a/src/qt/Makefile.am b/src/qt/Makefile.am index 33c5825eb3..248dcba0ec 100644 --- a/src/qt/Makefile.am +++ b/src/qt/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \ -I$(top_srcdir)/src/leveldb/helpers -I$(top_builddir)/src/qt \ -I$(top_builddir)/src/qt/forms $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \ - $(QR_CFLAGS) + $(QR_CFLAGS) $(BDB_CPPFLAGS) AM_LDFLAGS = $(PTHREAD_CFLAGS) bin_PROGRAMS = bitcoin-qt noinst_LIBRARIES = libbitcoinqt.a @@ -145,7 +145,7 @@ bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) \ -I$(top_srcdir)/src/qt/forms bitcoin_qt_SOURCES = bitcoin.cpp bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \ - $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) + $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) # forms/foo.h -> forms/ui_foo.h QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:.ui=.h)))) diff --git a/src/qt/test/Makefile.am b/src/qt/test/Makefile.am index f51ac9bd6d..f8fe97462b 100644 --- a/src/qt/test/Makefile.am +++ b/src/qt/test/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \ -I$(top_srcdir)/src/leveldb/helpers -I$(top_srcdir)/src/qt \ -I$(top_builddir)/src/qt $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \ - $(QR_CFLAGS) + $(QR_CFLAGS) $(BDB_CPPFLAGS) AM_LDFLAGS = $(PTHREAD_CFLAGS) bin_PROGRAMS = test_bitcoin-qt TESTS = test_bitcoin-qt @@ -20,7 +20,7 @@ test_bitcoin_qt_SOURCES = test_main.cpp uritests.cpp paymentservertests.cpp $(TE nodist_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP) test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN) $(LIBLEVELDB) \ $(LIBMEMENV) $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) \ - $(QR_LIBS) $(PROTOBUF_LIBS) + $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) CLEANFILES = $(BUILT_SOURCES) *.gcda *.gcno diff --git a/src/test/Makefile.am b/src/test/Makefile.am index d193b729f8..a859eb1de8 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/src/Makefile.include AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \ - -I$(top_srcdir)/src $(BOOST_INCLUDES) + -I$(top_srcdir)/src $(BOOST_INCLUDES) $(BDB_CPPFLAGS) AM_LDFLAGS = $(PTHREAD_CFLAGS) @@ -25,7 +25,7 @@ BUILT_SOURCES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h) # test_bitcoin binary # test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(TESTDEFS) test_bitcoin_LDADD = $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \ - $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) + $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(BDB_LIBS) test_bitcoin_SOURCES = accounting_tests.cpp alert_tests.cpp \ allocator_tests.cpp base32_tests.cpp base58_tests.cpp base64_tests.cpp \ bignum_tests.cpp bloom_tests.cpp canonical_tests.cpp checkblock_tests.cpp \ From dee632cc257bbf581e75e28e3eeccaa901761480 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Wed, 18 Sep 2013 15:53:29 -0400 Subject: [PATCH 3/4] win32: add version info to bitcoind.exe TODO: Add icon info --- src/Makefile.am | 5 +++++ src/bitcoin-res.rc | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/bitcoin-res.rc diff --git a/src/Makefile.am b/src/Makefile.am index 08ebc575b3..2d5b46c9c8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,4 @@ +include Makefile.include AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \ -I$(builddir) $(BOOST_INCLUDES) $(BDB_CPPFLAGS) @@ -47,6 +48,10 @@ bitcoind_LDADD = libbitcoin.a leveldb/libleveldb.a leveldb/libmemenv.a \ bitcoind_SOURCES = bitcoind.cpp # +if TARGET_WINDOWS +bitcoind_SOURCES += bitcoin-res.rc +endif + AM_CPPFLAGS += $(BDB_CPPFLAGS) bitcoind_LDADD += $(BDB_LIBS) diff --git a/src/bitcoin-res.rc b/src/bitcoin-res.rc new file mode 100644 index 0000000000..202b7ab352 --- /dev/null +++ b/src/bitcoin-res.rc @@ -0,0 +1,36 @@ +#include // needed for VERSIONINFO +#include "clientversion.h" // holds the needed client version information + +#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD +#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD) +#define VER_FILEVERSION VER_PRODUCTVERSION +#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR +#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin developers" + +VS_VERSION_INFO VERSIONINFO +FILEVERSION VER_FILEVERSION +PRODUCTVERSION VER_PRODUCTVERSION +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_APP +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" // U.S. English - multilingual (hex) + BEGIN + VALUE "CompanyName", "Bitcoin" + VALUE "FileDescription", "Bitcoind (OSS daemon/client for Bitcoin)" + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "InternalName", "bitcoind" + VALUE "LegalCopyright", COPYRIGHT_STR + VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." + VALUE "OriginalFilename", "bitcoind.exe" + VALUE "ProductName", "Bitcoind" + VALUE "ProductVersion", VER_PRODUCTVERSION_STR + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal) + END +END From 5ceb9c963700d4639fb3210b98aa028113e2a9c4 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Wed, 18 Sep 2013 17:39:18 -0400 Subject: [PATCH 4/4] win32: only check for windres for win32, and fail if missing --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 11357669dd..0e69903025 100644 --- a/configure.ac +++ b/configure.ac @@ -125,7 +125,6 @@ AC_PROG_MKDIR_P AC_PROG_SED AC_PATH_TOOL(AR, ar) AC_PATH_TOOL(RANLIB, ranlib) -AC_PATH_TOOL(WINDRES, windres) AC_PATH_TOOL(STRIP, strip) AC_PATH_TOOL(GCOV, gcov) AC_PATH_PROG(LCOV, lcov) @@ -183,6 +182,11 @@ case $host in AC_MSG_WARN("makensis not found. Cannot create installer.") fi + AC_PATH_TOOL(WINDRES, windres, none) + if test x$WINDRES = xnone; then + AC_MSG_ERROR("windres not found") + fi + CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB" LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE" CXXFLAGS="$CXXFLAGS -w"