Files
ports/main/ffmpeg/spkgbuild
2023-11-14 11:49:58 +00:00

85 lines
2.5 KiB
Plaintext
Executable File

# description : FFmpeg is a solution to record, convert and stream audio and video
# depends : libass fdk-aac freetype2 lame gnutls libtheora libvorbis libvpx opus x264 x265 alsa-lib sdl2 yasm aom dav1d
name=ffmpeg
version=6.1
release=1
source="https://ffmpeg.org/releases/$name-$version.tar.xz
ffmpeg-${version}-chromium_method-1.patch::https://linuxfromscratch.org/patches/downloads/ffmpeg/ffmpeg-${version}-chromium_method-1.patch
ffmpeg-x264-10bit.sh"
build() {
cd $name-$version
_opt=""
addopt() {
if [ "$_opt" = "" ]; then
scratch isinstalled $1 && _opt="--enable-$2" || _opt="--disable-$2"
elif [ ! "$_opt" = "" ]; then
scratch isinstalled $1 && _opt="$_opt --enable-$2" || _opt="$_opt --disable-$2"
fi
}
## $1 is package name
## $2 is feature
addopt libvdpau vdpau
addopt libva vaapi
addopt nvidia cuda
addopt nvidia cuvid
addopt nv-codec-headers nvenc
addopt amf-headers amf
addopt svt-av1 libsvtav1
# Adds an API necessary for some packages to build
patch -Np1 -i $SRC/ffmpeg-${version}-chromium_method-1.patch
# adds the ALSA library to the Flite LDFLAGS variable and
# enables the discovery of Flite
sed -i 's/-lflite"/-lflite -lasound"/' configure
./configure --prefix=/usr \
--enable-gpl \
--enable-gnutls \
--enable-version3 \
--enable-nonfree \
--disable-static \
--enable-lto \
--enable-shared \
--disable-debug \
--disable-libcelt \
--disable-optimizations \
--disable-stripping \
--disable-doc \
--enable-swresample \
--enable-avfilter \
--enable-pic \
--enable-postproc \
--enable-pthreads \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libaom \
--enable-libdav1d \
$_opt
make
gcc tools/qt-faststart.c -o tools/qt-faststart
make DESTDIR=$PKG install
install -m755 tools/qt-faststart $PKG/usr/bin
[ -e '/usr/lib/pkgconfig/x264.pc' ] && \
install -m 0755 -D $SRC/ffmpeg-x264-10bit.sh \
$PKG/usr/bin/ffmpeg-x264-10bit
rm -r $PKG/usr/share/ffmpeg/examples
}