mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-25 17:20:57 +08:00
[libcbor,libfido2] Fix on non-Windows, cleanup (#42341)
This commit is contained in:
parent
242ad169d3
commit
76450ca004
@ -1,13 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License.
|
||||
|
||||
find_path(LIBCBOR_INCLUDE_DIR NAMES cbor.h)
|
||||
|
||||
find_library(LIBCBOR_LIBRARY cbor)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCBOR DEFAULT_MSG LIBCBOR_LIBRARY LIBCBOR_INCLUDE_DIR)
|
||||
|
||||
if(LIBCBOR_FOUND)
|
||||
set(LIBCBOR_LIBRARIES ${LIBCBOR_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LIBCBOR_INCLUDE_DIR LIBCBOR_LIBRARY)
|
57
ports/libcbor/cmake-config.diff
Normal file
57
ports/libcbor/cmake-config.diff
Normal file
@ -0,0 +1,57 @@
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index e931239..a4fd827 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -9,7 +9,12 @@ if (NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
endif()
|
||||
|
||||
add_library(cbor ${SOURCES})
|
||||
-target_include_directories(cbor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
+target_include_directories(cbor PUBLIC
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
+)
|
||||
+set_target_properties(cbor PROPERTIES EXPORT_NAME libcbor)
|
||||
|
||||
# Explicitly link math.h if necessary
|
||||
check_function_exists(ldexp LDEXP_AVAILABLE)
|
||||
@@ -19,7 +24,6 @@ endif()
|
||||
|
||||
include(GenerateExportHeader)
|
||||
generate_export_header(cbor EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/cbor/cbor_export.h)
|
||||
-target_include_directories(cbor PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cbor/cbor_export.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cbor)
|
||||
|
||||
if (NOT ${CBOR_VERSION_MAJOR} EQUAL 0)
|
||||
@@ -37,6 +41,7 @@ configure_file(libcbor.pc.in libcbor.pc @ONLY)
|
||||
|
||||
# http://www.cmake.org/Wiki/CMake:Install_Commands
|
||||
install(TARGETS cbor
|
||||
+ EXPORT libcborTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
@@ -68,3 +73,6 @@ install(
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_LIBDIR}/cmake/libcbor
|
||||
)
|
||||
+install(EXPORT libcborTargets
|
||||
+ NAMESPACE libcbor::
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libcbor)
|
||||
diff --git a/src/libcborConfig.cmake.in b/src/libcborConfig.cmake.in
|
||||
index 565bed3..ef99a74 100644
|
||||
--- a/src/libcborConfig.cmake.in
|
||||
+++ b/src/libcborConfig.cmake.in
|
||||
@@ -2,7 +2,11 @@ set(CBOR_VERSION @CBOR_VERSION@)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
+include("${CMAKE_CURRENT_LIST_DIR}/libcborTargets.cmake")
|
||||
+
|
||||
+# legacy
|
||||
set_and_check(CBOR_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
||||
set_and_check(CBOR_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
||||
+set(CBOR_LIBRARIES "libcbor::libcbor")
|
||||
|
||||
check_required_components(libcbor)
|
@ -2,30 +2,26 @@ vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO PJK/libcbor
|
||||
REF "v${VERSION}"
|
||||
SHA512 c14aaa55c0c82e09b9eb2cc6847951d1bac8a081a247776c507d5450367da5717b1056bad09fb0f0178311de8754e8f89c060e0fc0f400fafdc42de441421e66
|
||||
SHA512 c14aaa55c0c82e09b9eb2cc6847951d1bac8a081a247776c507d5450367da5717b1056bad09fb0f0178311de8754e8f89c060e0fc0f400fafdc42de441421e66
|
||||
HEAD_REF master
|
||||
PATCHES cmake-config.diff
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DWITH_TESTS=OFF
|
||||
-DWITH_EXAMPLES=OFF
|
||||
-DVCPKG_VERBOSE=ON
|
||||
-DCMAKE_POLICY_DEFAULT_CMP0054=NEW
|
||||
-DSANITIZE=OFF
|
||||
-DCBOR_CUSTOM_ALLOC=ON
|
||||
-DWITH_EXAMPLES=OFF
|
||||
-DWITH_TESTS=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_build()
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
|
||||
|
||||
# Add Cmake Packagefile
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/LibCborConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
# Handle copyright
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "libcbor",
|
||||
"version": "0.11.0",
|
||||
"port-version": 1,
|
||||
"description": "libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format",
|
||||
"homepage": "https://github.com/PJK/libcbor",
|
||||
"license": "MIT",
|
||||
|
56
ports/libfido2/dependencies.diff
Normal file
56
ports/libfido2/dependencies.diff
Normal file
@ -0,0 +1,56 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c41de28..2c5b0f3 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -168,7 +168,13 @@ if(UNIX)
|
||||
endif()
|
||||
|
||||
|
||||
-if(MSVC)
|
||||
+find_package(libcbor CONFIG REQUIRED)
|
||||
+set(CBOR_LIBRARIES libcbor::libcbor)
|
||||
+find_package(ZLIB REQUIRED)
|
||||
+set(ZLIB_LIBRARIES ZLIB::ZLIB)
|
||||
+find_package(OpenSSL REQUIRED)
|
||||
+set(CRYPTO_LIBRARIES OpenSSL::Crypto)
|
||||
+if(0)
|
||||
if((NOT CBOR_INCLUDE_DIRS) OR (NOT CBOR_LIBRARY_DIRS) OR
|
||||
(NOT CRYPTO_INCLUDE_DIRS) OR (NOT CRYPTO_LIBRARY_DIRS) OR
|
||||
(NOT ZLIB_INCLUDE_DIRS) OR (NOT ZLIB_LIBRARY_DIRS))
|
||||
@@ -191,6 +197,7 @@ if(MSVC)
|
||||
set(CRYPTO_LIBRARIES crypto)
|
||||
endif()
|
||||
|
||||
+elseif(MSVC)
|
||||
set(MSVC_DISABLED_WARNINGS_LIST
|
||||
"C4152" # nonstandard extension used: function/data pointer
|
||||
# conversion in expression;
|
||||
@@ -216,7 +223,7 @@ if(MSVC)
|
||||
add_definitions(-DUSE_WINHELLO)
|
||||
endif()
|
||||
set(NFC_LINUX OFF)
|
||||
-else()
|
||||
+elseif(0)
|
||||
include(FindPkgConfig)
|
||||
pkg_search_module(CBOR libcbor)
|
||||
pkg_search_module(CRYPTO libcrypto)
|
||||
@@ -239,6 +246,7 @@ else()
|
||||
set(CRYPTO_LIBRARIES "crypto")
|
||||
endif()
|
||||
|
||||
+elseif(1)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
pkg_search_module(UDEV libudev REQUIRED)
|
||||
set(UDEV_NAME "udev")
|
||||
diff --git a/src/libfido2.pc.in b/src/libfido2.pc.in
|
||||
index 03d0606..1a299ae 100644
|
||||
--- a/src/libfido2.pc.in
|
||||
+++ b/src/libfido2.pc.in
|
||||
@@ -7,6 +7,6 @@ Name: @PROJECT_NAME@
|
||||
Description: A FIDO2 library
|
||||
URL: https://github.com/yubico/libfido2
|
||||
Version: @FIDO_VERSION@
|
||||
-Requires: libcrypto
|
||||
+Requires.private: libcrypto libcbor zlib
|
||||
Libs: -L${libdir} -lfido2
|
||||
Cflags: -I${includedir}
|
@ -1,56 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 6fa341a..8124d80 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -169,27 +169,20 @@ endif()
|
||||
|
||||
|
||||
if(MSVC)
|
||||
- if((NOT CBOR_INCLUDE_DIRS) OR (NOT CBOR_LIBRARY_DIRS) OR
|
||||
- (NOT CRYPTO_INCLUDE_DIRS) OR (NOT CRYPTO_LIBRARY_DIRS) OR
|
||||
- (NOT ZLIB_INCLUDE_DIRS) OR (NOT ZLIB_LIBRARY_DIRS))
|
||||
- message(FATAL_ERROR "please define "
|
||||
- "{CBOR,CRYPTO,ZLIB}_{INCLUDE,LIBRARY}_DIRS when "
|
||||
- "building under msvc")
|
||||
- endif()
|
||||
- if(BUILD_TESTS AND BUILD_SHARED_LIBS AND
|
||||
- ((NOT CBOR_BIN_DIRS) OR (NOT ZLIB_BIN_DIRS) OR (NOT CRYPTO_BIN_DIRS)))
|
||||
- message(FATAL_ERROR "please define {CBOR,CRYPTO,ZLIB}_BIN_DIRS "
|
||||
- "when building tests")
|
||||
- endif()
|
||||
- if(NOT CBOR_LIBRARIES)
|
||||
- set(CBOR_LIBRARIES cbor)
|
||||
- endif()
|
||||
- if(NOT ZLIB_LIBRARIES)
|
||||
- set(ZLIB_LIBRARIES zlib1)
|
||||
- endif()
|
||||
- if(NOT CRYPTO_LIBRARIES)
|
||||
- set(CRYPTO_LIBRARIES crypto)
|
||||
- endif()
|
||||
+ find_package(PkgConfig)
|
||||
+
|
||||
+ find_package(LIBCBOR REQUIRED)
|
||||
+ find_package(OpenSSL REQUIRED)
|
||||
+ find_package(ZLIB REQUIRED)
|
||||
+
|
||||
+ # Handling of different Packagenames in VCPKG
|
||||
+ set(CBOR_INCLUDE_DIRS ${LIBCBOR_INCLUDE_DIR})
|
||||
+ set(CRYPTO_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIRS})
|
||||
+ set(CBOR_LIBRARY_DIRS ${LIBCBOR_LIBRARY_DIRS})
|
||||
+ set(CRYPTO_LIBRARY_DIRS ${OPENSSL_LIBRARY_DIRS})
|
||||
+ set(CBOR_LIBRARIES ${LIBCBOR_LIBRARIES})
|
||||
+ set(CRYPTO_LIBRARIES ${OPENSSL_LIBRARIES})
|
||||
+ add_definitions("-D_CRT_SECURE_NO_WARNINGS" "-D_CRT_NONSTDC_NO_DEPRECATE")
|
||||
|
||||
set(MSVC_DISABLED_WARNINGS_LIST
|
||||
"C4152" # nonstandard extension used: function/data pointer
|
||||
@@ -469,6 +462,9 @@ message(STATUS "USE_PCSC: ${USE_PCSC}")
|
||||
message(STATUS "USE_WINHELLO: ${USE_WINHELLO}")
|
||||
message(STATUS "NFC_LINUX: ${NFC_LINUX}")
|
||||
|
||||
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996")
|
||||
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996")
|
||||
+
|
||||
if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
endif()
|
31
ports/libfido2/flags.diff
Normal file
31
ports/libfido2/flags.diff
Normal file
@ -0,0 +1,31 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2c5b0f3..b8178fa 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -219,6 +219,10 @@ elseif(MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP -W4 -WX ${MSVC_DISABLED_WARNINGS_STR}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Od /Z7 /guard:cf /sdl /RTCcsu")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi /guard:cf /sdl")
|
||||
+ add_definitions("-D_CRT_SECURE_NO_WARNINGS" "-D_CRT_NONSTDC_NO_DEPRECATE")
|
||||
+ string(REPLACE " -WX" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
+ string(REPLACE " /sdl" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
+ string(REPLACE " /sdl" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
if(USE_WINHELLO)
|
||||
add_definitions(-DUSE_WINHELLO)
|
||||
endif()
|
||||
@@ -303,7 +307,6 @@ elseif(1)
|
||||
|
||||
add_compile_options(-Wall)
|
||||
add_compile_options(-Wextra)
|
||||
- add_compile_options(-Werror)
|
||||
add_compile_options(-Wshadow)
|
||||
add_compile_options(-Wcast-qual)
|
||||
add_compile_options(-Wwrite-strings)
|
||||
@@ -311,7 +314,6 @@ elseif(1)
|
||||
add_compile_options(-Wbad-function-cast)
|
||||
add_compile_options(-Wimplicit-fallthrough)
|
||||
add_compile_options(-pedantic)
|
||||
- add_compile_options(-pedantic-errors)
|
||||
|
||||
set(EXTRA_CFLAGS "-Wconversion -Wsign-conversion")
|
||||
|
@ -1,26 +1,39 @@
|
||||
if(VCPKG_TARGET_IS_LINUX)
|
||||
message(
|
||||
"${PORT} currently requires the following libraries from the system package manager:
|
||||
libudev-dev
|
||||
These can be installed on Ubuntu systems via:
|
||||
sudo apt install libudev-dev"
|
||||
)
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO Yubico/libfido2
|
||||
REF ${VERSION}
|
||||
SHA512 97932ca1a9f8d1bb3cb4b4a8d56ef70085d19ad2bd27c67944fa17ed033bfa45d28d7ad3fa318723e79b17ef5a882ac4f999ad8a6b9965c58665d99c4da7b5ee
|
||||
SHA512 97932ca1a9f8d1bb3cb4b4a8d56ef70085d19ad2bd27c67944fa17ed033bfa45d28d7ad3fa318723e79b17ef5a882ac4f999ad8a6b9965c58665d99c4da7b5ee
|
||||
HEAD_REF main
|
||||
PATCHES
|
||||
"fix_cmakelists.patch"
|
||||
dependencies.diff
|
||||
flags.diff
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LIBFIDO2_BUILD_STATIC)
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBFIDO2_BUILD_SHARED)
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DBUILD_EXAMPLES=OFF
|
||||
-DBUILD_MANPAGES=OFF
|
||||
-DBUILD_STATIC_LIBS=${LIBFIDO2_BUILD_STATIC}
|
||||
-DBUILD_SHARED_LIBS=${LIBFIDO2_BUILD_SHARED}
|
||||
-DBUILD_TOOLS=OFF
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DBUILD_TESTS=OFF
|
||||
)
|
||||
-DBUILD_TOOLS=OFF
|
||||
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
PKG_CONFIG_EXECUTABLE
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "libfido2",
|
||||
"version": "1.15.0",
|
||||
"port-version": 1,
|
||||
"description": "Provides library functionality to communicate with a FIDO device over USB, and to verify attestation and assertion signatures.",
|
||||
"homepage": "https://developers.yubico.com/libfido2/",
|
||||
"license": "BSD-2-Clause",
|
||||
"supports": "!uwp & (x86 | x64) & windows",
|
||||
"supports": "!android & !uwp",
|
||||
"dependencies": [
|
||||
"libcbor",
|
||||
"openssl",
|
||||
|
@ -4362,7 +4362,7 @@
|
||||
},
|
||||
"libcbor": {
|
||||
"baseline": "0.11.0",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"libcds": {
|
||||
"baseline": "2.3.3",
|
||||
@ -4542,7 +4542,7 @@
|
||||
},
|
||||
"libfido2": {
|
||||
"baseline": "1.15.0",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"libflac": {
|
||||
"baseline": "1.4.3",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "cb6dbe47dabb8a7a43e149f49f8d7006fd670d67",
|
||||
"version": "0.11.0",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "174f4426df788de4be355adbc98f12a7f71914e8",
|
||||
"version": "0.11.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "7be0646188897c771d2d68a1cd81c640a3bbf9de",
|
||||
"version": "1.15.0",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "e422fffa6ba8b16a5aff5176841f704048e5fbd1",
|
||||
"version": "1.15.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user