public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rmlint] f45: Unbundle blake3
@ 2026-11-02 10:34 Artur Frenszek-Iwicki
  0 siblings, 0 replies; only message in thread
From: Artur Frenszek-Iwicki @ 2026-11-02 10:34 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/rmlint
Branch : f45
Commit : 01010438452deb30915c7cc3c9fccbd9353a77e3
Author : Artur Frenszek-Iwicki <fedora@svgames.pl>
Date   : 2026-11-02T10:44:42+01:00
Stats  : +135/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/rmlint/c/01010438452deb30915c7cc3c9fccbd9353a77e3?branch=f45

Log:
Unbundle blake3

---
diff --git a/0001-unbundle-blake3.patch b/0001-unbundle-blake3.patch
new file mode 100644
index 0000000..44430db
--- /dev/null
+++ b/0001-unbundle-blake3.patch
@@ -0,0 +1,131 @@
+diff -rU4 rmlint-2.11.0--orig/lib/checksum.c rmlint-2.11.0/lib/checksum.c
+--- rmlint-2.11.0--orig/lib/checksum.c	2026-11-02 00:30:58.000000000 +0100
++++ rmlint-2.11.0/lib/checksum.c	2026-11-02 10:29:27.927204908 +0100
+@@ -36,9 +36,9 @@
+ #include "utilities.h"
+ 
+ #include "checksums/highwayhash.h"
+ #include "checksums/blake2/blake2.h"
+-#include "checksums/blake3/blake3.h"
++#include <blake3.h>
+ #include "checksums/metrohash.h"
+ #include "checksums/murmur3.h"
+ #include "checksums/sha3/sha3.h"
+ #include "checksums/xxhash/xxhash.h"
+diff -rU4 rmlint-2.11.0--orig/lib/checksums/SConscript rmlint-2.11.0/lib/checksums/SConscript
+--- rmlint-2.11.0--orig/lib/checksums/SConscript	2026-11-02 00:30:58.000000000 +0100
++++ rmlint-2.11.0/lib/checksums/SConscript	2026-11-02 10:28:48.086770663 +0100
+@@ -1,73 +1,10 @@
+ Import('env')
+ 
+-# On x86 blake3 implements runtime CPU feature dispatch (via cpuid) to choose the
+-# best available SIMD implementation out of those compiled in. We build all of
+-# them unconditionally so the choice is made at runtime (based on the CPU that
+-# is executing rmlint) rather than at build time (based on the capabilities of
+-# the build host and/or the compilation flags which signify the baseline).
+-#
+-# On x86_64 we use the hand-written assembly sources which do not require any
+-# additional build flags. For i386 no assembly is provided, but the dispatch
+-# routine still looks for SIMD implementations, so we have to build the C sources
+-# and provide appropriate feature flags for each implementation.
+-#
+-# NB: We provide specific feature flags for each implementation (e.g. `-mavx2`
+-# for the AVX2 impl) *regardless* of the build target or the build CPU capabilities.
+-# This is safe and correct because the specific impl is chosen at runtime based
+-# on the executing CPU, and we do not "leak" the flags into other TUs.
+-#
+-# There is no runtime dispatch for aarch64 LE, compile-time BLAKE3_USE_NEON is used.
+-
+-blake3 = [
+-    File('blake3/blake3.c'),
+-    File('blake3/blake3_portable.c'),
+-]
+-
+-blake3_dispatch_flags = []
+-
+-if env['IS_X86_64']:
+-    print('Compiling BLAKE3 using x86_64 SIMD assembly')
+-    flavor = 'windows_gnu' if env['IS_WINDOWS'] or env['IS_CYGWIN'] else 'unix'
+-    blake3 += [
+-        File('blake3/blake3_%s_x86-64_%s.S' % (isa, flavor))
+-        for isa in ('sse2', 'sse41', 'avx2', 'avx512')
+-    ]
+-elif env['IS_X86']:
+-    print('Compiling BLAKE3 using x86 SIMD C intrinsics')
+-    blake3_simd_flags = {
+-        'sse2':   ['-msse2'],
+-        'sse41':  ['-msse4.1'],
+-        'avx2':   ['-mavx2'],
+-        'avx512': ['-mavx512f', '-mavx512vl'],
+-    }
+-    blake3 += [
+-        env.Object(
+-            'blake3/blake3_%s.c' % isa,
+-            CCFLAGS=env['CCFLAGS'] + flags,
+-        )
+-        for isa, flags in blake3_simd_flags.items()
+-    ]
+-elif env['IS_AARCH64_LE']:
+-    # We could manually set BLAKE3_USE_NEON, but blake3_impl.h autodetects
+-    # this at compile time, let it do it.
+-    print('Compiling BLAKE3 using AArch64 NEON')
+-    blake3 += [File('blake3/blake3_neon.c')]
+-    # Keep blake3 vendored verbatim for now, ignore the warning.
+-    # see https://github.com/BLAKE3-team/BLAKE3/pull/344
+-    if env['IS_CLANG']:
+-        blake3_dispatch_flags += ['-Wno-unreachable-code-aggressive']
+-else:
+-    print('Not compiling BLAKE3 SIMD implementations (none for this target)')
+-
+-blake3 += [env.Object('blake3/blake3_dispatch.c',
+-                      CCFLAGS=env['CCFLAGS'] + blake3_dispatch_flags)]
+-
+ sources = (
+     Glob('*.c') +
+     Glob('xxhash/*.c') +
+     Glob('blake2/*.c') +
+-    blake3 +
+     Glob('sha3/*.c')
+ )
+ 
+ Return('sources')
+diff -rU4 rmlint-2.11.0--orig/SConstruct rmlint-2.11.0/SConstruct
+--- rmlint-2.11.0--orig/SConstruct	2026-11-02 00:30:58.000000000 +0100
++++ rmlint-2.11.0/SConstruct	2026-11-02 10:35:09.326828051 +0100
+@@ -358,9 +358,9 @@
+ ])
+ 
+ 
+ conf.env.ParseConfig(PKG_CONFIG + ' --cflags --libs ' + ' '.join(packages))
+-conf.env.Append(_LIBFLAGS=['-lm'])
++conf.env.Append(_LIBFLAGS=['-lm', '-lblake3'])
+ 
+ conf.check_builtin_cpu_supports()
+ conf.check_blkid()
+ conf.check_sys_block()
+@@ -509,12 +509,8 @@
+ 
+     Find non-stripped binaries (needs libelf)             : {libelf}
+     Optimize using ioctl(FS_IOC_FIEMAP) (needs linux)     : {fiemap}
+     Metro SSE4.2 dispatch                                 : {crc_dispatch}
+-    BLAKE3 uses SIMD...
+-        ...x86_64 assembly                                : {blake3_simd_asm}
+-        ...x86 C intrinsics                               : {blake3_simd_c}
+-        ...AArch64 NEON                                   : {blake3_simd_neon}
+     Build manpage from docs/rmlint.1.rst                  : {sphinx}
+     Support for caching checksums in file's xattr         : {xattr}
+ 
+     Optimize non-rotational disks                         : {nonrotational}
+@@ -545,12 +541,8 @@
+         libelf=yesno(env['HAVE_LIBELF']),
+         fiemap=yesno(env['HAVE_FIEMAP']),
+         crc_dispatch=yesno(env['HAVE_BUILTIN_CPU_SUPPORTS'] & env['HAVE_MM_CRC32_U64']),
+ 
+-        blake3_simd_asm=yesno(env['IS_X86_64']),
+-        blake3_simd_c=yesno(env['IS_X86'] and not env['IS_X86_64']),
+-        blake3_simd_neon=yesno(env['IS_AARCH64_LE']),
+-
+         sphinx = f"{color('yes, using', 'green')}, {sphinx_bin}" if sphinx_bin else yesno(sphinx_bin),
+         xattr=yesno(env['HAVE_XATTR'] or env['HAVE_EXTATTR']),
+ 
+         nonrotational=yesno(env['HAVE_GIO_UNIX'] & env['HAVE_BLKID']),

diff --git a/rmlint.spec b/rmlint.spec
index eada180..b546d70 100644
--- a/rmlint.spec
+++ b/rmlint.spec
@@ -16,12 +16,14 @@ License:        GPL-3.0-only AND LicenseRef-Callaway-MIT AND LicenseRef-Callaway
 URL:            https://rmlint.rtfd.org
 Source0:        https://github.com/sahib/rmlint/archive/v%{version}/%{name}-%{version}.tar.gz
 Patch0:         0001-Add-RPM_BUILD_ROOT-to-env.patch
+Patch1:         0001-unbundle-blake3.patch
 
 BuildRequires:  desktop-file-utils
 BuildRequires:  gcc
 BuildRequires:  gettext
 BuildRequires:  scons
 
+BuildRequires:  blake3-devel
 BuildRequires:  elfutils-libelf-devel
 BuildRequires:  glib2-devel
 BuildRequires:  json-glib-devel
@@ -75,6 +77,8 @@ It is an extremely fast tool to remove duplicates from your filesystem.
 
 %prep
 %autosetup -p1
+rm -rf lib/checksums/blake3/
+
 for f in `find gui/shredder -name "*.py"`; do
     sed '1{\@^#!/usr/bin/env python@d}' $f > $f.new &&
     touch -r $f $f.new &&

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-02 10:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 10:34 [rpms/rmlint] f45: Unbundle blake3 Artur Frenszek-Iwicki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox