From 29ca1c1a789ad26fe5b768a3d3daa258ba1112bc Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Tue, 4 Feb 2025 21:24:03 +0100 Subject: [PATCH 1/2] lcevcdec: fix to make it work when avx is not supported --- pkgs/by-name/lc/lcevcdec/package.nix | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/lc/lcevcdec/package.nix b/pkgs/by-name/lc/lcevcdec/package.nix index 201d76afd5bc..e27c62ca9358 100644 --- a/pkgs/by-name/lc/lcevcdec/package.nix +++ b/pkgs/by-name/lc/lcevcdec/package.nix @@ -42,16 +42,26 @@ stdenv.mkDerivation (finalAttrs: { }) ]; - postPatch = '' - substituteInPlace cmake/tools/version_files.py \ - --replace-fail "args.git_version" '"${finalAttrs.version}"' \ - --replace-fail "args.git_hash" '"${finalAttrs.src.rev}"' \ - --replace-fail "args.git_date" '"1970-01-01"' - ''; + postPatch = + '' + substituteInPlace cmake/tools/version_files.py \ + --replace-fail "args.git_version" '"${finalAttrs.version}"' \ + --replace-fail "args.git_hash" '"${finalAttrs.src.rev}"' \ + --replace-fail "args.git_date" '"1970-01-01"' + + '' + + lib.optionalString (!stdenv.hostPlatform.avxSupport) '' + substituteInPlace cmake/modules/Compiler/GNU.cmake \ + --replace-fail "-mavx" "" + + substituteInPlace src/core/decoder/src/common/simd.c \ + --replace-fail "((_xgetbv(kControlRegister) & kOSXSaveMask) == kOSXSaveMask)" "false" + ''; env = { includedir = "${placeholder "dev"}/include"; libdir = "${placeholder "out"}/lib"; + NIX_CFLAGS_COMPILE = "-Wno-error=unused-variable"; }; pkgconfigItems = [ @@ -95,6 +105,9 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "VN_SDK_FFMPEG_LIBS_PACKAGE" "") (lib.cmakeBool "VN_SDK_UNIT_TESTS" false) (lib.cmakeBool "VN_SDK_SAMPLE_SOURCE" false) + (lib.cmakeBool "VN_CORE_AVX2" stdenv.hostPlatform.avx2Support) + # Requires avx for checking on runtime + (lib.cmakeBool "VN_CORE_SSE" stdenv.hostPlatform.avxSupport) ]; passthru = { From 2959d7514d037433996c2bceab52c7cda67dd8d3 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Tue, 4 Feb 2025 21:26:21 +0100 Subject: [PATCH 2/2] ffmpeg-full: renable lcevcdec support --- pkgs/development/libraries/ffmpeg/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 650db88130ad..c0bc22ffeec0 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -90,7 +90,7 @@ withKvazaar ? withFullDeps, # HEVC encoding withLadspa ? withFullDeps, # LADSPA audio filtering withLc3 ? withFullDeps && lib.versionAtLeast version "7.1", # LC3 de/encoding - withLcevcdec ? false && lib.versionAtLeast version "7.1", # LCEVC decoding # FIXME currently makes ffmpeg crash in any operation on non-AVX CPUs + withLcevcdec ? withFullDeps && lib.versionAtLeast version "7.1", # LCEVC decoding withLcms2 ? withFullDeps, # ICC profile support via lcms2 withLzma ? withHeadlessDeps, # xz-utils withMetal ? false, # Unfree and requires manual downloading of files