-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build-jack2.sh
executable file
·187 lines (148 loc) · 7.07 KB
/
build-jack2.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
#!/bin/bash
set -e
cd $(dirname ${0})
PAWPAW_ROOT="${PWD}"
JACK2_VERSION=${JACK2_VERSION:=git}
JACK_EXAMPLE_TOOLS_VERSION=${JACK_EXAMPLE_TOOLS_VERSION:=git}
JACK_ROUTER_VERSION=${JACK_ROUTER_VERSION:=6c2e532bb05d2ba59ef210bef2fe270d588c2fdf}
QJACKCTL_VERSION=${QJACKCTL_VERSION:=0.9.7}
# ---------------------------------------------------------------------------------------------------------------------
target="${1}"
if [ -z "${target}" ]; then
echo "usage: ${0} <target>"
exit 1
fi
# TODO check that bootstrap-jack.sh has been run
# ---------------------------------------------------------------------------------------------------------------------
source setup/check_target.sh
source setup/env.sh
source setup/functions.sh
source setup/versions.sh
# ---------------------------------------------------------------------------------------------------------------------
jack2_repo="https://github.com/jackaudio/jack2.git"
if [ -n "${PAWPAW_JACK2_NO_CUSTOM_PREFIX}" ]; then
jack2_prefix="${PAWPAW_PREFIX}"
else
jack2_prefix="${PAWPAW_PREFIX}-jack2"
if [ "${MACOS}" -eq 1 ]; then
jack2_extra_prefix="/usr/local"
fi
fi
# ---------------------------------------------------------------------------------------------------------------------
# jack2
jack2_args=""
if [ -n "${jack2_extra_prefix}" ]; then
jack2_args+=" --prefix=${jack2_extra_prefix}"
jack2_args+=" --destdir="${jack2_prefix}""
else
jack2_args+=" --prefix=${jack2_prefix}"
fi
if [ "${CROSS_COMPILING}" -eq 1 ]; then
if [ "${LINUX}" -eq 1 ]; then
jack2_args+=" --platform=linux"
elif [ "${MACOS}" -eq 1 ]; then
jack2_args+=" --platform=darwin"
elif [ "${WIN32}" -eq 1 ]; then
jack2_args+=" --platform=win32"
fi
fi
if [ "${WIN32}" -eq 1 ]; then
jack2_args+=" --static"
fi
if [ "${WIN64}" -eq 1 ]; then
jack2_args="${jack2_args} --mixed"
# win32 toolchain prefix
TOOLCHAIN_PREFIX32=$(echo ${TOOLCHAIN_PREFIX} | sed 's/x86_64/i686/')
# let jack2 find win32 binaries
TARGET_PATH="${TARGET_PATH}:/usr/${TOOLCHAIN_PREFIX32}/bin"
# setup linker for our custom folder
export EXTRA_LDFLAGS="-L${PAWPAW_PREFIX}/lib32"
fi
if [ "${JACK2_VERSION}" = "git" ]; then
if [ ! -d jack2 ]; then
git clone --recursive "${jack2_repo}"
fi
if [ ! -e "${PAWPAW_BUILDDIR}/jack2-git" ]; then
ln -sf "$(pwd)/jack2" "${PAWPAW_BUILDDIR}/jack2-git"
fi
rm -f "${PAWPAW_BUILDDIR}/jack2-git/.stamp_built"
else
download jack2 "${JACK2_VERSION}" "${jack2_repo}" "" "git"
fi
build_waf jack2 "${JACK2_VERSION}" "${jack2_args}"
# remove useless dbus-specific file
rm -f "${jack2_prefix}${jack2_extra_prefix}/bin/jack_control"
# generate MSVC lib files
if [ "${WIN64}" -eq 1 ]; then
llvm-dlltool -m i386 -D libjack.dll -d ${jack2_prefix}${jack2_extra_prefix}/lib32/libjack.def -l ${jack2_prefix}${jack2_extra_prefix}/lib32/libjack.lib
llvm-dlltool -m i386:x86-64 -D libjack64.dll -d ${jack2_prefix}${jack2_extra_prefix}/lib/libjack64.def -l ${jack2_prefix}${jack2_extra_prefix}/lib/libjack64.lib
llvm-dlltool -m i386:x86-64 -D libjacknet64.dll -d ${jack2_prefix}${jack2_extra_prefix}/lib/libjacknet64.def -l ${jack2_prefix}${jack2_extra_prefix}/lib/libjacknet64.lib
llvm-dlltool -m i386:x86-64 -D libjackserver64.dll -d ${jack2_prefix}${jack2_extra_prefix}/lib/libjackserver64.def -l ${jack2_prefix}${jack2_extra_prefix}/lib/libjackserver64.lib
elif [ "${WIN32}" -eq 1 ]; then
llvm-dlltool -m i386 -D libjack.dll -d ${jack2_prefix}${jack2_extra_prefix}/lib/libjack.def -l ${jack2_prefix}${jack2_extra_prefix}/lib/libjack.lib
llvm-dlltool -m i386 -D libjacknet.dll -d ${jack2_prefix}${jack2_extra_prefix}/lib/libjacknet.def -l ${jack2_prefix}${jack2_extra_prefix}/lib/libjacknet.lib
llvm-dlltool -m i386 -D libjackserver.dll -d ${jack2_prefix}${jack2_extra_prefix}/lib/libjackserver.def -l ${jack2_prefix}${jack2_extra_prefix}/lib/libjackserver.lib
fi
# copy jack pkg-config file to main system, so qjackctl can find it
if [ ! -e "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc" ]; then
cp -v "${jack2_prefix}${jack2_extra_prefix}/lib/pkgconfig/jack.pc" "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc"
# patch pkg-config file for static win32 builds in regular prefix
if [ "${WIN32}" -eq 1 ]; then
if [ "${WIN64}" -eq 1 ]; then
s="64"
else
s=""
fi
sed -i -e "s/lib -ljack${s}/lib -Wl,-Bdynamic -ljack${s} -Wl,-Bstatic/" "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc"
fi
fi
# ---------------------------------------------------------------------------------------------------------------------
# jack-example-tools
jack_example_tools_repo="https://github.com/jackaudio/jack-example-tools.git"
jack_example_tools_args=" --prefix=${jack2_prefix}${jack2_extra_prefix}"
echo ${jack2_prefix}${jack2_extra_prefix}
if [ "${JACK_EXAMPLE_TOOLS_VERSION}" = "git" ]; then
if [ ! -d jack-example-tools ]; then
git clone --recursive "${jack_example_tools_repo}"
fi
if [ ! -e "${PAWPAW_BUILDDIR}/jack-example-tools-git" ]; then
ln -sf "$(pwd)/jack-example-tools" "${PAWPAW_BUILDDIR}/jack-example-tools-git"
fi
rm -f "${PAWPAW_BUILDDIR}/jack-example-tools-git/.stamp_built"
else
download jack-example-tools "${JACK_EXAMPLE_TOOLS_VERSION}" "${jack_example_tools_repo}" "" "git"
fi
build_meson jack-example-tools "${JACK_EXAMPLE_TOOLS_VERSION}" "${jack_example_tools_args}"
# ---------------------------------------------------------------------------------------------------------------------
# jack-router (download, win32 only)
if [ "${WIN32}" -eq 1 ]; then
download jack-router "${JACK_ROUTER_VERSION}" "https://github.com/jackaudio/jack-router.git" "" "git"
fi
# ---------------------------------------------------------------------------------------------------------------------
# qjackctl (if qt is available)
if [ -f "${PAWPAW_PREFIX}/bin/moc" ]; then
# Join $2+ arguments into a string separated by $1
function join() {
local IFS=$1
shift
echo "$*"
}
if [ "${CROSS_COMPILING}" -eq 1 ]; then
# Use system's Qt tools for translations
qjackctl_CMAKE_PREFIX_PATH="${PAWPAW_PREFIX}/lib/cmake;$(join ';' /usr/{lib/$(gcc -print-multiarch),lib*,share}/cmake)"
echo "Using CMake prefix: ${qjackctl_CMAKE_PREFIX_PATH}"
else
qjackctl_CMAKE_PREFIX_PATH="${PAWPAW_PREFIX}/lib/cmake"
fi
QJACKCTL_EXTRAFLAGS="-DJack_ROOT=${jack2_prefix}${jack2_extra_prefix}"
QJACKCTL_EXTRAFLAGS+=" -DCONFIG_ALSA_SEQ:BOOL=OFF"
QJACKCTL_EXTRAFLAGS+=" -DCONFIG_DBUS:BOOL=OFF"
QJACKCTL_EXTRAFLAGS+=" -DCMAKE_PREFIX_PATH=${qjackctl_CMAKE_PREFIX_PATH}"
QJACKCTL_EXTRAFLAGS+=" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
download qjackctl "${QJACKCTL_VERSION}" https://download.sourceforge.net/qjackctl
build_cmake qjackctl "${QJACKCTL_VERSION}" "${QJACKCTL_EXTRAFLAGS}"
if [ "${WIN32}" -eq 1 ]; then
copy_file qjackctl "${QJACKCTL_VERSION}" "build/src/qjackctl.exe" "${jack2_prefix}/bin/qjackctl.exe"
fi
fi
# ---------------------------------------------------------------------------------------------------------------------