mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 02:34:59 -07:00
Automate libuv download and build
This commit is contained in:
parent
3da78364cc
commit
6b0b466585
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
build/
|
||||
.deps/
|
||||
|
||||
*.rej
|
||||
*.orig
|
||||
*.mo
|
||||
|
18
Makefile
18
Makefile
@ -3,12 +3,22 @@ CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=Debug
|
||||
test: build/src/vim
|
||||
cd src/testdir && make
|
||||
|
||||
build/src/vim:
|
||||
build/src/vim: deps
|
||||
cd build && make
|
||||
|
||||
cmake:
|
||||
rm -rf build
|
||||
deps: .deps/usr/lib/libuv.a
|
||||
|
||||
.deps/usr/lib/libuv.a:
|
||||
sh -e scripts/get-libuv.sh
|
||||
|
||||
cmake: clean
|
||||
mkdir build
|
||||
cd build && cmake $(CMAKE_FLAGS) ../
|
||||
|
||||
.PHONY: test cmake
|
||||
clean:
|
||||
rm -rf build
|
||||
for file in lua mbyte mzscheme small tiny; do \
|
||||
rm -f src/testdir/$$file.vim; \
|
||||
done
|
||||
|
||||
.PHONY: test deps cmake
|
||||
|
37
scripts/common.sh
Normal file
37
scripts/common.sh
Normal file
@ -0,0 +1,37 @@
|
||||
pkgroot="$(pwd)"
|
||||
deps="$pkgroot/.deps"
|
||||
prefix="$deps/usr"
|
||||
export PATH="$prefix/bin:$PATH"
|
||||
|
||||
download() {
|
||||
local url=$1
|
||||
local tgt=$2
|
||||
local sha1=$3
|
||||
|
||||
if [ ! -d "$tgt" ]; then
|
||||
mkdir -p "$tgt"
|
||||
if which wget > /dev/null 2>&1; then
|
||||
tmp_dir=$(mktemp -d "/tmp/download_sha1check_XXXXXXX")
|
||||
fifo="$tmp_dir/fifo"
|
||||
mkfifo "$fifo"
|
||||
# download, untar and calculate sha1 sum in one pass
|
||||
(wget "$url" -O - | tee "$fifo" | \
|
||||
(cd "$tgt"; tar --strip-components=1 -xvzf -)) &
|
||||
sum=$(sha1sum < "$fifo" | cut -d ' ' -f1)
|
||||
rm -rf "$tmp_dir"
|
||||
if [ "$sum" != "$sha1" ]; then
|
||||
echo "SHA1 sum doesn't match, expected '$sha1' got '$sum'"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Missing wget utility"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
github_download() {
|
||||
local repo=$1
|
||||
local ver=$2
|
||||
download "https://github.com/${repo}/archive/${ver}.tar.gz" "$3" "$4"
|
||||
}
|
16
scripts/get-libuv.sh
Normal file
16
scripts/get-libuv.sh
Normal file
@ -0,0 +1,16 @@
|
||||
. scripts/common.sh
|
||||
|
||||
uv_repo=joyent/libuv
|
||||
uv_ver=v0.11.19
|
||||
uv_dir="$deps/uv-$uv_ver"
|
||||
uv_sha1=5539d8e99e22b438cf4a412d4cec70ac6bb519fc
|
||||
|
||||
rm -rf "$uv_dir"
|
||||
|
||||
github_download "$uv_repo" "$uv_ver" "$uv_dir" "$uv_sha1"
|
||||
cd "$uv_dir"
|
||||
sh autogen.sh
|
||||
./configure --prefix="$prefix"
|
||||
make
|
||||
make install
|
||||
rm "$prefix/lib/"libuv*.so "$prefix/lib/"libuv*.so.*
|
Loading…
Reference in New Issue
Block a user