# Copyright (C) 2026 Huawei Device Co., Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
pkgname=ohos_vlc
pkgver=ohos-3.0.21
pkgrel=0
pkgdesc="VLC 是一款自由、开源的跨平台多媒体播放器及框架,可播放大多数多媒体文件,以及 DVD、音频 CD、VCD 及各类流媒体协议。"
url="https://www.videolan.org/"
archs=("arm64-v8a")
license=("GNU General Public License v2.0")
depends=("FFmpeg-surface-dev" "freetype2" "faad2" "libvorbis" "libdca" "flac" "speex" "libtheora" "aribb24" "speexdsp" "libkate" "libogg" "a52dec" "openssl-3.4.0" "live555" )
makedepends=("msgfmt")
autounpack=false
downloadpackage=false
buildtools="configure"
builddir=ohos_vlc
packagename=
source envset.sh
inited=true
host=
prepare() {
echo "--------------prepare()---------------------"
mkdir -p $builddir/$ARCH-build
echo $(pwd)
echo $(ls)
if [ $ARCH == "arm64-v8a" ]
then
setarm64ENV
CFLAGS="-Wl,-L$LYCIUM_ROOT/usr/libogg/arm64-v8a/lib/ -Wl,-logg -I$LYCIUM_ROOT/usr/libogg/arm64-v8a/include -Wl,-L$LYCIUM_ROOT/usr/a52dec/arm64-v8a/lib/ -Wl,-la52 -I$LYCIUM_ROOT/usr/a52dec/arm64-v8a/include -I$LYCIUM_ROOT//usr/FFmpeg/arm64-v8a/include -DHAVE_OHOS=1 $CFLAGS"
CXXFLAGS="-DHAVE_OHOS=1 $CXXFLAGS"
host=aarch64-linux
else
echo "${ARCH} not support"
return -1
fi
if [ $inited == true ];then
inited=false
cd $builddir
echo "-------------------bootstrap--------------------"
echo $(pwd)
echo $(ls)
./bootstrap
cd $OLDPWD
fi
}
build() {
echo "--------------build()---------------------"
echo $(pwd)
echo $(ls)
mkdir -p $builddir/$ARCH-contrib/include
mkdir -p $builddir/$ARCH-contrib/lib
cp -r $LYCIUM_ROOT/usr/openssl-3.4.0/$ARCH/include $builddir/$ARCH-contrib
cp -r $LYCIUM_ROOT/usr/openssl-3.4.0/$ARCH/lib $builddir/$ARCH-contrib
cp -r $LYCIUM_ROOT/usr/live555/$ARCH/include $builddir/$ARCH-contrib
cp -r $LYCIUM_ROOT/usr/live555/$ARCH/lib $builddir/$ARCH-contrib
local ffmpeg_prefix="$LYCIUM_ROOT/usr/FFmpeg/arm64-v8a"
export PKG_CONFIG_LIBDIR="${pkgconfigpath}:${ffmpeg_prefix}/lib/pkgconfig"
export CFLAGS="-I${ffmpeg_prefix}/include $CFLAGS"
export LDFLAGS="-L${ffmpeg_prefix}/lib $LDFLAGS"
cd $builddir/$ARCH-build
EGL_CFLAGS="-I${OHOS_SDK}/native/sysroot/usr/include" \
EGL_LIBS="-L${OHOS_SDK}/native/sysroot/usr/lib/ -lEGL" \
GLES2_CFLAGS="-I${OHOS_SDK}/native/sysroot/usr/include" \
GLES2_LIBS="-L${OHOS_SDK}/native/sysroot/usr/lib/ -lGLESv2" \
BUILDCC=gcc ../configure "$@" --host=$host --enable-live555 --enable-openssl --disable-lua --disable-a52 --disable-rpath \
--disable-xcb --disable-appdata --enable-gles2 --disable-alsa --disable-vlc --disable-v4l2 \
--enable-freetype ac_cv_func_open_memstream=no --disable-silent-rules --with-contrib="../$ARCH-contrib"
sed -i 's/-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment/-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment -lssl -lcrypto/g' config.status
sed -i 's/-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic/-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic -lssl -lcrypto/g' config.status
sed -i "s|hardcode_libdir_flag_spec='\$wl-rpath \$wl\$libdir'|hardcode_libdir_flag_spec='\$wl'|" config.status
sed -i "s|hardcode_libdir_flag_spec_CXX='\$wl-rpath \$wl\$libdir'|hardcode_libdir_flag_spec_CXX='\$wl'|" config.status
$MAKE
ret=$?
cd $OLDPWD
return $ret
}
package() {
cd $builddir/$ARCH-build
$MAKE install >> `pwd`/build.log 2>&1
cd $OLDPWD
}
check() {
unset host
if [ $ARCH == "arm64-v8a" ]
then
unsetarm64ENV
else
echo "${ARCH} not support"
return -1
fi
echo "The test must be on an OpenHarmony device!"
}
cleanbuild() {
echo "The test must be on an OpenHarmony device!"
#rm -rf ${PWD}/$builddir #${PWD}/$packagename
}