-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
Copy pathbuild.sh
54 lines (43 loc) · 1.38 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
#!/bin/bash
# This file is a part of Julia. License is MIT: https://julialang.org/license
#
# Usage:
# contrib/asan/build.sh <path> [<make_targets>...]
#
# Build ASAN-enabled julia. Given a workspace directory <path>, build
# ASAN-enabled julia in <path>/asan. Required toolss are install under
# <path>/toolchain. This scripts also takes optional <make_targets> arguments
# which are passed to `make`. The default make target is `debug`.
set -ue
# `$WORKSPACE` is a directory in which we create `toolchain` and `asan`
# sub-directories.
WORKSPACE="$1"
shift
if [ "$WORKSPACE" = "" ]; then
echo "Workspace directory must be specified as the first argument" >&2
exit 2
fi
mkdir -pv "$WORKSPACE"
WORKSPACE="$(cd "$WORKSPACE" && pwd)"
if [ "$WORKSPACE" = "" ]; then
echo "Failed to create the workspace directory." >&2
exit 2
fi
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
JULIA_HOME="$HERE/../../"
echo
echo "Installing toolchain..."
TOOLCHAIN="$WORKSPACE/toolchain"
if [ ! -d "$TOOLCHAIN" ]; then
make -C "$JULIA_HOME" configure O=$TOOLCHAIN
cp "$HERE/Make.user.tools" "$TOOLCHAIN/Make.user"
fi
make -C "$TOOLCHAIN/deps" install-clang install-llvm-tools
echo
echo "Building Julia..."
BUILD="$WORKSPACE/asan"
if [ ! -d "$BUILD" ]; then
make -C "$JULIA_HOME" configure O="$BUILD"
cp "$HERE/Make.user.asan" "$BUILD/Make.user"
fi
make -C "$BUILD" "$@"