diff --git a/media-video/ffmpeg/ffmpeg8-8.0.1.recipe b/media-video/ffmpeg/ffmpeg8-8.0.1.recipe new file mode 100644 index 000000000..cbded67f9 --- /dev/null +++ b/media-video/ffmpeg/ffmpeg8-8.0.1.recipe @@ -0,0 +1,355 @@ +SUMMARY="Audio and video recording, conversion, and streaming library" +DESCRIPTION="FFmpeg is a complete, cross-platform solution to record, convert \ +and stream audio and video. It includes libavcodec - the leading audio/video \ +codec library." +HOMEPAGE="https://ffmpeg.org/" +COPYRIGHT="2000-2003 Fabrice Bellard + 2003-2026 the FFmpeg developers" +LICENSE="GNU LGPL v3" +REVISION="1" +SOURCE_URI="https://ffmpeg.org/releases/ffmpeg-$portVersion.tar.xz" +CHECKSUM_SHA256="05ee0b03119b45c0bdb4df654b96802e909e0a752f72e4fe3794f487229e5a41" +PATCHES="ffmpeg-$portVersion.patchset" +SOURCE_DIR="ffmpeg-$portVersion" +ADDITIONAL_FILES="gcc_runtime.c" + +ARCHITECTURES="all" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + +ffmpegLibs="\ + libavcodec \ + libavdevice \ + libavfilter \ + libavformat \ + libavutil \ + libswresample \ + libswscale \ + " +# Do not sort alphabetically +libavutilVersion="60.8.100" +libavcodecVersion="62.11.100" +libavformatVersion="62.3.100" +libavdeviceVersion="62.1.100" +libavfilterVersion="11.4.100" +libswscaleVersion="9.1.100" +libswresampleVersion="6.1.100" +portVersionCompat="$portVersion compat >= 5" +for i in $ffmpegLibs; do + eval "${i}VersionCompat=\"\$${i}Version compat >= \${${i}Version%%.*}\"" +done + +PROVIDES=" + ffmpeg8$secondaryArchSuffix = $portVersionCompat + lib:libavcodec$secondaryArchSuffix = $libavcodecVersionCompat + lib:libavfilter$secondaryArchSuffix = $libavfilterVersionCompat + lib:libavformat$secondaryArchSuffix = $libavformatVersionCompat + lib:libavutil$secondaryArchSuffix = $libavutilVersionCompat + lib:libswresample$secondaryArchSuffix = $libswresampleVersionCompat + lib:libswscale$secondaryArchSuffix = $libswscaleVersionCompat + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libbz2$secondaryArchSuffix + lib:libiconv$secondaryArchSuffix + lib:libmp3lame$secondaryArchSuffix + lib:libogg$secondaryArchSuffix + lib:libopus$secondaryArchSuffix + lib:libspeex$secondaryArchSuffix + lib:libssl$secondaryArchSuffix + lib:libtheoradec$secondaryArchSuffix + lib:libtheoraenc$secondaryArchSuffix + lib:libvorbis$secondaryArchSuffix + lib:libvorbisenc$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then + REQUIRES+=" + lib:libass$secondaryArchSuffix + lib:libbrotlidec$secondaryArchSuffix + lib:libdav1d$secondaryArchSuffix + lib:libfdk_aac$secondaryArchSuffix + lib:libfontconfig$secondaryArchSuffix + lib:libfreetype$secondaryArchSuffix + lib:libfribidi$secondaryArchSuffix + lib:libgme$secondaryArchSuffix + lib:libgmp$secondaryArchSuffix + lib:libopenjp2$secondaryArchSuffix + lib:libopenmpt$secondaryArchSuffix + lib:libsnappy$secondaryArchSuffix + lib:libsoxr$secondaryArchSuffix + lib:libvpx$secondaryArchSuffix >= 11.0 + lib:libwebp$secondaryArchSuffix + lib:libxml2$secondaryArchSuffix + lib:liblzma$secondaryArchSuffix + " +fi + +PROVIDES_avdevice=" + ffmpeg8${secondaryArchSuffix}_avdevice = $portVersionCompat + lib:libavdevice$secondaryArchSuffix = $libavdeviceVersionCompat + " +REQUIRES_avdevice=" + haiku$secondaryArchSuffix + lib:libavcodec$secondaryArchSuffix == $libavcodecVersion + lib:libavfilter$secondaryArchSuffix == $libavfilterVersion + lib:libavformat$secondaryArchSuffix == $libavformatVersion + lib:libavutil$secondaryArchSuffix == $libavutilVersion + lib:libSDL2_2.0$secondaryArchSuffix + " + +PROVIDES_tools=" + ffmpeg8${secondaryArchSuffix}_tools = $portVersion + cmd:ffmpeg$secondaryArchSuffix = $portVersionCompat + cmd:ffplay$secondaryArchSuffix = $portVersionCompat + cmd:ffprobe$secondaryArchSuffix = $portVersionCompat + " +REQUIRES_tools=" + haiku$secondaryArchSuffix + lib:libavcodec$secondaryArchSuffix == $libavcodecVersion + lib:libavdevice$secondaryArchSuffix == $libavdeviceVersion + lib:libavfilter$secondaryArchSuffix == $libavfilterVersion + lib:libavformat$secondaryArchSuffix == $libavformatVersion + lib:libavutil$secondaryArchSuffix == $libavutilVersion + lib:libSDL2_2.0$secondaryArchSuffix + " +CONFLICTS_tools=" + ffmpeg${secondaryArchSuffix}_tools + ffmpeg5${secondaryArchSuffix}_tools + ffmpeg6${secondaryArchSuffix}_tools + ffmpeg7${secondaryArchSuffix}_tools + " + +PROVIDES_devel=" + ffmpeg8${secondaryArchSuffix}_devel = $portVersionCompat +# devel:libavcodec$secondaryArchSuffix = $libavcodecVersionCompat +# devel:libavdevice$secondaryArchSuffix = $libavdeviceVersionCompat +# devel:libavfilter$secondaryArchSuffix = $libavfilterVersionCompat +# devel:libavformat$secondaryArchSuffix = $libavformatVersionCompat +# devel:libavutil$secondaryArchSuffix = $libavutilVersionCompat +# devel:libswresample$secondaryArchSuffix = $libswresampleVersionCompat +# devel:libswscale$secondaryArchSuffix = $libswscaleVersionCompat + " +REQUIRES_devel=" + ffmpeg8$secondaryArchSuffix == $portVersion base + ffmpeg8${secondaryArchSuffix}_avdevice == $portVersion + devel:libspeex$secondaryArchSuffix + " +CONFLICTS_devel=" + ffmpeg${secondaryArchSuffix}_devel + ffmpeg5${secondaryArchSuffix}_devel + ffmpeg6${secondaryArchSuffix}_devel + ffmpeg7${secondaryArchSuffix}_devel + " + +# -- HACK! -- +# ffmpeg ~0.10 has perpetually had & caused problems when compiled with GCC 2. +# (Later versions do not compile with GCC 2 at all.) So instead, we now compile +# FFmpeg for x86_gcc2 with a modern GCC. +# +# This works because GCC's C ABI has not changed between 2 and now; only the C++ +# ABI has, and no BeOS applications expect a system FFmpeg at all, so we can +# break its ABI all we like. +if [ "$effectiveTargetArchitecture" = x86_gcc2 ] && \ + [ "$targetArchitecture" = x86_gcc2 ]; then + gccSuffix="_x86" +elif [ "$effectiveTargetArchitecture" = x86_gcc2 ] && \ + [ "$targetArchitecture" = x86 ]; then + gccSuffix="" +else + gccSuffix="$secondaryArchSuffix" +fi + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libbz2$secondaryArchSuffix + devel:libiconv$secondaryArchSuffix + devel:libmp3lame$secondaryArchSuffix + devel:libogg$secondaryArchSuffix + devel:libopus$secondaryArchSuffix + devel:libSDL2_2.0$secondaryArchSuffix + devel:libspeex$secondaryArchSuffix + devel:libssl$secondaryArchSuffix >= 3 + devel:libtheora$secondaryArchSuffix + devel:libvorbis$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " +if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then + BUILD_REQUIRES+=" + devel:libass$secondaryArchSuffix + devel:libbrotlidec$secondaryArchSuffix + devel:libdav1d$secondaryArchSuffix + devel:libfdk_aac$secondaryArchSuffix + devel:libfontconfig$secondaryArchSuffix + devel:libfreetype$secondaryArchSuffix + devel:libfribidi$secondaryArchSuffix + devel:libgme$secondaryArchSuffix + devel:libgmp$secondaryArchSuffix + devel:libopenjp2$secondaryArchSuffix + devel:libopenmpt$secondaryArchSuffix + devel:libsnappy$secondaryArchSuffix + devel:libsoxr$secondaryArchSuffix + devel:libvpx$secondaryArchSuffix + devel:libwebp$secondaryArchSuffix + devel:libxml2$secondaryArchSuffix + devel:liblzma$secondaryArchSuffix + " +fi +BUILD_PREREQUIRES=" + cmd:awk + cmd:cmp + cmd:gcc$gccSuffix >= 7 + cmd:g++$secondaryArchSuffix + cmd:ld$gccSuffix + cmd:grep + cmd:make + cmd:nasm + cmd:perl + cmd:pkg_config$secondaryArchSuffix + cmd:sed + cmd:texi2html + " + +PATCH() +{ + # patch hard-coded paths to perl + sed -i "s,/usr/bin/perl,$portPackageLinksDir/cmd~perl/bin/perl," \ + doc/Doxyfile \ + doc/texi2pod.pl + # force no-undefined-symbols + if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then + sed -i "s/SHFLAGS='-shared/SHFLAGS='-shared -Wl,--no-undefined/g" \ + configure + fi +} + +defineDebugInfoPackage ffmpeg8$secondaryArchSuffix \ + $libDir/libavcodec.so.$libavcodecVersion \ + $libDir/libavfilter.so.$libavfilterVersion \ + $libDir/libavformat.so.$libavformatVersion \ + $libDir/libavutil.so.$libavutilVersion \ + $libDir/libswresample.so.$libswresampleVersion \ + $libDir/libswscale.so.$libswscaleVersion \ + "$(getPackagePrefix avdevice)/$relativeLibDir"/libavdevice.so.$libavdeviceVersion \ + "$(getPackagePrefix tools)/$relativeBinDir"/ffmpeg \ + "$(getPackagePrefix tools)/$relativeBinDir"/ffplay \ + "$(getPackagePrefix tools)/$relativeBinDir"/ffprobe + +BUILD() +{ + ccArgs="" + extraArgs="" + if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then + cc="gcc${gccSuffix/_/-}" + ccArgs="--cc=$cc --cxx=g++${secondaryArchSuffix/_/-} + --ld=gcc${secondaryArchSuffix/_/-} + --host-ld=gcc${secondaryArchSuffix/_/-}" + + # Hack up base headers to make them think we're on GCC2 ABI + mkdir -p include_hacks include_hacks/os include_hacks/config + pushd include_hacks + rm -f os/BeBuild.h config/HaikuConfig.h + cp /system/develop/headers/os/BeBuild.h os + cp /system/develop/headers/config/HaikuConfig.h config + sed -i 's/__GNUC__ == 2/1/g' os/BeBuild.h config/HaikuConfig.h + popd + + # Compile gcc_runtime.c (subset of libgcc that GCC 13 utilizes here) + $cc -fvisibility=hidden -c $portDir/additional-files/gcc_runtime.c \ + -o gcc_runtime.o + + baseLDFLAGS="-B/system/bin/${gccSuffix/_/}" + ccArgs="$ccArgs --host-ldflags=\"${baseLDFLAGS}\"" + export CFLAGS="-isystem$(pwd) -isystem$(pwd)/os -isystem$(pwd)/config" + export LDFLAGS="$baseLDFLAGS $(pwd)/gcc_runtime.o" + extraArgs="--disable-asm" + else + extraArgs="--enable-libass \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-fontconfig \ + --enable-libfreetype \ + --enable-libfribidi \ + --enable-libgme \ + --enable-gmp \ + --enable-libopenjpeg \ + --enable-libopenmpt \ + --enable-libsnappy \ + --enable-libsoxr \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libxml2 \ + --enable-lzma \ + --enable-pic" + fi + + # not an autotools configure + ./configure \ + $ccArgs \ + --prefix=$prefix \ + --bindir=$binDir \ + --datadir=$dataDir/$portName \ + --incdir=$includeDir \ + --libdir=$libDir \ + --shlibdir=$libDir \ + --mandir=$manDir \ + --disable-debug \ + --disable-stripping \ + --disable-static \ + --enable-shared \ + --enable-version3 \ + --enable-libmp3lame \ + --enable-libopus \ + --enable-openssl \ + --enable-libspeex \ + --enable-libtheora \ + --enable-libvorbis \ + $extraArgs + + make $jobArgs +} + +INSTALL() +{ + make install + + prepareInstalledDevelLibs $ffmpegLibs + fixPkgconfig + + # The pkgconfig file reference other libraries using the wrong paths, which + # creates a lot of confusion. Fix them so correct paths are used. + local develPackageName="${portName}_devel-$portFullVersion" + local packageLinksDir=$(dirname $portPackageLinksDir) + local linksDir="$packageLinksDir/${develPackageName}/devel~libspeex$secondaryArchSuffix/$relativeDevelopLibDir" + sed -i -e "s,^\(Libs.private.*\)-L.*speex.* \(-lspeex.*\),\1-L$linksDir \2," \ + $developLibDir/pkgconfig/libavcodec.pc \ + $developLibDir/pkgconfig/libavdevice.pc \ + $developLibDir/pkgconfig/libavfilter.pc \ + $developLibDir/pkgconfig/libavformat.pc + + # Move html docs to the right place. + mkdir -p $docDir + mv $prefix/share/doc/ffmpeg $docDir + rm -r $prefix/share + + # Split out libs and executables which need libSDL + packageEntries tools $binDir $manDir/man1 + packageEntries avdevice $libDir/libavdevice* + + # devel package + packageEntries devel \ + $dataDir/ffmpeg8$secondaryArchSuffix/examples \ + $documentationDir \ + $developDir +} + +TEST() +{ + export LIBRARY_PATH="$sourceDir/libavutil${LIBRARY_PATH:+:$LIBRARY_PATH}" + export LIBRARY_PATH="$sourceDir/libavcodec${LIBRARY_PATH:+:$LIBRARY_PATH}" + export LIBRARY_PATH="$sourceDir/libswresample${LIBRARY_PATH:+:$LIBRARY_PATH}" + export LIBRARY_PATH="$sourceDir/libavdevice${LIBRARY_PATH:+:$LIBRARY_PATH}" + export LIBRARY_PATH="$sourceDir/libavfilter${LIBRARY_PATH:+:$LIBRARY_PATH}" + export LIBRARY_PATH="$sourceDir/libavformat${LIBRARY_PATH:+:$LIBRARY_PATH}" + export LIBRARY_PATH="$sourceDir/libswscale${LIBRARY_PATH:+:$LIBRARY_PATH}" + make check +} diff --git a/media-video/ffmpeg/patches/ffmpeg-8.0.1.patchset b/media-video/ffmpeg/patches/ffmpeg-8.0.1.patchset new file mode 100644 index 000000000..61c0138b6 --- /dev/null +++ b/media-video/ffmpeg/patches/ffmpeg-8.0.1.patchset @@ -0,0 +1,102 @@ +From fbd1cfaa9763248ba9f4a0ffb1e60a0320768ee9 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Wed, 7 Aug 2019 16:21:12 +0300 +Subject: disable ebx on x86. + + +diff --git a/configure b/configure +index a0eed36..66f2a50 100755 +--- a/configure ++++ b/configure +@@ -7920,6 +7920,7 @@ case $target_os in + haiku) + disable memalign + disable posix_memalign ++ enabled x86_32 && enabled shared && disable ebx_available + ;; + *-dos|freedos|opendos) + if test_cpp_condition sys/version.h "defined(__DJGPP__) && __DJGPP__ == 2 && __DJGPP_MINOR__ == 5"; then +-- +2.52.0 + + +From 939dc2f047fda255f376858d29f5af0b7a879035 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Wed, 7 Aug 2019 16:21:32 +0300 +Subject: Re-enable memalign for Haiku + +This had been disabled in 2011: +https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2011-June/038362.html + +If there are still problems with it we should rather fix them on Haiku +side. + +diff --git a/configure b/configure +index 66f2a50..778b121 100755 +--- a/configure ++++ b/configure +@@ -7918,8 +7918,6 @@ enabled threads || warn \ + + case $target_os in + haiku) +- disable memalign +- disable posix_memalign + enabled x86_32 && enabled shared && disable ebx_available + ;; + *-dos|freedos|opendos) +-- +2.52.0 + + +From fd6f461515d94a5effe96f9e2bc0c057cb6366d1 Mon Sep 17 00:00:00 2001 +From: Augustin Cavalier +Date: Fri, 21 Feb 2025 14:12:40 -0500 +Subject: libavutil: Forcibly enable use of pthread_setname_np. + +Defining _BSD_SOURCE in here may not work if pthread.h +was already included, so just redeclare the method and +set the definition. + +diff --git a/libavutil/thread.h b/libavutil/thread.h +index 2c00c7c..98f6edb 100644 +--- a/libavutil/thread.h ++++ b/libavutil/thread.h +@@ -37,6 +37,12 @@ + #if HAVE_PTHREADS + #include + ++#ifdef __HAIKU__ ++extern int pthread_setname_np(pthread_t thread, const char* name); ++#undef HAVE_PTHREAD_SETNAME_NP ++#define HAVE_PTHREAD_SETNAME_NP 1 ++#endif ++ + #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 + + #include +-- +2.52.0 + + +From e19b47559b774b6b5c49fa5a7e731fb3b892bc41 Mon Sep 17 00:00:00 2001 +From: Augustin Cavalier +Date: Fri, 21 Feb 2025 14:35:08 -0500 +Subject: libavutil: Give slicethreads names. + + +diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c +index 7650fc6..8d94805 100644 +--- a/libavutil/slicethread.c ++++ b/libavutil/slicethread.c +@@ -73,6 +73,8 @@ static void *attribute_align_arg thread_worker(void *v) + WorkerContext *w = v; + AVSliceThread *ctx = w->ctx; + ++ ff_thread_setname("av:slicethread"); ++ + pthread_mutex_lock(&w->mutex); + pthread_cond_signal(&w->cond); + +-- +2.52.0 +