linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #02052
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2253: Allow build without natupnp/htmlhelp (annoying to find for mingw)
------------------------------------------------------------
revno: 2253
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Tue 2010-10-05 23:48:07 +0200
message:
Allow build without natupnp/htmlhelp (annoying to find for mingw)
modified:
.bzrignore
SConstruct
miniupnpc/miniupnpc.c
win32/MainWindow.cpp
win32/SConscript
win32/UPnP_COM.cpp
win32/UPnP_COM.h
win32/WinUtil.cpp
win32/stdafx.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file '.bzrignore'
--- .bzrignore 2009-04-08 16:42:10 +0000
+++ .bzrignore 2010-10-05 21:48:07 +0000
@@ -14,3 +14,6 @@
./help/cshelp.h
./.pydevproject
./doc
+.sconf_temp
+config.log
+.sconsign.dblite
=== modified file 'SConstruct'
--- SConstruct 2010-09-21 20:28:03 +0000
+++ SConstruct 2010-10-05 21:48:07 +0000
@@ -165,6 +165,8 @@
defs = gcc_defs
env.Tool("gch", toolpath=".")
+ env.Append(CPPPATH = ['#/htmlhelp/include/'])
+ env.Append(LIBPATH = ['#/htmlhelp/lib/'])
env.Append(CPPDEFINES = defs[env['mode']])
env.Append(CPPDEFINES = defs['common'])
@@ -211,6 +213,14 @@
pot_bld = Builder (action = Action([pot_args], 'Extracting messages to $TARGET from $SOURCES'))
env.Append(BUILDERS = {'PotBuild' : pot_bld})
+conf = Configure(env)
+if conf.CheckCHeader("htmlhelp.h"):
+ conf.env.Append(CPPDEFINES="HAVE_HTMLHELP_H")
+ conf.env.Append(LIBS="htmlhelp")
+if conf.CheckCHeader("natupnp.h"):
+ conf.env.Append(CPPDEFINES="HAVE_NATUPNP_H")
+env = conf.Finish()
+
dev.zlib = dev.build('zlib/')
dev.bzip2 = dev.build('bzip2/')
dev.intl = dev.build('intl/')
=== modified file 'miniupnpc/miniupnpc.c'
--- miniupnpc/miniupnpc.c 2010-06-18 12:09:55 +0000
+++ miniupnpc/miniupnpc.c 2010-10-05 21:48:07 +0000
@@ -24,7 +24,7 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>
-#include <IPHlpApi.h>
+#include <iphlpapi.h>
#define snprintf _snprintf
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#define strncasecmp _memicmp
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2010-10-01 14:24:13 +0000
+++ win32/MainWindow.cpp 2010-10-05 21:48:07 +0000
@@ -528,9 +528,11 @@
return true;
}
+#ifdef HAVE_HTMLHELP_H
if(::HtmlHelp(NULL, NULL, HH_PRETRANSLATEMESSAGE, reinterpret_cast<DWORD_PTR>(&msg))) {
return true;
}
+#endif
Container* active = getTabView()->getActive();
if(active) {
=== modified file 'win32/SConscript'
--- win32/SConscript 2010-09-22 15:23:13 +0000
+++ win32/SConscript 2010-10-05 21:48:07 +0000
@@ -11,11 +11,14 @@
env.Prepend(LIBS = ['ssleay32', 'libeay32'])
else:
env.Prepend(LIBS = ['ssl', 'crypto'])
- env.Append(CPPPATH = ['#/htmlhelp/include/'])
- env.Append(LIBPATH = ['#/htmlhelp/lib/'])
-env.Append(LIBS = ['comctl32', 'ws2_32', 'ole32', 'gdi32', 'comdlg32', 'iphlpapi', 'winmm', 'shlwapi', 'htmlhelp', 'oleaut32', 'uuid'])
+
+if 'HAVE_HTMLHELP_H' in env['CPPPATH']:
+ env.Append(LIBS='htmlhelp')
+
+env.Append(LIBS = ['comctl32', 'ws2_32', 'ole32', 'gdi32', 'comdlg32', 'iphlpapi', 'winmm', 'shlwapi', 'oleaut32', 'uuid'])
env.Append(CPPPATH = ['#/openssl/include', '#/miniupnpc', '#/dwt/include', '#/'])
openssl_lib = '#/openssl/lib/'
+
if env['arch'] != 'x86':
openssl_lib += env['arch'] + '/'
env.Append(LIBPATH = [openssl_lib])
=== modified file 'win32/UPnP_COM.cpp'
--- win32/UPnP_COM.cpp 2010-09-09 18:16:26 +0000
+++ win32/UPnP_COM.cpp 2010-10-05 21:48:07 +0000
@@ -26,6 +26,14 @@
#include <ole2.h>
const string UPnP_COM::name = "Standard Windows";
+
+#ifdef HAVE_NATUPNP_H
+// for mingw64
+#ifndef interface
+#define interface struct
+#endif
+
+#include <natupnp.h>
bool UPnP_COM::init() {
// Lacking the __uuidof in mingw...
@@ -144,3 +152,27 @@
return 0;
return ret;
}
+
+#else
+
+bool UPnP_COM::init() {
+ return false;
+}
+
+bool UPnP_COM::add(const unsigned short port, const Protocol protocol, const string& description) {
+ return false;
+}
+
+bool UPnP_COM::remove(const unsigned short port, const Protocol protocol) {
+ return false;
+}
+
+string UPnP_COM::getExternalIP() {
+ return Util::emptyString;
+}
+
+IStaticPortMappingCollection* UPnP_COM::getStaticPortMappingCollection() {
+ return 0;
+}
+
+#endif
=== modified file 'win32/UPnP_COM.h'
--- win32/UPnP_COM.h 2010-09-09 18:16:26 +0000
+++ win32/UPnP_COM.h 2010-10-05 21:48:07 +0000
@@ -21,12 +21,8 @@
#include <dcpp/UPnP.h>
-// for mingw64
-#ifndef interface
-#define interface struct
-#endif
-
-#include <natupnp.h>
+struct IUPnPNAT;
+struct IStaticPortMappingCollection;
class UPnP_COM : public UPnP
{
=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp 2010-09-28 21:29:06 +0000
+++ win32/WinUtil.cpp 2010-10-05 21:48:07 +0000
@@ -47,6 +47,10 @@
#include <dwt/DWTException.h>
#include <dwt/LibraryLoader.h>
+#ifdef HAVE_HTMLHELP_H
+#include <htmlhelp.h>
+#endif
+
// def taken from <gettextP.h>
extern "C" const char *_nl_locale_name_default(void);
@@ -232,7 +236,9 @@
}
}
+#ifdef HAVE_HTMLHELP_H
::HtmlHelp(NULL, NULL, HH_INITIALIZE, reinterpret_cast<DWORD_PTR> (&helpCookie));
+#endif
}
void WinUtil::init_helpPath() {
@@ -268,7 +274,9 @@
}
void WinUtil::uninit() {
+#ifdef HAVE_HTMLHELP_H
::HtmlHelp(NULL, NULL, HH_UNINITIALIZE, helpCookie);
+#endif
}
void WinUtil::enableDEP() {
@@ -877,9 +885,11 @@
// context-sensitive help
new HelpPopup(widget, Text::toT(getHelpText(id)));
} else {
+#ifdef HAVE_HTMLHELP_H
if(id < IDH_BEGIN || id > IDH_END)
id = IDH_INDEX;
::HtmlHelp(widget->handle(), helpPath.c_str(), HH_HELP_CONTEXT, id);
+#endif
}
}
=== modified file 'win32/stdafx.h'
--- win32/stdafx.h 2010-08-06 21:02:04 +0000
+++ win32/stdafx.h 2010-10-05 21:48:07 +0000
@@ -23,8 +23,6 @@
#include <dcpp/DCPlusPlus.h>
#include <shlobj.h>
-#include <malloc.h>
-#include <htmlhelp.h>
#include <libintl.h>
#include <dwt/Application.h>