From a5b63c14c551da2d7d6b67fe65a6d189b4fc5bce Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 15 Jun 2019 14:20:09 -0700 Subject: [PATCH] libnatpmp: Switch to CMake Allows simplifying the Makefile. CMake patch is from upstream. Signed-off-by: Rosen Penev --- libs/libnatpmp/Makefile | 29 ++++------ .../patches/001-install_declspec.patch | 11 ---- libs/libnatpmp/patches/010-cmake.patch | 53 +++++++++++++++++++ 3 files changed, 63 insertions(+), 30 deletions(-) delete mode 100644 libs/libnatpmp/patches/001-install_declspec.patch create mode 100644 libs/libnatpmp/patches/010-cmake.patch diff --git a/libs/libnatpmp/Makefile b/libs/libnatpmp/Makefile index b7b52b4a60..6e2dce29d3 100644 --- a/libs/libnatpmp/Makefile +++ b/libs/libnatpmp/Makefile @@ -9,22 +9,25 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnatpmp PKG_VERSION:=20150609 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://miniupnp.tuxfamily.org/files PKG_HASH:=e1aa9c4c4219bc06943d6b2130f664daee213fb262fcb94dd355815b8f4536b0 -PKG_MAINTAINER:=Hauke Mehrtens -PKG_LICENSE:=BSD-3c + +PKG_MAINTAINER:=Rosen Penev +PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE -PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 +CMAKE_INSTALL:=1 include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk define Package/libnatpmp/Default TITLE:=NAT Port Mapping Protocol (NAT-PMP) - URL:=http://miniupnp.free.fr/libnatpmp.html + URL:=https://miniupnp.tuxfamily.org/libnatpmp.html endef define Package/libnatpmp/Default/description @@ -39,6 +42,7 @@ define Package/libnatpmp SECTION:=libs CATEGORY:=Libraries TITLE+= library + ABI_VERSION:=1 endef define Package/libnatpmp/description @@ -60,22 +64,9 @@ define Package/natpmpc/description This package contains the natpmp client. endef -MAKE_FLAGS += \ - COPTS="$(TARGET_CFLAGS)" \ - PREFIX="$(PKG_INSTALL_DIR)" \ - OS="Linux" - -define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/declspec.h $(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/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnatpmp.so.* $(1)/usr/lib/ endef define Package/natpmpc/install diff --git a/libs/libnatpmp/patches/001-install_declspec.patch b/libs/libnatpmp/patches/001-install_declspec.patch deleted file mode 100644 index d79dd3f6dd..0000000000 --- a/libs/libnatpmp/patches/001-install_declspec.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -56,7 +56,7 @@ else - endif - endif - --HEADERS = natpmp.h -+HEADERS = natpmp.h declspec.h - - EXECUTABLES = testgetgateway natpmpc-shared natpmpc-static - diff --git a/libs/libnatpmp/patches/010-cmake.patch b/libs/libnatpmp/patches/010-cmake.patch new file mode 100644 index 0000000000..c3909ed63d --- /dev/null +++ b/libs/libnatpmp/patches/010-cmake.patch @@ -0,0 +1,53 @@ +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,50 @@ ++cmake_minimum_required(VERSION 2.8.12) ++ ++if(POLICY CMP0048) ++ cmake_policy(SET CMP0048 NEW) ++endif() ++ ++project(natpmp C) ++ ++set (NATPMP_VERSION 20150609) ++set (NATPMP_API_VERSION 1) ++ ++set (NATPMP_SOURCES ++ natpmp.c ++ getgateway.c ++) ++ ++if (WIN32) ++ set (NATPMP_SOURCES ${NATPMP_SOURCES} wingettimeofday.c) ++endif (WIN32) ++ ++# Library itself ++add_library(natpmp SHARED ${NATPMP_SOURCES}) ++set_target_properties (natpmp PROPERTIES OUTPUT_NAME "natpmp") ++set_target_properties (natpmp PROPERTIES VERSION ${NATPMP_VERSION}) ++set_target_properties (natpmp PROPERTIES SOVERSION ${NATPMP_API_VERSION}) ++target_compile_definitions(natpmp PRIVATE -DENABLE_STRNATPMPERR) ++target_include_directories(natpmp PUBLIC ${CMAKE_CURRENT_LIST_DIR}) ++ ++if (WIN32) ++ target_link_libraries(natpmp PUBLIC ws2_32 Iphlpapi) ++ target_compile_definitions(natpmp PUBLIC -DNATPMP_STATICLIB) ++endif (WIN32) ++ ++install(TARGETS natpmp ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib${LIB_SUFFIX} ++ ARCHIVE DESTINATION lib${LIB_SUFFIX}) ++ ++# Executables ++add_executable(natpmpc natpmpc.c) ++target_link_libraries(natpmpc natpmp) ++ ++install(FILES natpmpc DESTINATION bin) ++ ++add_executable(testgetgateway ++ testgetgateway.c ++ getgateway.c) ++target_link_libraries(testgetgateway natpmp) ++ ++install(FILES natpmp.h DESTINATION include) -- 2.30.2