1# Downloads and build ogg, vorbis, flac, and libsndfile
2# Notes:
3# * Using pkgconfig did not work with emconfigure ./configure ..., so hardcoded paths are used
4# * All artifacts are installed into deps/lib and deps/include
5
6export CFLAGS="-O3 -flto"
7export CXXFLAGS="-O3 -flto"
8
9mkdir -p deps
10cd deps
11
12DEPS_DIR=$PWD
13
14echo $DEPS_DIR
15
16# DOWNLOAD DEPS AND UNPACK
17
18if [ ! -d "libogg-1.3.3" ]; then
19  wget http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.xz
20  tar xvf libogg-1.3.3.tar.xz
21
22  cd libogg-1.3.3
23  emconfigure ./configure --enable-static --disable-shared --prefix=$DEPS_DIR
24  #emconfigure ./configure --enable-static --disable-shared
25  emmake make install
26  cd ..
27fi
28
29if [ ! -d "libvorbis-1.3.6" ]; then
30  wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.tar.xz
31  tar xvf libvorbis-1.3.6.tar.xz
32
33  cd libvorbis-1.3.6
34  emconfigure ./configure --enable-static --disable-shared --prefix=$DEPS_DIR --libdir=$DEPS_DIR/lib --includedir=$DEPS_DIR/include
35  #emconfigure ./configure --enable-static --disable-shared
36  emmake make install
37  cd ..
38fi
39
40if [ ! -d "flac-1.3.2" ]; then
41wget http://downloads.xiph.org/releases/flac/flac-1.3.2.tar.xz
42tar xvf flac-1.3.2.tar.xz
43
44cd flac-1.3.2
45emconfigure ./configure --enable-static --disable-shared --prefix=$DEPS_DIR --libdir=$DEPS_DIR/lib --includedir=$DEPS_DIR/include --with-ogg-libraries=$DEPS_DIR/lib --with-ogg-includes=$DEPS_DIR/include --host=asmjs
46emmake make install
47cd ..
48fi
49
50
51if [ ! -d "libsndfile-1.0.25" ]; then
52
53wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz
54tar -xzf libsndfile-1.0.25.tar.gz
55patch libsndfile-1.0.25/src/sndfile.c < ../patches/sndfile.c.patch
56
57cd libsndfile-1.0.25
58#emconfigure ./configure --enable-static --disable-shared --disable-libtool-lock --disable-cpu-clip --disable-sqlite --disable-alsa --enable-external-libs --disable-full-suite
59emconfigure ./configure --enable-static --disable-shared --prefix=$DEPS_DIR --disable-libtool-lock --disable-cpu-clip --disable-sqlite --disable-alsa --enable-external-libs --includedir=$DEPS_DIR/include LD_FLAGS="-L${DEPS_DIR}/lib" --libdir="${DEPS_DIR}/lib" OGG_LIBS="-lm -logg" OGG_CFLAGS="-I${DEPS_DIR}/include"  VORBIS_LIBS="-lm -lvorbis" VORBIS_CFLAGS="-I${DEPS_DIR}/include" VORBISENC_LIBS="-lvorbisenc" VORBISENC_CFLAGS="-I${DEPS_DIR}/include" FLAC_LIBS="-lFLAC" FLAC_CFLAGS="-I${DEPS_DIR}/include"
60
61emmake make install
62
63fi
64
65
66
67
68#if [ ! -d "libsndfile" ]; then
69#git clone https://github.com/erikd/libsndfile.git
70#cd libsndfile
71#./autogen.sh
72#cd ..
73#fi
74#cd libsndfile
75#./autogen.sh
76#export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig
77#
78#echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}"
79#
80#emconfigure ./configure --enable-static --disable-shared --disable-libtool-lock --disable-cpu-clip --disable-sqlite --disable-alsa --enable-external-libs --prefix=$DEPS_DIR --libdir=$DEPS_DIR/lib --includedir=$DEPS_DIR/include --disable-full-suite
81#emmake make install
82
83
84## BUILD DEPS
85
86
87# cd libsndfile-1.0.25
88# emconfigure ./configure --enable-static --disable-shared --disable-libtool-lock --disable-cpu-clip --disable-sqlite --disable-alsa --disable-external-libs --build=i686
89# emmake make
90# cp ./src/.libs/libsndfile.a ../static-libs/libsndfile-wasm.a
91
92