git: 050e562c9dd9 - main - devel/stc: [NEW PORT] Modern, user-friendly, generic, type-safe and fast C99 library

From: Älven <alven_at_FreeBSD.org>
Date: Sat, 20 Sep 2025 09:47:26 UTC
The branch main has been updated by alven:

URL: https://cgit.FreeBSD.org/ports/commit/?id=050e562c9dd9c7a6e6eba3032bba75dc8b6bea44

commit 050e562c9dd9c7a6e6eba3032bba75dc8b6bea44
Author:     Älven <alven@FreeBSD.org>
AuthorDate: 2025-09-20 09:46:44 +0000
Commit:     Älven <alven@FreeBSD.org>
CommitDate: 2025-09-20 09:46:44 +0000

    devel/stc: [NEW PORT] Modern, user-friendly, generic, type-safe and fast C99 library
    
    STC is a mature, comprehensive, general purpose container and
    algorithm library for C99/C11. It has excellent ergonomics and
    requires virtually no boilerplate code. The library adds many missing
    features to C, like common data containers, algorithms, and
    abstractions found in contemporary system languages like Zig, Rust,
    and C++. Containers and algorithms are templated or generic, which
    allows for a fully typesafe, compact, and high performance
    implementation.
    
    WWW:            https://github.com/stclib/STC/
    
    Approved by:    yuri@ (Mentor)
    
    Differential Revision: https://reviews.freebsd.org/D52520
---
 devel/Makefile                           |  1 +
 devel/stc/Makefile                       | 33 ++++++++++++++++++++++
 devel/stc/distinfo                       |  3 ++
 devel/stc/files/patch-meson.build        | 47 ++++++++++++++++++++++++++++++++
 devel/stc/files/patch-meson__options.txt | 29 ++++++++++++++++++++
 devel/stc/pkg-descr                      |  3 ++
 devel/stc/pkg-plist                      | 43 +++++++++++++++++++++++++++++
 7 files changed, 159 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 9a9051857929..95af36ff08e2 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -8274,6 +8274,7 @@
     SUBDIR += statik
     SUBDIR += statsvn
     SUBDIR += stb
+    SUBDIR += stc
     SUBDIR += stdman
     SUBDIR += stdx-allocator
     SUBDIR += stfl
diff --git a/devel/stc/Makefile b/devel/stc/Makefile
new file mode 100644
index 000000000000..0144dd4420ee
--- /dev/null
+++ b/devel/stc/Makefile
@@ -0,0 +1,33 @@
+PORTNAME=	stc
+DISTVERSIONPREFIX=	v
+DISTVERSION=	5.0
+CATEGORIES=	devel
+PKGNAMESUFFIX=	-library
+
+MAINTAINER=	alven@FreeBSD.org
+COMMENT=	Modern, user-friendly, generic, type-safe and fast C99 library
+WWW=		https://github.com/stclib/STC/
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		meson
+USE_GITHUB=	yes
+GH_ACCOUNT=	stclib
+GH_PROJECT=	STC
+USE_LDCONFIG=	yes
+
+PORTDOCS=	*
+PORTEXAMPLES=	*
+
+OPTIONS_DEFINE=	DOCS EXAMPLES STATIC
+OPTIONS_SUB=	yes
+
+DOCS_MESON_ENABLED=	docs
+DOCS_MESON_ON=		-Ddocsdir=${DOCSDIR}
+EXAMPLES_MESON_ENABLED=	examples
+EXAMPLES_MESON_ON=	-Dexamplesdir=${EXAMPLESDIR}
+STATIC_MESON_ON=	-Ddefault_library=both
+STATIC_MESON_OFF=	-Ddefault_library=shared
+
+.include <bsd.port.mk>
diff --git a/devel/stc/distinfo b/devel/stc/distinfo
new file mode 100644
index 000000000000..5f1ef2442788
--- /dev/null
+++ b/devel/stc/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1758282222
+SHA256 (stclib-STC-v5.0_GH0.tar.gz) = d61353852b9d7ef69b56fa32edcbc7934f2153385f3778536234201ceebcc950
+SIZE (stclib-STC-v5.0_GH0.tar.gz) = 972147
diff --git a/devel/stc/files/patch-meson.build b/devel/stc/files/patch-meson.build
new file mode 100644
index 000000000000..3a696d2778d7
--- /dev/null
+++ b/devel/stc/files/patch-meson.build
@@ -0,0 +1,47 @@
+--- meson.build.orig	2025-01-12 20:41:47 UTC
++++ meson.build
+@@ -144,19 +144,33 @@ root = not meson.is_subproject()
+ endif
+ 
+ root = not meson.is_subproject()
+-subdir('tests')
+-subdir('examples')
+ 
+ if root
+-  datadir = get_option('datadir')
+-  docdir = get_option('docdir')
+-  if docdir == ''
+-    docdir = datadir / 'doc' / meson.project_name()
++  if get_option('docs').enabled()
++    docsdir = get_option('docsdir')
++
++    install_data('README.md', install_dir: docsdir)
++
++    install_subdir(
++      'docs',
++      install_dir: docsdir,
++      strip_directory: true
++    )
+   endif
+ 
+-  install_subdir(
+-    'docs',
+-    install_dir: docdir,
+-    strip_directory: true,
+-  )
++  if get_option('examples').enabled()
++    examplesdir = get_option('examplesdir')
++
++    subdir('examples')
++
++    install_subdir(
++      'examples',
++      install_dir: examplesdir,
++      strip_directory: true
++    )
++  endif
++
++  if get_option('tests').enabled()
++    subdir('tests')
++  endif
+ endif
diff --git a/devel/stc/files/patch-meson__options.txt b/devel/stc/files/patch-meson__options.txt
new file mode 100644
index 000000000000..50a03aeb95a1
--- /dev/null
+++ b/devel/stc/files/patch-meson__options.txt
@@ -0,0 +1,29 @@
+--- meson_options.txt.orig	2025-01-14 15:37:45 UTC
++++ meson_options.txt
+@@ -5,10 +5,10 @@ option(
+   description: 'Build checkscoped tool for c_guard* blocks',
+ )
+ option(
+-  'tests',
++  'docs',
+   type: 'feature',
+   value: 'auto',
+-  description: 'Build tests and ctest',
++  description: 'Build documentation',
+ )
+ option(
+   'examples',
+@@ -16,5 +16,12 @@ option(
+   value: 'auto',
+   description: 'Build examples',
+ )
++option(
++  'tests',
++  type: 'feature',
++  value: 'auto',
++  description: 'Build tests and ctest',
++)
+ 
+-option('docdir', type: 'string', description: 'documentation directory')
++option('docsdir', type: 'string', description: 'documentation directory')
++option('examplesdir', type: 'string', description: 'examples directory')
diff --git a/devel/stc/pkg-descr b/devel/stc/pkg-descr
new file mode 100644
index 000000000000..628b918f445a
--- /dev/null
+++ b/devel/stc/pkg-descr
@@ -0,0 +1,3 @@
+STC is a comprehensive, modern, typesafe and fast templated general purpose
+container and algorithms library for C99. It aims to make C-programming even
+more fun, more productive and safer.
diff --git a/devel/stc/pkg-plist b/devel/stc/pkg-plist
new file mode 100644
index 000000000000..977403744497
--- /dev/null
+++ b/devel/stc/pkg-plist
@@ -0,0 +1,43 @@
+include/c11/fmt.h
+include/stc/algorithm.h
+include/stc/arc.h
+include/stc/box.h
+include/stc/cbits.h
+include/stc/common.h
+include/stc/coption.h
+include/stc/coroutine.h
+include/stc/cregex.h
+include/stc/cspan.h
+include/stc/cstr.h
+include/stc/csview.h
+include/stc/ctest.h
+include/stc/deque.h
+include/stc/hmap.h
+include/stc/hset.h
+include/stc/list.h
+include/stc/pqueue.h
+include/stc/priv/cstr_prv.h
+include/stc/priv/linkage.h
+include/stc/priv/linkage2.h
+include/stc/priv/queue_prv.h
+include/stc/priv/sort_prv.h
+include/stc/priv/template.h
+include/stc/priv/template2.h
+include/stc/priv/utf8_prv.h
+include/stc/queue.h
+include/stc/random.h
+include/stc/smap.h
+include/stc/sort.h
+include/stc/sset.h
+include/stc/stack.h
+include/stc/sys/crange.h
+include/stc/sys/filter.h
+include/stc/sys/sumtype.h
+include/stc/sys/utility.h
+include/stc/types.h
+include/stc/utf8.h
+include/stc/vec.h
+include/stc/zsview.h
+%%STATIC%%lib/libstc.a
+lib/libstc.so
+lib/libstc.so.5