From ecad480520a0882b76263ae0de191123ef3c2500 Mon Sep 17 00:00:00 2001 From: rsadowski Date: Sat, 10 Dec 2022 09:59:55 +0000 Subject: [PATCH] Import libcrossguid-0.2.3.20211002 OK sthen@ Init port from Brad Comment: minimal and cross platform C++ GUID library Description: CrossGuid is a minimal, cross platform, C++ GUID library. It uses the best native GUID/UUID generator on the given platform and had a generic class for parsing, stringifying, and comparing IDs. Maintainer: The OpenBSD ports mailing-list WWW: https://github.com/graeme-hill/crossguid --- devel/libcrossguid/Makefile | 28 ++++++++++++++++ devel/libcrossguid/distinfo | 2 ++ .../libcrossguid/patches/patch-CMakeLists_txt | 23 +++++++++++++ devel/libcrossguid/patches/patch-src_guid_cpp | 32 +++++++++++++++++++ devel/libcrossguid/pkg/DESCR | 3 ++ devel/libcrossguid/pkg/PLIST | 11 +++++++ 6 files changed, 99 insertions(+) create mode 100644 devel/libcrossguid/Makefile create mode 100644 devel/libcrossguid/distinfo create mode 100644 devel/libcrossguid/patches/patch-CMakeLists_txt create mode 100644 devel/libcrossguid/patches/patch-src_guid_cpp create mode 100644 devel/libcrossguid/pkg/DESCR create mode 100644 devel/libcrossguid/pkg/PLIST diff --git a/devel/libcrossguid/Makefile b/devel/libcrossguid/Makefile new file mode 100644 index 00000000000..f4e6e26d132 --- /dev/null +++ b/devel/libcrossguid/Makefile @@ -0,0 +1,28 @@ +BROKEN-sparc64= SIBGUS in std::_Hashtable + +COMMENT= minimal and cross platform C++ GUID library + +DISTNAME= libcrossguid-0.2.3.20211002 +GH_ACCOUNT= graeme-hill +GH_PROJECT= crossguid +GH_COMMIT= ca1bf4b810e2d188d04cb6286f957008ee1b7681 +CATEGORIES= devel + +SHARED_LIBS= crossguid 0.0 + +# MIT +PERMIT_PACKAGE= Yes + +WANTLIB= ${COMPILER_LIBCXX} c m + +MODULES= devel/cmake + +# C++17 +COMPILER= base-clang ports-gcc + +CONFIGURE_ARGS+=-DBUILD_SHARED_LIBS=On + +do-test: + ${WRKBUILD}/crossguid-test + +.include diff --git a/devel/libcrossguid/distinfo b/devel/libcrossguid/distinfo new file mode 100644 index 00000000000..ee69cb43690 --- /dev/null +++ b/devel/libcrossguid/distinfo @@ -0,0 +1,2 @@ +SHA256 (libcrossguid-0.2.3.20211002-ca1bf4b8.tar.gz) = a+J+CzpJB/DNPPrewlXuG5JVaeG9BuZ6TS9CZymbacQ= +SIZE (libcrossguid-0.2.3.20211002-ca1bf4b8.tar.gz) = 141660 diff --git a/devel/libcrossguid/patches/patch-CMakeLists_txt b/devel/libcrossguid/patches/patch-CMakeLists_txt new file mode 100644 index 00000000000..eba3e6a8fcb --- /dev/null +++ b/devel/libcrossguid/patches/patch-CMakeLists_txt @@ -0,0 +1,23 @@ +Index: CMakeLists.txt +--- CMakeLists.txt.orig ++++ CMakeLists.txt +@@ -22,6 +22,8 @@ target_include_directories(crossguid PUBLIC + + if(WIN32) + target_compile_definitions(crossguid PRIVATE GUID_WINDOWS) ++elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD") ++ target_compile_definitions(crossguid PRIVATE GUID_DCE) + elseif(APPLE) + find_library(CFLIB CoreFoundation) + target_link_libraries(crossguid ${CFLIB}) +@@ -64,8 +66,8 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURC + set(CROSSGUID_ARCHIVE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") + set(CROSSGUID_FRAMEWORK_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") + +- set(CROSSGUID_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/crossguid/cmake") +- set(CROSSGUID_ADDITIONAL_FILES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/crossguid") ++ set(CROSSGUID_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/crossguid") ++ set(CROSSGUID_ADDITIONAL_FILES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/doc/crossguid") + + # Install target + install(TARGETS crossguid EXPORT crossguidTargets diff --git a/devel/libcrossguid/patches/patch-src_guid_cpp b/devel/libcrossguid/patches/patch-src_guid_cpp new file mode 100644 index 00000000000..013a822ae9f --- /dev/null +++ b/devel/libcrossguid/patches/patch-src_guid_cpp @@ -0,0 +1,32 @@ +Index: src/guid.cpp +--- src/guid.cpp.orig ++++ src/guid.cpp +@@ -42,6 +42,10 @@ THE SOFTWARE. + #include + #endif + ++#ifdef GUID_DCE ++#include ++#endif ++ + BEGIN_XG_NAMESPACE + + #ifdef GUID_ANDROID +@@ -275,6 +279,17 @@ Guid newGuid() + std::array data; + static_assert(std::is_same::value, "Wrong type!"); + uuid_generate(data.data()); ++ return Guid{std::move(data)}; ++} ++#endif ++ ++#ifdef GUID_DCE ++Guid newGuid() ++{ ++ uuid_t uuid; ++ std::array data; ++ uuid_create(&uuid, NULL); ++ uuid_enc_be(&data, &uuid); + return Guid{std::move(data)}; + } + #endif diff --git a/devel/libcrossguid/pkg/DESCR b/devel/libcrossguid/pkg/DESCR new file mode 100644 index 00000000000..cfc3a411238 --- /dev/null +++ b/devel/libcrossguid/pkg/DESCR @@ -0,0 +1,3 @@ +CrossGuid is a minimal, cross platform, C++ GUID library. It uses the +best native GUID/UUID generator on the given platform and had a generic +class for parsing, stringifying, and comparing IDs. diff --git a/devel/libcrossguid/pkg/PLIST b/devel/libcrossguid/pkg/PLIST new file mode 100644 index 00000000000..2e3a6a3529d --- /dev/null +++ b/devel/libcrossguid/pkg/PLIST @@ -0,0 +1,11 @@ +include/crossguid/ +include/crossguid/guid.hpp +lib/cmake/ +lib/cmake/crossguid/ +lib/cmake/crossguid/crossguid-config${MODCMAKE_BUILD_SUFFIX} +lib/cmake/crossguid/crossguid-config.cmake +@lib lib/libcrossguid.so.${LIBcrossguid_VERSION} +lib/pkgconfig/crossguid.pc +share/doc/crossguid/ +share/doc/crossguid/LICENSE +share/doc/crossguid/README.md