Fil-C on Nix

Filnix wiki

mbrock/filnix

ports/media.nix

Focused repairs for shared graphics and codec dependencies.

λpkgs
let
4inherit import./. inherit pkgs lib pkgs;
for patch addMesonFlag addMakeFlag addCMakeFlag addCFlag configure use
in
29dav1d=
29dav1d

NASM output has the native ABI. Use the upstream portable C decoder.

addMesonFlag"-Denable_asm=false"
33libvmaf=
33libvmaf
addMesonFlag"-Denable_asm=false"
usedoCheck = true;
37libyuv=
37libyuv
patch../patches/libyuv-xgetbv.patch
patch../patches/libyuv-interpolate-planes.patch

The x86 row kernels are inline assembly with memory operands, which Fil-C refuses at run time. Use libyuv's portable C kernels.

addCFlag"-DLIBYUV_DISABLE_X86"

Each unit test file registers hundreds of gtest tests from one static constructor, and Fil-C's -O3 pipeline is superlinear on that function (SROA's PromoteMemToReg). convert_argb_test.cc ran for over 15 minutes at 11 GB; at -O0 it takes about 2.5 minutes. Only the test code drops to -O0; the library keeps -O3.

use
λold
49postPatch=
old.postPatch or ""
+
substituteInPlace CMakeLists.txt --replace-fail \
'add_executable(libyuv_unittest ''${ly_unittest_sources})' \
'add_executable(libyuv_unittest ''${ly_unittest_sources})
target_compile_options(libyuv_unittest PRIVATE -O0)'
60timidity=
60timidity

The old ALSA 0.9 API needs symbol versions the Fil-C alsa-lib lacks.

patch../patches/timidity-alsa-new-api.patch
patch../patches/timidity-ctl-event-pointers.patch
uses for patch
65p7zip=
65p7zip

makefile.machine says gcc and g++. Nixpkgs prepends the target prefix when cross-compiling, but Fil-C's is empty, leaving gcc.

addMakeFlag"CC=clang"
addMakeFlag"CXX=clang++"
patch../patches/p7zip-hash-stdint.patch
patch../patches/p7zip-zstd-p2align.patch
use
73doCheck=
true

test_7z also checks RAR archives, whose codec the free source drops.

75checkTarget=
"test test_7zr"
78libmhash=
78libmhash

AC_FUNC_MALLOC cannot run its probe when cross-compiling, assumes malloc(0) returns NULL and renames malloc to an rpl_malloc that mhash does not provide. glibc's malloc(0) returns a pointer.

configure"ac_cv_func_malloc_0_nonnull=yes"
patch../patches/mhash-test-use-after-free.patch
use
85doCheck=
true

hash_test.sh generates the million-"a" SHA-1 input with perl.

87nativeCheckInputs=
pkgs.perl
94sfml_2=
94sfml_2
patch../patches/sfml2-libcxx-char-traits.patch

The suite builds with the library and runs from the build.

addCMakeFlag"-DSFML_BUILD_TEST_SUITE=ON"

Catch's fatal-signal handlers need sigaltstack.

addCFlag"-DCATCH_CONFIG_NO_POSIX_SIGNALS"
101mpg123=
101mpg123

Keep the decoder API; select upstream's C implementation of its kernels.

configure"--with-cpu=generic"
usedoCheck = true;