Skip to content

Instantly share code, notes, and snippets.

@cahlbin
Last active May 25, 2016 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cahlbin/b396d9d4034ad1a5f2c9 to your computer and use it in GitHub Desktop.
Save cahlbin/b396d9d4034ad1a5f2c9 to your computer and use it in GitHub Desktop.
Script to build rtags for OS X
#!/usr/bin/env bash
# Configuration
RTAGS_REPOSITORY="git@github.com:Andersbakken/rtags.git"
RTAGS_REVISION="da75268b1caa973402ab17e501718da7fc748b34"
# Pre-requisites
if ! which brew >/dev/null; then
echo "You need to install homebrew (http://brew.sh/)" && exit 1
fi
# Create scratch work dir
SCRATCH_DIR="scratch"
rm -rf "${SCRATCH_DIR}"
mkdir -p "${SCRATCH_DIR}"
pushd "${SCRATCH_DIR}"
# Install LLVM (3.6) via Homebew
brew list llvm
if [ $? -ne 0 ]; then
brew install llvm \
--with-libcxx \
--with-clang \
--with-python \
--with-rtti \
--without-assertions
# Note, installing with --with-lldb requires code signing.
# See https://llvm.org/svn/llvm-project/lldb/trunk/docs/code-signing.txt
fi
# Clone, build and install rtags
git clone "${RTAGS_REPOSITORY}"
pushd rtags
git submodule update --init --recursive
git checkout "${RTAGS_REVISION}"
popd
rm -rf rtags-build
mkdir -p rtags-build
pushd rtags-build
LIBCLANG_LLVM_CONFIG_EXECUTABLE=$(brew --prefix llvm)/bin/llvm-config
LLVM_BIN_PATH=$(brew --prefix llvm)/bin
export LIBCLANG_LLVM_CONFIG_EXECUTABLE
export CC="${LLVM_BIN_PATH}/clang"
export CXX="${LLVM_BIN_PATH}/clang++"
cmake ../rtags
make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment