-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·126 lines (109 loc) · 3.71 KB
/
install.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env bash
set -e
b=$(tput bold)
n=$(tput sgr0)
root=$(pwd)
# Load .config.ini
. ./.config.ini
# Get OS
os="Unknown"
if [[ "$(uname)" == "Darwin" ]]; then
# Do something under Mac OS X platform
os="Mac OSX"
elif [[ "$(expr substr $(uname -s) 1 5)" == "Linux" ]]; then
# Do something under GNU/Linux platform
os="Linux"
elif [[ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]]; then
# Do something under 32 bits Windows NT platform
os="Windows32"
elif [[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]]; then
# Do something under 64 bits Windows NT platform
os="Windows64"
fi
echo "Installing ${b}autoplay${n}"
echo " - ${b}autoplay version:${n} ${AUTOPLAY_VERSION}"
echo " - ${b}OS type:${n} ${os}"
if [[ "$os" == "Windows32" || "$os" == "Windows64" ]]; then
echo "${b}autoplay${n} does not support Windows!"
fi
echo ""
# -- GTEST
if [[ "${GTEST_LOC}" == "" ]]; then
GTEST_LOC=/usr
fi
if [[ "${GTEST_ROOT}" == "" ]]; then
GTEST_LOC=/tmp
fi
if [[ -f ${GTEST_LOC}/lib/libgtest.a ]]; then
echo " - ${b}GTest 1.8.0${n} dependency found."
else
echo " - Installing ${b}GTest 1.8.0${n} in ${b}${GTEST_LOC}${n}..."
cd ${GTEST_ROOT}
sudo wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz
sudo tar xf release-1.8.0.tar.gz
cd googletest-release-1.8.0/googletest
sudo mkdir -p bld; cd bld
sudo cmake ..
sudo make
sudo cp -a ../include/gtest ${GTEST_LOC}/include
sudo cp -a *.a ${GTEST_LOC}/lib/
cd ${root}
echo " - Installed ${b}GTest 1.8.0${n} in ${b}${GTEST_LOC}${n}."
fi
# -- BOOST
boost_dir=/usr/include/boost
if [[ "${BOOST_ROOT}" == "" ]]; then
BOOST_ROOT=${boost_dir}
fi
boost_install_dir=${boost_dir}-install
if [[ -d ${boost_dir} ]]; then
echo " - ${b}Boost 1.66.0${n} dependency found. (To reinstall, please remove the ${b}${boost_dir}${n} directory)"
else
echo " - Installing ${b}Boost 1.66.0${n} in ${b}${boost_dir}${n}..."
export BOOST_NO_SYSTEM_PATHS=ON
if [[ -z "$(ls -A ${BOOST_ROOT})" ]]; then
cd ${boost_install_dir}
wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz -q
tar xf boost_1_66_0.tar.gz > /dev/null 2>&1
cd boost_1_66_0/
./bootstrap.sh --prefix=${BOOST_ROOT} --with-libraries=chrono,date_time,filesystem,iostreams,locale,regex,system,thread
./b2 -q -a -j2 -d0 --disable-filesystem2 cxxflags="-v -std=c++11" threading=multi install
cd ${root};
else
echo " => Already have Boost cache"
fi
export LD_LIBRARY_PATH=${BOOST_ROOT}/lib:${LD_LIBRARY_PATH}
sudo rm -f /usr/local/lib/libboost*.dylib*
sudo ln -s ${BOOST_ROOT}/lib/*.{so,dylib}* /usr/local/lib
echo " - Installed ${b}Boost 1.66.0${n} in ${b}${boost_dir}${n}."
fi
# -- TRNG (Tina's Random Number Generator)
if [[ "${TRNG_LOC}" == "" ]]; then
TRNG_LOC=${root}/deps/trng
fi
trng_dir=${TRNG_LOC}
trng_install_dir=${root}/dependencies/trng
if [[ -d ${trng_dir} ]]; then
echo " - ${b}TRNG${n} dependency found. (To reinstall, please remove the ${b}${trng_dir}${n} directory)"
else
echo " - Installing ${b}TRNG${n} in ${b}${trng_dir}${n}..."
mkdir -p ${trng_dir}
cd ${trng_install_dir}
autoreconf --force --install
sudo ./configure --prefix=${trng_dir}
sudo make && sudo make install
cd ${root}
echo " - Installed ${b}TRNG${n} in ${b}${trng_dir}${n}."
fi
# -- ALSA (RtMIDI)
if [[ "${os}" == "Linux" ]]; then
echo " - Fetching ${b}ALSA${n}..."
sudo apt-get install -y libasound-dev alsa-base alsa-oss
fi
# -- autoplay
echo " - Installing ${b}autoplay${n}..."
mkdir build; cd build
cmake -DTRNG_LOCATION=${trng_dir} ..
make install
cd ${root}
echo " - Installed ${b}autoplay${n}..."