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

View file

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

View file

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

View file

@ -49,7 +49,7 @@
(use-package irony (use-package irony
:after cc-mode :after cc-mode
:config :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 (add-hook! c++-mode
(make-local-variable 'irony-additional-clang-options) (make-local-variable 'irony-additional-clang-options)
(push "-std=c++11" irony-additional-clang-options)) (push "-std=c++11" irony-additional-clang-options))