mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-04 03:09:07 +08:00
[libpcap] Enable compilation of libpcap port on x86-windows and x64-windows (#10731)
* Enable compilation of libpcap port on x86-windows and x64-windows As winpcap and libpcap install the same headers, this two port have been marked as not not compatible, and cannot be installed together. * Update ci.baseline.txt * Add libcrafter failing ports to ci.baseline.txt
This commit is contained in:
parent
50deb3eceb
commit
310f4df34f
@ -1,5 +1,5 @@
|
||||
Source: libpcap
|
||||
Version: 1.9.1-1
|
||||
Version: 1.9.1-2
|
||||
Description: A portable C/C++ library for network traffic capture
|
||||
Homepage: https://www.tcpdump.org/
|
||||
Supports: linux
|
||||
Supports: !(arm64|uwp|osx)
|
||||
|
47
ports/libpcap/add-disable-packet-option.patch
Normal file
47
ports/libpcap/add-disable-packet-option.patch
Normal file
@ -0,0 +1,47 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 3fe9979..23783d3 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -161,6 +161,7 @@ set(SEPTEL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../septel" CACHE PATH "Path to dire
|
||||
option(DISABLE_SNF "Disable Myricom SNF support" OFF)
|
||||
|
||||
option(DISABLE_TC "Disable Riverbed TurboCap support" OFF)
|
||||
+option(DISABLE_PACKET "Disable Packet support" OFF)
|
||||
|
||||
#
|
||||
# Debugging options.
|
||||
@@ -220,19 +221,21 @@ if(WIN32)
|
||||
include_directories(${CMAKE_HOME_DIRECTORY}/../../Common)
|
||||
endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/../../Common)
|
||||
|
||||
- find_package(Packet)
|
||||
- if(PACKET_FOUND)
|
||||
- set(HAVE_PACKET32 TRUE)
|
||||
- include_directories(${PACKET_INCLUDE_DIRS})
|
||||
- #
|
||||
- # Check whether we have the NPcap PacketIsLoopbackAdapter()
|
||||
- # function.
|
||||
- #
|
||||
- cmake_push_check_state()
|
||||
- set(CMAKE_REQUIRED_LIBRARIES ${PACKET_LIBRARIES})
|
||||
- check_function_exists(PacketIsLoopbackAdapter HAVE_PACKET_IS_LOOPBACK_ADAPTER)
|
||||
- cmake_pop_check_state()
|
||||
- endif(PACKET_FOUND)
|
||||
+ if(NOT DISABLE_PACKET)
|
||||
+ find_package(Packet)
|
||||
+ if(PACKET_FOUND)
|
||||
+ set(HAVE_PACKET32 TRUE)
|
||||
+ include_directories(${PACKET_INCLUDE_DIRS})
|
||||
+ #
|
||||
+ # Check whether we have the NPcap PacketIsLoopbackAdapter()
|
||||
+ # function.
|
||||
+ #
|
||||
+ cmake_push_check_state()
|
||||
+ set(CMAKE_REQUIRED_LIBRARIES ${PACKET_LIBRARIES})
|
||||
+ check_function_exists(PacketIsLoopbackAdapter HAVE_PACKET_IS_LOOPBACK_ADAPTER)
|
||||
+ cmake_pop_check_state()
|
||||
+ endif(PACKET_FOUND)
|
||||
+ endif()
|
||||
|
||||
message(STATUS "checking for Npcap's version.h")
|
||||
check_symbol_exists(WINPCAP_PRODUCT_NAME "../../version.h" HAVE_VERSION_H)
|
97
ports/libpcap/install-pc-on-msvc.patch
Normal file
97
ports/libpcap/install-pc-on-msvc.patch
Normal file
@ -0,0 +1,97 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 55b93f1..3fe9979 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -2355,48 +2355,54 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap.h DESTINATION include)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap-bpf.h DESTINATION include)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap-namedb.h DESTINATION include)
|
||||
|
||||
-# On UN*X, and on Windows when not using MSVC, generate libpcap.pc and
|
||||
+# Generate libpcap.pc
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
+ set(PACKAGE_NAME ${LIBRARY_NAME})
|
||||
+else()
|
||||
+ set(PACKAGE_NAME pcap)
|
||||
+endif()
|
||||
+set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
+set(exec_prefix "\${prefix}")
|
||||
+set(includedir "\${prefix}/include")
|
||||
+set(libdir "\${exec_prefix}/lib")
|
||||
+if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
|
||||
+ CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
|
||||
+ CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
|
||||
+ CMAKE_SYSTEM_NAME STREQUAL "DragonFly BSD" OR
|
||||
+ CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
|
||||
+ CMAKE_SYSTEM_NAME STREQUAL "OSF1")
|
||||
+ #
|
||||
+ # Platforms where the linker is the GNU linker
|
||||
+ # or accepts command-line arguments like
|
||||
+ # those the GNU linker accepts.
|
||||
+ #
|
||||
+ set(V_RPATH_OPT "-Wl,-rpath,")
|
||||
+elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
|
||||
+ #
|
||||
+ # SunOS 5.x.
|
||||
+ #
|
||||
+ # XXX - this assumes GCC is using the Sun linker,
|
||||
+ # rather than the GNU linker.
|
||||
+ #
|
||||
+ set(V_RPATH_OPT "-Wl,-R,")
|
||||
+else()
|
||||
+ #
|
||||
+ # No option needed to set the RPATH.
|
||||
+ #
|
||||
+ set(V_RPATH_OPT "")
|
||||
+endif()
|
||||
+set(LIBS "")
|
||||
+foreach(LIB ${PCAP_LINK_LIBRARIES})
|
||||
+ set(LIBS "${LIBS} -l${LIB}")
|
||||
+endforeach(LIB)
|
||||
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpcap.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc @ONLY)
|
||||
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc DESTINATION lib/pkgconfig)
|
||||
+
|
||||
+# On UN*X, and on Windows when not using MSVC, generate
|
||||
# pcap-config and process man pages and arrange that they be installed.
|
||||
if(NOT MSVC)
|
||||
- set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
- set(exec_prefix "\${prefix}")
|
||||
- set(includedir "\${prefix}/include")
|
||||
- set(libdir "\${exec_prefix}/lib")
|
||||
- if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
|
||||
- CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
|
||||
- CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
|
||||
- CMAKE_SYSTEM_NAME STREQUAL "DragonFly BSD" OR
|
||||
- CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
|
||||
- CMAKE_SYSTEM_NAME STREQUAL "OSF1")
|
||||
- #
|
||||
- # Platforms where the linker is the GNU linker
|
||||
- # or accepts command-line arguments like
|
||||
- # those the GNU linker accepts.
|
||||
- #
|
||||
- set(V_RPATH_OPT "-Wl,-rpath,")
|
||||
- elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
|
||||
- #
|
||||
- # SunOS 5.x.
|
||||
- #
|
||||
- # XXX - this assumes GCC is using the Sun linker,
|
||||
- # rather than the GNU linker.
|
||||
- #
|
||||
- set(V_RPATH_OPT "-Wl,-R,")
|
||||
- else()
|
||||
- #
|
||||
- # No option needed to set the RPATH.
|
||||
- #
|
||||
- set(V_RPATH_OPT "")
|
||||
- endif()
|
||||
- set(LIBS "")
|
||||
- foreach(LIB ${PCAP_LINK_LIBRARIES})
|
||||
- set(LIBS "${LIBS} -l${LIB}")
|
||||
- endforeach(LIB)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcap-config.in ${CMAKE_CURRENT_BINARY_DIR}/pcap-config @ONLY)
|
||||
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpcap.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc @ONLY)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pcap-config DESTINATION bin)
|
||||
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc DESTINATION lib/pkgconfig)
|
||||
-
|
||||
#
|
||||
# Man pages.
|
||||
#
|
@ -1,11 +1,17 @@
|
||||
vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux platform" ON_TARGET "Windows" "OSX")
|
||||
vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports x64-windows, x86-windows and Linux" ON_TARGET "UWP" "OSX" ON_ARCH "arm64")
|
||||
|
||||
message(
|
||||
if(EXISTS "${CURRENT_INSTALLED_DIR}/share/winpcap")
|
||||
message(FATAL_ERROR "FATAL ERROR: winpcap and libpcap are incompatible.")
|
||||
endif()
|
||||
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
message(
|
||||
"libpcap currently requires the following libraries from the system package manager:
|
||||
flex
|
||||
libbison-dev
|
||||
These can be installed on Ubuntu systems via sudo apt install flex libbison-dev"
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
@ -22,8 +28,22 @@ vcpkg_extract_source_archive_ex(
|
||||
REF 1.9.1
|
||||
PATCHES
|
||||
0001-fix-package-name.patch
|
||||
install-pc-on-msvc.patch
|
||||
add-disable-packet-option.patch
|
||||
)
|
||||
|
||||
# Only dynamic builds are currently supported on Windows
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
endif()
|
||||
|
||||
vcpkg_find_acquire_program(BISON)
|
||||
get_filename_component(BISON_PATH ${BISON} DIRECTORY)
|
||||
vcpkg_add_to_path(${BISON_PATH})
|
||||
vcpkg_find_acquire_program(FLEX)
|
||||
get_filename_component(FLEX_PATH ${FLEX} DIRECTORY)
|
||||
vcpkg_add_to_path(${FLEX_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
@ -33,15 +53,43 @@ vcpkg_configure_cmake(
|
||||
-DDISABLE_BLUETOOTH=ON
|
||||
-DDISABLE_DBUS=ON
|
||||
-DDISABLE_RDMA=ON
|
||||
-DDISABLE_DAG=ON
|
||||
-DDISABLE_SEPTEL=ON
|
||||
-DDISABLE_SNF=ON
|
||||
-DDISABLE_TC=ON
|
||||
-DDISABLE_PACKET=ON
|
||||
-DENABLE_REMOTE=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
# On Windows 64-bit, libpcap 1.9.1 installs the libraries in a amd64 subdirectory of the usual directories
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
set(libsubdir "amd64")
|
||||
file(GLOB_RECURSE FILES_TO_MOVE ${CURRENT_PACKAGES_DIR}/lib/${libsubdir}/*)
|
||||
file(COPY ${FILES_TO_MOVE} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
||||
file(GLOB_RECURSE FILES_TO_MOVE ${CURRENT_PACKAGES_DIR}/debug/lib/${libsubdir}/*)
|
||||
file(COPY ${FILES_TO_MOVE} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
||||
file(GLOB_RECURSE FILES_TO_MOVE ${CURRENT_PACKAGES_DIR}/bin/${libsubdir}/*)
|
||||
file(COPY ${FILES_TO_MOVE} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
|
||||
file(GLOB_RECURSE FILES_TO_MOVE ${CURRENT_PACKAGES_DIR}/debug/bin/${libsubdir}/*)
|
||||
file(COPY ${FILES_TO_MOVE} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/${libsubdir}
|
||||
${CURRENT_PACKAGES_DIR}/debug/lib/${libsubdir}
|
||||
${CURRENT_PACKAGES_DIR}/bin/${libsubdir}
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/${libsubdir})
|
||||
endif()
|
||||
|
||||
# Even if compiled with BUILD_SHARED_LIBS=ON, pcap also install a pcap_static library
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/pcap_static.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pcap_static.lib)
|
||||
endif()
|
||||
|
||||
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES ws2_32)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/share/man)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: winpcap
|
||||
Version: 4.1.3-2
|
||||
Version: 4.1.3-3
|
||||
Homepage: https://www.winpcap.org
|
||||
Description: WinPcap is the industry-standard tool for link-layer network access in Windows environments.
|
||||
|
@ -1,4 +1,6 @@
|
||||
include(vcpkg_common_functions)
|
||||
if(EXISTS "${CURRENT_INSTALLED_DIR}/share/libpcap")
|
||||
message(FATAL_ERROR "FATAL ERROR: libpcap and winpcap are incompatible.")
|
||||
endif()
|
||||
|
||||
set(WINPCAP_VERSION 4_1_3)
|
||||
|
||||
|
@ -711,6 +711,8 @@ libconfig:x64-osx=fail
|
||||
libcopp:arm64-windows=fail
|
||||
libcopp:arm-uwp=fail
|
||||
libcopp:x64-windows-static=fail
|
||||
libcrafter:x86-windows=fail
|
||||
libcrafter:x64-windows=fail
|
||||
cpuid:arm-uwp=fail
|
||||
cpuid:x64-uwp=fail
|
||||
cpuid:arm64-windows=fail
|
||||
@ -863,9 +865,7 @@ libpcap:arm64-windows=fail
|
||||
libpcap:arm-uwp=fail
|
||||
libpcap:x64-osx=fail
|
||||
libpcap:x64-uwp=fail
|
||||
libpcap:x64-windows=fail
|
||||
libpcap:x64-windows-static=fail
|
||||
libpcap:x86-windows=fail
|
||||
libpff:arm-uwp=fail
|
||||
libpff:x64-linux=fail
|
||||
libpff:x64-osx=fail
|
||||
|
Loading…
Reference in New Issue
Block a user