Commit 27f880cd authored by Brateau Etienne's avatar Brateau Etienne Committed by Jean-Baptiste Kempf
Browse files

Add a script to generate the static module list

All modules are built statically. So we must generate a table with the
enty point to vlc can use them.
parent a8d127ab
#!/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
}
. emsdk-portable/emsdk_env.sh
if [ ! -d vlc ]; then
diagnostic "vlc must exists. Execute compile.sh"
exit 1
fi
cd vlc
PROJECT_DIR=$(pwd)
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=$(llvm-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