You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.5 KiB

  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. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=pcapplusplus
  9. PKG_VERSION:=21.11
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source-linux.tar.gz
  12. PKG_HASH:=a936aa5b11dcb6d2ad764749d339fc683021bbf8badc1e493e17e61e50a1cbb1
  13. PKG_SOURCE_URL:=https://github.com/seladb/PcapPlusPlus/releases/download/v$(PKG_VERSION)/
  14. PKG_BUILD_DIR:=$(BUILD_DIR)/pcapplusplus-$(PKG_VERSION)-source-linux
  15. PKG_LICENSE:=Unlicense
  16. PKG_LICENSE_FILES:=LICENSE
  17. include $(INCLUDE_DIR)/package.mk
  18. define Package/pcapplusplus
  19. SECTION:=net
  20. CATEGORY:=Network
  21. URL:=https://pcapplusplus.github.io/
  22. TITLE:=Library for getting information about the passing traffic
  23. DEPENDS:=+libpcap +libstdcpp
  24. endef
  25. define Build/Compile
  26. cd $(PKG_BUILD_DIR)/PcapPlusPlus; ./configure-linux.sh --install-dir /usr
  27. make -C $(PKG_BUILD_DIR)/PcapPlusPlus CXXFLAGS="$(TARGET_CXXFLAGS) -fPIC" CFLAGS="$(TARGET_CFLAGS) -fPIC" CXX=$(TARGET_CXX) CC=$(TARGET_CC) AR=$(TARGET_AR) libs
  28. endef
  29. define Build/InstallDev
  30. $(INSTALL_DIR) $(1)/usr/include
  31. $(CP) $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/header/*.h $(1)/usr/include
  32. $(INSTALL_DIR) $(1)/usr/lib
  33. # Convert static libraries to shared ones
  34. $(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
  35. $(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
  36. $(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
  37. $(CP) $(PKG_BUILD_DIR)/PcapPlusPlus/Dist/lib*.a $(1)/usr/lib
  38. endef
  39. define Package/pcapplusplus/install
  40. $(INSTALL_DIR) $(1)/usr/lib
  41. # Convert static libraries to shared ones
  42. $(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
  43. $(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
  44. $(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
  45. endef
  46. $(eval $(call BuildPackage,pcapplusplus))