代码拉取完成,页面将自动刷新
# Contributor: Jeff Han <hanjinfei@foxmail.com>
# Maintainer: Jeff Han <hanjinfei@foxmail.com>
pkgname=FFmpeg
pkgver=n6.0
pkgrel=0
pkgdesc="FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata."
url="https://github.com/FFmpeg/FFmpeg/"
archs=("armeabi-v7a" "arm64-v8a")
license=("GPL2" "GPL3" "LGPL3" "MIT" "X11" "BSD-styl")
depends=("rtmpdump" "openssl_1_0_2u")
makedepends=()
source="https://github.com/FFmpeg/$pkgname/archive/refs/tags/$pkgver.tar.gz"
autounpack=false
downloadpackage=true
buildtools="configure"
builddir=$pkgname-${pkgver}
packagename=$builddir.tar.gz
source envset.sh
buildhost=true
arch=
ldflags=
prepare() {
if [ "$LYCIUM_BUILD_OS" == "Linux" ]
then
hostosname=linux
elif [ "$LYCIUM_BUILD_OS" == "Darwi" ]
then
hostosname=darwin
else
echo "System cannot recognize, exiting"
return -1
fi
if [ $buildhost == true ]
then
tar -zxf $packagename
cd $builddir
./configure --enable-static --enable-shared --disable-doc --disable-htmlpages \
--target-os=$hostosname --disable-optimizations --prefix=`pwd`/hostbuild > $publicbuildlog 2>&1
$MAKE >> $publicbuildlog 2>&1
$MAKE install >> $publicbuildlog 2>&1
export LD_LIBRARY_PATH=`pwd`/hostbuild/lib:$LD_LIBRARY_PATH
sed -i.bak 's/include $(SRC_PATH)\/tests\/fate\/source.mak/#include $(SRC_PATH)\/tests\/fate\/source.mak/g' tests/Makefile
$MAKE check >> $publicbuildlog 2>&1
ret=$?
buildhost=false
cd $OLDPWD
fi
mkdir $pkgname-$ARCH-build
tar -zxf $packagename -C $pkgname-$ARCH-build
cd $pkgname-$ARCH-build/$builddir
patch -p1 < ../../FFmpeg_oh_test.patch
cd $OLDPWD
if [ $ARCH == "armeabi-v7a" ]
then
setarm32ENV
arch=arm
ldflags="-L${OHOS_SDK}/native/sysroot/usr/lib/arm-linux-ohos"
elif [ $ARCH == "arm64-v8a" ]
then
setarm64ENV
arch=aarch64
ldflags="-L${OHOS_SDK}/native/sysroot/usr/lib/aarch64-linux-ohos"
else
echo "${ARCH} not support"
return -1
fi
return $ret
}
build() {
cd $pkgname-$ARCH-build/$builddir
PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./configure "$@" --enable-neon --enable-asm --enable-network \
--disable-vulkan --enable-cross-compile --enable-librtmp --disable-x86asm --enable-openssl --enable-protocols \
--enable-static --enable-shared --disable-doc --disable-htmlpages --target-os=linux --arch=$arch \
--cc=${CC} --ld=${CC} --strip=${STRIP} --host-cc="${CC}" --host-ld="${CC}" --host-os=linux \
--host-ldflags=${ldflags} --sysroot=${OHOS_SDK}/native/sysroot > $buildlog 2>&1
$MAKE >> $buildlog 2>&1
ret=$?
cd $OLDPWD
return $ret
}
package() {
cd $pkgname-$ARCH-build/$builddir
$MAKE install >> $buildlog 2>&1
cd $OLDPWD
}
checktestfiles() {
cd $pkgname-$ARCH-build/$builddir/tests/ref
tmpdir=("fate" "acodec" "lavf" "lavf-fate" "pixfmt" "seek" "vsynth")
for dir in ${tmpdir[*]}
do
for file in `ls $dir`
do
if [ ! -f $dir/$file ]; then
continue
fi
str=`cat $dir/$file | grep "\*tests"`
if [ ! -z "$str" ]
then
sed -i.bak 's/\*tests/tests/g' $dir/$file
fi
done
done
cd $OLDPWD
}
copyhostbin() {
file=$1
if [[ -f tests/$file ]] && [[ ! -f tests/$file.${ARCH} ]]
then
mv tests/$file tests/$file.${ARCH}
cp ../../$builddir/tests/$file tests/$file
fi
}
check() {
cd $pkgname-$ARCH-build/$builddir
# disable running cmd
sed -i.bak 's/ $(Q)$(SRC_PATH)\/tests\/fate-run.sh/# $(Q)$(SRC_PATH)\/tests\/fate-run.sh/g' tests/Makefile
# disable check git sources
sed -i.bak 's/include $(SRC_PATH)\/tests\/fate\/source.mak/#include $(SRC_PATH)\/tests\/fate\/source.mak/g' tests/Makefile
# disable check ffprobe,this use xmllint command, which ohos is not support
sed -i.bak 's/include $(SRC_PATH)\/tests\/fate\/ffprobe.mak/#include $(SRC_PATH)\/tests\/fate\/ffprobe.mak/g' tests/Makefile
# change x86 cmd for generate test target
mv ffmpeg ffmpeg.${ARCH}
cp ../../$builddir/ffmpeg ./
retrytimes=0
ret=0
while true
do
$MAKE check >> $buildlog 2>&1
if [ $? -eq 0 ]
then
break;
fi
copyhostbin base64
copyhostbin audiomatch
copyhostbin audiogen
copyhostbin videogen
copyhostbin tiny_psnr
copyhostbin tiny_ssim
copyhostbin rotozoom
let retrytimes=$retrytimes+1
if [ $retrytimes -gt 4 ]
then
ret=1
break
fi
done
mv ffmpeg.${ARCH} ffmpeg
for file in `ls tests/*.${ARCH}`
do
tmpfile=${file%.*}
mv $file $tmpfile
done
# reduction running cmd for real test
sed -i.bak 's/# $(Q)$(SRC_PATH)\/tests\/fate-run.sh/ $(Q)$(SRC_PATH)\/tests\/fate-run.sh/g' tests/Makefile
cd $OLDPWD
checktestfiles
echo "The test must be on an OpenHarmony device!"
# skip running test on host
# real test CMD
# make check
return $ret
}
recoverpkgbuildenv() {
unset arch
unset ldflags
if [ $ARCH == "armeabi-v7a" ]
then
unsetarm32ENV
elif [ $ARCH == "arm64-v8a" ]
then
unsetarm64ENV
else
echo "${ARCH} not support"
return -1
fi
}
# 清理环境
cleanbuild() {
rm -rf ${PWD}/${builddir} ${PWD}/$pkgname-arm64-v8a-build ${PWD}/$pkgname-armeabi-v7a-build #${PWD}/$packagename
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。