Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg baseline] Fix ports build on Linux #23497

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ports/libgnutls/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ vcpkg_configure_make(
--disable-maintainer-mode
--disable-rpath
--disable-libdane
--disable-guile
--with-included-unistring
--without-p11-kit
--without-tpm
Expand Down
3 changes: 2 additions & 1 deletion ports/libgnutls/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "libgnutls",
"version": "3.6.15",
"port-version": 2,
"port-version": 3,
"description": "A secure communications library implementing the SSL, TLS and DTLS protocols",
"homepage": "https://www.gnutls.org/",
"license": "LGPL-2.1-or-later",
"supports": "!windows",
"dependencies": [
"gettext",
Expand Down
2 changes: 2 additions & 0 deletions ports/ncurses/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ endif()
set(OPTIONS_DEBUG
"--with-pkg-config-libdir=${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig"
--with-debug
--without-normal
)
set(OPTIONS_RELEASE
"--with-pkg-config-libdir=${CURRENT_INSTALLED_DIR}/lib/pkgconfig"
--without-debug
--with-normal
)

vcpkg_configure_make(
Expand Down
3 changes: 3 additions & 0 deletions ports/ncurses/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "ncurses",
"version-string": "6.3",
"port-version": 1,
"description": "free software emulation of curses in System V Release 4.0",
"homepage": "https://invisible-island.net/ncurses/announce.html",
"license": "MIT",
"supports": "!windows | mingw"
}
106 changes: 106 additions & 0 deletions ports/pcapplusplus/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
cmake_minimum_required(VERSION 3.12)

project(pcapplusplus CXX)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

if (WIN32)
set(BUILD_SHARED_LIBS OFF)
endif()

# 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 "${CMAKE_CURRENT_LIST_DIR}/Common++/header"
"${CMAKE_CURRENT_LIST_DIR}/3rdParty/EndianPortable/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 "${CMAKE_CURRENT_LIST_DIR}/Packet++/header"
"${CMAKE_CURRENT_LIST_DIR}/3rdParty/hash-library")
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/*.cpp")

add_library(pcappp ${PCAPPP_SOURCES})

target_include_directories(pcappp PUBLIC "${CMAKE_CURRENT_LIST_DIR}/Pcap++/header" "${PCAP_INCLUDES}"
"${CMAKE_CURRENT_LIST_DIR}/3rdParty/LightPcapNg/LightPcapNg/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
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
102 changes: 11 additions & 91 deletions ports/pcapplusplus/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -7,97 +9,15 @@ vcpkg_from_github(
SHA512 ad10034950c0c3e6a4638e8b314c8983ce42609948d7d8d40ad0ff678820a2469807bd29aff77e657a150008602475b50cea84a0766ad87ea203985519cb38ac
HEAD_REF master
)
file(COPY "${CURRENT_PORT_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

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}
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)

# Lib
file(GLOB LIB_FILES "${SOURCE_PATH}/Dist/*.a")
file(
INSTALL ${LIB_FILES}
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()

# Include
file(GLOB HEADER_FILES "${SOURCE_PATH}/Dist/header/*.h")
file(
INSTALL ${HEADER_FILES}
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")

# Copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
endif()
file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright")
8 changes: 7 additions & 1 deletion ports/pcapplusplus/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "pcapplusplus",
"version-string": "21.11",
"version": "21.11",
"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",
"license": null,
"dependencies": [
{
"name": "libpcap",
Expand All @@ -12,6 +14,10 @@
"name": "pthreads",
"platform": "windows"
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "winpcap",
"platform": "windows"
Expand Down
6 changes: 3 additions & 3 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3538,7 +3538,7 @@
},
"libgnutls": {
"baseline": "3.6.15",
"port-version": 2
"port-version": 3
},
"libgo": {
"baseline": "3.1",
Expand Down Expand Up @@ -4730,7 +4730,7 @@
},
"ncurses": {
"baseline": "6.3",
"port-version": 0
"port-version": 1
},
"neargye-semver": {
"baseline": "0.3.0",
Expand Down Expand Up @@ -5254,7 +5254,7 @@
},
"pcapplusplus": {
"baseline": "21.11",
"port-version": 0
"port-version": 1
},
"pcg": {
"baseline": "2021-04-06",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libgnutls.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f041c07b59c7ac2389ac1fd6d8a175466bb648b7",
"version": "3.6.15",
"port-version": 3
},
{
"git-tree": "c03a1c452fa39d1b6d884aa3ef12c0c98a11f0a3",
"version": "3.6.15",
Expand Down
5 changes: 5 additions & 0 deletions versions/n-/ncurses.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "46f36d51c287c33525346dcf6fb903ddeea5a4d7",
"version-string": "6.3",
"port-version": 1
},
{
"git-tree": "68d49e9492a5a00c0b04cfbe2985ed99fc33973a",
"version-string": "6.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/p-/pcapplusplus.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f1f63c9365f0cb128761835ebceeafb6b162c815",
"version": "21.11",
"port-version": 1
},
{
"git-tree": "e0480fc24edf7b699eb027d24c3737026dd1128c",
"version-string": "21.11",
Expand Down