-
-
Notifications
You must be signed in to change notification settings - Fork 193
/
build-cross-tools.sh
executable file
·102 lines (96 loc) · 2.97 KB
/
build-cross-tools.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
#!/bin/sh
#
# Copyright (c) 2018 Martin Storsjo
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
set -e
while [ $# -gt 0 ]; do
case "$1" in
--with-python)
PYTHON=1
;;
--disable-lldb)
LLVM_ARGS="$LLVM_ARGS $1"
NO_LLDB=1
;;
--disable-lldb-mi)
NO_LLDB_MI=1
;;
--disable-clang-tools-extra)
LLVM_ARGS="$LLVM_ARGS $1"
;;
--no-llvm-tool-reuse)
LLVM_ARGS="$LLVM_ARGS $1"
;;
--disable-mingw-w64-tools)
NO_MINGW_W64_TOOLS=1
;;
--full-llvm)
LLVM_ARGS="$LLVM_ARGS $1"
FULL_LLVM=1
;;
--disable-make)
NO_MAKE=1
;;
*)
if [ -z "$NATIVE" ]; then
NATIVE="$1"
elif [ -z "$PREFIX" ]; then
PREFIX="$1"
elif [ -z "$CROSS_ARCH" ]; then
CROSS_ARCH="$1"
else
echo Unrecognized parameter $1
exit 1
fi
;;
esac
shift
done
if [ -z "$CROSS_ARCH" ]; then
echo $0 native prefix arch [--with-python] [--disable-lldb] [--disable-lldb-mi] [--disable-clang-tool-extra] [--disable-mingw-w64-tools] [--disable-make]
exit 1
fi
for dep in git curl cmake; do
if ! command -v $dep >/dev/null; then
echo "$dep not installed. Please install it and retry" 1>&2
exit 1
fi
done
export PATH="$NATIVE/bin:$PATH"
HOST=$CROSS_ARCH-w64-mingw32
if [ -n "$PYTHON" ]; then
PYTHON_NATIVE_PREFIX="$(cd "$(dirname "$0")" && pwd)/python-native"
[ -d "$PYTHON_NATIVE_PREFIX" ] || rm -rf "$PYTHON_NATIVE_PREFIX"
./build-python.sh $PYTHON_NATIVE_PREFIX
export PATH="$PYTHON_NATIVE_PREFIX/bin:$PATH"
./build-python.sh $PREFIX/python --host=$HOST
mkdir -p $PREFIX/bin
cp $PREFIX/python/bin/*.dll $PREFIX/bin
LLVM_ARGS="$LLVM_ARGS --with-python"
fi
./build-llvm.sh $PREFIX --host=$HOST $LLVM_ARGS
if [ -z "$NO_LLDB" ] && [ -z "$NO_LLDB_MI" ]; then
./build-lldb-mi.sh $PREFIX --host=$HOST
fi
if [ -z "$FULL_LLVM" ]; then
./strip-llvm.sh $PREFIX --host=$HOST
fi
if [ -z "$NO_MINGW_W64_TOOLS" ]; then
./build-mingw-w64-tools.sh $PREFIX --skip-include-triplet-prefix --host=$HOST
fi
./install-wrappers.sh $PREFIX --host=$HOST
./prepare-cross-toolchain.sh $NATIVE $PREFIX $CROSS_ARCH
if [ -z "$NO_MAKE" ]; then
./build-make.sh $PREFIX --host=$HOST
fi