[pcapplusplus] update to 23.09 (#34767)

* [pcapplusplus] update to 23.09

* vcpkg: run x-add-version --all

* Update ports/pcapplusplus/vcpkg.json

Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>

* Update ports/pcapplusplus/portfile.cmake

Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>

* Update ports/pcapplusplus/vcpkg.json

Co-authored-by: Kai Pastor <dg0yt@darc.de>

* Fix version with leading zero

* Update pcapplusplus.json

* pcapplusplus: update with review

* Update pcapplusplus.json

---------

Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>
Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
Clément Péron 2023-10-31 20:01:51 +01:00 committed by GitHub
parent 21fd2501a0
commit 4a5beaf42d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 131 deletions

View File

@ -1,113 +0,0 @@
cmake_minimum_required(VERSION 3.12)
project(pcapplusplus C CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
if (WIN32)
set(BUILD_SHARED_LIBS OFF)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS ON)
# dependencies
include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
if (WIN32)
find_path(PCAP_INCLUDES NAMES pcap.h)
find_library(PCAP_LIBRARY_RELEASE NAMES wpcap PATH_SUFFIXES lib REQUIRED)
find_library(PCAP_LIBRARY_DEBUG NAMES wpcap PATH_SUFFIXES lib REQUIRED)
find_library(PACKET_LIBRARY_RELEASE NAMES Packet PATH_SUFFIXES lib REQUIRED)
find_library(PACKET_LIBRARY_DEBUG NAMES Packet PATH_SUFFIXES lib REQUIRED)
select_library_configurations(PCAP)
select_library_configurations(PACKET)
list(APPEND PCAP_LIBRARIES ${PACKET_LIBRARIES})
else()
find_path(PCAP_INCLUDES NAMES pcap.h)
find_library(PCAP_LIBRARY_RELEASE NAMES pcap PATH_SUFFIXES lib REQUIRED)
find_library(PCAP_LIBRARY_DEBUG NAMES pcap PATH_SUFFIXES lib REQUIRED)
select_library_configurations(PCAP)
endif()
find_package(Threads REQUIRED)
# common++
file(GLOB COMMONPP_HEADERS "${CMAKE_CURRENT_LIST_DIR}/Common++/header/*.h")
file(GLOB COMMONPP_SOURCES "${CMAKE_CURRENT_LIST_DIR}/Common++/src/*.cpp")
add_library(commonpp ${COMMONPP_SOURCES})
target_include_directories(commonpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common++/header> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/EndianPortable/include> $<INSTALL_INTERFACE:include>)
set_target_properties(commonpp PROPERTIES OUTPUT_NAME Common++)
if (WIN32)
target_compile_definitions(commonpp PRIVATE WPCAP HAVE_REMOTE _CRT_SECURE_NO_WARNINGS)
elseif (UNIX AND NOT APPLE)
target_compile_definitions(commonpp PRIVATE LINUX)
elseif (APPLE)
target_compile_definitions(commonpp PRIVATE MAC_OS_X)
endif()
# packet++
file(GLOB PACKETPP_HEADERS "${CMAKE_CURRENT_LIST_DIR}/Packet++/header/*.h")
file(GLOB PACKETPP_SOURCES "${CMAKE_CURRENT_LIST_DIR}/Packet++/src/*.cpp")
list(APPEND PACKETPP_SOURCES "${CMAKE_CURRENT_LIST_DIR}/3rdParty/hash-library/md5.cpp")
add_library(packetpp ${PACKETPP_SOURCES})
target_include_directories(packetpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Packet++/header> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/hash-library> $<INSTALL_INTERFACE:include>)
target_link_libraries(packetpp PRIVATE commonpp)
set_target_properties(packetpp PROPERTIES OUTPUT_NAME Packet++)
if (WIN32)
target_compile_definitions(packetpp PRIVATE WPCAP HAVE_REMOTE _CRT_SECURE_NO_WARNINGS)
elseif (UNIX AND NOT APPLE)
target_compile_definitions(packetpp PRIVATE LINUX)
elseif (APPLE)
target_compile_definitions(packetpp PRIVATE MAC_OS_X)
endif()
# pcap++
file(GLOB PCAPPP_HEADERS "${CMAKE_CURRENT_LIST_DIR}/Pcap++/header/*.h")
file(GLOB PCAPPP_SOURCES "${CMAKE_CURRENT_LIST_DIR}/Pcap++/src/*.cpp")
file(GLOB LIGHTPCAPNG_SOURCES "${CMAKE_CURRENT_LIST_DIR}/3rdParty/LightPcapNg/LightPcapNg/src/*.c")
add_library(pcappp ${PCAPPP_SOURCES} ${LIGHTPCAPNG_SOURCES})
target_include_directories(pcappp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Pcap++/header> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/LightPcapNg/LightPcapNg/include> "${PCAP_INCLUDES}" $<INSTALL_INTERFACE:include>)
target_link_libraries(pcappp PUBLIC commonpp packetpp ${PCAP_LIBRARIES} Threads::Threads)
if (WIN32)
target_link_libraries(pcappp PUBLIC ws2_32 iphlpapi)
elseif (APPLE)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(SYSTEMCONFIGURATION_LIBRARY SystemConfiguration)
target_link_libraries(pcappp PUBLIC ${COREFOUNDATION_LIBRARY} ${SYSTEMCONFIGURATION_LIBRARY})
endif()
if (WIN32)
target_compile_definitions(pcappp PRIVATE WPCAP HAVE_REMOTE HAVE_STRUCT_TIMESPEC _CRT_SECURE_NO_WARNINGS)
elseif (UNIX AND NOT APPLE)
target_compile_definitions(pcappp PRIVATE LINUX)
elseif (APPLE)
target_compile_definitions(pcappp PRIVATE MAC_OS_X)
endif()
set_target_properties(pcappp PROPERTIES OUTPUT_NAME Pcap++)
# Install
install(FILES ${PCAPPP_HEADERS} ${COMMONPP_HEADERS} ${PACKETPP_HEADERS} DESTINATION include)
install(FILES "${CMAKE_CURRENT_LIST_DIR}/LICENSE" DESTINATION share/pcapplusplus)
install(
TARGETS pcappp commonpp packetpp
EXPORT unofficial-pcapplusplus-config
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(EXPORT unofficial-pcapplusplus-config
NAMESPACE unofficial::pcapplusplus::
DESTINATION share/unofficial-pcapplusplus
)

View File

@ -1,29 +1,31 @@
if (VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
# Convert PcapPlusPlus to add leading zero 23.9 => 23.09
string(REGEX REPLACE "^([0-9]+)[.]([0-9])\$" "\\1.0\\2" PCAPPLUSPLUS_VERSION "${VERSION}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO seladb/PcapPlusPlus
REF v22.11
SHA512 41a507ce385d8549186eeec1a1ae138070ab2021d9ffd907829551b3b865ecb526fa05a0ff9ca01b41a2a2807a60a3cba016f62063d30d849282c83e17a2b6e1
REF "v${PCAPPLUSPLUS_VERSION}"
SHA512 e7dc1dbd85c9f0d2f9c5d3e436456c2cd183fb508c869fa8fb83f46aac99b868a16283204e5d57a0bfd7587f6ac2582b3e14c6098683fad4501708c8fededd6a
HEAD_REF master
)
file(COPY "${CURRENT_PORT_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DPCAPPP_BUILD_EXAMPLES=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/pcapplusplus)
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(APPEND ${CURRENT_PACKAGES_DIR}/share/unofficial-pcapplusplus/unofficial-pcapplusplus-config.cmake "
include(CMakeFindDependencyMacro)
find_dependency(Threads)")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/debug/include"
)
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-pcapplusplus)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -1,6 +1,6 @@
{
"name": "pcapplusplus",
"version": "22.11",
"version": "23.9",
"port-version": 1,
"description": "PcapPlusPlus is a multi-platform C++ library for capturing, parsing and crafting of network packets",
"homepage": "https://github.com/seladb/PcapPlusPlus",
@ -10,10 +10,6 @@
"name": "libpcap",
"platform": "!windows"
},
{
"name": "pthreads",
"platform": "windows"
},
{
"name": "vcpkg-cmake",
"host": true

View File

@ -6409,7 +6409,7 @@
"port-version": 9
},
"pcapplusplus": {
"baseline": "22.11",
"baseline": "23.9",
"port-version": 1
},
"pcg": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "51f8425ebc003224002c45c5f7454ebf2fb79a82",
"version": "23.9",
"port-version": 1
},
{
"git-tree": "3dc217621a6ef6ef4f4bd353a1e5088b15960428",
"version": "22.11",