build_third_party.sh 1.48 KB
Newer Older
moto's avatar
moto committed
1
#!/bin/bash
2
3
# Build third party libraries (SoX, lame, libmad, and flac)
# Usage: ./build_thid_parth.sh [prefix] [download_only?=false]
moto's avatar
moto committed
4
5
6
7
8
9
10
11
12
13

set -e

this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
root_dir="${this_dir}/../.."

prefix="${1:-}"
if [ -z "${prefix}" ]; then
    prefix="${root_dir}"
fi
14
download_only="${2:-false}"
moto's avatar
moto committed
15
16
17
18
19
20
21
22
23

tp_dir="${prefix}/third_party"
tmp_dir="${tp_dir}/tmp"
build_dir="${tp_dir}/build"

mkdir -p "${tmp_dir}" "${build_dir}"

. "${this_dir}/build_third_party_helper.sh"

moto's avatar
moto committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if ! found_ogg "${build_dir}" ; then
    get_ogg "${tmp_dir}"
    if [ "${download_only}" = "false" ]; then
        build_ogg "${tmp_dir}" "${build_dir}"
    fi
fi

if ! found_vorbis "${build_dir}" ; then
    get_vorbis "${tmp_dir}"
    if [ "${download_only}" = "false" ]; then
        build_vorbis "${tmp_dir}" "${build_dir}"
    fi
fi

moto's avatar
moto committed
38
if ! found_lame "${build_dir}" ; then
39
40
41
42
    get_lame "${tmp_dir}"
    if [ "${download_only}" = "false" ]; then
        build_lame "${tmp_dir}" "${build_dir}"
    fi
moto's avatar
moto committed
43
44
45
fi

if ! found_flac "${build_dir}" ; then
46
47
48
49
   get_flac "${tmp_dir}"
   if [ "${download_only}" = "false" ]; then
       build_flac "${tmp_dir}" "${build_dir}"
   fi
moto's avatar
moto committed
50
51
52
fi

if ! found_mad "${build_dir}" ; then
53
54
55
56
   get_mad "${tmp_dir}"
   if [ "${download_only}" = "false" ]; then
       build_mad "${tmp_dir}" "${build_dir}"
   fi
moto's avatar
moto committed
57
58
59
fi

if ! found_sox "${build_dir}" ; then
60
61
62
63
   get_sox "${tmp_dir}"
   if [ "${download_only}" = "false" ]; then
       build_sox "${tmp_dir}" "${build_dir}"
   fi
moto's avatar
moto committed
64
fi