From d31fe2166e9c912133747f7ac162d582aa453a0b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 27 Aug 2016 23:01:43 +0200 Subject: [PATCH] Rewrite ./ext/ setup scripts --- .gitignore | 5 ++++- ext/Makefile | 46 --------------------------------------------- ext/README.md | 0 ext/VARS | 17 +++++++++++++++++ ext/setup-cc.sh | 27 ++++++++++++++++++++++++++ ext/setup-csharp.sh | 12 ++++++++++++ ext/setup-js.sh | 13 +++++++++++++ ext/setup-rust.sh | 13 +++++++++++++ ext/setup-sh.sh | 11 +++++++++++ 9 files changed, 97 insertions(+), 47 deletions(-) delete mode 100644 ext/Makefile create mode 100644 ext/README.md create mode 100644 ext/VARS create mode 100755 ext/setup-cc.sh create mode 100755 ext/setup-csharp.sh create mode 100755 ext/setup-js.sh create mode 100755 ext/setup-rust.sh create mode 100755 ext/setup-sh.sh diff --git a/.gitignore b/.gitignore index 2733a0e04..1f06135ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ .cask/ -ext/ +ext/* +!ext/*.sh +!ext/*.md +!ext/VARS eshell/ private/cache/ private/snippets/ diff --git a/ext/Makefile b/ext/Makefile deleted file mode 100644 index 2390586a4..000000000 --- a/ext/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -CACHE_DIR="$(HOME)/.emacs.d/private/cache/`hostname`/`emacs --version | grep -o '2[0-9]\.[0-9]'`" -ELPA_DIR="$(HOME)/.emacs.d/.cask/`emacs --version | grep -o '2[0-9]\.[0-9]\.[0-9]'`/elpa" - -LLVMV="3.8.0" -LLVM="clang+llvm-$(LLVMV)-x86_64-apple-darwin" - -# - -all: rust csharp js sh cc - -rust: - @echo "Installing Rust dependencies" - git clone --depth 1 --recursive "https://github.com/rust-lang/rust.git" rust - git clone --depth 1 --recursive "https://github.com/phildawes/racer.git" racer-src - cd racer-src && cargo build --release - mv racer-src/target/release/racer ./racer - rm -rf racer-src - -csharp: - @echo "Installing C# dependencies" - git clone --depth 1 --recursive "https://github.com/OmniSharp/omnisharp-server" omnisharp - cd omnisharp && xbuild - mv omnisharp/bin/Debug/OmniSharp.exe ./OmniSharp.exe - rm -rf omnisharp - -js: - @echo "Installing js2-mode dependencies" - npm -g install trepanjs tern - -sh: - @echo "Installing zsh/bash dependencies" - brew install zshdb bashdb - -cc: - @echo "Installing irony-mode dependencies" - [ -f "clang.tar.xz" ] || wget "http://llvm.org/releases/$(LLVMV)/$(LLVM).tar.xz" -O clang.tar.xz - @if [ ! -d clang ]; then \ - tar -xzvf clang.tar.xz; \ - mv "$(LLVM)" clang; \ - fi - @mkdir -p build; cd build && cmake -DCMAKE_INSTALL_PREFIX=$(CACHE_DIR)/irony/ \ - -DLIBCLANG_LIBRARY=~/.emacs.d/ext/clang/lib/libclang.dylib \ - -DLIBCLANG_INCLUDE_DIR=~/.emacs.d/ext/clang/include/ \ - $(ELPA_DIR)/irony-2*/server && \ - cmake --build . --use-stderr --config Release --target install - install_name_tool -change @rpath/libclang.dylib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib $(CACHE_DIR)/irony/bin/irony-server diff --git a/ext/README.md b/ext/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/ext/VARS b/ext/VARS new file mode 100644 index 000000000..cc4696244 --- /dev/null +++ b/ext/VARS @@ -0,0 +1,17 @@ +#!/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" + +is-mac() { [ "$(uname)" == "Darwin" ]; } +is-linux() { [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; } + +git-repo() { + old=$(pwd) + if [ -d "$2" ]; then + cd "$2" && git pull + else + git clone --depth 1 --recursive "$1" "$2" + fi + cd "$old" +} diff --git a/ext/setup-cc.sh b/ext/setup-cc.sh new file mode 100755 index 000000000..8e8a4fd27 --- /dev/null +++ b/ext/setup-cc.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +cd ~/.emacs.d/ext +source ./VARS + +LLVMV="3.8.0" +LLVM="clang+llvm-${LLVMV}-x86_64-apple-darwin" + +# +echo "Setting up C/C++ (irony-mode)" + +if is-mac; then + brew install cmake + brew install llvm --with-clang +fi + +# Build irony-server +git-repo "https://github.com/Sarcasm/irony-mode" "irony-mode" +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 \ + /usr/local/opt/llvm/lib/libclang.dylib \ + ${CACHE_DIR}/irony/bin/irony-server diff --git a/ext/setup-csharp.sh b/ext/setup-csharp.sh new file mode 100755 index 000000000..4d3157b17 --- /dev/null +++ b/ext/setup-csharp.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +cd ~/.emacs.d/ext +source ./VARS + +# +echo "Setting up C# (omnisharp)" + +git-repo "https://github.com/OmniSharp/omnisharp-server" omnisharp +cd omnisharp && xbuild +mv omnisharp/bin/Debug/OmniSharp.exe ./OmniSharp.exe +rm -rf omnisharp diff --git a/ext/setup-js.sh b/ext/setup-js.sh new file mode 100755 index 000000000..110b6d5bd --- /dev/null +++ b/ext/setup-js.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +cd ~/.emacs.d/ext +source ./VARS + +# +echo "Setting up JS (tern/trepanjs)" + +if is-mac; then + brew install node +fi + +npm -g install trepanjs tern diff --git a/ext/setup-rust.sh b/ext/setup-rust.sh new file mode 100755 index 000000000..590c43a5e --- /dev/null +++ b/ext/setup-rust.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +cd ~/.emacs.d/ext +source ./VARS + +# +echo "Setting up Rust" + +git-repo "https://github.com/rust-lang/rust.git" "rust" +git-repo "https://github.com/phildawes/racer.git" "racer-src" + +cd racer-src && cargo build --release +mv racer-src/target/release/racer ./racer diff --git a/ext/setup-sh.sh b/ext/setup-sh.sh new file mode 100755 index 000000000..e9306d23b --- /dev/null +++ b/ext/setup-sh.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +cd ~/.emacs.d/ext +source ./VARS + +# +echo "Setting up zsh/bash (zshdb, bashdb)" + +if is-mac; then + brew install zshdb bashdb +fi