Merge pull request #20349 from turris-cz/unbound-1171
[feed/packages.git] / libs / pcapplusplus / Makefile
1 #
2 # Copyright (C) 2021 Michal Hrusecky <michal.hrusecky@turris.com>
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=pcapplusplus
11 PKG_VERSION:=21.11
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source-linux.tar.gz
15 PKG_HASH:=a936aa5b11dcb6d2ad764749d339fc683021bbf8badc1e493e17e61e50a1cbb1
16 PKG_SOURCE_URL:=https://github.com/seladb/PcapPlusPlus/releases/download/v$(PKG_VERSION)/
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/pcapplusplus-$(PKG_VERSION)-source-linux
19
20 PKG_LICENSE:=Unlicense
21 PKG_LICENSE_FILES:=LICENSE
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/pcapplusplus
26 SECTION:=net
27 CATEGORY:=Network
28 URL:=https://pcapplusplus.github.io/
29 TITLE:=Library for getting information about the passing traffic
30 DEPENDS:=+libpcap +libstdcpp
31 endef
32
33 define Build/Compile
34 cd $(PKG_BUILD_DIR)/PcapPlusPlus; ./configure-linux.sh --install-dir /usr
35 make -C $(PKG_BUILD_DIR)/PcapPlusPlus CXXFLAGS="$(TARGET_CXXFLAGS) -fPIC" CFLAGS="$(TARGET_CFLAGS) -fPIC" CXX="$(TARGET_CXX)" CC="$(TARGET_CC)" AR=$(TARGET_AR) libs
36 endef
37
38 define Build/InstallDev
39 $(INSTALL_DIR) $(1)/usr/include
40 $(CP) $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/header/*.h $(1)/usr/include
41 $(INSTALL_DIR) $(1)/usr/lib
42 # Convert static libraries to shared ones
43 $(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
44 $(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
45 $(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
46 $(CP) $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/lib*.a $(1)/usr/lib
47 endef
48
49 define Package/pcapplusplus/install
50 $(INSTALL_DIR) $(1)/usr/lib
51 # Convert static libraries to shared ones
52 $(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
53 $(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
54 $(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
55 endef
56
57 $(eval $(call BuildPackage,pcapplusplus))