From d66c4f43d991f6292540246eda4688a2646623f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Mar=C3=ADn=20Soto?= Date: Mon, 25 May 2026 21:10:56 -0600 Subject: [PATCH 1/7] libffi: fix dir for riscv --- pkg/libffi/gen.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/libffi/gen.lua b/pkg/libffi/gen.lua index e9b04888..8dfb1a17 100644 --- a/pkg/libffi/gen.lua +++ b/pkg/libffi/gen.lua @@ -1,6 +1,6 @@ local targets = { aarch64={name='AARCH64', dir='aarch64'}, - riscv64={name='RISCV', dir='riscv64'}, + riscv64={name='RISCV', dir='riscv'}, x86_64={name='X86_64', dir='x86'}, } local arch = config.target.platform:match('[^-]*') From caa768fa79addc699d132e720b2594157e69f9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Mar=C3=ADn=20Soto?= Date: Mon, 25 May 2026 23:02:48 -0600 Subject: [PATCH 2/7] dav1d: guard x86 defines in config.h dav1d won't build without the x86 defs defined and set to 0 on riscv64 --- pkg/dav1d/config.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/dav1d/config.h b/pkg/dav1d/config.h index 738521c2..96a9ea72 100644 --- a/pkg/dav1d/config.h +++ b/pkg/dav1d/config.h @@ -1,11 +1,17 @@ #define ARCH_AARCH64 0 #define ARCH_ARM 0 #define ARCH_PPC64LE 0 +#define ARCH_X86 0 +#define ARCH_X86_32 0 +#define ARCH_X86_64 0 + #ifdef __x86_64__ +#undef ARCH_X86 +#undef ARCH_X86_64 #define ARCH_X86 1 -#define ARCH_X86_32 0 #define ARCH_X86_64 1 #endif + #define CONFIG_16BPC 1 #define CONFIG_8BPC 1 #define CONFIG_LOG 1 From 6ff9a5073c5dbb36f84f711883c8ab5892997cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Mar=C3=ADn=20Soto?= Date: Tue, 26 May 2026 00:26:40 -0600 Subject: [PATCH 3/7] ffmpeg: build on riscv64 Gated x86-only features in config.h, and used paths[[]] to select source files for each architecture --- pkg/ffmpeg/config.h | 189 +++++++++++++------ pkg/ffmpeg/gen.lua | 445 ++++++++++++++++++++++++++------------------ 2 files changed, 389 insertions(+), 245 deletions(-) diff --git a/pkg/ffmpeg/config.h b/pkg/ffmpeg/config.h index 129e18d9..5611a522 100644 --- a/pkg/ffmpeg/config.h +++ b/pkg/ffmpeg/config.h @@ -33,9 +33,6 @@ #define ARCH_SPARC64 0 #define ARCH_TILEGX 0 #define ARCH_TILEPRO 0 -#define ARCH_X86 1 -#define ARCH_X86_32 0 -#define ARCH_X86_64 1 #define HAVE_ARMV5TE 0 #define HAVE_ARMV6 0 #define HAVE_ARMV6T2 0 @@ -54,25 +51,6 @@ #define HAVE_VSX 0 #define HAVE_RV 0 #define HAVE_RVV 0 -#define HAVE_AESNI 1 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 -#define HAVE_AVX 1 -#define HAVE_AVX2 1 -#define HAVE_AVX512 1 -#define HAVE_AVX512ICL 1 -#define HAVE_FMA3 1 -#define HAVE_FMA4 1 -#define HAVE_MMX 1 -#define HAVE_MMXEXT 1 -#define HAVE_SSE 1 -#define HAVE_SSE2 1 -#define HAVE_SSE3 1 -#define HAVE_SSE4 1 -#define HAVE_SSE42 1 -#define HAVE_SSSE3 1 -#define HAVE_XOP 1 -#define HAVE_I686 1 #define HAVE_MIPSFPU 0 #define HAVE_MIPS32R2 0 #define HAVE_MIPS32R5 0 @@ -105,24 +83,6 @@ #define HAVE_VSX_EXTERNAL 0 #define HAVE_RV_EXTERNAL 0 #define HAVE_RVV_EXTERNAL 0 -#define HAVE_AESNI_EXTERNAL 1 -#define HAVE_AMD3DNOW_EXTERNAL 1 -#define HAVE_AMD3DNOWEXT_EXTERNAL 1 -#define HAVE_AVX_EXTERNAL 1 -#define HAVE_AVX2_EXTERNAL 1 -#define HAVE_AVX512_EXTERNAL 1 -#define HAVE_AVX512ICL_EXTERNAL 1 -#define HAVE_FMA3_EXTERNAL 1 -#define HAVE_FMA4_EXTERNAL 1 -#define HAVE_MMX_EXTERNAL 1 -#define HAVE_MMXEXT_EXTERNAL 1 -#define HAVE_SSE_EXTERNAL 1 -#define HAVE_SSE2_EXTERNAL 1 -#define HAVE_SSE3_EXTERNAL 1 -#define HAVE_SSE4_EXTERNAL 1 -#define HAVE_SSE42_EXTERNAL 1 -#define HAVE_SSSE3_EXTERNAL 1 -#define HAVE_XOP_EXTERNAL 1 #define HAVE_I686_EXTERNAL 0 #define HAVE_MIPSFPU_EXTERNAL 0 #define HAVE_MIPS32R2_EXTERNAL 0 @@ -156,24 +116,6 @@ #define HAVE_VSX_INLINE 0 #define HAVE_RV_INLINE 0 #define HAVE_RVV_INLINE 0 -#define HAVE_AESNI_INLINE HAVE_INLINE_ASM -#define HAVE_AMD3DNOW_INLINE HAVE_INLINE_ASM -#define HAVE_AMD3DNOWEXT_INLINE HAVE_INLINE_ASM -#define HAVE_AVX_INLINE HAVE_INLINE_ASM -#define HAVE_AVX2_INLINE HAVE_INLINE_ASM -#define HAVE_AVX512_INLINE HAVE_INLINE_ASM -#define HAVE_AVX512ICL_INLINE HAVE_INLINE_ASM -#define HAVE_FMA3_INLINE HAVE_INLINE_ASM -#define HAVE_FMA4_INLINE HAVE_INLINE_ASM -#define HAVE_MMX_INLINE HAVE_INLINE_ASM -#define HAVE_MMXEXT_INLINE HAVE_INLINE_ASM -#define HAVE_SSE_INLINE HAVE_INLINE_ASM -#define HAVE_SSE2_INLINE HAVE_INLINE_ASM -#define HAVE_SSE3_INLINE HAVE_INLINE_ASM -#define HAVE_SSE4_INLINE HAVE_INLINE_ASM -#define HAVE_SSE42_INLINE HAVE_INLINE_ASM -#define HAVE_SSSE3_INLINE HAVE_INLINE_ASM -#define HAVE_XOP_INLINE HAVE_INLINE_ASM #define HAVE_I686_INLINE 0 #define HAVE_MIPSFPU_INLINE 0 #define HAVE_MIPS32R2_INLINE 0 @@ -207,7 +149,6 @@ #define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 /* probe HAVE_INLINE_ASM */ #define HAVE_SYMVER 1 -#define HAVE_X86ASM 1 #define HAVE_BIGENDIAN 0 #define HAVE_FAST_UNALIGNED 1 #define HAVE_ARPA_INET_H 1 @@ -765,3 +706,133 @@ #define CONFIG_VP8DSP 0 #define CONFIG_WMA_FREQS 1 #define CONFIG_WMV2DSP 1 + +#if defined(__x86_64__) +#define ARCH_X86 1 +#define ARCH_X86_32 0 +#define ARCH_X86_64 1 + +#define HAVE_AESNI 1 +#define HAVE_AMD3DNOW 1 +#define HAVE_AMD3DNOWEXT 1 +#define HAVE_AVX 1 +#define HAVE_AVX2 1 +#define HAVE_AVX512 1 +#define HAVE_AVX512ICL 1 +#define HAVE_FMA3 1 +#define HAVE_FMA4 1 +#define HAVE_MMX 1 +#define HAVE_MMXEXT 1 +#define HAVE_SSE 1 +#define HAVE_SSE2 1 +#define HAVE_SSE3 1 +#define HAVE_SSE4 1 +#define HAVE_SSE42 1 +#define HAVE_SSSE3 1 +#define HAVE_XOP 1 +#define HAVE_I686 1 + +#define HAVE_AESNI_EXTERNAL 1 +#define HAVE_AMD3DNOW_EXTERNAL 1 +#define HAVE_AMD3DNOWEXT_EXTERNAL 1 +#define HAVE_AVX_EXTERNAL 1 +#define HAVE_AVX2_EXTERNAL 1 +#define HAVE_AVX512_EXTERNAL 1 +#define HAVE_AVX512ICL_EXTERNAL 1 +#define HAVE_FMA3_EXTERNAL 1 +#define HAVE_FMA4_EXTERNAL 1 +#define HAVE_MMX_EXTERNAL 1 +#define HAVE_MMXEXT_EXTERNAL 1 +#define HAVE_SSE_EXTERNAL 1 +#define HAVE_SSE2_EXTERNAL 1 +#define HAVE_SSE3_EXTERNAL 1 +#define HAVE_SSE4_EXTERNAL 1 +#define HAVE_SSE42_EXTERNAL 1 +#define HAVE_SSSE3_EXTERNAL 1 +#define HAVE_XOP_EXTERNAL 1 + +#define HAVE_AESNI_INLINE HAVE_INLINE_ASM +#define HAVE_AMD3DNOW_INLINE HAVE_INLINE_ASM +#define HAVE_AMD3DNOWEXT_INLINE HAVE_INLINE_ASM +#define HAVE_AVX_INLINE HAVE_INLINE_ASM +#define HAVE_AVX2_INLINE HAVE_INLINE_ASM +#define HAVE_AVX512_INLINE HAVE_INLINE_ASM +#define HAVE_AVX512ICL_INLINE HAVE_INLINE_ASM +#define HAVE_FMA3_INLINE HAVE_INLINE_ASM +#define HAVE_FMA4_INLINE HAVE_INLINE_ASM +#define HAVE_MMX_INLINE HAVE_INLINE_ASM +#define HAVE_MMXEXT_INLINE HAVE_INLINE_ASM +#define HAVE_SSE_INLINE HAVE_INLINE_ASM +#define HAVE_SSE2_INLINE HAVE_INLINE_ASM +#define HAVE_SSE3_INLINE HAVE_INLINE_ASM +#define HAVE_SSE4_INLINE HAVE_INLINE_ASM +#define HAVE_SSE42_INLINE HAVE_INLINE_ASM +#define HAVE_SSSE3_INLINE HAVE_INLINE_ASM +#define HAVE_XOP_INLINE HAVE_INLINE_ASM + +#define HAVE_X86ASM 1 +#else +#define ARCH_X86 0 +#define ARCH_X86_32 0 +#define ARCH_X86_64 0 + +#define HAVE_AESNI 0 +#define HAVE_AMD3DNOW 0 +#define HAVE_AMD3DNOWEXT 0 +#define HAVE_AVX 0 +#define HAVE_AVX2 0 +#define HAVE_AVX512 0 +#define HAVE_AVX512ICL 0 +#define HAVE_FMA3 0 +#define HAVE_FMA4 0 +#define HAVE_MMX 0 +#define HAVE_MMXEXT 0 +#define HAVE_SSE 0 +#define HAVE_SSE2 0 +#define HAVE_SSE3 0 +#define HAVE_SSE4 0 +#define HAVE_SSE42 0 +#define HAVE_SSSE3 0 +#define HAVE_XOP 0 +#define HAVE_I686 0 + +#define HAVE_AESNI_EXTERNAL 0 +#define HAVE_AMD3DNOW_EXTERNAL 0 +#define HAVE_AMD3DNOWEXT_EXTERNAL 0 +#define HAVE_AVX_EXTERNAL 0 +#define HAVE_AVX2_EXTERNAL 0 +#define HAVE_AVX512_EXTERNAL 0 +#define HAVE_AVX512ICL_EXTERNAL 0 +#define HAVE_FMA3_EXTERNAL 0 +#define HAVE_FMA4_EXTERNAL 0 +#define HAVE_MMX_EXTERNAL 0 +#define HAVE_MMXEXT_EXTERNAL 0 +#define HAVE_SSE_EXTERNAL 0 +#define HAVE_SSE2_EXTERNAL 0 +#define HAVE_SSE3_EXTERNAL 0 +#define HAVE_SSE4_EXTERNAL 0 +#define HAVE_SSE42_EXTERNAL 0 +#define HAVE_SSSE3_EXTERNAL 0 +#define HAVE_XOP_EXTERNAL 0 + +#define HAVE_AESNI_INLINE 0 +#define HAVE_AMD3DNOW_INLINE 0 +#define HAVE_AMD3DNOWEXT_INLINE 0 +#define HAVE_AVX_INLINE 0 +#define HAVE_AVX2_INLINE 0 +#define HAVE_AVX512_INLINE 0 +#define HAVE_AVX512ICL_INLINE 0 +#define HAVE_FMA3_INLINE 0 +#define HAVE_FMA4_INLINE 0 +#define HAVE_MMX_INLINE 0 +#define HAVE_MMXEXT_INLINE 0 +#define HAVE_SSE_INLINE 0 +#define HAVE_SSE2_INLINE 0 +#define HAVE_SSE3_INLINE 0 +#define HAVE_SSE4_INLINE 0 +#define HAVE_SSE42_INLINE 0 +#define HAVE_SSSE3_INLINE 0 +#define HAVE_XOP_INLINE 0 + +#define HAVE_X86ASM 0 +#endif diff --git a/pkg/ffmpeg/gen.lua b/pkg/ffmpeg/gen.lua index cd7c42df..7b5dd5e0 100644 --- a/pkg/ffmpeg/gen.lua +++ b/pkg/ffmpeg/gen.lua @@ -1,3 +1,12 @@ +local targets = { + aarch64={dir='aarch64'}, + riscv64={dir='riscv'}, + x86_64={dir='x86'}, +} +local arch = config.target.platform:match('[^-]*') +local targ = targets[arch] +if not targ then return end + local arch = 'x86' cflags{ '-Wno-deprecated-declarations', @@ -13,8 +22,8 @@ cflags{ } nasmflags{ '-i $srcdir/', - '-i $srcdir/libavcodec/'..arch..'/', - '-i $srcdir/libavutil/'..arch..'/', + '-i $srcdir/libavcodec/'..targ.dir..'/', + '-i $srcdir/libavutil/'..targ.dir..'/', '-f elf64', '-P $outdir/config.asm', } @@ -113,16 +122,19 @@ for line in iterlines('sources.txt', 1) do local i = line:find(' ', 1, true) if i and options[line:sub(1, i - 1)] then for src, lib, dir in line:gmatch('(([%w_-]+)/?([%w_-]*)[%w_/-]*/[%w_.-]+)', i + 1) do - if not archs[dir] or dir == arch then + if not archs[dir] or dir == targ.dir then sources[lib][src] = true end end end end -- combination option in libavutil/x86/Makefile +-- probe false positive on riscv64 +if arch == 'x86_64' then if not options.HAVE_MMX_INLINE and options.HAVE_MMX_EXTERNAL and not options.HAVE_MM_EMPTY then sources.libavutil['libavutil/x86/emms.asm'] = true end +end for lib, srcs in pairs(sources) do sources[lib] = table.keys(srcs) end @@ -173,44 +185,47 @@ end sub('lib.ninja', function() cflags{'-D HAVE_AV_CONFIG_H'} lib('libavcodec.a', { - expand{'libavcodec/', { - 'ac3_parser.c', - 'adts_parser.c', - 'allcodecs.c', - 'avcodec.c', - 'avdct.c', - 'avfft.c', - 'avpacket.c', - 'bitstream.c', - 'bitstream_filters.c', - 'bsf.c', - 'codec_desc.c', - 'codec_par.c', - 'd3d11va.c', - 'decode.c', - 'dirac.c', - 'dv_profile.c', - 'encode.c', - 'get_buffer.c', - 'imgconvert.c', - 'jni.c', - 'mathtables.c', - 'mediacodec.c', - 'mpeg12framerate.c', - 'options.c', - 'parser.c', - 'parsers.c', - 'profiles.c', - 'qsv_api.c', - 'raw.c', - 'refstruct.c', - 'utils.c', - 'version.c', - 'vlc.c', - 'vorbis_parser.c', - 'xiph.c', - 'x86/constants.c', - }}, + paths[[ + libavcodec/( + ac3_parser.c + adts_parser.c + allcodecs.c + avcodec.c + avdct.c + avfft.c + avpacket.c + bitstream.c + bitstream_filters.c + bsf.c + codec_desc.c + codec_par.c + d3d11va.c + decode.c + dirac.c + dv_profile.c + encode.c + get_buffer.c + imgconvert.c + jni.c + mathtables.c + mediacodec.c + mpeg12framerate.c + options.c + parser.c + parsers.c + profiles.c + qsv_api.c + raw.c + refstruct.c + utils.c + version.c + vlc.c + vorbis_parser.c + xiph.c + + @x86_64 x86/constants.c + ) + ]], sources.libavcodec, 'libavutil.a', }) @@ -285,160 +300,218 @@ lib('libavformat.a', { }) lib('libavutil.a', { - expand{'libavutil/', { - 'adler32.c', - 'aes.c', - 'aes_ctr.c', - 'ambient_viewing_environment.c', - 'audio_fifo.c', - 'avstring.c', - 'avsscanf.c', - 'base64.c', - 'blowfish.c', - 'bprint.c', - 'buffer.c', - 'cast5.c', - 'camellia.c', - 'channel_layout.c', - 'cpu.c', - 'crc.c', - 'csp.c', - 'des.c', - 'detection_bbox.c', - 'dict.c', - 'display.c', - 'dovi_meta.c', - 'downmix_info.c', - 'encryption_info.c', - 'error.c', - 'eval.c', - 'executor.c', - 'fifo.c', - 'file.c', - 'file_open.c', - 'float_dsp.c', - 'fixed_dsp.c', - 'frame.c', - 'hash.c', - 'hdr_dynamic_metadata.c', - 'hdr_dynamic_vivid_metadata.c', - 'hmac.c', - 'hwcontext.c', - 'iamf.c', - 'imgutils.c', - 'integer.c', - 'intmath.c', - 'lfg.c', - 'lls.c', - 'log.c', - 'log2_tab.c', - 'lzo.c', - 'mathematics.c', - 'mastering_display_metadata.c', - 'md5.c', - 'mem.c', - 'murmur3.c', - 'opt.c', - 'parseutils.c', - 'pixdesc.c', - 'pixelutils.c', - 'random_seed.c', - 'rational.c', - 'reverse.c', - 'rc4.c', - 'ripemd.c', - 'samplefmt.c', - 'sha.c', - 'sha512.c', - 'slicethread.c', - 'spherical.c', - 'stereo3d.c', - 'threadmessage.c', - 'time.c', - 'timecode.c', - 'timestamp.c', - 'tree.c', - 'twofish.c', - 'utils.c', - 'xga_font_data.c', - 'xtea.c', - 'tea.c', - 'tx.c', - 'tx_float.c', - 'tx_double.c', - 'tx_int32.c', - 'uuid.c', - 'version.c', - 'video_enc_params.c', - 'video_hint.c', - 'film_grain_params.c', - 'x86/cpu.c', - 'x86/fixed_dsp_init.c', - 'x86/float_dsp_init.c', - 'x86/imgutils_init.c', - 'x86/lls_init.c', - 'x86/cpuid.asm', - 'x86/fixed_dsp.asm', - 'x86/float_dsp.asm', - 'x86/imgutils.asm', - 'x86/lls.asm', - 'x86/tx_float.asm', - }}, + paths[[ + libavutil/( + adler32.c + aes.c + aes_ctr.c + ambient_viewing_environment.c + audio_fifo.c + avstring.c + avsscanf.c + base64.c + blowfish.c + bprint.c + buffer.c + cast5.c + camellia.c + channel_layout.c + cpu.c + crc.c + csp.c + des.c + detection_bbox.c + dict.c + display.c + dovi_meta.c + downmix_info.c + encryption_info.c + error.c + eval.c + executor.c + fifo.c + file.c + file_open.c + float_dsp.c + fixed_dsp.c + frame.c + hash.c + hdr_dynamic_metadata.c + hdr_dynamic_vivid_metadata.c + hmac.c + hwcontext.c + iamf.c + imgutils.c + integer.c + intmath.c + lfg.c + lls.c + log.c + log2_tab.c + lzo.c + mathematics.c + mastering_display_metadata.c + md5.c + mem.c + murmur3.c + opt.c + parseutils.c + pixdesc.c + pixelutils.c + random_seed.c + rational.c + reverse.c + rc4.c + ripemd.c + samplefmt.c + sha.c + sha512.c + slicethread.c + spherical.c + stereo3d.c + threadmessage.c + time.c + timecode.c + timestamp.c + tree.c + twofish.c + utils.c + xga_font_data.c + xtea.c + tea.c + tx.c + tx_float.c + tx_double.c + tx_int32.c + uuid.c + version.c + video_enc_params.c + video_hint.c + film_grain_params.c + + @x86_64 x86/( + cpu.c + fixed_dsp_init.c + float_dsp_init.c + imgutils_init.c + lls_init.c + cpuid.asm + fixed_dsp.asm + float_dsp.asm + imgutils.asm + lls.asm + tx_float.asm + ) + + @riscv64 riscv/( + asm.S + bswap_rvb.S + cpu.c + fixed_dsp_init.c + fixed_dsp_rvv.S + float_dsp_init.c + float_dsp_rvv.S + ) + + @aarch64 aarch64/( + asm.S + cpu.c + float_dsp_init.c + float_dsp_neon.S + tx_float_init.c + tx_float_neon.S + ) + ) + ]], sources.libavutil, }) lib('libswresample.a', { - expand{'libswresample/', { - 'audioconvert.c', - 'dither.c', - 'options.c', - 'rematrix.c', - 'resample.c', - 'resample_dsp.c', - 'swresample.c', - 'swresample_frame.c', - 'version.c', - 'x86/audio_convert.asm', - 'x86/rematrix.asm', - 'x86/resample.asm', - 'x86/audio_convert_init.c', - 'x86/rematrix_init.c', - 'x86/resample_init.c', - }}, + paths[[ + libswresample/( + audioconvert.c + dither.c + options.c + rematrix.c + resample.c + resample_dsp.c + swresample.c + swresample_frame.c + version.c + + @x86_64 x86/( + audio_convert.asm + rematrix.asm + resample.asm + audio_convert_init.c + rematrix_init.c + resample_init.c + ) + + @aarch64 aarch64/( + audio_convert_init.c + audio_convert_neon.S + neontest.c + resample.S + resample_init.c + ) + ) + ]], sources.libswresample, 'libavutil.a', }) lib('libswscale.a', { - expand{'libswscale/', { - 'alphablend.c', - 'hscale.c', - 'hscale_fast_bilinear.c', - 'gamma.c', - 'half2float.c', - 'input.c', - 'options.c', - 'output.c', - 'rgb2rgb.c', - 'slice.c', - 'swscale.c', - 'swscale_unscaled.c', - 'utils.c', - 'version.c', - 'yuv2rgb.c', - 'vscale.c', - 'x86/rgb2rgb.c', - 'x86/swscale.c', - 'x86/yuv2rgb.c', - 'x86/hscale_fast_bilinear_simd.c', - 'x86/input.asm', - 'x86/output.asm', - 'x86/scale.asm', - 'x86/scale_avx2.asm', - 'x86/rgb_2_rgb.asm', - 'x86/yuv_2_rgb.asm', - 'x86/yuv2yuvX.asm', - }}, + paths[[ + libswscale/( + alphablend.c + hscale.c + hscale_fast_bilinear.c + gamma.c + half2float.c + input.c + options.c + output.c + rgb2rgb.c + slice.c + swscale.c + swscale_unscaled.c + utils.c + version.c + yuv2rgb.c + vscale.c + + @x86_64 x86/( + rgb2rgb.c + swscale.c + yuv2rgb.c + hscale_fast_bilinear_simd.c + input.asm + output.asm + scale.asm + scale_avx2.asm + rgb_2_rgb.asm + yuv_2_rgb.asm + yuv2yuvX.asm + ) + + @riscv64 riscv/( + rgb2rgb.c + rgb2rgb_rvb.S + rgb2rgb_rvv.S + ) + + @aarch64 aarch64/( + hscale.S + output.S + rgb2rgb.c + rgb2rgb_neon.S + swscale.c + swscale_unscaled.c + yuv2rgb_neon.S + ) + ) + ]], sources.libswscale, 'libavutil.a', }) From 885abdf66e0c931f2b8d8b08923393fc59fbe4ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Mar=C3=ADn=20Soto?= Date: Tue, 26 May 2026 00:37:34 -0600 Subject: [PATCH 4/7] ffmpeg: cleanup crud --- pkg/ffmpeg/gen.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/ffmpeg/gen.lua b/pkg/ffmpeg/gen.lua index 7b5dd5e0..749c9aca 100644 --- a/pkg/ffmpeg/gen.lua +++ b/pkg/ffmpeg/gen.lua @@ -7,7 +7,6 @@ local arch = config.target.platform:match('[^-]*') local targ = targets[arch] if not targ then return end -local arch = 'x86' cflags{ '-Wno-deprecated-declarations', '-Wno-discarded-qualifiers', @@ -129,12 +128,9 @@ for line in iterlines('sources.txt', 1) do end end -- combination option in libavutil/x86/Makefile --- probe false positive on riscv64 -if arch == 'x86_64' then if not options.HAVE_MMX_INLINE and options.HAVE_MMX_EXTERNAL and not options.HAVE_MM_EMPTY then sources.libavutil['libavutil/x86/emms.asm'] = true end -end for lib, srcs in pairs(sources) do sources[lib] = table.keys(srcs) end From 3d624bc3ee5301b46f52ad74ec4f47a229f7dbe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Mar=C3=ADn=20Soto?= Date: Wed, 27 May 2026 04:11:45 -0600 Subject: [PATCH 5/7] rules.ninja: add unifdef unifdef is needed to generate temporary header files that awk/sed/etc. can modify without producing redefines. This adds unifdef as a build dependency --- rules.ninja | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules.ninja b/rules.ninja index 8aa27b4c..d16a8348 100644 --- a/rules.ninja +++ b/rules.ninja @@ -74,6 +74,10 @@ rule yacc command = yacc $yaccflags $in description = YACC $out +rule unifdef + command = unifdef -x2 $flags $in > $out + description = UNIFDEF $out + rule sed command = sed $expr $in >$out description = SED $out From e2e9fc0867af7ee2ae99e9382829e07018a1ecc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Mar=C3=ADn=20Soto?= Date: Wed, 27 May 2026 04:17:12 -0600 Subject: [PATCH 6/7] dav1d: fix build regression on x86 the awk expression would make redefined macros due to the new arch guards in config.h. Pass config.h through unifdef first --- pkg/dav1d/config.h | 10 +++++----- pkg/dav1d/gen.lua | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/dav1d/config.h b/pkg/dav1d/config.h index 96a9ea72..f045731d 100644 --- a/pkg/dav1d/config.h +++ b/pkg/dav1d/config.h @@ -1,15 +1,15 @@ #define ARCH_AARCH64 0 #define ARCH_ARM 0 #define ARCH_PPC64LE 0 -#define ARCH_X86 0 -#define ARCH_X86_32 0 -#define ARCH_X86_64 0 #ifdef __x86_64__ -#undef ARCH_X86 -#undef ARCH_X86_64 #define ARCH_X86 1 +#define ARCH_X86_32 0 #define ARCH_X86_64 1 +#else +#define ARCH_X86 0 +#define ARCH_X86_32 0 +#define ARCH_X86_64 0 #endif #define CONFIG_16BPC 1 diff --git a/pkg/dav1d/gen.lua b/pkg/dav1d/gen.lua index 6bca4237..8cf22ebb 100644 --- a/pkg/dav1d/gen.lua +++ b/pkg/dav1d/gen.lua @@ -41,7 +41,8 @@ build('sed', '$outdir/include/dav1d/version.h', '$srcdir/include/dav1d/version.h build('awk', '$outdir/vcs_version.h', '$dir/ver', { expr=[['{printf "#define DAV1D_VERSION \"%s\"\n", $$1}']], }) -build('awk', '$outdir/config.asm', '$dir/config.h', { +build('unifdef', '$outdir/config.h.tmp', '$dir/config.h', {flags='-D__x86_64__'}) +build('awk', '$outdir/config.asm', '$outdir/config.h.tmp', { expr=[['$$1 == "#define" {print "%define " substr($$0, length("#define ") + 1)} END {print "%define private_prefix dav1d"}']], }) build('touch', '$outdir/cli_config.h') From 79008da96fe0142825e88336e84c353449fa1f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Mar=C3=ADn=20Soto?= Date: Wed, 27 May 2026 04:18:35 -0600 Subject: [PATCH 7/7] ffmpeg: fix build regression on x86 the awk expression would make redefined macros due to the new arch guards in config.h. Pass config.h throughunifdef first. --- pkg/ffmpeg/gen.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/ffmpeg/gen.lua b/pkg/ffmpeg/gen.lua index 749c9aca..1972e493 100644 --- a/pkg/ffmpeg/gen.lua +++ b/pkg/ffmpeg/gen.lua @@ -48,7 +48,8 @@ local probe = { build('cat', '$outdir/config.h', {'$dir/config-head.h', probe, '$dir/config.h', '$dir/config-tail.h'}) build('copy', '$outdir/config_components.h', '$dir/config_components.h') -build('sed', '$outdir/config.asm', {probe, '$dir/config.h'}, { +build('unifdef', '$outdir/config.h.tmp', '$dir/config.h', {flags='-D__x86_64__'}) +build('sed', '$outdir/config.asm', {probe, '$outdir/config.h.tmp'}, { expr=[[-n -e 's,^# *,%,p']], }) build('awk', '$outdir/config.texi', '$dir/config.h', { @@ -396,6 +397,7 @@ lib('libavutil.a', { float_dsp.asm imgutils.asm lls.asm + tx_float_init.c tx_float.asm )