-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcompileVorbis.sh
executable file
·54 lines (43 loc) · 1.64 KB
/
compileVorbis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# configure libogg
cd libogg
if [ ! -f configure ]; then
# generate configuration script
./autogen.sh
# -O20 and -04 cause problems
# see /~https://github.com/kripken/emscripten/issues/264
sed -i '' 's/-O20/-O2/g' configure
sed -i '' 's/-O4/-O2/g' configure
# finally, run configuration script
emconfigure ./configure --prefix="`pwd`" --disable-static
fi
# compile libogg
emmake make
emmake make install
cd ..
# configure libvorbis
dir=`pwd`
cd libvorbis
if [ ! -f configure ]; then
# generate configuration script
# disable running configure automatically
sed -i '' 's/$srcdir\/configure/#/' autogen.sh
./autogen.sh
# -O20 and -04 cause problems
# see /~https://github.com/kripken/emscripten/issues/264
sed -i '' 's/-O20/-O2/g' configure
sed -i '' 's/-O4/-O2/g' configure
# disable oggpack_writealign test
sed -i '' 's/$ac_cv_func_oggpack_writealign/yes/' configure
# finally, run configuration script
mkdir -p build
emconfigure ./configure --prefix="$dir/libvorbis/build" --disable-oggtest --disable-static --with-ogg=$dir/libogg --with-ogg-libraries=$dir/libogg/lib
fi
# compile libvorbis
EMCC_CFLAGS="--ignore-dynamic-linking" emmake make
emmake make install
# compile wrapper
cd ..
mkdir -p build
emcc -O3 -s RESERVED_FUNCTION_POINTERS=50 -s EXPORTED_FUNCTIONS="['_VorbisInit', '_VorbisHeaderDecode', '_VorbisGetChannels', '_VorbisGetSampleRate', '_VorbisGetNumComments', '_VorbisGetComment', '_VorbisDecode', '_VorbisDestroy']" -I libogg/include -Llibogg/lib -logg -I libvorbis/include -Llibvorbis/build/lib -lvorbis src/vorbis.c -o build/libvorbis.js
echo "module.exports = Module" >> build/libvorbis.js