git: 8a2fd68d44bd - main - lang/kefir: C17/C23 compiler

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Sun, 19 Oct 2025 08:05:21 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8a2fd68d44bd723c4f2d1489d6b0a25b2bad9099

commit 8a2fd68d44bd723c4f2d1489d6b0a25b2bad9099
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2025-10-15 22:59:31 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-10-19 08:03:25 +0000

    lang/kefir: C17/C23 compiler
    
    Kefir is an independent compiler for the C17/C23 programming language,
    developed by Jevgenij Protopopov.  Kefir has been validated with a test
    suite of 80 software projects, among which are GNU core- and binutils,
    Curl, Nginx, OpenSSL, Perl, Postgresql, Tcl and many others.  The
    compiler targets x86_64 architecture and System-V AMD64 ABI, supporting
    Linux, FreeBSD, NetBSD an OpenBSD.  While the primary priority is
    compatibility and compliance, Kefir also features conservative SSA-based
    optimization pipeline, debug information generation,
    position-independent code, and implements bit-identical bootstrap.
    Kefir focuses on C source code translation to assembly, and integrates
    with the rest of system toolchain (assembler, linker, standard library)
    for other tasks.
    
    WWW: https://kefir.protopopov.lv/
---
 lang/Makefile                             |   1 +
 lang/kefir/Makefile                       |  30 ++++
 lang/kefir/distinfo                       |   3 +
 lang/kefir/files/patch-source_Makefile.mk |  11 ++
 lang/kefir/pkg-descr                      |  12 ++
 lang/kefir/pkg-plist                      | 260 ++++++++++++++++++++++++++++++
 6 files changed, 317 insertions(+)

diff --git a/lang/Makefile b/lang/Makefile
index 9d93a2d9960a..3f2e15fb33a4 100644
--- a/lang/Makefile
+++ b/lang/Makefile
@@ -162,6 +162,7 @@
     SUBDIR += julia
     SUBDIR += jython
     SUBDIR += kawa
+    SUBDIR += kefir
     SUBDIR += kf5-kross
     SUBDIR += kotlin
     SUBDIR += kturtle
diff --git a/lang/kefir/Makefile b/lang/kefir/Makefile
new file mode 100644
index 000000000000..66a3974bbd07
--- /dev/null
+++ b/lang/kefir/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	kefir
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.5.0
+CATEGORIES=	lang devel
+MASTER_SITES=	https://git.sr.ht/~jprotopopov/kefir/archive/${DISTVERSIONFULL}.tar.gz?dummy=/
+
+MAINTAINER=	fuz@FreeBSD.org
+COMMENT=	C17/C23 compiler
+WWW=		https://kefir.protopopov.lv/
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+ONLY_FOR_ARCHS=	amd64
+ONLY_FOR_ARCHS_REASON=	compiler targets amd64 only right now
+
+BUILD_DEPENDS=	as:devel/binutils \
+		grealpath:sysutils/coreutils
+RUN_DEPENDS=	as:devel/binutils
+TEST_DEPENDS=	bash:shells/bash
+
+USES=		gmake
+USE_LDCONFIG=	yes
+TEST_TARGET= 	test
+MAKE_ARGS=	prefix=${PREFIX}
+.if "${WITH_DEBUG}" == "yes"
+MAKE_ARGS+=	PROFILE=debug
+.endif
+
+.include <bsd.port.mk>
diff --git a/lang/kefir/distinfo b/lang/kefir/distinfo
new file mode 100644
index 000000000000..adf92888116d
--- /dev/null
+++ b/lang/kefir/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1760556283
+SHA256 (kefir-v0.5.0.tar.gz) = c162a114392b90708e49edfebe3e23f85c0c5e025fbac5a9ce518f1dfe4835f9
+SIZE (kefir-v0.5.0.tar.gz) = 2190983
diff --git a/lang/kefir/files/patch-source_Makefile.mk b/lang/kefir/files/patch-source_Makefile.mk
new file mode 100644
index 000000000000..723722ce9f08
--- /dev/null
+++ b/lang/kefir/files/patch-source_Makefile.mk
@@ -0,0 +1,11 @@
+--- source/Makefile.mk.orig	2025-10-15 22:39:36 UTC
++++ source/Makefile.mk
+@@ -68,7 +68,7 @@ $(LIBKEFIR_SO).$(LIBKEFIR_SO_VERSION): $(KEFIR_LIB_OBJ
+ $(LIBKEFIR_SO).$(LIBKEFIR_SO_VERSION): $(KEFIR_LIB_OBJECT_FILES)
+ 	@mkdir -p $(shell dirname "$@")
+ 	@echo "Linking $@"
+-	@$(CCLD) -shared -o $@ $(KEFIR_LIB_OBJECT_FILES) $(LDFLAGS)
++	@$(CCLD) -shared -Wl,-soname=$(shell basename "$@") -o $@ $(KEFIR_LIB_OBJECT_FILES) $(LDFLAGS)
+ ifneq (,$(findstring release,$(PROFILE)))
+ 	@echo "Stripping $@"
+ 	@$(STRIP) $@
diff --git a/lang/kefir/pkg-descr b/lang/kefir/pkg-descr
new file mode 100644
index 000000000000..fbb34c08212a
--- /dev/null
+++ b/lang/kefir/pkg-descr
@@ -0,0 +1,12 @@
+Kefir is an independent compiler for the C17/C23 programming language,
+developed by Jevgenij Protopopov.  Kefir has been validated with a test
+suite of 80 software projects, among which are GNU core- and binutils,
+Curl, Nginx, OpenSSL, Perl, Postgresql, Tcl and many others.  The
+compiler targets x86_64 architecture and System-V AMD64 ABI, supporting
+Linux, FreeBSD, NetBSD an OpenBSD.  While the primary priority is
+compatibility and compliance, Kefir also features conservative SSA-based
+optimization pipeline, debug information generation,
+position-independent code, and implements bit-identical bootstrap.
+Kefir focuses on C source code translation to assembly, and integrates
+with the rest of system toolchain (assembler, linker, standard library)
+for other tasks.
diff --git a/lang/kefir/pkg-plist b/lang/kefir/pkg-plist
new file mode 100644
index 000000000000..9d72e6b11161
--- /dev/null
+++ b/lang/kefir/pkg-plist
@@ -0,0 +1,260 @@
+bin/kefir
+bin/kefir-cc
+bin/kefir-cc1
+bin/kefir-detect-host-env
+etc/kefir.local
+include/kefir/runtime
+include/kefir/toolchain/kefir/ast-translator/base.h
+include/kefir/toolchain/kefir/ast-translator/cache.h
+include/kefir/toolchain/kefir/ast-translator/context.h
+include/kefir/toolchain/kefir/ast-translator/debug/translator.h
+include/kefir/toolchain/kefir/ast-translator/environment.h
+include/kefir/toolchain/kefir/ast-translator/flow_control.h
+include/kefir/toolchain/kefir/ast-translator/function_declaration.h
+include/kefir/toolchain/kefir/ast-translator/function_definition.h
+include/kefir/toolchain/kefir/ast-translator/initializer.h
+include/kefir/toolchain/kefir/ast-translator/jump.h
+include/kefir/toolchain/kefir/ast-translator/layout.h
+include/kefir/toolchain/kefir/ast-translator/lvalue.h
+include/kefir/toolchain/kefir/ast-translator/misc.h
+include/kefir/toolchain/kefir/ast-translator/scope/global_scope_layout.h
+include/kefir/toolchain/kefir/ast-translator/scope/local_scope_layout.h
+include/kefir/toolchain/kefir/ast-translator/scope/scope_layout_impl.h
+include/kefir/toolchain/kefir/ast-translator/scope/scoped_identifier.h
+include/kefir/toolchain/kefir/ast-translator/scope/translator.h
+include/kefir/toolchain/kefir/ast-translator/temporaries.h
+include/kefir/toolchain/kefir/ast-translator/translator.h
+include/kefir/toolchain/kefir/ast-translator/translator_impl.h
+include/kefir/toolchain/kefir/ast-translator/type.h
+include/kefir/toolchain/kefir/ast-translator/typeconv.h
+include/kefir/toolchain/kefir/ast-translator/util.h
+include/kefir/toolchain/kefir/ast-translator/value.h
+include/kefir/toolchain/kefir/ast/alignment.h
+include/kefir/toolchain/kefir/ast/analyzer/analyzer.h
+include/kefir/toolchain/kefir/ast/analyzer/declarator.h
+include/kefir/toolchain/kefir/ast/analyzer/initializer.h
+include/kefir/toolchain/kefir/ast/analyzer/member_designator.h
+include/kefir/toolchain/kefir/ast/analyzer/nodes.h
+include/kefir/toolchain/kefir/ast/analyzer/type_traversal.h
+include/kefir/toolchain/kefir/ast/attributes.h
+include/kefir/toolchain/kefir/ast/base.h
+include/kefir/toolchain/kefir/ast/cache.h
+include/kefir/toolchain/kefir/ast/constant_expression.h
+include/kefir/toolchain/kefir/ast/constant_expression_impl.h
+include/kefir/toolchain/kefir/ast/constants.h
+include/kefir/toolchain/kefir/ast/context.h
+include/kefir/toolchain/kefir/ast/context_impl.h
+include/kefir/toolchain/kefir/ast/declarator.h
+include/kefir/toolchain/kefir/ast/declarator_specifier.h
+include/kefir/toolchain/kefir/ast/deprecation.h
+include/kefir/toolchain/kefir/ast/designator.h
+include/kefir/toolchain/kefir/ast/downcast.h
+include/kefir/toolchain/kefir/ast/flow_control.h
+include/kefir/toolchain/kefir/ast/format.h
+include/kefir/toolchain/kefir/ast/function_declaration_context.h
+include/kefir/toolchain/kefir/ast/global_context.h
+include/kefir/toolchain/kefir/ast/initializer.h
+include/kefir/toolchain/kefir/ast/initializer_traversal.h
+include/kefir/toolchain/kefir/ast/local_context.h
+include/kefir/toolchain/kefir/ast/node.h
+include/kefir/toolchain/kefir/ast/node_base.h
+include/kefir/toolchain/kefir/ast/node_helpers.h
+include/kefir/toolchain/kefir/ast/node_internal.h
+include/kefir/toolchain/kefir/ast/object.h
+include/kefir/toolchain/kefir/ast/runtime.h
+include/kefir/toolchain/kefir/ast/scope.h
+include/kefir/toolchain/kefir/ast/target_environment.h
+include/kefir/toolchain/kefir/ast/temporaries.h
+include/kefir/toolchain/kefir/ast/type.h
+include/kefir/toolchain/kefir/ast/type/array.h
+include/kefir/toolchain/kefir/ast/type/base.h
+include/kefir/toolchain/kefir/ast/type/basic.h
+include/kefir/toolchain/kefir/ast/type/enum.h
+include/kefir/toolchain/kefir/ast/type/function.h
+include/kefir/toolchain/kefir/ast/type/pointer.h
+include/kefir/toolchain/kefir/ast/type/qualified.h
+include/kefir/toolchain/kefir/ast/type/struct.h
+include/kefir/toolchain/kefir/ast/type_completion.h
+include/kefir/toolchain/kefir/ast/type_conv.h
+include/kefir/toolchain/kefir/ast/type_layout.h
+include/kefir/toolchain/kefir/cc1/cc1.h
+include/kefir/toolchain/kefir/cc1/options.h
+include/kefir/toolchain/kefir/codegen/amd64-common.h
+include/kefir/toolchain/kefir/codegen/amd64/asmcmp.h
+include/kefir/toolchain/kefir/codegen/amd64/codegen.h
+include/kefir/toolchain/kefir/codegen/amd64/devirtualize.h
+include/kefir/toolchain/kefir/codegen/amd64/dwarf.h
+include/kefir/toolchain/kefir/codegen/amd64/function.h
+include/kefir/toolchain/kefir/codegen/amd64/lowering.h
+include/kefir/toolchain/kefir/codegen/amd64/module.h
+include/kefir/toolchain/kefir/codegen/amd64/stack_frame.h
+include/kefir/toolchain/kefir/codegen/amd64/static_data.h
+include/kefir/toolchain/kefir/codegen/amd64/symbolic_labels.h
+include/kefir/toolchain/kefir/codegen/amd64/xregalloc.h
+include/kefir/toolchain/kefir/codegen/asmcmp/base.h
+include/kefir/toolchain/kefir/codegen/asmcmp/context.h
+include/kefir/toolchain/kefir/codegen/asmcmp/debug.h
+include/kefir/toolchain/kefir/codegen/asmcmp/format.h
+include/kefir/toolchain/kefir/codegen/asmcmp/pipeline.h
+include/kefir/toolchain/kefir/codegen/asmcmp/type_defs.h
+include/kefir/toolchain/kefir/codegen/codegen.h
+include/kefir/toolchain/kefir/codegen/variable_allocator.h
+include/kefir/toolchain/kefir/compiler/compiler.h
+include/kefir/toolchain/kefir/compiler/configuration.h
+include/kefir/toolchain/kefir/compiler/profile.h
+include/kefir/toolchain/kefir/core/base.h
+include/kefir/toolchain/kefir/core/basic-types.h
+include/kefir/toolchain/kefir/core/bitset.h
+include/kefir/toolchain/kefir/core/block_tree.h
+include/kefir/toolchain/kefir/core/data_model.h
+include/kefir/toolchain/kefir/core/error.h
+include/kefir/toolchain/kefir/core/error_format.h
+include/kefir/toolchain/kefir/core/extensions.h
+include/kefir/toolchain/kefir/core/hash.h
+include/kefir/toolchain/kefir/core/hashset.h
+include/kefir/toolchain/kefir/core/hashtable.h
+include/kefir/toolchain/kefir/core/hashtree.h
+include/kefir/toolchain/kefir/core/hashtreeset.h
+include/kefir/toolchain/kefir/core/interval_tree.h
+include/kefir/toolchain/kefir/core/list.h
+include/kefir/toolchain/kefir/core/mem.h
+include/kefir/toolchain/kefir/core/optional.h
+include/kefir/toolchain/kefir/core/os_error.h
+include/kefir/toolchain/kefir/core/platform.h
+include/kefir/toolchain/kefir/core/queue.h
+include/kefir/toolchain/kefir/core/sort.h
+include/kefir/toolchain/kefir/core/source_error.h
+include/kefir/toolchain/kefir/core/source_location.h
+include/kefir/toolchain/kefir/core/standard_version.h
+include/kefir/toolchain/kefir/core/string_array.h
+include/kefir/toolchain/kefir/core/string_buffer.h
+include/kefir/toolchain/kefir/core/string_builder.h
+include/kefir/toolchain/kefir/core/string_pool.h
+include/kefir/toolchain/kefir/core/tree.h
+include/kefir/toolchain/kefir/core/trie.h
+include/kefir/toolchain/kefir/core/util.h
+include/kefir/toolchain/kefir/core/vector.h
+include/kefir/toolchain/kefir/core/version.h
+include/kefir/toolchain/kefir/driver/compiler_options.h
+include/kefir/toolchain/kefir/driver/configuration.h
+include/kefir/toolchain/kefir/driver/driver.h
+include/kefir/toolchain/kefir/driver/driver_prologue.h
+include/kefir/toolchain/kefir/driver/externals.h
+include/kefir/toolchain/kefir/driver/parser.h
+include/kefir/toolchain/kefir/driver/runner.h
+include/kefir/toolchain/kefir/driver/target.h
+include/kefir/toolchain/kefir/driver/target_configuration.h
+include/kefir/toolchain/kefir/driver/tools.h
+include/kefir/toolchain/kefir/ir/assembly.h
+include/kefir/toolchain/kefir/ir/bitfields.h
+include/kefir/toolchain/kefir/ir/builder.h
+include/kefir/toolchain/kefir/ir/compact.h
+include/kefir/toolchain/kefir/ir/data.h
+include/kefir/toolchain/kefir/ir/debug.h
+include/kefir/toolchain/kefir/ir/format.h
+include/kefir/toolchain/kefir/ir/format_impl.h
+include/kefir/toolchain/kefir/ir/function.h
+include/kefir/toolchain/kefir/ir/instr.h
+include/kefir/toolchain/kefir/ir/mnemonic.h
+include/kefir/toolchain/kefir/ir/module.h
+include/kefir/toolchain/kefir/ir/opcode_defs.h
+include/kefir/toolchain/kefir/ir/opcodes.h
+include/kefir/toolchain/kefir/ir/platform.h
+include/kefir/toolchain/kefir/ir/type.h
+include/kefir/toolchain/kefir/ir/type_tree.h
+include/kefir/toolchain/kefir/lexer/allocator.h
+include/kefir/toolchain/kefir/lexer/base.h
+include/kefir/toolchain/kefir/lexer/buffer.h
+include/kefir/toolchain/kefir/lexer/context.h
+include/kefir/toolchain/kefir/lexer/format.h
+include/kefir/toolchain/kefir/lexer/lexem.h
+include/kefir/toolchain/kefir/lexer/lexer.h
+include/kefir/toolchain/kefir/lexer/source_cursor.h
+include/kefir/toolchain/kefir/lexer/string_literal_impl.h
+include/kefir/toolchain/kefir/optimizer/analysis.h
+include/kefir/toolchain/kefir/optimizer/base.h
+include/kefir/toolchain/kefir/optimizer/builder.h
+include/kefir/toolchain/kefir/optimizer/code.h
+include/kefir/toolchain/kefir/optimizer/code_util.h
+include/kefir/toolchain/kefir/optimizer/configuration.h
+include/kefir/toolchain/kefir/optimizer/constructor.h
+include/kefir/toolchain/kefir/optimizer/constructor_internal.h
+include/kefir/toolchain/kefir/optimizer/debug.h
+include/kefir/toolchain/kefir/optimizer/format.h
+include/kefir/toolchain/kefir/optimizer/function.h
+include/kefir/toolchain/kefir/optimizer/inline.h
+include/kefir/toolchain/kefir/optimizer/liveness.h
+include/kefir/toolchain/kefir/optimizer/local_variables.h
+include/kefir/toolchain/kefir/optimizer/loop_nest.h
+include/kefir/toolchain/kefir/optimizer/module.h
+include/kefir/toolchain/kefir/optimizer/opcode_defs.h
+include/kefir/toolchain/kefir/optimizer/pipeline.h
+include/kefir/toolchain/kefir/optimizer/schedule.h
+include/kefir/toolchain/kefir/optimizer/structure.h
+include/kefir/toolchain/kefir/optimizer/type.h
+include/kefir/toolchain/kefir/parser/base.h
+include/kefir/toolchain/kefir/parser/builder.h
+include/kefir/toolchain/kefir/parser/builtins.h
+include/kefir/toolchain/kefir/parser/cursor.h
+include/kefir/toolchain/kefir/parser/parser.h
+include/kefir/toolchain/kefir/parser/rule_helpers.h
+include/kefir/toolchain/kefir/parser/rules.h
+include/kefir/toolchain/kefir/parser/ruleset.h
+include/kefir/toolchain/kefir/parser/scope.h
+include/kefir/toolchain/kefir/platform/cli_parser.h
+include/kefir/toolchain/kefir/platform/filesystem.h
+include/kefir/toolchain/kefir/platform/filesystem_source.h
+include/kefir/toolchain/kefir/platform/input.h
+include/kefir/toolchain/kefir/platform/process.h
+include/kefir/toolchain/kefir/platform/tempfile.h
+include/kefir/toolchain/kefir/preprocessor/ast_context.h
+include/kefir/toolchain/kefir/preprocessor/directives.h
+include/kefir/toolchain/kefir/preprocessor/format.h
+include/kefir/toolchain/kefir/preprocessor/macro.h
+include/kefir/toolchain/kefir/preprocessor/macro_scope.h
+include/kefir/toolchain/kefir/preprocessor/predefined_macro.h
+include/kefir/toolchain/kefir/preprocessor/preprocessor.h
+include/kefir/toolchain/kefir/preprocessor/source_dependency_locator.h
+include/kefir/toolchain/kefir/preprocessor/source_file.h
+include/kefir/toolchain/kefir/preprocessor/token_sequence.h
+include/kefir/toolchain/kefir/preprocessor/tokenizer.h
+include/kefir/toolchain/kefir/preprocessor/user_macro.h
+include/kefir/toolchain/kefir/preprocessor/util.h
+include/kefir/toolchain/kefir/preprocessor/virtual_source_file.h
+include/kefir/toolchain/kefir/runtime/common/alloca.h
+include/kefir/toolchain/kefir/runtime/common/float.h
+include/kefir/toolchain/kefir/runtime/common/typeclass.h
+include/kefir/toolchain/kefir/runtime/common/typeclass_kefir_impl.h
+include/kefir/toolchain/kefir/target/abi/amd64/base.h
+include/kefir/toolchain/kefir/target/abi/amd64/bitfields.h
+include/kefir/toolchain/kefir/target/abi/amd64/function.h
+include/kefir/toolchain/kefir/target/abi/amd64/parameters.h
+include/kefir/toolchain/kefir/target/abi/amd64/platform.h
+include/kefir/toolchain/kefir/target/abi/amd64/return.h
+include/kefir/toolchain/kefir/target/abi/amd64/system-v/bitfields.h
+include/kefir/toolchain/kefir/target/abi/amd64/system-v/data.h
+include/kefir/toolchain/kefir/target/abi/amd64/system-v/parameters.h
+include/kefir/toolchain/kefir/target/abi/amd64/system-v/qwords.h
+include/kefir/toolchain/kefir/target/abi/amd64/system-v/return.h
+include/kefir/toolchain/kefir/target/abi/amd64/system-v/type_layout.h
+include/kefir/toolchain/kefir/target/abi/amd64/type_layout.h
+include/kefir/toolchain/kefir/target/abi/amd64/vararg.h
+include/kefir/toolchain/kefir/target/abi/util.h
+include/kefir/toolchain/kefir/target/asm/amd64/db.h
+include/kefir/toolchain/kefir/target/asm/amd64/xasmgen.h
+include/kefir/toolchain/kefir/target/dwarf/dwarf.h
+include/kefir/toolchain/kefir/target/dwarf/generator.h
+include/kefir/toolchain/kefir/test/codegen.h
+include/kefir/toolchain/kefir/test/module_shim.h
+include/kefir/toolchain/kefir/test/unit_test.h
+include/kefir/toolchain/kefir/test/util.h
+include/kefir/toolchain/kefir/util/bigint.h
+include/kefir/toolchain/kefir/util/char32.h
+include/kefir/toolchain/kefir/util/json.h
+include/kefir/toolchain/kefir/util/uchar.h
+lib/libkefir.a
+lib/libkefir.so
+lib/libkefir.so.0.0
+share/man/man1/kefir-cc1.1.gz
+share/man/man1/kefir-detect-host-env.1.gz
+share/man/man1/kefir.1.gz