Rewrite ext setup scripts + module-cc irony path

This commit is contained in:
Henrik Lissner 2016-10-11 13:21:14 +02:00
parent a1b0db0b07
commit 483bdb79ee
4 changed files with 60 additions and 25 deletions

View file

@ -1,10 +1,15 @@
#!/usr/bin/env bash
CACHE_DIR="${HOME}/.emacs.d/private/cache/`hostname`/"
ELPA_DIR="${HOME}/.emacs.d/.cask/`emacs --version | grep -E -o '2[4-9]\.[0-9\.]+'`/elpa"
HOSTNAME=`emacs --batch --eval '(message "%s" (system-name))' 2>&1`
is-mac() { [ "$(uname)" == "Darwin" ]; }
is-linux() { [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; }
ROOT_DIR="$(cd $(dirname $0)/../ && pwd -P)"
CACHE_DIR="$ROOT_DIR/private/cache/$HOSTNAME"
ELPA_DIR="$ROOT_DIR/.cask/`emacs --version | grep -E -o '2[4-9]\.[0-9\.]+'`/elpa"
EXT_DIR="$ROOT_DIR/ext"
#
is-arch() { [ -f "/etc/arch-release" ]; }
is-deb() { [ -f "/etc/debian_version" ]; }
git-repo() {
old=$(pwd)

View file

@ -1,27 +1,48 @@
#!/usr/bin/env bash
cd ~/.emacs.d/ext
source ./VARS
LLVMV="3.8.0"
LLVM="clang+llvm-${LLVMV}-x86_64-apple-darwin"
source VARS
#
echo "Setting up C/C++ (irony-mode)"
if is-mac; then
case "$OSTYPE" in
darwin*)
brew install cmake
brew install llvm --with-clang
fi
;;
linux*)
if is-arch; then
sudo pacman --noconfirm -S cmake clang
elif is-deb; then
echo "Not implemented"
exit 1
fi
;;
esac
# Build irony-server
git-repo "https://github.com/Sarcasm/irony-mode" "irony-mode"
# Reset build directory
cd irony-mode/server
[ -d build ] && rm -rf build
mkdir build && cd build
cmake -DCMAKE_INSTALL_RPATH_USE_LINK_PATH\=ON \
-DCMAKE_INSTALL_PREFIX\=${CACHE_DIR}/irony/ ../ && \
cmake --build . --use-stderr --config Release --target install
install_name_tool -change @rpath/libclang.dylib \
DEST="$(pwd)/irony-mode/server/build/irony/"
# Compile
if is-mac
then
cmake -DCMAKE_INSTALL_RPATH_USE_LINK_PATH\=ON \
-DCMAKE_INSTALL_PREFIX\="$DEST" ../
else
cmake -DCMAKE_INSTALL_PREFIX\="$DEST" ../
fi
cmake --build . --use-stderr --config Release --target install
if is-mac
then
install_name_tool -change @rpath/libclang.dylib \
/usr/local/opt/llvm/lib/libclang.dylib \
${CACHE_DIR}/irony/bin/irony-server
$DEST/bin/irony-server
fi

View file

@ -1,13 +1,22 @@
#!/usr/bin/env bash
cd ~/.emacs.d/ext
source ./VARS
source VARS
#
echo "Setting up JS (tern/trepanjs)"
if is-mac; then
case "$OSTYPE" in
darwin*)
brew install node
fi
;;
linux*)
if is-arch; then
sudo pacman --noconfirm -S nodejs npm
else
echo "..."
exit 1
fi
;;
esac
npm -g install trepanjs tern

View file

@ -49,7 +49,7 @@
(use-package irony
:after cc-mode
:config
(setq irony-server-install-prefix (concat doom-temp-dir "/irony/"))
(setq irony-server-install-prefix (concat doom-ext-dir "/irony-mode/server/build/irony/"))
(add-hook! c++-mode
(make-local-variable 'irony-additional-clang-options)
(push "-std=c++11" irony-additional-clang-options))