aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libhydrogen
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libhydrogen')
-rw-r--r--vcpkg/ports/libhydrogen/no-arch.patch25
-rw-r--r--vcpkg/ports/libhydrogen/portfile.cmake24
-rw-r--r--vcpkg/ports/libhydrogen/remove-tests.patch30
-rw-r--r--vcpkg/ports/libhydrogen/vcpkg.json17
4 files changed, 96 insertions, 0 deletions
diff --git a/vcpkg/ports/libhydrogen/no-arch.patch b/vcpkg/ports/libhydrogen/no-arch.patch
new file mode 100644
index 0000000..2649010
--- /dev/null
+++ b/vcpkg/ports/libhydrogen/no-arch.patch
@@ -0,0 +1,25 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 91e2bf1..7333479 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -39,11 +39,6 @@ set(arduino_files "library.properties")
+
+ # Compile options
+
+-get_setting(target_arch STRING "Target system architecture (fed to the compiler's -march=XXX).")
+-if(NOT target_arch AND NOT CMAKE_CROSSCOMPILING)
+- set(target_arch native)
+-endif()
+-
+ get_setting(target_device STRING "Target device identifier (defines HYDRO_TARGET_DEVICE_XXX).")
+
+ set(compile_options
+@@ -52,7 +47,7 @@ set(compile_options
+ # ---- Definitions ----
+ $<$<BOOL:${target_device}>:-DHYDRO_TARGET_DEVICE_${target_device}>
+ # ---- Optimizations ----
+- -Os $<$<BOOL:${target_arch}>:-march=${target_arch}> -fno-exceptions
++ -Os -fno-exceptions
+ # ---- Warnings ----
+ -Wall
+ -Wextra
diff --git a/vcpkg/ports/libhydrogen/portfile.cmake b/vcpkg/ports/libhydrogen/portfile.cmake
new file mode 100644
index 0000000..e2870ab
--- /dev/null
+++ b/vcpkg/ports/libhydrogen/portfile.cmake
@@ -0,0 +1,24 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO jedisct1/libhydrogen
+ REF 9f9d504bb5a97bc98ee52529726d41c027df76ad #2022-06-21
+ SHA512 f4dabc0b399c8850563c8a967209db537fdf787deaef46899a5484bc89bffb31581312940549784defe4c42d057309aaabd402831a7c3a94b04a00d47a07736c
+ HEAD_REF master
+ PATCHES
+ remove-tests.patch
+ no-arch.patch
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+)
+
+vcpkg_cmake_install()
+
+vcpkg_cmake_config_fixup(CONFIG_PATH share/cmake/hydrogen)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
diff --git a/vcpkg/ports/libhydrogen/remove-tests.patch b/vcpkg/ports/libhydrogen/remove-tests.patch
new file mode 100644
index 0000000..399e883
--- /dev/null
+++ b/vcpkg/ports/libhydrogen/remove-tests.patch
@@ -0,0 +1,30 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -139,12 +139,13 @@
+ # Tests
+
+ set(tests_executable "${PROJECT_NAME}-tests")
+ set(tests_run_target "${PROJECT_NAME}-run-tests")
+ set(tests_run_file "${PROJECT_BINARY_DIR}/${tests_run_target}.done")
+
++if(0)
+ enable_testing()
+ add_executable("${tests_executable}" ${test_files})
+ target_compile_options("${tests_executable}" PRIVATE ${compile_options})
+ target_link_libraries("${tests_executable}" "${PROJECT_NAME}")
+ add_test(NAME "${tests_executable}" COMMAND "${tests_executable}")
+
+@@ -166,12 +167,13 @@
+ COMMAND "${CMAKE_COMMAND}"
+ ARGS -E touch "${tests_run_file}"
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
+ VERBATIM)
+ add_custom_target("${tests_run_target}" ALL DEPENDS "${tests_run_file}" VERBATIM)
+ endif()
++endif()
+
+ # Generate Arduino package
+
+ set(arduino_package_file "${PROJECT_BINARY_DIR}/hydrogen-crypto.zip")
+
+ # Use the relative versions of the file path lists or else the full paths will end up in the
diff --git a/vcpkg/ports/libhydrogen/vcpkg.json b/vcpkg/ports/libhydrogen/vcpkg.json
new file mode 100644
index 0000000..8251ad4
--- /dev/null
+++ b/vcpkg/ports/libhydrogen/vcpkg.json
@@ -0,0 +1,17 @@
+{
+ "name": "libhydrogen",
+ "version-date": "2022-06-21",
+ "description": "A lightweight, secure, easy-to-use crypto library suitable for constrained environments",
+ "homepage": "https://github.com/jedisct1/libhydrogen",
+ "license": "ISC",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}