diff options
| author | seladb <pcapplusplus@gmail.com> | 2021-07-22 15:11:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-22 15:11:30 -0700 |
| commit | 10c81db0c95f91acfc97e7f51f58c3834a1c9892 (patch) | |
| tree | 9368e134baaabf68da74ec31d9f17b0211f4de52 | |
| parent | d12cbb40ed3eb0eb60b844585f57a5d0b6ed0c23 (diff) | |
| download | vcpkg-10c81db0c95f91acfc97e7f51f58c3834a1c9892.tar.gz vcpkg-10c81db0c95f91acfc97e7f51f58c3834a1c9892.zip | |
[pcapplusplus] New port (#18899)
* Add PcapPlusPlus port
* Fix non-windows installation
* Run json formatting and x-add-version
* Run x-add-version
* Fix sha
* Apply suggestions to `vcpkg.json` from code review
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
* Fix versions
* Fix sha for pcapplusplus.json
* Apply suggestions from code review
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
* Revert back from 'version' to 'version-string'
* Apply suggestions from code review
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
* Fix SHA in pcapplusplus.json
* Remove the patches and copy the lib files from the `Dist` folder
* Fix sha
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
| -rw-r--r-- | ports/pcapplusplus/portfile.cmake | 103 | ||||
| -rw-r--r-- | ports/pcapplusplus/vcpkg.json | 20 | ||||
| -rw-r--r-- | versions/baseline.json | 4 | ||||
| -rw-r--r-- | versions/p-/pcapplusplus.json | 9 |
4 files changed, 136 insertions, 0 deletions
diff --git a/ports/pcapplusplus/portfile.cmake b/ports/pcapplusplus/portfile.cmake new file mode 100644 index 000000000..2ec3eea70 --- /dev/null +++ b/ports/pcapplusplus/portfile.cmake @@ -0,0 +1,103 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO seladb/PcapPlusPlus + REF v21.05 + SHA512 35227707a48f0e41469247e0993c4aabef7f168a285354e19386b554e0e3d51dc6bf8b128658e16d50e0b6e6e0a029322dee1b4b241e84b8603e2cf73c7f3532 + HEAD_REF master +) + +if(VCPKG_TARGET_IS_WINDOWS) + if(VCPKG_PLATFORM_TOOLSET STREQUAL "v140") + set(VS_VERSION "vs2015") + elseif(VCPKG_PLATFORM_TOOLSET STREQUAL "v141") + set(VS_VERSION "vs2017") + elseif(VCPKG_PLATFORM_TOOLSET STREQUAL "v142") + set(VS_VERSION "vs2019") + else() + message(FATAL_ERROR "Unsupported visual studio version") + endif() + + vcpkg_execute_required_process( + COMMAND configure-windows-visual-studio.bat -v ${VS_VERSION} -w . -p . + WORKING_DIRECTORY ${SOURCE_PATH} + ) + + vcpkg_install_msbuild( + SOURCE_PATH "${SOURCE_PATH}" + PROJECT_SUBPATH "mk/${VS_VERSION}/Common++.vcxproj" + PLATFORM ${TRIPLET_SYSTEM_ARCH} + INCLUDES_SUBPATH Dist/header + ALLOW_ROOT_INCLUDES + USE_VCPKG_INTEGRATION + ) + vcpkg_install_msbuild( + SOURCE_PATH "${SOURCE_PATH}" + PROJECT_SUBPATH "mk/${VS_VERSION}/Packet++.vcxproj" + PLATFORM ${TRIPLET_SYSTEM_ARCH} + INCLUDES_SUBPATH Dist/header + ALLOW_ROOT_INCLUDES + USE_VCPKG_INTEGRATION + ) + vcpkg_install_msbuild( + SOURCE_PATH "${SOURCE_PATH}" + PROJECT_SUBPATH "mk/${VS_VERSION}/Pcap++.vcxproj" + PLATFORM ${TRIPLET_SYSTEM_ARCH} + USE_VCPKG_INTEGRATION + INCLUDES_SUBPATH Dist/header + ALLOW_ROOT_INCLUDES + LICENSE_SUBPATH LICENSE + ) + + # Lib + file(GLOB LIB_FILES_RELEASE "${SOURCE_PATH}/Dist/**/Release/*") + file( + INSTALL ${LIB_FILES_RELEASE} + DESTINATION ${CURRENT_PACKAGES_DIR}/lib + ) + file(GLOB LIB_FILES_RELEASE "${SOURCE_PATH}/Dist/**/Debug/*") + file( + INSTALL ${LIB_FILES_RELEASE} + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib + ) + + file( + REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/tools" "${CURRENT_PACKAGES_DIR}/lib/LightPcapNg.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/LightPcapNg.lib" + ) +else() + if(VCPKG_TARGET_IS_LINUX) + set(CONFIG_CMD "./configure-linux.sh") + elseif(VCPKG_TARGET_IS_OSX) + set(CONFIG_CMD "./configure-mac_os_x.sh") + else() + message(FATAL_ERROR "Unsupported platform") + endif() + + vcpkg_execute_required_process( + COMMAND ${SOURCE_PATH}/${CONFIG_CMD} --libpcap-include-dir ${CURRENT_INSTALLED_DIR}/include + WORKING_DIRECTORY ${SOURCE_PATH} + ) + + vcpkg_execute_build_process( + COMMAND make libs + WORKING_DIRECTORY ${SOURCE_PATH} + ) + + # Lib + file(GLOB LIB_FILES "${SOURCE_PATH}/Dist/*.a") + file( + INSTALL ${LIB_FILES} + DESTINATION ${CURRENT_PACKAGES_DIR}/lib + ) + + # Include + file(GLOB HEADER_FILES "${SOURCE_PATH}/Dist/header/*.h") + file( + INSTALL ${HEADER_FILES} + DESTINATION ${CURRENT_PACKAGES_DIR}/include + ) + + # Copyright + file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +endif() diff --git a/ports/pcapplusplus/vcpkg.json b/ports/pcapplusplus/vcpkg.json new file mode 100644 index 000000000..40a35228f --- /dev/null +++ b/ports/pcapplusplus/vcpkg.json @@ -0,0 +1,20 @@ +{ + "name": "pcapplusplus", + "version-string": "21.05", + "description": "PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets", + "homepage": "https://github.com/seladb/PcapPlusPlus", + "dependencies": [ + { + "name": "libpcap", + "platform": "!windows" + }, + { + "name": "pthreads", + "platform": "windows" + }, + { + "name": "winpcap", + "platform": "windows" + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 39d17150a..dc4b1ac20 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4800,6 +4800,10 @@ "baseline": "0.5.14", "port-version": 4 }, + "pcapplusplus": { + "baseline": "21.05", + "port-version": 0 + }, "pcg": { "baseline": "2021-04-06", "port-version": 0 diff --git a/versions/p-/pcapplusplus.json b/versions/p-/pcapplusplus.json new file mode 100644 index 000000000..35f3a210c --- /dev/null +++ b/versions/p-/pcapplusplus.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "946d7783c459b46253318626bee9040e4e07bc56", + "version-string": "21.05", + "port-version": 0 + } + ] +} |
