Debian Codegraph @

build

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 ## Created by Juan-Pablo Caceres
3
4 # Parse command line options
5 clean=1
6 install=0
7 jobs=1
8 CONFIG="DEFINES+=JACKTRIP_BUILD_INFO=\\\"$(gitscip-shell system . . git. describe --tags)-$(gitscip-shell system . . git. rev-parse --short HEAD)\\\""
9 UNKNOWN_OPTIONS=()
10 BUILD_RTAUDIO=0
11 RTAUDIO=0
12 NO_SYSTEM_RTAUDIO=0
13 PRO_FILE="../jacktrip.pro"
14 HELP_STR="usage:\n
15 ./build [noclean nojack rtaudio nogui novs vsftux static install [-config static]]\n\n
16 options:\n
17 noclean - do not run \"make clean\" first\n
18 nojack - build without jack\n
19 rtaudio - build with RtAudio\n
20 no-system-rtaudio - use bundled RtAudio library even if it's available in the system\n
21 nogui - build without the gui\n
22 novs - build without Virtual Studio support\n
23 nooscpp - build without OSC support\n
24 vsftux - build with Virtual Studio first launch experience\n
25 noupdater - build without auto-update support\n
26 static - build with static libraries\n
27 weakjack - build with weak linking of jack libraries\n
28 install - install jacktrip in system location (uses sudo)\n
29 "
30 while [[ "$#" -gt 0 ]]; do
31 if [[ ${#UNKNOWN_OPTIONS[@]} -eq 0 ]]; then
32 case $1 in
33 noclean) clean=0 ;;
34 nojack)
35 echoscip-shell system . . echo. "Building without jack"
36 CONFIG="-config nojack $CONFIG"
37 ;;
38 rtaudio)
39 RTAUDIO=1
40 ;;
41 no-system-rtaudio)
42 NO_SYSTEM_RTAUDIO=1
43 ;;
44 nogui)
45 echoscip-shell system . . echo. "Building without the gui"
46 CONFIG="-config nogui $CONFIG"
47 ;;
48 novs)
49 echoscip-shell system . . echo. "Building without Virtual Studio support"
50 CONFIG="-config novs $CONFIG"
51 ;;
52 nooscpp)
53 echoscip-shell system . . echo. "Building without OSC support"
54 CONFIG="-config nooscpp $CONFIG"
55 ;;
56 vsftux)
57 echoscip-shell system . . echo. "Building with Virtual Studio first launch experience"
58 CONFIG="-config vsftux $CONFIG"
59 ;;
60 noupdater)
61 echoscip-shell system . . echo. "Building without auto-update support"
62 CONFIG="-config noupdater $CONFIG"
63 ;;
64 static)
65 echoscip-shell system . . echo. "Building with static libraries"
66 CONFIG="-config static $CONFIG"
67 ;;
68 weakjack)
69 echoscip-shell system . . echo. "Building with weak linking of jack"
70 CONFIG="-config weakjack $CONFIG"
71 ;;
72 install)
73 echoscip-shell system . . echo. "Will install JackTrip in system location"
74 install=1
75 ;;
76 -j*)
77 jobs=$(echoscip-shell system . . echo. $1 |sedscip-shell system . . sed. 's,-j0*\([0-9]*\),\1,')
78 if [[ $jobs -le 1 ]]; then
79 jobs=1
80 fi
81 echoscip-shell system . . echo. "Will build using $jobs make jobs"
82 ;;
83 -h|--help)
84 echoscip-shell system . . echo. -e $HELP_STR; exit
85 ;;
86 *) UNKNOWN_OPTIONS+=("$1") ;;
87 esac
88 shift
89 else
90 case $1 in
91 *) UNKNOWN_OPTIONS+=("$1") ;;
92 esac
93 shift
94 fi
95 done
96
97 echoscip-shell system . . echo. "All build options:"
98 echoscip-shell system . . echo. "$CONFIG"
99
100 # Check for Platform
101 platform='unknown'
102 unamestr=`unamescip-shell system . . uname.`
103 if [[ "$unamestr" == 'Linux' ]]; then
104 echoscip-shell system . . echo. "Building on Linux"
105 platform='linux'
106 elif [[ "$unamestr" == 'Darwin' ]]; then
107 echoscip-shell system . . echo. "Building on macOS"
108 platform='macosx'
109 elif [[ "$unamestr" == 'MINGW'* ]]; then
110 echoscip-shell system . . echo. "Building on Windows (MinGW)"
111 platform='mingw'
112 fi
113
114 # Set qmake command name
115 if [[ $platform == 'linux' ]]; then
116 if hash qmake-qt5 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then
117 echoscip-shell system . . echo. "Using qmake-qt5"
118 QCMD=qmake-qt5
119 elif hash qmake 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then #in case qt was compiled by user
120 echoscip-shell system . . echo. "Using qmake"
121 QCMD=qmake
122 fi
123 MCMD=make
124 elif [[ $platform == 'macosx' ]]; then
125 QCMD=qmake
126 # if qmake is not in path, try homebrew qt5
127 echoscip-shell system . . echo. "path to qmake"
128 echoscip-shell system . . echo. "$(whichscip-shell system . . which. qmake)"
129 if ! command -v $QCMD &> /dev/nullscip-shell filesystem . . `/dev/null`.; then
130 # echo "qmake not found in \$PATH, searching for homebrew qt5"
131 QT_PREFIX=`brew --prefix qt5`
132 if [[ -n $QT_PREFIX ]]; then
133 QCMD="$QT_PREFIX/bin/$QCMD"
134 echoscip-shell system . . echo. "Using qmake at $QCMD"
135 else
136 echoscip-shell system . . echo. "Homebrew installation of qt5 not found"
137 exit
138 fi
139 fi
140 MCMD=make
141 elif [[ $platform == 'mingw' ]]; then
142 QCMD=qmake
143 MCMD=mingw32-make
144 elif [[ $platform == 'unknown' ]]; then
145 echoscip-shell system . . echo. "Unregonized platform, exiting"
146 exit
147 fi
148
149 # detect spec
150 QSPEC=`$QCMD -query | grepscip-shell system . . grep. QMAKE_SPEC`
151 QSPEC=${QSPEC##QMAKE_SPEC:}
152
153 # check spec for windows to update make command
154 if [[ $QSPEC == "win32-msvc" ]]; then
155 MCMD=nmake
156 JOM=$(whichscip-shell system . . which. jom.exe)
157 if [[ "x$JOM" != "x" ]]; then
158 MCMD=$JOM
159 fi
160 fi
161
162 # check for RtAudio
163 if [[ $RTAUDIO == 1 ]]; then
164 pkg-config --exists rtaudio 2> /dev/nullscip-shell filesystem . . `/dev/null`.
165 if [[ $? -eq 0 ]]; then
166 if [[ $NO_SYSTEM_RTAUDIO == 1 ]]; then
167 echoscip-shell system . . echo. "RtAudio library found, but using the bundled library anyway"
168 BUILD_RTAUDIO=1
169 else
170 echoscip-shell system . . echo. "Using system-provided RtAudio library"
171 fi
172 else
173 echoscip-shell system . . echo. "Using bundled RtAudio library"
174 BUILD_RTAUDIO=1
175 fi
176 fi
177
178 if [[ $BUILD_RTAUDIO == 1 ]]; then
179 PRO_FILE="../jacktrip_and_rtaudio.pro";
180 CONFIG="-config bundled_rtaudio $CONFIG"
181 elif [[ $RTAUDIO == 1 ]]; then
182 echoscip-shell system . . echo. "Building with RtAudio"
183 CONFIG="-config rtaudio $CONFIG"
184 fi
185
186 # Create our build directory
187 mkdirscip-shell system . . mkdir. -p builddir
188 cd builddir
189
190 # exit if build commands fail
191 set -e
192
193 # Build
194 echoscip-shell system . . echo. "qmake command:"
195 echoscip-shell system . . echo. $QCMD -spec $QSPEC $CONFIG "${UNKNOWN_OPTIONS[@]}" $PRO_FILE
196 $QCMD -spec $QSPEC $CONFIG "${UNKNOWN_OPTIONS[@]}" $PRO_FILE
197 if [[ $clean == 1 ]]; then
198 $MCMD clean
199 fi
200 if [[ "$MCMD" == "nmake" ]]; then
201 $MCMD release
202 else
203 $MCMD -j$jobs release
204 fi
205 if [[ "$install" == 1 ]]; then
206 echoscip-shell system . . echo. "*** Installing JackTrip ***"
207 echoscip-shell system . . echo. "We need elevated privileges to install JackTrip in the system location"
208 sudoscip-shell system . . sudo. $MCMD release-install
209 fi