create_main.sh 1.06 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
set -e

## FUNCTIONS

diagnostic()
{
     echo "$@" 1>&2;
}

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

Mehdi Sabwat's avatar
Mehdi Sabwat committed
19
source emsdk/emsdk_env.sh
20
21
22
23
24
25

if [ ! -d vlc ]; then
    diagnostic "vlc must exists. Execute compile.sh"
    exit 1
fi

26
PATH_VLC=${PATH_VLC:=./vlc}
27
SAMPLE_DIR=${SAMPLE_DIR:=./samples}
28
PROJECT_DIR=${PROJECT_DIR:=./vlc/extras/package/wasm-emscripten/build}
29

Mehdi Sabwat's avatar
Mehdi Sabwat committed
30
# for release, remove profiling-funcs and add -Os
31
32
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 \
33
    -I $PATH_VLC/include/ -I $PROJECT_DIR/wasm32-unknown-emscripten/include/ main.c \
34
    $PROJECT_DIR/build-emscripten/lib/.libs/libvlc.a \
35
36
37
    $PROJECT_DIR/build-emscripten/vlc-modules.bc \
    $PROJECT_DIR/build-emscripten/modules/.libs/*.a \
    $PROJECT_DIR/wasm32-unknown-emscripten/lib/*.a \
38
39
    $PROJECT_DIR/build-emscripten/src/.libs/libvlccore.a \
    $PROJECT_DIR/build-emscripten/compat/.libs/libcompat.a \
40
    -o experimental.html --preload-file ${SAMPLE_DIR}