diff --git a/textproc/Makefile b/textproc/Makefile --- a/textproc/Makefile +++ b/textproc/Makefile @@ -372,6 +372,7 @@ SUBDIR += kmflcomp SUBDIR += kn-aspell SUBDIR += kompare + SUBDIR += krep SUBDIR += kreport SUBDIR += ku-aspell SUBDIR += ky-aspell diff --git a/textproc/krep/Makefile b/textproc/krep/Makefile new file mode 100644 --- /dev/null +++ b/textproc/krep/Makefile @@ -0,0 +1,26 @@ +PORTNAME= krep +DISTVERSIONPREFIX= v +DISTVERSION= 2.2.0 +CATEGORIES= textproc + +MAINTAINER= alven@FreeBSD.org +COMMENT= High-performance string search utility +WWW= https://github.com/davidesantangelo/krep/ + +LICENSE= BSD2CLAUSE +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= gmake + +USE_GITHUB= yes +GH_ACCOUNT= davidesantangelo + +TEST_TARGET= test + +PLIST_FILES= bin/krep + +OPTIONS_DEFINE= SIMD + +SIMD_MAKE_ARGS= SIMD=1 + +.include diff --git a/textproc/krep/distinfo b/textproc/krep/distinfo new file mode 100644 --- /dev/null +++ b/textproc/krep/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1771430500 +SHA256 (davidesantangelo-krep-v2.2.0_GH0.tar.gz) = 9929a0b8a4d6502689e562657777f2ce47fc4e1d67ae81b6f1d2104ac1900b84 +SIZE (davidesantangelo-krep-v2.2.0_GH0.tar.gz) = 78896 diff --git a/textproc/krep/files/patch-Makefile b/textproc/krep/files/patch-Makefile new file mode 100644 --- /dev/null +++ b/textproc/krep/files/patch-Makefile @@ -0,0 +1,34 @@ +--- Makefile.orig 2026-02-18 16:14:00 UTC ++++ Makefile +@@ -5,10 +5,10 @@ BINDIR = $(PREFIX)/bin + PREFIX ?= /usr/local + BINDIR = $(PREFIX)/bin + +-CC = gcc +-CFLAGS = -Wall -Wextra -O3 -ffast-math -std=c11 -pthread -D_GNU_SOURCE -D_DEFAULT_SOURCE \ ++CC ?= gcc ++CFLAGS ?= -Wall -Wextra -O3 -ffast-math -std=c11 -pthread -D_GNU_SOURCE -D_DEFAULT_SOURCE \ + -flto -funroll-loops -finline-functions +-LDFLAGS = -pthread -flto ++LDFLAGS += -pthread -flto + + # Build mode: set NATIVE=1 for maximum performance on local machine + # Example: make NATIVE=1 +@@ -19,6 +19,9 @@ ARCH := $(shell uname -m) + # Detect architecture for SIMD flags + ARCH := $(shell uname -m) + ++# Build mode: set SIMD=1 for maximum performance using SIMD instructions ++# Example: make SIMD=1 ++ifdef SIMD + ifeq ($(ARCH), x86_64) + # Check for AVX-512 support (Linux: /proc/cpuinfo, macOS: sysctl) + HAS_AVX512 := $(shell (grep -q avx512f /proc/cpuinfo 2>/dev/null && echo 1) || \ +@@ -46,6 +49,7 @@ else ifeq ($(ARCH), aarch64) + else ifeq ($(ARCH), aarch64) + # Enable NEON for aarch64 Linux + CFLAGS += -D__ARM_NEON ++endif + endif + + # Source files diff --git a/textproc/krep/pkg-descr b/textproc/krep/pkg-descr new file mode 100644 --- /dev/null +++ b/textproc/krep/pkg-descr @@ -0,0 +1,13 @@ +krep is an optimized string search utility designed for maximum throughput and +efficiency when processing large files and directories. It is built with +performance in mind, offering multiple search algorithms and SIMD acceleration +when available. + +Note: Krep is not intended to be a full replacement or direct competitor to +feature-rich tools like grep or ripgrep. Instead, it aims to be a minimal, +efficient, and pragmatic tool focused on speed and simplicity. + +Krep provides the essential features needed for fast searching, without the +extensive options and complexity of more comprehensive search utilities. Its +design philosophy is to deliver the fastest possible search for the most common +use cases, with a clean and minimal interface.