mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:01:48 +08:00
[libaes-siv] New port (#34519)
* [ports/libaes-siv] New port * [ports/libaes-siv/CMakeLists.txt] Only include one C file ; use compile flags from their official CMakeLists.txt ; link OpenSSL * Update ports/libaes-siv/portfile.cmake Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> * `./vcpkg x-add-version --all --overwrite-version` * [ports/libaes-siv/CMakeLists.txt] Copy yara port's approach to depending on OpenSSL * [ports/libaes-siv/CMakeLists.txt] Use @ for escaping vars and use https://cmake.org/cmake/help/latest/command/file.html#configure instead of `file(WRITE` following by `configure_file` * Update ports/libaes-siv/CMakeLists.txt Co-authored-by: Kai Pastor <dg0yt@darc.de> * Update ports/libaes-siv/CMakeLists.txt Co-authored-by: Kai Pastor <dg0yt@darc.de> * Update ports/libaes-siv/CMakeLists.txt Co-authored-by: Kai Pastor <dg0yt@darc.de> * ./vcpkg x-add-version libaes-siv --overwrite-version --------- Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
parent
b54e364833
commit
4d73751b34
74
ports/libaes-siv/CMakeLists.txt
Normal file
74
ports/libaes-siv/CMakeLists.txt
Normal file
@ -0,0 +1,74 @@
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
set(no_lib_project_name "aes_siv")
|
||||
project(libaes-siv LANGUAGES C)
|
||||
set(PROJECT_VERSION "${VERSION}")
|
||||
|
||||
set(Header_Files "${no_lib_project_name}.h")
|
||||
set(Source_Files "${no_lib_project_name}.c")
|
||||
|
||||
add_library("${PROJECT_NAME}" "${Header_Files}" "${Source_Files}")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
target_include_directories(
|
||||
"${PROJECT_NAME}"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
target_compile_features("${PROJECT_NAME}" PRIVATE c_std_99)
|
||||
set(config_file "${CMAKE_BINARY_DIR}/include/${no_lib_project_name}_config.h")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${config_file}")
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -Wstrict-prototypes -Wconversion -Og -ggdb3 -ftree-vectorize")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Wall -Wextra -Wstrict-prototypes -Wconversion -O3 -fomit-frame-pointer -funroll-loops -ftree-vectorize -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -Wstrict-prototypes -Wconversion -ggdb3 -O3 -funroll-loops -ftree-vectorize -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "-Wall -Wextra -Wstrict-prototypes -Wconversion -Os -fomit-frame-pointer -ftree-vectorize -DNDEBUG")
|
||||
endif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL Clang OR CMAKE_C_COMPILER_ID STREQUAL AppleClang)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -Wstrict-prototypes -Wconversion -O0 -ggdb3 -ftree-vectorize")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Wall -Wextra -Wstrict-prototypes -Wconversion -O3 -fomit-frame-pointer -funroll-loops -ftree-vectorize -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -Wstrict-prototypes -Wconversion -ggdb3 -O3 -funroll-loops -ftree-vectorize -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "-Wall -Wextra -Wstrict-prototypes -Wconversion -Os -fomit-frame-pointer -ftree-vectorize -DNDEBUG")
|
||||
endif(CMAKE_C_COMPILER_ID STREQUAL Clang OR CMAKE_C_COMPILER_ID STREQUAL AppleClang)
|
||||
|
||||
find_package(OpenSSL REQUIRED COMPONENTS Crypto)
|
||||
target_link_libraries("${PROJECT_NAME}" PRIVATE OpenSSL::Crypto)
|
||||
|
||||
install(
|
||||
TARGETS "${PROJECT_NAME}"
|
||||
EXPORT "unofficial-${PROJECT_NAME}Config"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
set(cmake_config_file "${CMAKE_CURRENT_BINARY_DIR}/unofficial-${PROJECT_NAME}-config.cmake")
|
||||
file(CONFIGURE
|
||||
OUTPUT "${cmake_config_file}"
|
||||
CONTENT [[
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(OpenSSL)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-@PROJECT_NAME@Targets.cmake")
|
||||
]]
|
||||
@ONLY
|
||||
)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(VERSION_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/unofficial-${PROJECT_NAME}ConfigVersion.cmake")
|
||||
write_basic_package_version_file(
|
||||
"${VERSION_FILE_PATH}"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(FILES "${cmake_config_file}" "${VERSION_FILE_PATH}" DESTINATION "share/unofficial-${PROJECT_NAME}")
|
||||
install(FILES ${Header_Files} "${config_file}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
install(
|
||||
EXPORT "unofficial-${PROJECT_NAME}Config"
|
||||
FILE "unofficial-${PROJECT_NAME}Targets.cmake"
|
||||
NAMESPACE "unofficial::${PROJECT_NAME}::"
|
||||
DESTINATION "share/unofficial-${PROJECT_NAME}")
|
||||
|
39
ports/libaes-siv/header_rename.patch
Normal file
39
ports/libaes-siv/header_rename.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff --git a/aes_siv.c b/aes_siv.c
|
||||
index 00a510d..2b31ed3 100644
|
||||
--- a/aes_siv.c
|
||||
+++ b/aes_siv.c
|
||||
@@ -5,7 +5,7 @@
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
#define _ISOC99_SOURCE 1
|
||||
|
||||
-#include "config.h"
|
||||
+#include "aes_siv_config.h"
|
||||
#include "aes_siv.h"
|
||||
|
||||
#include <assert.h>
|
||||
diff --git a/bench.c b/bench.c
|
||||
index ea5a29b..61cb485 100644
|
||||
--- a/bench.c
|
||||
+++ b/bench.c
|
||||
@@ -2,7 +2,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
-#include "config.h"
|
||||
+#include "aes_siv_config.h"
|
||||
#include "aes_siv.h"
|
||||
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
diff --git a/tests.c b/tests.c
|
||||
index 996cc58..9ff9637 100644
|
||||
--- a/tests.c
|
||||
+++ b/tests.c
|
||||
@@ -5,7 +5,7 @@
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
#define _ISOC99_SOURCE 1
|
||||
|
||||
-#include "config.h"
|
||||
+#include "aes_siv_config.h"
|
||||
#include "aes_siv.h"
|
||||
|
||||
#undef NDEBUG
|
34
ports/libaes-siv/portfile.cmake
Normal file
34
ports/libaes-siv/portfile.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO dfoxfranke/libaes_siv
|
||||
REF 9681279cfaa6e6399bb7ca3afbbc27fc2e19df4b
|
||||
SHA512 96441420339bd11f37f4feff29f9306afa60e5b07ac7e7b879778c0e6964f8f679ffb7c1deca43ca054b7851e4e7bf5fca548dc60c92469fe9d3235cb5a37776
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
header_rename.patch
|
||||
)
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt"
|
||||
DESTINATION "${SOURCE_PATH}")
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
"-DVERSION=${VERSION}"
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT})
|
||||
|
||||
# Handle copyright
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
|
||||
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/include")
|
3
ports/libaes-siv/usage
Normal file
3
ports/libaes-siv/usage
Normal file
@ -0,0 +1,3 @@
|
||||
libaes-siv provides CMake targets:
|
||||
find_package(unofficial-libaes-siv CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE unofficial::libaes-siv::libaes-siv)
|
18
ports/libaes-siv/vcpkg.json
Normal file
18
ports/libaes-siv/vcpkg.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "libaes-siv",
|
||||
"version-date": "2020-10-15",
|
||||
"description": "An RFC5297-compliant C implementation of AES-SIV.",
|
||||
"homepage": "https://github.com/dfoxfranke/libaes_siv",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": [
|
||||
"openssl",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
@ -4028,6 +4028,10 @@
|
||||
"baseline": "1.3.2",
|
||||
"port-version": 1
|
||||
},
|
||||
"libaes-siv": {
|
||||
"baseline": "2020-10-15",
|
||||
"port-version": 0
|
||||
},
|
||||
"libaiff": {
|
||||
"baseline": "5.0",
|
||||
"port-version": 9
|
||||
|
9
versions/l-/libaes-siv.json
Normal file
9
versions/l-/libaes-siv.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "ecae087c343539db9225d7a31c076e245925d30b",
|
||||
"version-date": "2020-10-15",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user