From 2d8e396be33463e7ba8df7f1ff3b08d0443e54cb Mon Sep 17 00:00:00 2001 From: Michal Hrusecky Date: Mon, 15 Nov 2021 11:59:39 +0100 Subject: [PATCH] pcapplusplus: Add new package PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use. It provides C++ wrappers for the most popular packet processing engines such as libpcap, WinPcap, DPDK and PF_RING. Signed-off-by: Michal Hrusecky --- libs/pcapplusplus/Makefile | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 libs/pcapplusplus/Makefile diff --git a/libs/pcapplusplus/Makefile b/libs/pcapplusplus/Makefile new file mode 100644 index 0000000000..af44583a10 --- /dev/null +++ b/libs/pcapplusplus/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2021 Michal Hrusecky +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pcapplusplus +PKG_VERSION:=21.11 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source-linux.tar.gz +PKG_HASH:=a936aa5b11dcb6d2ad764749d339fc683021bbf8badc1e493e17e61e50a1cbb1 +PKG_SOURCE_URL:=https://github.com/seladb/PcapPlusPlus/releases/download/v$(PKG_VERSION)/ + +PKG_BUILD_DIR:=$(BUILD_DIR)/pcapplusplus-$(PKG_VERSION)-source-linux + +PKG_LICENSE:=Unlicense +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/pcapplusplus + SECTION:=net + CATEGORY:=Network + URL:=https://pcapplusplus.github.io/ + TITLE:=Library for getting information about the passing traffic + DEPENDS:=+libpcap +libstdcpp +endef + +define Build/Compile + cd $(PKG_BUILD_DIR)/PcapPlusPlus; ./configure-linux.sh --install-dir /usr + make -C $(PKG_BUILD_DIR)/PcapPlusPlus CXXFLAGS="$(TARGET_CXXFLAGS) -fPIC" CFLAGS="$(TARGET_CFLAGS) -fPIC" CXX=$(TARGET_CXX) CC=$(TARGET_CC) AR=$(TARGET_AR) libs +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/header/*.h $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/lib + # Convert static libraries to shared ones + $(TARGET_CXX) $(TARGET_CXXFLAGS) -shared -o $(1)/usr/lib/libCommon++.so -Wl,--whole-archive $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/libCommon++.a -Wl,--no-whole-archive + $(TARGET_CXX) $(TARGET_CXXFLAGS) -shared -o $(1)/usr/lib/libPacket++.so -Wl,--whole-archive $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/libPacket++.a -Wl,--no-whole-archive + $(TARGET_CXX) $(TARGET_CXXFLAGS) -shared -o $(1)/usr/lib/libPcap++.so -Wl,--whole-archive $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/libPcap++.a -Wl,--no-whole-archive + $(CP) $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/lib*.a $(1)/usr/lib +endef + +define Package/pcapplusplus/install + $(INSTALL_DIR) $(1)/usr/lib + # Convert static libraries to shared ones + $(TARGET_CXX) $(TARGET_CXXFLAGS) -shared -o $(1)/usr/lib/libCommon++.so -Wl,--whole-archive $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/libCommon++.a -Wl,--no-whole-archive + $(TARGET_CXX) $(TARGET_CXXFLAGS) -shared -o $(1)/usr/lib/libPacket++.so -Wl,--whole-archive $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/libPacket++.a -Wl,--no-whole-archive + $(TARGET_CXX) $(TARGET_CXXFLAGS) -shared -o $(1)/usr/lib/libPcap++.so -Wl,--whole-archive $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/libPcap++.a -Wl,--no-whole-archive +endef + +$(eval $(call BuildPackage,pcapplusplus)) -- 2.30.2