ccls/ci/before_deploy.sh

37 lines
955 B
Bash
Raw Normal View History

2018-02-07 06:46:05 +00:00
#!/usr/bin/env bash
root=$(realpath "$(dirname "$0")/..")
version=$(TZ=UTC date +v%Y%m%d)
2018-02-07 06:46:05 +00:00
cd "$root/build/release"
2018-02-07 06:46:05 +00:00
case $(uname -s) in
Darwin)
libclang=(lib/clang+llvm-*/lib/libclang.dylib)
name=cquery-$version-x86_64-apple-darwin ;;
2018-02-07 06:46:05 +00:00
FreeBSD)
libclang=(lib/clang+llvm-*/lib/libclang.so.?)
name=cquery-$version-x86_64-unknown-freebsd10 ;;
Linux)
libclang=(lib/clang+llvm-*/lib/libclang.so.?)
name=cquery-$version-x86_64-unknown-linux-gnu ;;
2018-02-07 06:46:05 +00:00
*)
echo Unsupported >&2
exit 1 ;;
esac
pkg=$(mktemp -d)
2018-02-07 06:46:05 +00:00
rsync -rtLR bin "./${libclang[0]}" ./lib/clang+llvm-*/lib/clang/*/include "$pkg/"
cd "$pkg"
2018-02-07 06:46:05 +00:00
strip -s bin/cquery "${libclang[0]}"
case $(uname -s) in
Darwin)
# FIXME
;;
Linux)
# ./bin/cquery -> $name/bin/cquery
tar -Jcf "$root/build/$name.tar.xz" --owner 0 --group 0 --xform "s,^\./,$name/," . ;;
*)
tar -Jcf "$root/build/$name.tar.xz" --uid 0 --gid 0 -s ",^\./,$name/," .
esac
rm -r "$pkg"