[libpcap] Fix pkgconfig libs and include path (#9426)

* [libpcap] Fix pkgconfig libs and include path

* [libpcap] use vcpkg_fixup_pkgconfig instead of homegrown

* Update ports/libpcap/portfile.cmake

* Update ports/libpcap/CONTROL

* Update ports/libpcap/portfile.cmake

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
This commit is contained in:
almikhayl 2020-06-11 11:02:50 +03:00 committed by GitHub
parent 8bd2b60f4e
commit 9574e60a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 10 deletions

View File

@ -0,0 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 55b93f1..f4f9d51 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2358,7 +2358,6 @@ 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
# pcap-config and process man pages and arrange that they be installed.
if(NOT MSVC)
- set(PACKAGE_NAME ${LIBRARY_NAME})
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(includedir "\${prefix}/include")

View File

@ -1,4 +1,5 @@
Source: libpcap Source: libpcap
Version: 1.9.1 Version: 1.9.1-1
Description: A portable C/C++ library for network traffic capture Description: A portable C/C++ library for network traffic capture
Homepage: https://www.tcpdump.org/ Homepage: https://www.tcpdump.org/
Supports: linux

View File

@ -7,6 +7,8 @@ message(
These can be installed on Ubuntu systems via sudo apt install flex libbison-dev" These can be installed on Ubuntu systems via sudo apt install flex libbison-dev"
) )
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
vcpkg_download_distfile( vcpkg_download_distfile(
SOURCE_ARCHIVE_PATH SOURCE_ARCHIVE_PATH
URLS http://www.tcpdump.org/release/libpcap-1.9.1.tar.gz URLS http://www.tcpdump.org/release/libpcap-1.9.1.tar.gz
@ -18,6 +20,8 @@ vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${SOURCE_ARCHIVE_PATH} ARCHIVE ${SOURCE_ARCHIVE_PATH}
REF 1.9.1 REF 1.9.1
PATCHES
0001-fix-package-name.patch
) )
vcpkg_configure_cmake( vcpkg_configure_cmake(
@ -32,18 +36,12 @@ vcpkg_configure_cmake(
) )
vcpkg_install_cmake() vcpkg_install_cmake()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpcap RENAME copyright) file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static) if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif() endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/share/man) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/share/man)
file(READ ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpcap.pc LIBPCAP_PC)
string(REGEX REPLACE \($|\n\)prefix=[^\n]+ \\1prefix=\"${CURRENT_INSTALLED_DIR}\" LIBPCAP_PC_FIXED "${LIBPCAP_PC}")
file(WRITE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpcap.pc "${LIBPCAP_PC_FIXED}")
file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcap.pc DEBUG_LIBPCAP_PC)
string(REGEX REPLACE \($|\n\)prefix=[^\n]+ \\1prefix=\"${CURRENT_INSTALLED_DIR}/debug\" DEBUG_LIBPCAP_PC_FIXED "${DEBUG_LIBPCAP_PC}")
file(WRITE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcap.pc "${DEBUG_LIBPCAP_PC_FIXED}")