forked from google/zetasql
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from aceforeverd/ci/build-and-release
ci: build and release
- Loading branch information
Showing
3 changed files
with
169 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -eE | ||
|
||
RED='\033[0;31m' | ||
NC='\033[0m' | ||
|
||
analyze_so() { | ||
local so_file | ||
so_file=$1 | ||
local archive_file | ||
archive_file=$(echo "$so_file" | sed -e 's/\.so$/\.a/') | ||
if [ ! -e "$archive_file" ]; then | ||
echo -e "${RED}$so_file is orphan, no $archive_file found${NC}" | ||
fi | ||
} | ||
|
||
analyze_archive() { | ||
local archive_file | ||
archive_file=$1 | ||
local so_file | ||
so_file=$(echo "$archive_file" | sed -e 's/\.a$/\.so/') | ||
if [ ! -e "$so_file" ]; then | ||
echo -e "${RED}$archive_file is orphan, no $so_file found${NC}" | ||
fi | ||
} | ||
|
||
export -f analyze_so analyze_archive | ||
|
||
pushd bazel-bin/ | ||
find zetasql -maxdepth 4 -iname '*.so' -exec bash -c 'analyze_so $0' {} \; | ||
find zetasql -iname '*.a' -exec bash -c 'analyze_archive $0' {} \; | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
|
||
# install zetasql compiled header files and libs | ||
|
||
set -eE | ||
|
||
cd "$(dirname "$0")" | ||
VERSION=${TAG:-$(git rev-parse --short HEAD)} | ||
export ROOT=$(pwd) | ||
export PREFIX="$ROOT/libzetasql-$VERSION" | ||
|
||
rm -rf tmp-lib libzetasql.mri | ||
mkdir -p tmp-lib | ||
|
||
install_lib() { | ||
local file | ||
file=$1 | ||
local libname | ||
libname=lib$(echo "$file" | tr '/' '_' | sed -e 's/lib//') | ||
install -D "$file" "$ROOT/tmp-lib/$libname" | ||
} | ||
|
||
install_gen_include_file() { | ||
local file | ||
file=$1 | ||
local outfile | ||
outfile=$(echo "$file" | sed -e 's/^.*proto\///') | ||
install -D "$file" "$PREFIX/include/$outfile" | ||
} | ||
|
||
install_external_lib() { | ||
local file | ||
file=$1 | ||
local libname | ||
libname=$(basename "$file") | ||
install -D "$file" "$PREFIX/lib/$libname" | ||
} | ||
|
||
export -f install_gen_include_file | ||
export -f install_lib | ||
export -f install_external_lib | ||
|
||
|
||
pushd bazel-bin/ | ||
# exlucde test so | ||
find zetasql -maxdepth 4 -type f -iname '*.so' -exec bash -c 'install_lib $0' {} \; | ||
find zetasql -type f -iname '*.a' -exec bash -c 'install_lib $0' {} \; | ||
|
||
# external lib headers | ||
pushd "$(realpath .)/../../../../../external/com_googlesource_code_re2" | ||
find re2 -iname "*.h" -exec install -D {} "$PREFIX"/include/{} \; | ||
popd | ||
|
||
# external lib | ||
pushd external | ||
find icu -type f -iregex ".*/.*\.\(so\|a\)\$" -exec bash -c 'install_external_lib $0' {} \; | ||
find com_googlesource_code_re2 -type f -iregex ".*/.*\.\(so\|a\)\$" -exec bash -c 'install_external_lib $0' {} \; | ||
find com_googleapis_googleapis -type f -iname '*.so' -exec bash -c 'install_external_lib $0' {} \; | ||
popd | ||
|
||
# zetasql generated files: protobuf & template generated files | ||
find zetasql -type f -iname "*.h" -exec install -D {} "$PREFIX"/include/{} \; | ||
find zetasql -iregex ".*/_virtual_includes/.*\.h\$" -exec bash -c 'install_gen_include_file $0' {} \; | ||
popd # bazel-bin | ||
|
||
# header files from source | ||
find zetasql -type f -iname "*.h" -exec install -D {} "$PREFIX"/include/{} \; | ||
|
||
|
||
echo 'create libzetasql.a' >> libzetasql.mri | ||
find tmp-lib/ -iname "*.a" -type f -exec bash -c 'echo "addlib $0" >> libzetasql.mri' {} \; | ||
echo "save" >> libzetasql.mri | ||
echo "end" >> libzetasql.mri | ||
|
||
ar -M <libzetasql.mri | ||
ranlib libzetasql.a | ||
mv libzetasql.a "$PREFIX/lib" | ||
mv tmp-lib/*.so "$PREFIX/lib" | ||
|
||
|
||
tar czf "libzetasql-$VERSION.tar.gz" "libzetasql-$VERSION"/ |