buildlibvlc.sh 1.44 KB
Newer Older
Thomas Guillem's avatar
Thomas Guillem committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/bin/sh

rootdir=`dirname $0`

checkfail()
{
    if [ ! $? -eq 0 ];then
        echo "'$1' failed"
        exit 1
    fi
}

if [ ! -d "${rootdir}/vlc-android" ]; then
    echo "VLC Android source not found, cloning"
    git clone http://code.videolan.org/videolan/vlc-android.git
    checkfail "git clone"
fi

sh -c "cd ${rootdir}/vlc-android && ./compile.sh -l $*"
checkfail "./vlc-android/compile.sh $*"

Thomas Guillem's avatar
Thomas Guillem committed
22 23
aar_file=`ls "${rootdir}"/vlc-android/libvlc/build/outputs/aar/*.aar --sort=time|head -n 1`
cp "${aar_file}" "${rootdir}"/libvlc/libvlc-3.0.0.aar
Thomas Guillem's avatar
Thomas Guillem committed
24 25 26
checkfail "libvlc*.arr not found"

VLC_SRC_DIR=`realpath "${rootdir}"/vlc-android/vlc`
27
LIBVLCJNI_LIBS=`realpath "${rootdir}"/vlc-android/libvlc/jni/libs`
Thomas Guillem's avatar
Thomas Guillem committed
28 29

for project in native_sample;do
30 31 32 33
    for jnilinkdir in ${LIBVLCJNI_LIBS}/*;do
        arch=`basename $jnilinkdir`
        if [ ! -f "${jnilinkdir}/libvlcjni.so" ];then
            continue;
34
        fi
35 36 37 38 39 40 41 42 43 44 45 46 47
        for linkdir in ${VLC_SRC_DIR}/build-android*/ndk/libs/${arch};do
            if [ ! -f "${linkdir}/libvlc.so" ];then
                continue;
            fi
            $ANDROID_NDK/ndk-build -C "${rootdir}"/${project} \
                VLC_SRC_DIR="${VLC_SRC_DIR}" \
                LIBVLC_LDLIBS="-L${linkdir} -L${jnilinkdir} -lvlc -lvlcjni" \
                APP_BUILD_SCRIPT=jni/Android.mk \
                APP_PLATFORM=android-9 \
                APP_ABI=${arch} \
                NDK_PROJECT_PATH=jni
            break
        done
Thomas Guillem's avatar
Thomas Guillem committed
48 49
    done
done