gulrak_filesystem, new recipe (#7865)

This commit is contained in:
Schrijvers Luc
2023-02-22 19:15:46 +01:00
committed by GitHub
parent c8dc00c227
commit d54e3623d0
2 changed files with 163 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
SUMMARY="Header-only single-file std::filesystem compatible helper library"
DESCRIPTION="This is a header-only single-file std::filesystem compatible helper library, \
based on the C++17 and C++20 specs, but implemented for C++11, C++14, C++17 or C++20 (tightly \
following the C++17 standard with very few documented exceptions). It is currently tested on \
macOS 10.12/10.14/10.15/11.6, Windows 10, Ubuntu 18.04, Ubuntu 20.04, CentOS 7, CentOS 8, \
FreeBSD 12, Alpine ARM/ARM64 Linux and Solaris 10 but should work on other systems too, as long \
as you have at least a C++11 compatible compiler. It should work with Android NDK, Emscripten and \
I even had reports of it being used on iOS (within sandboxing constraints) and with v1.5.6 there \
is experimental support for QNX. The support of Android NDK, Emscripten and QNX is not backed up \
by automated testing but PRs and bug reports are welcome for those too. It is of course in its \
own namespace ghc::filesystem to not interfere with a regular std::filesystem should you use \
it in a mixed C++17 environment (which is possible)."
HOMEPAGE="https://github.com/gulrak/filesystem/"
COPYRIGHT="2018 Steffen Schümann"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="7d62c5746c724d28da216d9e11827ba4e573df15ef40720292827a4dfd33f2e9"
SOURCE_FILENAME="gulrak_filesystem-v$portVersion.tar.gz"
SOURCE_DIR="filesystem-$portVersion"
PATCHES="163.patch"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
gulrak_filesystem$secondaryArchSuffix = $portVersion
devel:filesystem$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
"
PATCH()
{
sed -i "s:-Werror::g" cmake/GhcHelper.cmake test/CMakeLists.txt
}
BUILD()
{
cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \
$cmakeDirArgs
make -C build $jobArgs
}
INSTALL()
{
make -C build install
}
TEST()
{
ctest --output-on-failure --test-dir build/test
}

View File

@@ -0,0 +1,101 @@
From 9afb43851d64a4ed67b96332e8c5a48afdf9d308 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 18 Feb 2023 10:21:53 +0100
Subject: [PATCH 1/2] filesystem.hpp, add support for Haiku
---
include/ghc/filesystem.hpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp
index 1d39b81..3ae48f2 100644
--- a/include/ghc/filesystem.hpp
+++ b/include/ghc/filesystem.hpp
@@ -78,6 +78,8 @@
#include <wasi/api.h>
#elif defined(__QNX__)
#define GHC_OS_QNX
+#elif defined(__HAIKU__)
+#define GHC_OS_HAIKU
#else
#error "Operating system currently not supported!"
#endif
From a9c18e0880a8289bbbb062d8ba356e9a6ff1cbc5 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sun, 19 Feb 2023 09:11:34 +0100
Subject: [PATCH 2/2] Fix Haiku build
---
cmake/GhcHelper.cmake | 9 +++++++++
test/CMakeLists.txt | 9 +++++++++
2 files changed, 18 insertions(+)
diff --git a/cmake/GhcHelper.cmake b/cmake/GhcHelper.cmake
index ca0f787..4d9e5a0 100644
--- a/cmake/GhcHelper.cmake
+++ b/cmake/GhcHelper.cmake
@@ -22,6 +22,9 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND (CMAKE_CXX_COMPILER_VERSION V
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(filesystem_test xnet)
endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
+ target_link_libraries(filesystem_test network)
+ endif()
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
endif()
@@ -34,6 +37,9 @@ if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 O
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(${targetName} xnet)
endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
+ target_link_libraries(${targetName} network)
+ endif()
target_compile_options(${targetName} PRIVATE $<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
endif()
@@ -55,6 +61,9 @@ macro(AddTestExecutableWithStdCpp cppStd)
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(filesystem_test_cpp${cppStd} xnet)
endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
+ target_link_libraries(filesystem_test_cpp${cppStd} network)
+ endif()
target_compile_options(filesystem_test_cpp${cppStd} PRIVATE
$<$<BOOL:${EMSCRIPTEN}>:-s DISABLE_EXCEPTION_CATCHING=0>
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations>
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index cf7237e..2275c61 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -25,6 +25,9 @@ if(GHC_COVERAGE)
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(filesystem_test PUBLIC xnet)
endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
+ target_link_libraries(filesystem_test PUBLIC network)
+ endif()
if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
AddTestExecutableWithStdCpp(17 filesystem_test.cpp catch.hpp)
endif()
@@ -38,6 +41,9 @@ else()
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(filesystem_test xnet)
endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
+ target_link_libraries(filesystem_test network)
+ endif()
SetTestCompileOptions(filesystem_test)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)
@@ -77,6 +83,9 @@ target_link_libraries(fwd_impl_test ghc_filesystem)
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(fwd_impl_test xnet)
endif()
+if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
+ target_link_libraries(fwd_impl_test network)
+endif()
SetTestCompileOptions(fwd_impl_test)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)