before_deploy.sh maxOS support

This commit is contained in:
scturtle 2018-02-07 15:48:09 +08:00
parent 67bac3a196
commit ad5ddb51c4

View File

@ -1,17 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
root=$(realpath "$(dirname "$0")/..") root=$(cd "$(dirname "$0")/.."; pwd)
version=$(TZ=UTC date +v%Y%m%d) version=$(TZ=UTC date +v%Y%m%d)
cd "$root/build/release" cd "$root/build/release"
case $(uname -s) in case $(uname -s) in
Darwin) Darwin)
libclang=(lib/clang+llvm-*/lib/libclang.dylib) libclang=(lib/clang+llvm-*/lib/libclang.dylib)
strip_option="-x"
name=cquery-$version-x86_64-apple-darwin ;; name=cquery-$version-x86_64-apple-darwin ;;
FreeBSD) FreeBSD)
libclang=(lib/clang+llvm-*/lib/libclang.so.?) libclang=(lib/clang+llvm-*/lib/libclang.so.?)
strip_option="-s"
name=cquery-$version-x86_64-unknown-freebsd10 ;; name=cquery-$version-x86_64-unknown-freebsd10 ;;
Linux) Linux)
libclang=(lib/clang+llvm-*/lib/libclang.so.?) libclang=(lib/clang+llvm-*/lib/libclang.so.?)
strip_option="-s"
name=cquery-$version-x86_64-unknown-linux-gnu ;; name=cquery-$version-x86_64-unknown-linux-gnu ;;
*) *)
echo Unsupported >&2 echo Unsupported >&2
@ -19,18 +22,20 @@ case $(uname -s) in
esac esac
pkg=$(mktemp -d) pkg=$(mktemp -d)
rsync -rtLR bin "./${libclang[0]}" ./lib/clang+llvm-*/lib/clang/*/include "$pkg/" mkdir "$pkg/$name"
rsync -rtLR bin "./${libclang[0]}" ./lib/clang+llvm-*/lib/clang/*/include "$pkg/$name"
cd "$pkg" cd "$pkg"
strip -s bin/cquery "${libclang[0]}" strip "$strip_option" "$name/bin/cquery" "$name/${libclang[0]}"
case $(uname -s) in case $(uname -s) in
Darwin) Darwin)
# FIXME tar -cf filelist --format=mtree --options="!all,time,mode,type" "$name"
;; awk '/#mtree/{print;print "/set uid=0 gid=0";next}1' filelist > newflielist
tar -zcf "$root/build/$name.tar.gz" @newflielist ;;
Linux) Linux)
# ./bin/cquery -> $name/bin/cquery # ./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" --owner 0 --group 0 $name ;;
*) *)
tar -Jcf "$root/build/$name.tar.xz" --uid 0 --gid 0 -s ",^\./,$name/," . tar -Jcf "$root/build/$name.tar.xz" --uid 0 --gid 0 $name ;;
esac esac
rm -r "$pkg" rm -r "$pkg"