写了个脚本自动下载和编译VLC代码,分享给有需要的人也顺便练练手。如果你的网络足够好,并且可以Over the wall,那么直接运行这个脚本就会下载好最新的VLC代码并且编译成功。
1. 这个脚本只能运行在Linux环境。
2. 建议定义好ANDROID_NDK和ANDROID_SDK环境变量,要不这个寻找的过程时间会比较长。
3. 如果期间出现中断一般情况是下载谷歌那对压缩包导致的,他里面使用了curl这个下载工具,失败就直接终止了,解决方案是:不断的执行./compile.sh这个脚本,要不就是手工下载好下载失败的那些包,然后放到指定位置。
4. 也可以使用我下载好的jar包,在末尾会有附件的下载地址,里面包含了两个tar包(请勿修改名字)和一个脚本,把他们放一块运行即可。
5. 如果一切顺利会编译所需要的所有库和apk,如果网上不over the wall,使用我提供的jar包仅仅能编译出所需要的库,apk可以通过Eclipse或者Android Studio编译出来。
6. 请尊重作者的劳动成果。
#!/bin/bash
cur_dir=`pwd`
#---------------- Find env --------------#
if [ -z "${ANDROID_SDK}" ]; then
echo "has not yet been defined ANDROID_SDK, i will try to find sdk path from your home dir."
echo "finding ..."
t_dir=`cd ~/ && find . -type d -name platform-tools`
if [ -n "$t_dir" ]; then
t_dir=`cd ~/ && cd ${t_dir} && pwd`
sdk_dir=`cd ${t_dir} && cd .. && pwd`
echo "android sdk path: '${sdk_dir}'"
echo ""
export ANDROID_SDK=${sdk_dir}
else
echo "i can't find your sdk position."
echo "please fix me!"
exit 1
fi
fi
if [ -z "${ANDROID_NDK}" ]; then
echo "has not yet been defined ANDROID_NDK, i will try to find sdk path from your home dir."
echo "finding ..."
t_dir=`which ndk-build`
if [ -n "$t_dir" ]; then
ndk_dir=`dirname ${t_dir}`
echo "android ndk path: '${ndk_dir}'"
echo ""
export ANDROID_NDK=${ndk_dir}
else
echo "i can't find your ndk position."
echo "please fix me!\n"
exit 1
fi
fi
#---------------- End find env --------------#
# check git
if test `which git`; then
git version
echo ""
else
echo "install git tool."
sudo apt-get install git
git version
echo ""
fi
# download vlc-android
vlc_dir="vlc-android"
if test -d ${vlc_dir}; then
echo "existing '${vlc_dir}' dir"
echo "continue ..."
echo ""
else
echo "start to clone '${vlc_dir}' dir"
git clone git://git.videolan.org/vlc-ports/android.git ${vlc_dir}
fi
if [ ! -d ${vlc_dir} ]; then
echo "clone ${vlc_dir} fail, try again."
echo "git clone git://git.videolan.org/vlc-ports/android.git ${vlc_dir}"
git clone git://git.videolan.org/vlc-ports/android.git ${vlc_dir}
fi
if [ ! -d ${vlc_dir} ]; then
echo "clone ${vlc_dir} fail again."
echo "exit ..."
echo ""
exit 1
fi
# arrived here, the vlc_dir certainly exist
vlc_dir=`cd ${vlc_dir} && pwd`
# download vlc source
cd ${vlc_dir}
if test -d vlc; then
echo "existing 'vlc' dir"
echo "continue ..."
echo ""
else
echo "start to clone '${vlc_dir}' dir"
git clone git://git.videolan.org/vlc.git vlc
fi
if test ! -d ${vlc_dir}/vlc; then
echo "download 'vlc' fail."
echo "exit ..."
echo ""
exit 1
fi
# if exist,decompression
extras_tar="${cur_dir}/extras_tools.tar"
extras_dir="${vlc_dir}/vlc/extras/tools"
if test -f ${extras_tar} -a -d ${extras_dir}; then
cp -v ${extras_tar} ${extras_dir}/
tar -xvf ${extras_dir}/extras_tools.tar -C ${extras_dir}/
rm -v ${extras_dir}/extras_tools.tar
fi
contrib_tar="${cur_dir}/contrib_tarballs.tar"
contrib_dir="${vlc_dir}/vlc/contrib/tarballs"
if test -f ${contrib_tar} -a -d ${contrib_dir}; then
cp -v ${contrib_tar} ${contrib_dir}/
tar -xvf ${contrib_dir}/contrib_tarballs.tar -C ${contrib_dir}/
rm -v ${contrib_dir}/contrib_tarballs.tar
fi
if [ -f compile.sh ]; then
echo "start dowmload the lack of the package && compile."
echo "please wait for about an hour ..."
./compile.sh
else
echo "git clone git://git.videolan.org/vlc.git vlc"
echo "clone vlc fail."
echo "exit ..."
exit 1
fi
容易下载失败的包:
vlc-android/vlc/extras/tools
cmake-3.1.0.tar.gz protobuf-2.6.0.tar.bz2 ragel-6.8.tar.gz yasm-1.2.0.tar.gz
vlc-android/vlc/contrib/tarballs
a52dec-0.7.4.tar.gz gmp-6.0.0.tar.bz2 libdvdnav-5.0.3.tar.bz2 libmad-0.15.1b.tar.gz libtasn1-3.7.tar.gz nettle-2.7.1.tar.gz taglib-1.9.1.tar.gz
contrib_tarballs.tar gnutls-3.2.21.tar.xz libdvdread-5.0.3.tar.bz2 libmatroska-1.4.2.tar.bz2 libtheora-1.1.1.tar.xz openjpeg-1.5.0.tar.gz zlib-1.2.8.tar.gz
ffmpeg-HEAD.tar.xz jpegsrc.v9a.tar.gz libebml-1.3.1.tar.bz2 libmodplug-0.8.8.5.tar.gz libupnp-1.6.19.tar.bz2 opus-1.1.tar.gz zvbi-0.2.35.tar.bz2
flac-1.3.1.tar.xz libass-0.12.1.tar.gz libgcrypt-1.6.2.tar.bz2 libmpeg2-0.5.1.tar.gz LibVNCServer-0.9.9.tar.gz postproc-git.tar.gz
freetype-2.5.5.tar.gz libdsm-0.0.5.tar.gz libgpg-error-1.18.tar.bz2 libogg-1.3.2.tar.xz libvorbis-1.3.5.tar.xz protobuf-2.6.0.tar.bz2
fribidi-0.19.6.tar.bz2 libdvbpsi-1.2.0.tar.bz2 libgsm_1.0.13.tar.gz libpng-1.6.16.tar.xz libxml2-2.9.2.tar.gz speex-1.2rc2.tar.gz
gettext-0.19.4.tar.gz libdvdcss-1.3.99.tar.bz2 libiconv-1.14.tar.gz libssh2-1.4.3.tar.gz live.2014.07.25.tar.gz speexdsp-1.2rc3.tar.gz
下载地址