MiniUPNPc : new recipe (#1775)

This commit is contained in:
miqlas
2017-11-04 17:42:22 +01:00
committed by Jérôme Duval
parent c6b8de9443
commit 94b8ea2d2c
2 changed files with 197 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
SUMMARY="UPnP IGD client lightweight library"
DESCRIPTION="The usage of the miniUPnP client library is useful whenever an \
application needs to listen for incoming connections.
Examples : P2P applications, FTP clients for active mode, IRC (for DCC)
or IM applications, network games, any server."
HOMEPAGE="http://miniupnp.free.fr"
COPYRIGHT="2005-2016 Thomas Bernard"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="http://miniupnp.free.fr/files/miniupnpc-$portVersion.tar.gz"
CHECKSUM_SHA256='148517020581260c8a2fa532224870bc53e59004777affcaf27ef636a72825d4'
PATCHES="miniupnpc-$portVersion.patchset"
ARCHITECTURES="?x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="?x86"
PROVIDES="
miniupnpc$secondaryArchSuffix = $portVersion
lib:libminiupnpc$secondaryArchSuffix = 2.0.0 compat >= 2
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
miniupnpc${secondaryArchSuffix}_devel = $portVersion
devel:libminiupnpc$secondaryArchSuffix = 2.0.0 compat >= 2
"
REQUIRES_devel="
miniupnpc$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:cmake
cmd:make
"
BUILD()
{
mkdir -p build && cd "$_"
cmake \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_BUILD_TYPE=release \
-Wno-dev \
..
make $jobArgs
}
INSTALL()
{
make -C build install
mkdir -p $includeDir
mv $prefix/include/* $includeDir
rmdir $prefix/include
if [ -n "$secondaryArchSuffix" ]; then
mv $prefix/lib $prefix/lib2
mkdir -p $libDir
mv $prefix/lib2/* $libDir/
rmdir $prefix/lib2
fi
prepareInstalledDevelLibs libminiupnpc
packageEntries devel \
$developDir
}

View File

@@ -0,0 +1,127 @@
From 16d30832c4904176ed3da24722479af76ff9768d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 4 Nov 2017 12:28:39 +0100
Subject: Haiku got no IP_MREQN
diff --git a/minissdpc.c b/minissdpc.c
index 3479de8..8d9aebc 100644
--- a/minissdpc.c
+++ b/minissdpc.c
@@ -67,7 +67,7 @@ struct sockaddr_un {
#define PRINT_SOCKET_ERROR(x) perror(x)
#endif
-#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__)
+#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__) && !defined(__HAIKU__)
#define HAS_IP_MREQN
#endif
--
2.14.2
From 6469b592119544458368771223bfbf58ae8e8b7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 4 Nov 2017 12:35:06 +0100
Subject: On Haiku SIOCGIFADDR lives in sys/sockio.h
diff --git a/minissdpc.c b/minissdpc.c
index 8d9aebc..f492a27 100644
--- a/minissdpc.c
+++ b/minissdpc.c
@@ -75,6 +75,8 @@ struct sockaddr_un {
#include <sys/ioctl.h>
#if defined(__sun)
#include <sys/sockio.h>
+#elif defined(__HAIKU__)
+#include <sys/sockio.h>
#endif
#endif
--
2.14.2
From ced64c1ef646fdce2a7a674514a4fba93ba33e0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 4 Nov 2017 12:38:06 +0100
Subject: atoui was already taken
diff --git a/portlistingparse.c b/portlistingparse.c
index d1954f5..ac0ced7 100644
--- a/portlistingparse.c
+++ b/portlistingparse.c
@@ -31,7 +31,7 @@ static const struct {
/* Helper function */
static UNSIGNED_INTEGER
-atoui(const char * p, int l)
+atoui2(const char * p, int l)
{
UNSIGNED_INTEGER r = 0;
while(l > 0 && *p)
@@ -107,7 +107,7 @@ data(void * d, const char * data, int l)
pm->remoteHost[l] = '\0';
break;
case NewExternalPort:
- pm->externalPort = (unsigned short)atoui(data, l);
+ pm->externalPort = (unsigned short)atoui2(data, l);
break;
case NewProtocol:
if(l > 3)
@@ -116,21 +116,21 @@ data(void * d, const char * data, int l)
pm->protocol[l] = '\0';
break;
case NewInternalPort:
- pm->internalPort = (unsigned short)atoui(data, l);
+ pm->internalPort = (unsigned short)atoui2(data, l);
break;
case NewInternalClient:
memcpy(pm->internalClient, data, l);
pm->internalClient[l] = '\0';
break;
case NewEnabled:
- pm->enabled = (unsigned char)atoui(data, l);
+ pm->enabled = (unsigned char)atoui2(data, l);
break;
case NewDescription:
memcpy(pm->description, data, l);
pm->description[l] = '\0';
break;
case NewLeaseTime:
- pm->leaseTime = atoui(data, l);
+ pm->leaseTime = atoui2(data, l);
break;
default:
break;
--
2.14.2
From adbacfa365ac35160e44a485b50c5113301eb859 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 4 Nov 2017 12:41:17 +0100
Subject: Haiku got networking stuffs in -lnetwork
diff --git a/CMakeLists.txt b/CMakeLists.txt
index adb30ef..28ec485 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,6 +106,10 @@ if (WIN32)
# set (LDLIBS ${SOCKET_LIBRARY} ${NSL_LIBRARY} ${RESOLV_LIBRARY} ${LDLIBS})
endif (WIN32)
+if (HAIKU)
+ list(APPEND LDLIBS -lnetwork)
+endif (HAIKU)
+
if (NOT UPNPC_BUILD_STATIC AND NOT UPNPC_BUILD_SHARED)
message (FATAL "Both shared and static libraries are disabled!")
endif (NOT UPNPC_BUILD_STATIC AND NOT UPNPC_BUILD_SHARED)
--
2.14.2