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
|
#!/bin/bash
## Created by Juan-Pablo Caceres
# Parse command line options
clean=1
install=0
CONFIG="DEFINES+=JACKTRIP_BUILD_INFO=\\\"$(git describe --tags)-$(git rev-parse --short HEAD)\\\""
UNKNOWN_OPTIONS=
BUILD_RTAUDIO=0
RTAUDIO=0
NO_SYSTEM_RTAUDIO=0
PRO_FILE="../jacktrip.pro"
HELP_STR="usage:\n
./build [noclean nojack rtaudio nogui novs static install [-config static]]\n\n
options:\n
noclean - do not run \"make clean\" first\n
nojack - build without jack\n
rtaudio - build with RtAudio\n
no-system-rtaudio - use bundled RtAudio library even if it's available in the system\n
nogui - build without the gui\n
novs - build without Virtual Studio support\n
noupdater - build without auto-update support\n
static - build with static libraries\n
weakjack - build with weak linking of jack libraries\n
install - install jacktrip in system location (uses sudo)\n
"
while [[ "$#" -gt 0 ]]; do
if [[ -z "$UNKNOWN_OPTIONS" ]]; then
case $1 in
noclean) clean=0 ;;
nojack)
echo "Building without jack"
CONFIG="-config nojack $CONFIG"
;;
rtaudio)
RTAUDIO=1
;;
no-system-rtaudio)
NO_SYSTEM_RTAUDIO=1
;;
nogui)
echo "Building without the gui"
CONFIG="-config nogui $CONFIG"
;;
novs)
echo "Building without Virtual Studio support"
CONFIG="-config novs $CONFIG"
;;
noupdater)
echo "Building without auto-update support"
CONFIG="-config noupdater $CONFIG"
;;
static)
echo "Building with static libraries"
CONFIG="-config static $CONFIG"
;;
weakjack)
echo "Building with weak linking of jack"
CONFIG="-config weakjack $CONFIG"
;;
install)
echo "Will install JackTrip in system location"
install=1
;;
-h|--help)
echo -e $HELP_STR; exit
;;
*) UNKNOWN_OPTIONS="$UNKNOWN_OPTIONS $1" ;;
esac
shift
else
case $1 in
*) UNKNOWN_OPTIONS="$UNKNOWN_OPTIONS $1" ;;
esac
shift
fi
done
echo "All build options:"
echo "$CONFIG"
# Check for Platform
platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
echo "Building on Linux"
platform='linux'
elif [[ "$unamestr" == 'Darwin' ]]; then
echo "Building on macOS"
platform='macosx'
elif [[ "$unamestr" == 'MINGW'* ]]; then
echo "Building on Windows (MinGW)"
platform='mingw'
fi
# Set qmake command name
if [[ $platform == 'linux' ]]; then
if hash qmake-qt5 2>/dev/null; then
echo "Using qmake-qt5"
QCMD=qmake-qt5
elif hash qmake 2>/dev/null; then #in case qt was compiled by user
echo "Using qmake"
QCMD=qmake
fi
MCMD=make
elif [[ $platform == 'macosx' ]]; then
QCMD=qmake
# if qmake is not in path, try homebrew qt5
echo "path to qmake"
echo "$(which qmake)"
if ! command -v $QCMD &> /dev/null; then
# echo "qmake not found in \$PATH, searching for homebrew qt5"
QT_PREFIX=`brew --prefix qt5`
if [[ -n $QT_PREFIX ]]; then
QCMD="$QT_PREFIX/bin/$QCMD"
echo "Using qmake at $QCMD"
else
echo "Homebrew installation of qt5 not found"
exit
fi
fi
MCMD=make
elif [[ $platform == 'mingw' ]]; then
QCMD=qmake
MCMD=mingw32-make
elif [[ $platform == 'unknown' ]]; then
echo "Unregonized platform, exiting"
exit
fi
# detect spec
QSPEC=`$QCMD -query | grep QMAKE_SPEC`
QSPEC=${QSPEC##QMAKE_SPEC:}
# check for RtAudio
if [[ $RTAUDIO == 1 ]]; then
pkg-config --exists rtaudio 2> /dev/null
if [[ $? -eq 0 ]]; then
if [[ $NO_SYSTEM_RTAUDIO == 1 ]]; then
echo "RtAudio library found, but using the bundled library anyway"
BUILD_RTAUDIO=1
else
echo "Using system-provided RtAudio library"
fi
else
echo "Using bundled RtAudio library"
BUILD_RTAUDIO=1
fi
fi
if [[ $BUILD_RTAUDIO == 1 ]]; then
PRO_FILE="../jacktrip_and_rtaudio.pro";
CONFIG="-config bundled_rtaudio $CONFIG"
elif [[ $RTAUDIO == 1 ]]; then
echo "Building with RtAudio"
CONFIG="-config rtaudio $CONFIG"
fi
# Create our build directory
mkdir -p builddir
cd builddir
# exit if build commands fail
set -e
# Build
QCMDARGS=(-spec $QSPEC $CONFIG "$UNKNOWN_OPTIONS" $PRO_FILE)
echo "qmake command:"
echo $QCMD ${QCMDARGS[@]}
if [[ $clean == 1 ]]; then
$QCMD ${QCMDARGS[@]}
$MCMD clean
fi
$QCMD ${QCMDARGS[@]}
$MCMD release
if [[ "$install" == 1 ]]; then
echo "*** Installing JackTrip ***"
echo "We need elevated privileges to install JackTrip in the system location"
sudo $MCMD release-install
fi
|