2018-02-07 06:46:05 +00:00
|
|
|
#!/usr/bin/env bash
|
2018-02-07 03:05:37 +00:00
|
|
|
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 03:05:37 +00:00
|
|
|
|
2018-02-07 06:46:05 +00:00
|
|
|
case $(uname -s) in
|
|
|
|
Darwin)
|
|
|
|
libclang=(lib/clang+llvm-*/lib/libclang.dylib)
|
2018-02-07 03:05:37 +00:00
|
|
|
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.?)
|
2018-02-07 03:05:37 +00:00
|
|
|
name=cquery-$version-x86_64-unknown-linux-gnu ;;
|
2018-02-07 06:46:05 +00:00
|
|
|
*)
|
|
|
|
echo Unsupported >&2
|
|
|
|
exit 1 ;;
|
2018-02-07 03:05:37 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
pkg=$(mktemp -d)
|
2018-02-07 06:46:05 +00:00
|
|
|
rsync -rtLR bin "./${libclang[0]}" ./lib/clang+llvm-*/lib/clang/*/include "$pkg/"
|
2018-02-07 03:05:37 +00:00
|
|
|
|
|
|
|
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
|
2018-02-07 03:05:37 +00:00
|
|
|
rm -r "$pkg"
|