aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libtins
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libtins
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libtins')
-rw-r--r--vcpkg/ports/libtins/find-pcap_static.patch13
-rw-r--r--vcpkg/ports/libtins/fix-source-writes.patch36
-rw-r--r--vcpkg/ports/libtins/fix_include.patch22
-rw-r--r--vcpkg/ports/libtins/portfile.cmake49
-rw-r--r--vcpkg/ports/libtins/vcpkg.json21
5 files changed, 141 insertions, 0 deletions
diff --git a/vcpkg/ports/libtins/find-pcap_static.patch b/vcpkg/ports/libtins/find-pcap_static.patch
new file mode 100644
index 0000000..7134b0c
--- /dev/null
+++ b/vcpkg/ports/libtins/find-pcap_static.patch
@@ -0,0 +1,13 @@
+diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake
+index 388b30b..f5264c3 100644
+--- a/cmake/Modules/FindPCAP.cmake
++++ b/cmake/Modules/FindPCAP.cmake
+@@ -38,7 +38,7 @@ if (${CMAKE_SIZEOF_VOID_P} EQUAL 8 AND WIN32)
+ endif ()
+
+ find_library(PCAP_LIBRARY
+- NAMES pcap wpcap
++ NAMES pcap wpcap pcap_static NAMES_PER_DIR
+ HINTS ${HINT_DIR}
+ )
+
diff --git a/vcpkg/ports/libtins/fix-source-writes.patch b/vcpkg/ports/libtins/fix-source-writes.patch
new file mode 100644
index 0000000..251b4f2
--- /dev/null
+++ b/vcpkg/ports/libtins/fix-source-writes.patch
@@ -0,0 +1,36 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1e13def..eda8d68 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -228,8 +228,9 @@ ENDIF(DOXYGEN_FOUND)
+ # Configuration file
+ CONFIGURE_FILE(
+ "${PROJECT_SOURCE_DIR}/include/tins/config.h.in"
+- "${PROJECT_SOURCE_DIR}/include/tins/config.h"
++ "${PROJECT_BINARY_DIR}/include/tins/config.h"
+ )
++INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/include")
+
+ IF (NOT CMAKE_INSTALL_LIBDIR)
+ SET(CMAKE_INSTALL_LIBDIR lib)
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index e07772e..94bc8bf 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -82,7 +82,7 @@ set(HEADERS
+ ${LIBTINS_INCLUDE_DIR}/tins/handshake_capturer.h
+ ${LIBTINS_INCLUDE_DIR}/tins/stp.h
+ ${LIBTINS_INCLUDE_DIR}/tins/pppoe.h
+- ${LIBTINS_INCLUDE_DIR}/tins/config.h
++ ${PROJECT_BINARY_DIR}/include/tins/config.h
+ ${LIBTINS_INCLUDE_DIR}/tins/constants.h
+ ${LIBTINS_INCLUDE_DIR}/tins/crypto.h
+ ${LIBTINS_INCLUDE_DIR}/tins/cxxstd.h
+@@ -229,6 +229,7 @@ MACRO(INSTALL_HEADERS_WITH_DIRECTORY HEADER_LIST)
+ FOREACH(HEADER ${HEADERS})
+ # Extract directory name and remove leading '../'
+ get_filename_component(DIR ${HEADER} PATH)
++ string(REPLACE "${PROJECT_BINARY_DIR}/" "" DIR ${DIR})
+ STRING(REGEX REPLACE "^\\.\\.\\/" "" DIR ${DIR})
+ INSTALL(FILES ${HEADER} DESTINATION ${DIR})
+ ENDFOREACH(HEADER)
diff --git a/vcpkg/ports/libtins/fix_include.patch b/vcpkg/ports/libtins/fix_include.patch
new file mode 100644
index 0000000..c069cc0
--- /dev/null
+++ b/vcpkg/ports/libtins/fix_include.patch
@@ -0,0 +1,22 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 94bc8bf..14a15e9 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -211,6 +211,7 @@ ADD_LIBRARY(
+ )
+
+ TARGET_LINK_LIBRARIES(tins ${PCAP_LIBRARY} ${OPENSSL_LIBRARIES} ${LIBTINS_OS_LIBS})
++target_include_directories(tins PUBLIC $<INSTALL_INTERFACE:include>)
+
+ SET_TARGET_PROPERTIES(tins PROPERTIES OUTPUT_NAME tins)
+ SET_TARGET_PROPERTIES(tins PROPERTIES VERSION ${LIBTINS_VERSION} SOVERSION ${LIBTINS_VERSION} )
+diff --git a/libtins.pc.in b/libtins.pc.in
+index e9a5c29..c7e3f6c 100644
+--- a/libtins.pc.in
++++ b/libtins.pc.in
+@@ -7,4 +7,4 @@ Name: libtins
+ Description: C++ packet crafting, sniffing and interpretation library.
+ Version: @pkgconfig_version@
+ Libs: -L${libdir} -ltins
+-Cflags: -I${includedir}/tins
++Cflags: -I${includedir}
diff --git a/vcpkg/ports/libtins/portfile.cmake b/vcpkg/ports/libtins/portfile.cmake
new file mode 100644
index 0000000..5d46ddb
--- /dev/null
+++ b/vcpkg/ports/libtins/portfile.cmake
@@ -0,0 +1,49 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO mfontanini/libtins
+ REF "v${VERSION}"
+ SHA512 d8887949cb545dbaf4247c8405feb5cc1032f370bb418dd5344043dc97555b1b826a8d33cfc7dd0a7a9a9af6f3a46bd6fcbed89f98d5eb23fdd10294f823fcd6
+ HEAD_REF master
+ PATCHES
+ fix-source-writes.patch
+ find-pcap_static.patch
+ fix_include.patch
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBTINS_BUILD_SHARED)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DLIBTINS_BUILD_SHARED=${LIBTINS_BUILD_SHARED}
+ -DLIBTINS_ENABLE_CXX11=1
+ -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=1
+)
+
+vcpkg_cmake_install()
+vcpkg_fixup_pkgconfig()
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_cmake_config_fixup(CONFIG_PATH CMake)
+else()
+ vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/libtins)
+endif()
+
+vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/libtins/libtinsConfig.cmake" "set(LIBTINS_INCLUDE_DIRS \"${SOURCE_PATH}/include\")" [[
+get_filename_component(LIBTINS_CMAKE_DIR "${LIBTINS_CMAKE_DIR}" PATH)
+get_filename_component(LIBTINS_CMAKE_DIR "${LIBTINS_CMAKE_DIR}" PATH)
+set(LIBTINS_INCLUDE_DIRS "${LIBTINS_CMAKE_DIR}/include")
+]])
+
+vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/libtins/libtinsConfig.cmake" "\${LIBTINS_CMAKE_DIR}/libtinsTargets.cmake" "\${CMAKE_CURRENT_LIST_DIR}/libtinsTargets.cmake")
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/tins/macros.h" "!defined(TINS_STATIC)" "1")
+else()
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/tins/macros.h" "!defined(TINS_STATIC)" "0")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libtins" RENAME copyright)
diff --git a/vcpkg/ports/libtins/vcpkg.json b/vcpkg/ports/libtins/vcpkg.json
new file mode 100644
index 0000000..8dcb5c0
--- /dev/null
+++ b/vcpkg/ports/libtins/vcpkg.json
@@ -0,0 +1,21 @@
+{
+ "name": "libtins",
+ "version": "4.5",
+ "description": "High-level, multiplatform C++ network packet sniffing and crafting library",
+ "license": "BSD-2-Clause",
+ "supports": "!uwp",
+ "dependencies": [
+ "boost-any",
+ "boost-icl",
+ "libpcap",
+ "openssl",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}