Rewrite ./ext/ setup scripts

This commit is contained in:
Henrik Lissner 2016-08-27 23:01:43 +02:00
parent c25c589281
commit d31fe2166e
9 changed files with 97 additions and 47 deletions

5
.gitignore vendored
View file

@ -1,5 +1,8 @@
.cask/ .cask/
ext/ ext/*
!ext/*.sh
!ext/*.md
!ext/VARS
eshell/ eshell/
private/cache/ private/cache/
private/snippets/ private/snippets/

View file

@ -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

0
ext/README.md Normal file
View file

17
ext/VARS Normal file
View file

@ -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"
}

27
ext/setup-cc.sh Executable file
View file

@ -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

12
ext/setup-csharp.sh Executable file
View file

@ -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

13
ext/setup-js.sh Executable file
View file

@ -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

13
ext/setup-rust.sh Executable file
View file

@ -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

11
ext/setup-sh.sh Executable file
View file

@ -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