git: 734040197adf - main - devel/scnlib: new port, scanf for modern C++
Thierry Thomas <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.ports |
|---|---|
| Message-ID | <[email protected]> |
The branch main has been updated by thierry: URL: https://cgit.FreeBSD.org/ports/commit/?id=734040197adf219afbc750f9d478cae735db2ded commit 734040197adf219afbc750f9d478cae735db2ded Author: Thierry Thomas <[email protected]> AuthorDate: 2026-08-15 19:50:26 +0000 Commit: Thierry Thomas <[email protected]> CommitDate: 2026-08-15 19:58:03 +0000 devel/scnlib: new port, scanf for modern C++ --- devel/Makefile | 1 + devel/scnlib/Makefile | 38 ++++++++++++++++++++++ devel/scnlib/distinfo | 3 ++ .../patch-benchmark_runtime_float_repeated.cpp | 7 ++++ .../files/patch-benchmark_runtime_float_single.cpp | 7 ++++ devel/scnlib/files/patch-src_scn_impl.cpp | 25 ++++++++++++++ devel/scnlib/pkg-descr | 7 ++++ devel/scnlib/pkg-plist | 13 ++++++++ 8 files changed, 101 insertions(+) diff --git a/devel/Makefile b/devel/Makefile index 0f197e43428b..072522862214 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -8613,6 +8613,7 @@ SUBDIR += sccache SUBDIR += sccs SUBDIR += schilybase + SUBDIR += scn SUBDIR += scons SUBDIR += sdbus-cpp SUBDIR += sdl12 diff --git a/devel/scnlib/Makefile b/devel/scnlib/Makefile new file mode 100644 index 000000000000..a7c42fabd149 --- /dev/null +++ b/devel/scnlib/Makefile @@ -0,0 +1,38 @@ +PORTNAME= scnlib +DISTVERSIONPREFIX= v +DISTVERSION= 4.0.1 +CATEGORIES= devel + +MAINTAINER= [email protected] +COMMENT= scanf for modern C++ +WWW= https://www.scnlib.dev/ + +LICENSE= APACHE20 + +BUILD_DEPENDS= ${NONEXISTENT}:devel/googletest:patch \ + ${NONEXISTENT}:math/fast_float:patch \ + ${NONEXISTENT}:devel/benchmark:patch + +USES= cmake compiler:c++20-lang python +USE_CXXSTD= c++20 + +USE_GITHUB= yes +GH_ACCOUNT= eliaskosunen + +BINARY_ALIAS= git=false +CMAKE_ON= BUILD_SHARED_LIBS +USE_LDCONFIG= yes + +GB_WRKSRC= ${MAKE} -C ${.CURDIR}/../benchmark -V WRKSRC +GT_WRKSRC= ${MAKE} -C ${.CURDIR}/../googletest -V WRKSRC +FF_WRKSRC= ${MAKE} -C ${.CURDIR}/../../math/fast_float -V WRKSRC + +pre-configure: + ${MKDIR} ${CONFIGURE_WRKSRC}/_deps/googletest-src \ + ${CONFIGURE_WRKSRC}/_deps/google-benchmark-src \ + ${CONFIGURE_WRKSRC}/_deps/fast_float-src + ${CP} -Rp $$(${GB_WRKSRC})/ ${CONFIGURE_WRKSRC}/_deps/google-benchmark-src + ${CP} -Rp $$(${GT_WRKSRC})/ ${CONFIGURE_WRKSRC}/_deps/googletest-src + ${CP} -Rp $$(${FF_WRKSRC})/ ${CONFIGURE_WRKSRC}/_deps/fast_float-src + +.include <bsd.port.mk> diff --git a/devel/scnlib/distinfo b/devel/scnlib/distinfo new file mode 100644 index 000000000000..0ca30db119b2 --- /dev/null +++ b/devel/scnlib/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1786812032 +SHA256 (eliaskosunen-scnlib-v4.0.1_GH0.tar.gz) = ece17b26840894cc57a7127138fe4540929adcb297524dec02c490c233ff46a7 +SIZE (eliaskosunen-scnlib-v4.0.1_GH0.tar.gz) = 434107 diff --git a/devel/scnlib/files/patch-benchmark_runtime_float_repeated.cpp b/devel/scnlib/files/patch-benchmark_runtime_float_repeated.cpp new file mode 100644 index 000000000000..406de72f0ae2 --- /dev/null +++ b/devel/scnlib/files/patch-benchmark_runtime_float_repeated.cpp @@ -0,0 +1,7 @@ +--- benchmark/runtime/float/repeated.cpp.orig 2024-11-03 23:00:07 UTC ++++ benchmark/runtime/float/repeated.cpp +@@ -210,4 +210,3 @@ BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, doub + } + BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, float); + BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, double); +-BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, long double); diff --git a/devel/scnlib/files/patch-benchmark_runtime_float_single.cpp b/devel/scnlib/files/patch-benchmark_runtime_float_single.cpp new file mode 100644 index 000000000000..b3823fadedf5 --- /dev/null +++ b/devel/scnlib/files/patch-benchmark_runtime_float_single.cpp @@ -0,0 +1,7 @@ +--- benchmark/runtime/float/single.cpp.orig 2024-11-03 23:00:07 UTC ++++ benchmark/runtime/float/single.cpp +@@ -185,4 +185,3 @@ BENCHMARK_TEMPLATE(scan_float_single_fastfloat, double + } + BENCHMARK_TEMPLATE(scan_float_single_fastfloat, float); + BENCHMARK_TEMPLATE(scan_float_single_fastfloat, double); +-BENCHMARK_TEMPLATE(scan_float_single_fastfloat, long double); diff --git a/devel/scnlib/files/patch-src_scn_impl.cpp b/devel/scnlib/files/patch-src_scn_impl.cpp new file mode 100644 index 000000000000..8f3d8867e5bb --- /dev/null +++ b/devel/scnlib/files/patch-src_scn_impl.cpp @@ -0,0 +1,25 @@ +--- src/scn/impl.cpp.orig 2024-11-03 23:00:07 UTC ++++ src/scn/impl.cpp +@@ -721,15 +721,18 @@ struct fast_float_impl_base : impl_base { + struct fast_float_impl_base : impl_base { + fast_float::chars_format get_flags() const + { +- unsigned format_flags{}; ++ // Patch from https://github.com/eliaskosunen/scnlib/pull/136 ++ fast_float::chars_format format_flags{}; + if ((m_options & float_reader_base::allow_fixed) != 0) { +- format_flags |= fast_float::fixed; ++ format_flags = ++ static_cast<fast_float::chars_format>(format_flags | fast_float::chars_format::fixed); + } + if ((m_options & float_reader_base::allow_scientific) != 0) { +- format_flags |= fast_float::scientific; ++ format_flags = ++ static_cast<fast_float::chars_format>(format_flags | fast_float::chars_format::scientific); + } + +- return static_cast<fast_float::chars_format>(format_flags); ++ return format_flags; + } + }; + diff --git a/devel/scnlib/pkg-descr b/devel/scnlib/pkg-descr new file mode 100644 index 000000000000..0f1817f4ce9e --- /dev/null +++ b/devel/scnlib/pkg-descr @@ -0,0 +1,7 @@ +scnlib is a modern C++ library for replacing scanf and std::istream. This +library attempts to move us ever so much closer to replacing iostreams and C +stdio altogether. It's faster than iostream (see Benchmarks), and type-safe, +unlike scanf. Think {fmt} or C++20 std::format, but in the other direction. + +This library is the reference implementation of the ISO C++ standards proposal +P1729 "Text Parsing". diff --git a/devel/scnlib/pkg-plist b/devel/scnlib/pkg-plist new file mode 100644 index 000000000000..5ddd13e9ac78 --- /dev/null +++ b/devel/scnlib/pkg-plist @@ -0,0 +1,13 @@ +include/scn/chrono.h +include/scn/fwd.h +include/scn/istream.h +include/scn/ranges.h +include/scn/regex.h +include/scn/scan.h +include/scn/xchar.h +lib/cmake/scn/scn-config-version.cmake +lib/cmake/scn/scn-config.cmake +lib/cmake/scn/scn-targets-%%CMAKE_BUILD_TYPE%%.cmake +lib/cmake/scn/scn-targets.cmake +lib/libscn.so +lib/libscn.so.4