forked from ossia/ossia-supercollider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·291 lines (205 loc) · 8.83 KB
/
build.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#!/bin/bash -eux
export OFFLINE=0
export CUSTOM_BOOST=0
export OS_IS_LINUX=0
export OS_IS_OSX=0
export BOOST_ROOT=""
export BOOST_INCLUDE=""
export BOOST_LIBS=""
export QT_PATH=""
export DISTRO=""
if [ "$1" = "offline" ]; then
OFFLINE=1
fi
if ! [ -z "$2" ] && ! [ -z "$3" ]; then
echo "BOOST CUSTOM"
CUSTOM_BOOST=1
BOOST_INCLUDE=$2
BOOST_LIBS=$3
fi
# PLATFORM ----------------------------------------------------------------------------
UNAME=$(uname | tr "[:upper:]" "[:lower:]")
# If Linux, try to determine specific distribution
if [ "$UNAME" == "linux" ]; then
# If available, use LSB to identify distribution
if [ -f /etc/lsb-release -o -d /etc/lsb-release.d ]; then
DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'//)
# Otherwise, use release info file
else
DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1)
fi
fi
# For everything else (or if above failed), just use generic identifier
[ "$DISTRO" == "" ] && DISTRO=$UNAME
unset UNAME
# DEPENDENCIES ------------------------------------------------------------------------
nonPackBoost() {
# installing non-packaged dependencies
if [ ! -d "dependencies" ]; then
mkdir dependencies
fi
(
cd dependencies
# download and install boost
if [ $CUSTOM_BOOST = 0 ]; then
if [ ! -d "boost_1_65_1" ]; then
wget http://downloads.sourceforge.net/project/boost/boost/1.65.1/boost_1_65_1.tar.bz2
tar xf boost_1_65_1.tar.bz2
fi
if [[ ! -d "boost" ]]; then
(
mkdir boost
cd boost_1_65_1
./bootstrap.sh --with-libraries=atomic,date_time,chrono,exception,timer,thread,system,filesystem,program_options,regex,test \
--prefix=../boost
./b2 install
rm -rf ../boost_1_65_1.tar.bz2
)
fi
fi
)
BOOST_ROOT="$(pwd)/dependencies/boost_1_65_1"
echo "boost found"
BOOST_LIBS="$(pwd)/dependencies/boost/lib"
BOOST_INCLUDE="$(pwd)/dependencies/boost/include"
}
if [ "$DISTRO" = "darwin" ]; then
# check homebrew installation
export HOMEBREW_BIN=$(command -v brew)
if [[ "$HOMEBREW_BIN" == "" ]]; then
echo "Homebrew is not installed."
echo "Please install it by running the following command:"
echo ' /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
exit 1
fi
# CHECK HOMEBREW DEPENDENCIE
if [ $OFFLINE = 0 ]; then
# QT 5.5 (required for supercollider's webkit
if brew ls --versions [email protected] > /dev/null; then
echo "[email protected] with brew correctly installed"
else
echo "installing [email protected] with homebrew"
brew install [email protected]
fi
# use boost dowloaded source instead of brew package
# BOOST >= 1.65
#if brew ls --versions boost > /dev/null; then
# echo "boost already installed"
#else
# echo "installing boost with homebrew"
# brew install boost
#fi
# wget >= 1.19.5
if brew ls --versions wget > /dev/null; then
echo "wget already installed"
else
echo "installing wget with homebrew"
brew install wget
fi
# CMAKE
if brew ls --versions cmake > /dev/null; then
echo "cmake already installed"
else
echo "installing cmake with homebrew"
brew install cmake
fi
# ADDING DEFAULT PATHS
#BOOST_ROOT="/usr/local/opt/boost"
#BOOST_INCLUDE="/usr/local/opt/boost/include"
QT_PATH="/usr/local/opt/[email protected]"
fi
# use boost dowloaded source instead of brew package
nonPackBoost
elif [ "$DISTRO" = "Ubuntu" ] || [ "$DISTRO" = "elementary" ] ; then
# checking/installing ossia & supercollider dependencies
if [ $OFFLINE = 0 ]; then
sudo apt -y install cmake libjack-jackd2-dev libsndfile1-dev libxt-dev libfftw3-dev libudev-dev \
qt5-default qt5-qmake qttools5-dev qttools5-dev-tools qtdeclarative5-dev libqt5webkit5-dev \
qtpositioning5-dev libqt5sensors5-dev libqt5opengl5-dev \
libavahi-compat-libdnssd-dev git wget gcc
QT_PATH="/usr/lib/x86_64-linux-gnu"
fi
nonPackBoost
elif [ "$DISTRO" = "archlinux" ]; then
sudo pacman -S git cmake
BOOST_LIBS="/usr/lib"
BOOST_INCLUDE="/usr/include"
fi
# LIBOSSIA OVERWRITE ------------------------------------------------------------------------
(
cd submodules/libossia
# revert to boost 1.65.1
yes | cp -rf ../../Ossia/Overwrites/libossia/OssiaDeps.cmake CMake/
# boost install script not needed, especialy as this downloads a different boost version than 1.65.1 used here
rm -rf OSSIA/InstallBoost.cmake
)
# LIBOSSIA BUILD ------------------------------------------------------------------------------
# temporary fix for ossia cxx_standard
mkdir -p build
mkdir -p build/libossia
mkdir -p install
(
cd build/libossia
# CMake and build libossia
echo "now building libossia..."
if [ "$DISTRO" = "darwin" ]; then
cmake ../../submodules/libossia -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../install/libossia -DOSSIA_PYTHON=0 -DOSSIA_NO_QT=1 -DOSSIA_TESTING=0 -DOSSIA_STATIC=1 -DOSSIA_NO_SONAME=1 -DOSSIA_PD=0 -DBOOST_ROOT=$BOOST_ROOT
elif [ "$DISTRO" = "Ubuntu" ] || [ "$DISTRO" = "elementary" ]; then
cmake ../../submodules/libossia -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../install/libossia -DOSSIA_PYTHON=0 -DOSSIA_NO_QT=1 -DOSSIA_TESTING=0 -DOSSIA_STATIC=1 -DOSSIA_NO_SONAME=1 -DOSSIA_PD=0 -DBOOST_ROOT=$BOOST_ROOT -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
fi
make -j8
echo "libossia built succesfully... installing"
make install
# Cleaning up
rm -rf libossia build
)
# COPY & OVERWRITES ------------------------------------------------------------------------
(
cd submodules/supercollider
if [ "$1" != "offline" ]; then
git checkout 3.9
fi
cd SCClassLibrary
if [[ ! -d "Ossia" ]]; then
mkdir Ossia
fi
)
(
yes | cp -rf Ossia/Overwrites/doc/lex.scdoc.cpp submodules/supercollider/SCDoc
yes | cp -rf Ossia/Overwrites/root/CMakeLists.txt submodules/supercollider
yes | cp -rf Ossia/Overwrites/lang/CMakeLists.txt submodules/supercollider/lang
yes | cp -rf Ossia/Overwrites/lang/PyrPrimitive.cpp submodules/supercollider/lang/LangPrimSource
yes | cp -rf Ossia/Overwrites/testsuite/CMakeLists.txt submodules/supercollider/testsuite/supernova
yes | cp -rf Ossia/Overwrites/server/scsynth/CMakeLists.txt submodules/supercollider/server/scsynth
yes | cp -rf Ossia/Overwrites/server/supernova/CMakeLists.txt submodules/supercollider/server/supernova
yes | cp -rf Ossia/Classes/ossia.sc submodules/supercollider/SCClassLibrary/Ossia
yes | cp -rf Ossia/HelpSource/Guides/OssiaReference.schelp submodules/supercollider/HelpSource/Guides
yes | cp -rf Ossia/HelpSource/Classes submodules/supercollider/HelpSource/Classes
yes | cp -rf Ossia/HelpSource/Help.schelp submodules/supercollider/HelpSource
shopt -s dotglob nullglob
mv submodules/supercollider/HelpSource/Classes/Classes submodules/supercollider/HelpSource/Classes/Ossia
mv submodules/supercollider/HelpSource/Classes/Ossia/* submodules/supercollider/HelpSource/Classes/
rm -rf submodules/supercollider/HelpSource/Classes/Ossia
cd install/libossia/include
if [[ ! -d "ossia-sc" ]]; then
mkdir ossia-sc
fi
)
# move the ossia prim header into ossia include directory...
# the header should maybe be present in libossia repository...
yes | cp -rf Ossia/Primitives/pyrossiaprim.h install/libossia/include/ossia-sc
# SUPERCOLLIDER BUILD ----------------------------------------------------------------------
(
cd submodules/supercollider
# remove packaged boost, which gets somehow included even with SYSTEM_BOOST=ON
rm -rf external_libraries/boost
)
mkdir -p build/supercollider
cd build/supercollider
if [ "$DISTRO" = "darwin" ]; then
cmake ../../submodules/supercollider -DCMAKE_PREFIX_PATH=$QT_PATH -DCMAKE_INSTALL_PREFIX=../../install/supercollider -DSYSTEM_BOOST=ON -DBOOST_ROOT=$BOOST_ROOT -DBOOST_INCLUDEDIR=$BOOST_INCLUDE -DBOOST_LIBRARYDIR=$BOOST_LIBS -DBoost_DEBUG=OFF
elif [ "$DISTRO" = "Ubuntu" ] || [ "$DISTRO" = "elementary" ]; then
cmake ../../submodules/supercollider -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_BUILD_TYPE=Release -DSYSTEM_BOOST=ON -DBOOST_INCLUDEDIR=$BOOST_INCLUDE -DBOOST_LIBRARYDIR=$BOOST_LIBS -DBOOST_ROOT=$BOOST_ROOT -DBoost_DEBUG=OFF
fi
make -j8
sudo make install