From 642223cef633dd66540808b8df5a7eff7629494b Mon Sep 17 00:00:00 2001 From: Stephen Walker Date: Thu, 23 Jun 2011 00:38:53 +0000 Subject: [PATCH] libnatpmp: add the libnatpmp library SVN-Revision: 27260 --- libs/libnatpmp/Makefile | 82 +++++++++++++++++++ .../libnatpmp/patches/001-cross_compile.patch | 20 +++++ 2 files changed, 102 insertions(+) create mode 100644 libs/libnatpmp/Makefile create mode 100644 libs/libnatpmp/patches/001-cross_compile.patch diff --git a/libs/libnatpmp/Makefile b/libs/libnatpmp/Makefile new file mode 100644 index 000000000..df2ab557e --- /dev/null +++ b/libs/libnatpmp/Makefile @@ -0,0 +1,82 @@ +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libnatpmp +PKG_VERSION:=20110618 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://miniupnp.free.fr/files +PKG_MD5SUM:=6a5fdc8aa6c8602ea96567dabe51d6d3 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/libnatpmp/Default + TITLE:=NAT Port Mapping Protocol (NAT-PMP) + URL:=http://miniupnp.free.fr/libnatpmp.html +endef + +define Package/libnatpmp/Default/description + libnatpmp is an attempt to make a portable and fully compliant implementation + of the protocol for the client side. It is based on non blocking sockets and + all calls of the API are asynchronous. It is therefore very easy to integrate + the NAT-PMP code to any event driven code. +endef + +define Package/libnatpmp + $(call Package/libnatpmp/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+= library +endef + +define Package/libnatpmp/description + $(call Package/libnatpmp/Default/description) + This package contains the shared library. +endef + +define Package/natpmpc + $(call Package/libnatpmp/Default) + SECTION:=net + CATEGORY:=Network + SUBMENU:=Firewall + TITLE+= client + DEPENDS:=+libnatpmp +endef + +define Package/natpmpc/description + $(call Package/libnatpmp/Default/description) + This package contains the natpmp client. +endef + +MAKE_FLAGS += \ + COPTS="$(TARGET_CFLAGS)" \ + PREFIX="$(PKG_INSTALL_DIR)" + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/natpmp.h $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnatpmp*.{so*,a} $(1)/usr/lib/ +endef + +define Package/libnatpmp/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libnatpmp.so.* $(1)/usr/lib/ +endef + +define Package/natpmpc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/natpmpc $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,libnatpmp)) +$(eval $(call BuildPackage,natpmpc)) diff --git a/libs/libnatpmp/patches/001-cross_compile.patch b/libs/libnatpmp/patches/001-cross_compile.patch new file mode 100644 index 000000000..0869f2d93 --- /dev/null +++ b/libs/libnatpmp/patches/001-cross_compile.patch @@ -0,0 +1,20 @@ +--- a/Makefile ++++ b/Makefile +@@ -4,14 +4,15 @@ + # (c) 2007-2011 Thomas Bernard + # http://miniupnp.free.fr/libnatpmp.html + +-OS = $(shell uname -s) ++OS = Linux + CC = gcc + INSTALL = install + + # APIVERSION is used in soname + APIVERSION = 1 + LDFLAGS = -Wl,--no-undefined +-CFLAGS = -O -fPIC -Wall -DENABLE_STRNATPMPERR ++COPTS = -O ++CFLAGS = $(COPTS) -fPIC -Wall -DENABLE_STRNATPMPERR + + LIBOBJS = natpmp.o getgateway.o + -- 2.30.2