forked from textmate/textmate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·102 lines (77 loc) · 3.9 KB
/
configure
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
# set -u
function error () { printf >&2 "%s\n\nPlease see README.md for build instructions.\n" "$1"; exit 1; }
# =================================================
# = Fallback build directory and signing identity =
# =================================================
: ${builddir:=$HOME/build/TextMate}
: ${identity:=-}
: ${capnp_prefix:=/usr/local}
: ${rest_api:=https://api.textmate.org}
: ${CC:=xcrun clang}
: ${CXX:=xcrun clang++}
# ========================================================
# = Application name, version, revision, and required OS =
# ========================================================
name=TextMate
ver=$(curl -sf "${rest_api}/releases/nightly/version")${tag:-+git.$(git rev-parse --short HEAD)}
min_os=10.8
# ===============================
# = Check if boost is installed =
# ===============================
if which -s brew && [[ -z "$boostdir" && ! -d /usr/local/include/boost ]]; then
boostdir=$(brew --prefix boost)/include/boost
fi
for dir in "${boostdir:-/usr/include/boost}" /{opt,usr}/local/include/boost ${CPATH//:/ }; do
if [[ ! -L "${builddir}/include/boost" && -d "${dir}" ]]; then
mkdir -p "${builddir}/include" && ln -fs "${dir}" "${builddir}/include/boost"
fi
done
test -L "${builddir}/include/boost" || error "*** boost not installed."
# ===========================================
# = Check if google sparsehash is installed =
# ===========================================
if which -s brew && [[ -z "$sparsedir" && ! -d /usr/local/include/sparsehash ]]; then
sparsedir=$(brew --prefix google-sparsehash)/include/sparsehash
fi
for dir in "${sparsedir:-/usr/include/sparsehash}" /{opt,usr}/local/include/sparsehash/ ; do
if [[ ! -L "${builddir}/include/sparsehash" && -d "${dir}" ]]; then
mkdir -p "${builddir}/include" && ln -fs "${dir}" "${builddir}/include/sparsehash"
fi
done
test -L "${builddir}/include/sparsehash" || error "*** google sparsehash not installed."
# ===========================================
# = Check if non-system openssl is intalled =
# ===========================================
if which -s brew && [[ -z "$libressl_prefix" && ! -d "${libressl_prefix}/include/openssl" ]]; then
libressl_prefix=$(brew --prefix libressl)
test -d "${libressl_prefix}/include/" || error "*** openssl headers not found."
fi
if which -s port && [[ -z "$libressl_prefix" && ! -d "${libressl_prefix}/include/openssl" ]]; then
libressl_prefix=/opt/local/
test -d "${libressl_prefix}/include/openssl" || error "*** openssl headers not found."
fi
# ===============================================
# = Check if we can use pbzip2 instead of bzip2 =
# ===============================================
bzip2_flag="-j"
if which -s pbzip2; then
bzip2_flag="--use-compress-prog=pbzip2"
fi
# ==============================
# = Check various dependencies =
# ==============================
test -x "${capnp_prefix}/bin/capnp" || error "*** cap’n’proto not installed in ‘${capnp_prefix}’. Set \`capnp_prefix\` if installed elsewhere."
for dep in ninja ragel multimarkdown pgrep pkill; do
which -s "$dep" || error "*** dependency missing: ‘${dep}’."
done
# =====================================
# = Generate fixtures and build files =
# =====================================
mkdir -p "$builddir/Frameworks/SoftwareUpdate/fixtures"
DST=$(cd >/dev/null "$builddir/Frameworks/SoftwareUpdate/fixtures"; pwd) make -C Frameworks/SoftwareUpdate/fixtures
bin/gen_build -o build.ninja -C "$builddir" -dAPP_NAME="$name" -dAPP_VERSION="$ver" -dAPP_MIN_OS="$min_os" -dCC="$CC" -dCXX="$CXX" -didentity="$identity" -drest_api="$rest_api" -dbzip2_flag="$bzip2_flag" -dtest_flags="$test" -dcapnp_prefix="$capnp_prefix" -dlibressl_prefix="$libressl_prefix" target
ninja Frameworks/encoding/src/frequencies.capnp.h
ninja Frameworks/plist/src/cache.capnp.h
BUNDLES_TBZ=Applications/TextMate/resources/DefaultBundles.tbz
test -e "$BUNDLES_TBZ" || builddir="$builddir" bin/create_default_bundles_tbz "$BUNDLES_TBZ"