forked from apache/mesos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·116 lines (93 loc) · 3.56 KB
/
bootstrap
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
#!/bin/sh
# Make sure that we are in the right directory.
if test ! -f configure.ac; then
cat >&2 <<__EOF__
You must run bootstrap from the root of the distribution.
__EOF__
exit 1
fi
# Helper functions to get the absolute path of a directory as well as compute
# the relative path between two directories.
# Unfortunately these functions are not as readable as, say, python's
# os.path.relpath method, but they allow us to avoid a hard dependence on
# python or other tools during bootstrap.
abspath() {
cd "`dirname "${1}"`"
echo "${PWD}"/"`basename "${1}"`"
cd "${OLDPWD}"
}
relpath() {
local from to up
from="`abspath "${1%/}"`" to="`abspath "${2%/}"/`"
while test "${to}" = "${to#"${from}"/}" \
-a "${to}" != "${from}"; do
from="${from%/*}" up="../${up}"
done
to="${up%/}${to#${from}}"
echo "${to:-.}"
}
# Grab a reference to the repo's git directory. Usually this is simply .git in
# the repo's top level directory. However, when submodules are used, it may
# appear elsewhere. The most up-to-date way of finding this directory is to use
# `git rev-parse --git-common-dir`. This is necessary to support things like
# git worktree in addition to git submodules. However, as of January 2016,
# support for the '--git-common-dir' flag is fairly new, forcing us to fall
# back to the older '--git-dir' flag if '--git-common-dir' is not supported. We
# do this by checking the output of `git rev-parse --git-common-dir` and seeing
# if it gives us a valid directory back. If not, we set the git directory using
# the '--git-dir' flag instead.
_gitdir=`git rev-parse --git-common-dir`
if test ! -d "${_gitdir}"; then
_gitdir=`git rev-parse --git-dir`
fi
# Grab a reference to the git hooks directory as well as the relative path from
# the git hooks directory to the current directory.
_hooksdir=${_gitdir}/hooks
_relpath=`relpath "${_hooksdir}" "${PWD}"`
# Install mesos default hooks and gitignore template.
if test ! -e "${_hooksdir}/pre-commit"; then
ln -s "${_relpath}/support/hooks/pre-commit" "${_hooksdir}/pre-commit"
fi
if test ! -e "${_hooksdir}/post-rewrite"; then
ln -s "${_relpath}/support/hooks/post-rewrite" "${_hooksdir}/post-rewrite"
fi
if test ! -e "${_hooksdir}/commit-msg"; then
ln -s "${_relpath}/support/hooks/commit-msg" "${_hooksdir}/commit-msg"
fi
if test ! -e .gitignore; then
ln -s support/gitignore .gitignore
fi
if test ! -e .reviewboardrc; then
ln -s support/reviewboardrc .reviewboardrc
fi
if test ! -e .clang-format; then
ln -s support/clang-format .clang-format
fi
if [ -n "$AUTOMAKE" ] || [ -n "$ACLOCAL" ] ; then
if [ -z "$ACLOCAL" ] || [ -z "$AUTOMAKE" ] ; then
_present="AUTOMAKE"
_missing="ACLOCAL"
[ -n "$ACLOCAL" ] && _present="ACLOCAL" && _missing="AUTOMAKE"
cat >&2 <<__EOF__
[ERROR]: You are providing the path to ${_present}
through your environment but no reference to ${_missing}.
To fix this error please specify ${_missing} too.
As an example, if you are using automake-1.12 and have
available aclocal-1.12 you will want to do the following:
AUTOMAKE="/usr/local/bin/automake-1.12" \\
ACLOCAL="/usr/local/bin/aclocal-1.12" \\
./bootstrap
Your current environment has:
AUTOMAKE="$AUTOMAKE"
ACLOCAL="$ACLOCAL"
__EOF__
exit 1
fi
else
AUTOMAKE="$(which automake)"
fi
# Note that we don't use '--no-recursive' because older versions of
# autoconf/autoreconf bail with that option. Unfortunately this means
# that we'll modify a lot of files in 3rdparty/libprocess, but that
# may change in the future.
autoreconf --install -Wall --verbose "${@}"