-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathsetup_mason.sh
More file actions
executable file
·51 lines (45 loc) · 1.66 KB
/
setup_mason.sh
File metadata and controls
executable file
·51 lines (45 loc) · 1.66 KB
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
#!/bin/bash
# we pin the mason version to avoid changes in mason breaking builds
MASON_ARCHIVE_VERSION="f00098c63"
MASON_ARCHIVE_BASE="https://github.com/mapbox/mason/archive"
function install() {
local package_prefix=
package_prefix=$(mason prefix $1 $2) || return
if [ ! -d "$package_prefix/" ]; then
mason install $1 $2 || return
fi
mason link $1 $2
}
function mason_packages() {
printf '%s\n' "${MASON_ROOT:-"$PWD/mason_packages"}"
}
function setup_mason() {
local cdup=
if cdup=$(git rev-parse --show-cdup 2>/dev/null); then
# we are inside *some* git repository (not necessarily python-mapnik)
if git submodule status "${cdup}mason" >/dev/null 2>&1; then
# there is submodule "mason" (assume we are in python-mapnik)
# update the submodule, bail out on failure
git submodule update --init "${cdup}mason" ||
return
else
# there is no submodule named "mason"
# proceed as if we were outside git repository
cdup=
fi
fi
if [ ! -d "${cdup}mason/" ]; then
# the directory doesn't exist, and we are either outside any git
# repository, or in a repository with no submodule named "mason"
mkdir -p "${cdup}mason/"
# download and unpack mason archive
curl -sSfL "${MASON_ARCHIVE_BASE}/${MASON_ARCHIVE_VERSION}.tar.gz" |
tar --extract --gunzip --directory="${cdup}mason/" \
--strip-components=1 --exclude="test" ||
return
fi
export PATH=$(cd "${cdup}mason" && pwd):${PATH}
export CXX=${CXX:-clang++}
export CC=${CC:-clang}
}
setup_mason