Commit 5aa5c70b authored by Mehdi Sabwat's avatar Mehdi Sabwat
Browse files

build: update scripts to use extras/package build script

parent 5c66cfa8
......@@ -15,6 +15,8 @@ checkfail()
exit 1
fi
}
SLOW_MODE=${SLOW_MODE:=1}
WORK_DIR=$PWD
EMSDK_VERSION="2.0.17"
......@@ -35,140 +37,28 @@ if [ ! -d vlc ]; then
cd vlc
diagnostic "VLC source: resetting to the TESTED_HASH commit (${TESTED_HASH})"
git reset --hard ${TESTED_HASH} || checkfail "VLC source: TESTED_HASH ${TESTED_HASH} not found"
cd ..
checkfail "vlc source: git clone failed"
fi
cd vlc
# Make in //
if [ -z "$MAKEFLAGS" ]; then
UNAMES=$(uname -s)
MAKEFLAGS=
if which nproc >/dev/null; then
MAKEFLAGS=-j`nproc`
elif [ "$UNAMES" == "Darwin" ] && which sysctl >/dev/null; then
MAKEFLAGS=-j`sysctl -n machdep.cpu.thread_count`
# patching vlc
if [ -d ../vlc_patches ] && [ "$(ls -A ../vlc_patches)" ]; then
# core patches
git am -3 ../vlc_patches/upstream-core/*.patch
fi
checkfail "vlc source: git clone failed"
fi
# VLC tools
export PATH=`pwd`/extras/tools/build/bin:$PATH
echo "Building tools"
cd extras/tools
./bootstrap
checkfail "buildsystem tools: bootstrap failed"
make $MAKEFLAGS
checkfail "buildsystem tools: make"
cd $WORK_DIR
diagnostic "Setting the environment"
source emsdk/emsdk_env.sh
export PKG_CONFIG_PATH=$EMSDK/emscripten/incoming/system/lib/pkgconfig
export PKG_CONFIG_LIBDIR=$PWD/vlc/contrib/wasm32_unknowm_emscripten/lib/pkgconfig
export PKG_CONFIG_PATH_CUSTOM=$PKG_CONFIG_LIBDIR
# Check that clang is working
clang --version
diagnostic "Patching"
cd vlc
# patching vlc
if [ -d ../vlc_patches ] && [ "$(ls -A ../vlc_patches)" ]; then
# core patches
git am -3 ../vlc_patches/upstream-core/*.patch
fi
# BOOTSTRAP
if [ ! -f configure ]; then
echo "Bootstraping"
./bootstrap
checkfail "vlc: bootstrap failed"
fi
############
# Contribs #
############
echo "Building the contribs"
mkdir -p contrib/contrib-emscripten
cd contrib/contrib-emscripten
../bootstrap --disable-disc --disable-gpl --disable-sout \
--disable-network \
--host=wasm32-unknown-emscripten --build=x86_64-linux
checkfail "contribs: bootstrap failed"
emmake make list
emmake make $MAKEFLAGS fetch
checkfail "contribs: make fetch failed"
emmake make $MAKEFLAGS .ffmpeg
checkfail "contribs: make failed"
cd ../../
# Build
mkdir -p build-emscripten && cd build-emscripten
OPTIONS="
--host=wasm32-unknown-emscripten
--enable-debug
--enable-gles2
--disable-lua
--disable-ssp
--disable-nls
--disable-sout
--disable-vlm
--disable-addonmanagermodules
--enable-avcodec
--enable-merge-ffmpeg
--disable-swscale
--disable-a52
--disable-x264
--disable-xcb
--disable-alsa
--disable-macosx
--disable-sparkle
--disable-qt
--disable-screen
--disable-xcb
--disable-pulse
--disable-alsa
--disable-oss
--disable-vlc"
# --disable-xvideo Unknown option
# Note :
# search.h is a blacklisted module
# time.h is a blacklisted module
# shm.h is a blacklisted module
# ssp is not supported on the wasm backend
emconfigure ../configure ${OPTIONS} \
ac_cv_func_sendmsg=yes ac_cv_func_recvmsg=yes ac_cv_func_if_nameindex=yes ac_cv_header_search_h=no ac_cv_header_time_h=no ac_cv_header_sys_shm_h=no
emmake make ${MAKEFLAGS}
diagnostic "Generating module list"
cd ../..
./generate_modules_list.sh
cd vlc/build-emscripten
emcc vlc-modules.c -o vlc-modules.bc -pthread
cd ../..
diagnostic "build libvlc"
cd ./vlc/extras/package/wasm-emscripten/
./build.sh --mode=${SLOW_MODE}
url="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
# copy Dolby_Canyon.vob
diagnostic "getting video"
cd vlc/build-emscripten/
curl ${url} -o BigBuckBunny.mp4
cd $WORK_DIR
if [ ! -f "./BigBuckBunny.mp4" ]; then
curl ${url} -o BigBuckBunny.mp4
fi
diagnostic "Generating executable"
cp main.c vlc/build-emscripten/
./create_main.sh
......@@ -23,16 +23,18 @@ if [ ! -d vlc ]; then
exit 1
fi
PROJECT_DIR=$(pwd)/vlc
PATH_VLC=${PATH_VLC:=./vlc}
SAMPLE=${SAMPLE:=./BigBuckBunny.mp4}
PROJECT_DIR=${PROJECT_DIR:=./vlc/extras/package/wasm-emscripten/build}
cd vlc/build-emscripten
# for release, remove profiling-funcs and add -Os
-I $PROJECT_DIR/include/ -I $PROJECT_DIR/contrib/wasm32-unknown-emscripten/include/ main.c \
emcc --bind -s USE_PTHREADS=1 -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=15 \
-s OFFSCREEN_FRAMEBUFFER=1 -s USE_WEBGL2=1 --profiling-funcs \
-I $PATH_VLC/include/ -I $PROJECT_DIR/wasm32-unknown-emscripten/include/ main.c \
$PROJECT_DIR/build-emscripten/lib/.libs/libvlc.a \
vlc-modules.bc $PROJECT_DIR/build-emscripten/modules/.libs/*.a \
$PROJECT_DIR/contrib/wasm32-unknown-emscripten/lib/*.a \
$PROJECT_DIR/build-emscripten/vlc-modules.bc \
$PROJECT_DIR/build-emscripten/modules/.libs/*.a \
$PROJECT_DIR/wasm32-unknown-emscripten/lib/*.a \
$PROJECT_DIR/build-emscripten/src/.libs/libvlccore.a \
$PROJECT_DIR/build-emscripten/compat/.libs/libcompat.a \
-o ../../experimental.html --emrun --preload-file BigBuckBunny.mp4
-o experimental.html --preload-file ${SAMPLE}
#!/bin/bash
set -e
## FUNCTIONS
diagnostic()
{
echo "$@" 1>&2;
}
checkfail()
{
if [ ! $? -eq 0 ];then
diagnostic "$1"
exit 1
fi
}
get_symbol()
{
echo "$1" | grep vlc_entry_$2 | cut -d " " -f 3
}
source emsdk/emsdk_env.sh
if [ ! -d vlc ]; then
diagnostic "vlc must exists. Execute compile.sh"
exit 1
fi
cd vlc
PROJECT_DIR=$(pwd)
NM="$EMSDK/upstream/bin/llvm-nm"
cd build-emscripten/modules/.libs
# create module list
echo "creating module list"
touch $PROJECT_DIR/build-emscripten/vlc-modules.c
echo -e "// This file is autogenerated" > $PROJECT_DIR/build-emscripten/vlc-modules.c
echo -e "#include <unistd.h>\n\n" >> $PROJECT_DIR/build-emscripten/vlc-modules.c
BUILTINS="const void *vlc_static_modules[] = {\n"
LDFLAGS=""
DEFINITIONS=""
VLCMODULES=""
i=""
for i in `ls *plugin.a`
do
VLCMODULES="$i $VLCMODULES"
done
for file in $VLCMODULES
do
symbols=$($NM -g $file)
entryname=$(get_symbol "$symbols" _)
DEFINITIONS+="int $entryname (int (*)(void *, void *, int, ...), void *);\n";
BUILTINS+=" $entryname,\n"
LDFLAGS+="\$PROJECT_DIR/build-emscripten/modules/.libs/$file "
done;
cd ../..
BUILTINS="$BUILTINS NULL\n};\n"
echo -e "$DEFINITIONS\n$BUILTINS" >> $PROJECT_DIR/build-emscripten/vlc-modules.c
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment