From 36682b9d5376dc19b3fd9bf6960fd261a035c693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20S=2E=20Ga=C3=9Fmann?= Date: Tue, 7 Jun 2022 18:55:04 +0200 Subject: [PATCH 1/2] [stduuid] Add new port @1.2.2 --- ports/stduuid/fix-gsl-polyfill.patch | 37 ++++++++++++++++++++ ports/stduuid/fix-install-directory.patch | 23 +++++++++++++ ports/stduuid/fix-libuuid-dependency.patch | 32 +++++++++++++++++ ports/stduuid/portfile.cmake | 40 ++++++++++++++++++++++ ports/stduuid/vcpkg.json | 33 ++++++++++++++++++ 5 files changed, 165 insertions(+) create mode 100644 ports/stduuid/fix-gsl-polyfill.patch create mode 100644 ports/stduuid/fix-install-directory.patch create mode 100644 ports/stduuid/fix-libuuid-dependency.patch create mode 100644 ports/stduuid/portfile.cmake create mode 100644 ports/stduuid/vcpkg.json diff --git a/ports/stduuid/fix-gsl-polyfill.patch b/ports/stduuid/fix-gsl-polyfill.patch new file mode 100644 index 00000000000000..2e07871bd60229 --- /dev/null +++ b/ports/stduuid/fix-gsl-polyfill.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f45a7dc..039ee53 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -37,11 +37,11 @@ if (UUID_TIME_GENERATOR) + endif() + + # Using span from std +-if (NOT UUID_USING_CXX20_SPAN) +- target_include_directories(${PROJECT_NAME} INTERFACE +- $ +- $) +- install(DIRECTORY gsl DESTINATION include) ++if (UUID_USING_CXX20_SPAN) ++ target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_20) ++else() ++ find_package(Microsoft.GSL CONFIG REQUIRED) ++ target_link_libraries(${PROJECT_NAME} INTERFACE Microsoft.GSL::GSL) + endif () + + # Install step and imported target +diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in +index 7217b72..fb981d2 100644 +--- a/cmake/Config.cmake.in ++++ b/cmake/Config.cmake.in +@@ -9,6 +9,10 @@ if (@UUID_SYSTEM_GENERATOR@) + endif () + endif () + ++if (NOT "@UUID_USING_CXX20_SPAN@") ++ find_dependency(Microsoft.GSL) ++endif () ++ + include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") + + check_required_components(@PROJECT_NAME@) +\ No newline at end of file diff --git a/ports/stduuid/fix-install-directory.patch b/ports/stduuid/fix-install-directory.patch new file mode 100644 index 00000000000000..f80d5b6a630ef2 --- /dev/null +++ b/ports/stduuid/fix-install-directory.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fffb92c..f45a7dc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,7 +11,8 @@ option(UUID_USING_CXX20_SPAN "Using span from std instead of gsl" OFF) + add_library(${PROJECT_NAME} INTERFACE) + target_include_directories(${PROJECT_NAME} INTERFACE + $ +- $) ++ $ ++ $) + + # Using system uuid generator + if (UUID_SYSTEM_GENERATOR) +@@ -44,7 +45,7 @@ if (NOT UUID_USING_CXX20_SPAN) + endif () + + # Install step and imported target +-install(FILES include/uuid.h DESTINATION include) ++install(FILES include/uuid.h DESTINATION include/stduuid) + install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets) + install(EXPORT ${PROJECT_NAME}-targets + DESTINATION lib/cmake/${PROJECT_NAME}) diff --git a/ports/stduuid/fix-libuuid-dependency.patch b/ports/stduuid/fix-libuuid-dependency.patch new file mode 100644 index 00000000000000..59134811d5fbc4 --- /dev/null +++ b/ports/stduuid/fix-libuuid-dependency.patch @@ -0,0 +1,32 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 039ee53..d4218a4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,11 +23,8 @@ if (UUID_SYSTEM_GENERATOR) + find_library(CFLIB CoreFoundation REQUIRED) + target_link_libraries(${PROJECT_NAME} INTERFACE ${CFLIB}) + else () +- find_package(Libuuid REQUIRED) +- if (Libuuid_FOUND) +- target_include_directories(${PROJECT_NAME} INTERFACE ${Libuuid_INCLUDE_DIRS}) +- target_link_libraries(${PROJECT_NAME} INTERFACE ${Libuuid_LIBRARIES}) +- endif () ++ find_package(unofficial-libuuid CONFIG REQUIRED) ++ target_link_libraries(${PROJECT_NAME} INTERFACE unofficial::UUID::uuid) + endif () + endif () + +diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in +index fb981d2..8a3c8ab 100644 +--- a/cmake/Config.cmake.in ++++ b/cmake/Config.cmake.in +@@ -4,8 +4,7 @@ include(CMakeFindDependencyMacro) + if (@UUID_SYSTEM_GENERATOR@) + if (WIN32 OR APPLE) + else () +- list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) +- find_dependency(Libuuid REQUIRED) ++ find_dependency(unofficial-libuuid CONFIG) + endif () + endif () + diff --git a/ports/stduuid/portfile.cmake b/ports/stduuid/portfile.cmake new file mode 100644 index 00000000000000..27a3bf8d3767e1 --- /dev/null +++ b/ports/stduuid/portfile.cmake @@ -0,0 +1,40 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mariusbancila/stduuid + REF v1.2.2 + SHA512 30970c25992e1ba35d96e3b2fc8530466c1070b8b913b8c37e9f698f39121a5a74361e2c4db4c2ba2feddb0ce9b2f14b78c4761cdac09b89a6a0117b179b08a7 + HEAD_REF master + PATCHES + fix-install-directory.patch + fix-gsl-polyfill.patch + fix-libuuid-dependency.patch +) + +# the debug build is not necessary, because stduuid deployed files are header-only +set(VCPKG_BUILD_TYPE release) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + system-gen UUID_SYSTEM_GENERATOR + INVERTED_FEATURES + gsl-span UUID_USING_CXX20_SPAN +) + +vcpkg_cmake_configure(SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DUUID_BUILD_TESTS=OFF + ${FEATURE_OPTIONS} +) +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT}) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib) + +if("gsl-span" IN_LIST FEATURES) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/stduuid/uuid.h" "#ifdef __cpp_lib_span" "#if 0") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/stduuid/uuid.h" "#include " "#include ") +else() + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/stduuid/uuid.h" "#ifdef __cpp_lib_span" "#if 1") +endif() + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/stduuid/vcpkg.json b/ports/stduuid/vcpkg.json new file mode 100644 index 00000000000000..840ce796b08713 --- /dev/null +++ b/ports/stduuid/vcpkg.json @@ -0,0 +1,33 @@ +{ + "name": "stduuid", + "version": "1.2.2", + "description": "A C++17 cross-platform implementation for UUIDs", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "gsl-span": { + "description": "Using span from gsl instead of std", + "dependencies": [ + "ms-gsl" + ] + }, + "system-gen": { + "description": "Enable operating system uuid generator", + "dependencies": [ + { + "name": "libuuid", + "platform": "!osx & !windows" + } + ] + } + } +} From 09ceee5553248de83a1e531f7ac6bd243a7e35d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20S=2E=20Ga=C3=9Fmann?= Date: Tue, 7 Jun 2022 18:57:29 +0200 Subject: [PATCH 2/2] [stduuid] Add v1.2.2 to version database --- versions/baseline.json | 4 ++++ versions/s-/stduuid.json | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 versions/s-/stduuid.json diff --git a/versions/baseline.json b/versions/baseline.json index 50065ba91469e9..327722f6d0caeb 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6824,6 +6824,10 @@ "baseline": "2021-09-10", "port-version": 0 }, + "stduuid": { + "baseline": "1.2.2", + "port-version": 0 + }, "stftpitchshift": { "baseline": "1.4.1", "port-version": 0 diff --git a/versions/s-/stduuid.json b/versions/s-/stduuid.json new file mode 100644 index 00000000000000..c89c5a62626f11 --- /dev/null +++ b/versions/s-/stduuid.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "bd235773c953e5636a7b9f6356437daef6e5010c", + "version": "1.2.2", + "port-version": 0 + } + ] +}