ports/177987: games/megaglest: fix build
Stefan Ehmann
shoesoft at gmx.net
Sat Apr 20 08:20:01 UTC 2013
>Number: 177987
>Category: ports
>Synopsis: games/megaglest: fix build
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Apr 20 08:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Stefan Ehmann
>Release: FreeBSD 9.1-RELEASE-p1 amd64
>Organization:
>Environment:
System: FreeBSD 9.1-RELEASE-p1 #1 r247006M: Tue Feb 19 21:33:53 CET 2013
stefan at walrus.pepperland:/usr/obj/usr/src/sys/WALRUS
>Description:
megaglest build fails with recent versions of miniupnpc
apply patch obtained from megaglest SVN r3958
>How-To-Repeat:
>Fix:
--- patch-megaglest-miniupnpc begins here ---
diff -ruN megaglest.org/files/patch-miniupnpc-1.7 megaglest/files/patch-miniupnpc-1.7
--- megaglest.org/files/patch-miniupnpc-1.7 1970-01-01 01:00:00.000000000 +0100
+++ megaglest/files/patch-miniupnpc-1.7 2013-04-20 09:57:15.000000000 +0200
@@ -0,0 +1,170 @@
+Index: source/shared_lib/sources/platform/posix/socket.cpp
+===================================================================
+--- source/shared_lib/sources/platform/posix/socket.cpp (revision 3957)
++++ source/shared_lib/sources/platform/posix/socket.cpp (revision 3958)
+@@ -2478,13 +2478,22 @@
+ if(SystemFlags::VERBOSE_MODE_ENABLED) printf("UPnP device found: %s %s\n", dev->descURL, dev->st);
+
+ //printf("UPnP device found: [%s] [%s] lanaddr [%s]\n", dev->descURL, dev->st,lanaddr);
++#ifndef MINIUPNPC_VERSION_PRE1_7
++ descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, (sizeof(lanaddr) / sizeof(lanaddr[0])),0);
++#else
+ descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, (sizeof(lanaddr) / sizeof(lanaddr[0])));
++#endif
+ if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"LAN address: %s\n", lanaddr);
+
+ if (descXML) {
+ parserootdesc (descXML, descXMLsize, &data);
+ free (descXML); descXML = 0;
++
++#ifndef MINIUPNPC_VERSION_PRE1_7
++ GetUPNPUrls (&urls, &data, dev->descURL,0);
++#else
+ GetUPNPUrls (&urls, &data, dev->descURL);
++#endif
+ }
+ snprintf(buf, 255,"UPnP device found: %s %s LAN address %s", dev->descURL, dev->st, lanaddr);
+
+Index: source/shared_lib/CMakeLists.txt
+===================================================================
+--- source/shared_lib/CMakeLists.txt (revision 3957)
++++ source/shared_lib/CMakeLists.txt (revision 3958)
+@@ -297,7 +297,12 @@
+ ADD_DEFINITIONS(-DMINIUPNPC_VERSION_PRE1_6)
+ message(STATUS "Adding macro for miniupnpc version: pre v1.6")
+ ENDIF()
+- IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6)
++ IF(MINIUPNPC_VERSION_PRE1_7)
++ ADD_DEFINITIONS(-DMINIUPNPC_VERSION_PRE1_7)
++ message(STATUS "Adding macro for miniupnpc version: pre v1.7")
++ ENDIF()
++
++ IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7)
+ message(STATUS "**No macros required for miniupnpc version")
+ ENDIF()
+
+Index: mk/cmake/Modules/FindMiniupnpc.cmake
+===================================================================
+--- mk/cmake/Modules/FindMiniupnpc.cmake (revision 3957)
++++ mk/cmake/Modules/FindMiniupnpc.cmake (revision 3958)
+@@ -58,20 +58,16 @@
+ #include <stdio.h>
+ int main()
+ {
+- struct UPNPDev *devlist = NULL;
+- int upnp_delay = 5000;
+- const char *upnp_multicastif = NULL;
+- const char *upnp_minissdpdsock = NULL;
+- int upnp_sameport = 0;
+- int upnp_ipv6 = 0;
+- int upnp_error = 0;
+- devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport, upnp_ipv6, &upnp_error);
++ static struct UPNPUrls urls;
++ static struct IGDdatas data;
+
++ GetUPNPUrls (&urls, &data, \"myurl\",0);
++
+ return 0;
+ }"
+- MINIUPNPC_VERSION_1_6_OR_HIGHER)
+-
+- IF (NOT MINIUPNPC_VERSION_1_6_OR_HIGHER)
++ MINIUPNPC_VERSION_1_7_OR_HIGHER)
++
++ IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
+ set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
+ check_cxx_source_runs("
+@@ -88,6 +84,30 @@
+ int upnp_sameport = 0;
+ int upnp_ipv6 = 0;
+ int upnp_error = 0;
++ devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport, upnp_ipv6, &upnp_error);
++
++ return 0;
++ }"
++ MINIUPNPC_VERSION_PRE1_7)
++ ENDIF()
++
++ IF (NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
++ set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
++ set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
++ check_cxx_source_runs("
++ #include <miniwget.h>
++ #include <miniupnpc.h>
++ #include <upnpcommands.h>
++ #include <stdio.h>
++ int main()
++ {
++ struct UPNPDev *devlist = NULL;
++ int upnp_delay = 5000;
++ const char *upnp_multicastif = NULL;
++ const char *upnp_minissdpdsock = NULL;
++ int upnp_sameport = 0;
++ int upnp_ipv6 = 0;
++ int upnp_error = 0;
+ devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport);
+
+ return 0;
+@@ -96,25 +116,27 @@
+
+ ENDIF()
+
+- set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
+- set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
+- check_cxx_source_runs("
+- #include <miniwget.h>
+- #include <miniupnpc.h>
+- #include <upnpcommands.h>
+- #include <stdio.h>
+- static struct UPNPUrls urls;
+- static struct IGDdatas data;
+- int main()
+- {
+- char externalIP[16] = "";
+- UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIP);
++ IF (NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
++ set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
++ set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
++ check_cxx_source_runs("
++ #include <miniwget.h>
++ #include <miniupnpc.h>
++ #include <upnpcommands.h>
++ #include <stdio.h>
++ static struct UPNPUrls urls;
++ static struct IGDdatas data;
++ int main()
++ {
++ char externalIP[16] = "";
++ UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIP);
+
+- return 0;
+- }"
+- MINIUPNPC_VERSION_1_5_OR_HIGHER)
++ return 0;
++ }"
++ MINIUPNPC_VERSION_1_5_OR_HIGHER)
++ ENDIF()
+
+- IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER)
++ IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
+ set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
+ check_cxx_source_runs("
+@@ -141,10 +163,14 @@
+ IF(MINIUPNPC_VERSION_PRE1_6)
+ message(STATUS "Found miniupnpc version is pre v1.6")
+ ENDIF()
+- IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6)
+- message(STATUS "Found miniupnpc version is v1.6 or higher")
++ IF(MINIUPNPC_VERSION_PRE1_7)
++ message(STATUS "Found miniupnpc version is pre v1.7")
+ ENDIF()
+
++ IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7)
++ message(STATUS "Found miniupnpc version is v1.7 or higher")
++ ENDIF()
++
+ else ()
+ message (STATUS "Could not find miniupnp")
+ endif ()
--- patch-megaglest-miniupnpc ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list