build_from_source.sh 2.53 KB
Newer Older
1
#!/bin/bash
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
set -ex

# Arguments: PREFIX, specifying where to install dependencies into

PREFIX="$1"

rm -rf /tmp/torchaudio-deps
mkdir /tmp/torchaudio-deps
pushd /tmp/torchaudio-deps

curl -L -o sox-14.4.2.tar.bz2 "http://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsox%2Ffiles%2Fsox%2F14.4.2%2F&ts=1416316415&use_mirror=heanet"
curl -L -o lame-3.99.5.tar.gz "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2Ffiles%2Flame%2F3.99%2F&ts=1416316457&use_mirror=kent"
curl -L -o flac-1.3.2.tar.xz "https://superb-dca2.dl.sourceforge.net/project/flac/flac-src/flac-1.3.2.tar.xz"
curl -L -o libmad-0.15.1b.tar.gz "https://downloads.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz"
17
18
19
20
21

# unpack the dependencies
tar xfp sox-14.4.2.tar.bz2
tar xfp lame-3.99.5.tar.gz
tar xfp flac-1.3.2.tar.xz
22
tar xfp libmad-0.15.1b.tar.gz
23
24
25

# build lame, statically
pushd lame-3.99.5
26
./configure --disable-shared --enable-static --prefix="$PREFIX/third_party/lame" CFLAGS=-fPIC CXXFLAGS=-fPIC --with-pic --disable-debug --disable-dependency-tracking --enable-nasm
27
make -s -j && make install
28
29
30
31
popd

# build flac, statically
pushd flac-1.3.2
32
./configure --disable-shared --enable-static --prefix="$PREFIX/third_party/flac" CFLAGS=-fPIC CXXFLAGS=-fPIC \
33
34
35
36
37
38
    --with-pic --disable-debug --disable-dependency-tracking
make -s -j && make install
popd

# build mad, statically
pushd libmad-0.15.1b
39
40
# See https://stackoverflow.com/a/12864879/23845
sed -i.bak 's/-march=i486//' configure
41
./configure --disable-shared --enable-static --prefix="$PREFIX/third_party/mad" CFLAGS=-fPIC CXXFLAGS=-fPIC \
42
43
    --with-pic --disable-debug --disable-dependency-tracking
make -s -j && make install
44
45
46
popd

# build sox, statically
47
48
49
# --without-png makes OS X build less hazardous; somehow the build
# finds png and enables it.  We don't want it; we'd need to package
# it statically if we do.
50
pushd sox-14.4.2
51
52
53
./configure --disable-shared --enable-static --prefix="$PREFIX/third_party/sox" \
    LDFLAGS="-L$PREFIX/third_party/lame/lib -L$PREFIX/third_party/flac/lib -L$PREFIX/third_party/mad/lib" \
    CPPFLAGS="-I$PREFIX/third_party/lame/include -I$PREFIX/third_party/flac/include -I$PREFIX/third_party/mad/include" \
54
    --with-lame --with-flac --with-mad --without-alsa --without-coreaudio --without-png --without-oggvorbis --without-oss --without-sndfile CFLAGS=-fPIC CXXFLAGS=-fPIC --with-pic --disable-debug --disable-dependency-tracking
55
make -s -j && make install
56
popd
57
58

popd