mirror of
https://github.com/textmate/textmate.git
synced 2026-01-14 09:18:07 -05:00
Previously we would download and archive the default bundles as part of ./configure and place the result in our source directory, this however both pollutes the source directory with generated files, but also had the ./configure step actually do a partial build, since we need to build the ‘bl’ executable to download bundles.
76 lines
2.6 KiB
Bash
Executable File
76 lines
2.6 KiB
Bash
Executable File
#!/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}
|
||
|
||
# =======================
|
||
# = Application version =
|
||
# =======================
|
||
|
||
ver=$(curl -sf "${rest_api}/releases/nightly/version")${tag:-+git.$(git rev-parse --short HEAD)}
|
||
|
||
# ===============================
|
||
# = 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 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 build files =
|
||
# ========================
|
||
|
||
bin/gen_build -o build.ninja -C "$builddir" -dAPP_VERSION="$ver" -didentity="$identity" -drest_api="$rest_api" -dbzip2_flag="$bzip2_flag" -dcapnp_prefix="$capnp_prefix" target
|