aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo-Chuan Hsieh <sunpoet@FreeBSD.org>2025-12-09 06:37:07 +0000
committerPo-Chuan Hsieh <sunpoet@FreeBSD.org>2025-12-09 11:20:47 +0000
commitb3058e362102f7b0aa5147e4fd4134c1d60879d9 (patch)
treed0b611e688d086cf426d83a163fbec72e57bcd32
parent6c32a82f7f491ac7f45519152eded3aa7c2beab5 (diff)
devel/base64: Add base64 0.5.2
This is an implementation of a base64 stream encoding/decoding library in C99 with SIMD (AVX2, AVX512, NEON, AArch64/NEON, SSSE3, SSE4.1, SSE4.2, AVX) and OpenMP acceleration. It also contains wrapper functions to encode/decode simple length-delimited strings. This library aims to be: - FAST; - easy to use; - elegant. On x86, the library does runtime feature detection. The first time it's called, the library will determine the appropriate encoding/decoding routines for the machine. It then remembers them for the lifetime of the program. If your processor supports AVX2, SSSE3, SSE4.1, SSE4.2 or AVX instructions, the library will pick an optimized codec that lets it encode/decode 12 or 24 bytes at a time, which gives a speedup of four or more times compared to the "plain" bytewise codec. AVX512 support is only for encoding at present, utilizing the AVX512 VL and VBMI instructions. Decoding part reused AVX2 implementations. For CPUs later than Cannonlake (manufactured in 2018) supports these instructions. NEON support is hardcoded to on or off at compile time, because portable runtime feature detection is unavailable on ARM. Even if your processor does not support SIMD instructions, this is a very fast library. The fallback routine can process 32 or 64 bits of input in one round, depending on your processor's word width, which still makes it significantly faster than naive bytewise implementations. On some 64-bit machines, the 64-bit routines even outperform the SSSE3 ones.
-rw-r--r--devel/Makefile1
-rw-r--r--devel/base64/Makefile38
-rw-r--r--devel/base64/distinfo3
-rw-r--r--devel/base64/pkg-descr28
-rw-r--r--devel/base64/pkg-plist9
5 files changed, 79 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index 549e995eb367..5ec871885409 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -293,6 +293,7 @@
SUBDIR += bacnet-stack
SUBDIR += bacon
SUBDIR += bam
+ SUBDIR += base64
SUBDIR += bashdb
SUBDIR += basu
SUBDIR += bats-core
diff --git a/devel/base64/Makefile b/devel/base64/Makefile
new file mode 100644
index 000000000000..5f41f563fc74
--- /dev/null
+++ b/devel/base64/Makefile
@@ -0,0 +1,38 @@
+PORTNAME= base64
+PORTVERSION= 0.5.2
+DISTVERSIONPREFIX= v
+CATEGORIES= devel
+
+MAINTAINER= sunpoet@FreeBSD.org
+COMMENT= Fast Base64 stream encoder/decoder in C99, with SIMD acceleration
+WWW= https://github.com/aklomp/base64
+
+LICENSE= BSD2CLAUSE
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USES= cmake:testing
+
+CMAKE_OFF= BASE64_BUILD_TESTS \
+ BASE64_REGENERATE_TABLES \
+ BASE64_WERROR \
+ BASE64_WITH_AVX \
+ BASE64_WITH_AVX2 \
+ BASE64_WITH_AVX512 \
+ BASE64_WITH_NEON32 \
+ BASE64_WITH_NEON64 \
+ BASE64_WITH_OpenMP \
+ BASE64_WITH_SSE41 \
+ BASE64_WITH_SSE42 \
+ BASE64_WITH_SSSE3
+CMAKE_ON= BASE64_BUILD_CLI \
+ BUILD_SHARED_LIBS
+CMAKE_TESTING_ON= \
+ BASE64_BUILD_TESTS \
+ BASE64_WERROR
+
+PLIST_SUB= PORTVERSION=${PORTVERSION}
+
+USE_GITHUB= yes
+GH_ACCOUNT= aklomp
+
+.include <bsd.port.mk>
diff --git a/devel/base64/distinfo b/devel/base64/distinfo
new file mode 100644
index 000000000000..becb5228a1c6
--- /dev/null
+++ b/devel/base64/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1765032618
+SHA256 (aklomp-base64-v0.5.2_GH0.tar.gz) = 723a0f9f4cf44cf79e97bcc315ec8f85e52eb104c8882942c3f2fba95acc080d
+SIZE (aklomp-base64-v0.5.2_GH0.tar.gz) = 104531
diff --git a/devel/base64/pkg-descr b/devel/base64/pkg-descr
new file mode 100644
index 000000000000..243756f0e06c
--- /dev/null
+++ b/devel/base64/pkg-descr
@@ -0,0 +1,28 @@
+This is an implementation of a base64 stream encoding/decoding library in C99
+with SIMD (AVX2, AVX512, NEON, AArch64/NEON, SSSE3, SSE4.1, SSE4.2, AVX) and
+OpenMP acceleration. It also contains wrapper functions to encode/decode simple
+length-delimited strings. This library aims to be:
+- FAST;
+- easy to use;
+- elegant.
+
+On x86, the library does runtime feature detection. The first time it's called,
+the library will determine the appropriate encoding/decoding routines for the
+machine. It then remembers them for the lifetime of the program. If your
+processor supports AVX2, SSSE3, SSE4.1, SSE4.2 or AVX instructions, the library
+will pick an optimized codec that lets it encode/decode 12 or 24 bytes at a
+time, which gives a speedup of four or more times compared to the "plain"
+bytewise codec.
+
+AVX512 support is only for encoding at present, utilizing the AVX512 VL and VBMI
+instructions. Decoding part reused AVX2 implementations. For CPUs later than
+Cannonlake (manufactured in 2018) supports these instructions.
+
+NEON support is hardcoded to on or off at compile time, because portable runtime
+feature detection is unavailable on ARM.
+
+Even if your processor does not support SIMD instructions, this is a very fast
+library. The fallback routine can process 32 or 64 bits of input in one round,
+depending on your processor's word width, which still makes it significantly
+faster than naive bytewise implementations. On some 64-bit machines, the 64-bit
+routines even outperform the SSSE3 ones.
diff --git a/devel/base64/pkg-plist b/devel/base64/pkg-plist
new file mode 100644
index 000000000000..be5e3b4802cb
--- /dev/null
+++ b/devel/base64/pkg-plist
@@ -0,0 +1,9 @@
+bin/base64
+include/libbase64.h
+lib/cmake/base64/base64-config-version.cmake
+lib/cmake/base64/base64-config.cmake
+lib/cmake/base64/base64-targets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/base64/base64-targets.cmake
+lib/libbase64.so
+lib/libbase64.so.0
+lib/libbase64.so.%%PORTVERSION%%