-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
2 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,51 @@ | ||
#!/bin/bash | ||
|
||
# This script will download the latest libchdb release from GitHub and extract | ||
# the libchdb.so file to the current directory. This script is intended to be | ||
# used by the build process to ensure that the latest version of libchdb is | ||
# used. | ||
|
||
# Change directory to the script's directory | ||
cd "$(dirname "$0")" | ||
|
||
# Get the newest release version | ||
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/chdb-io/chdb/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | ||
# LATEST_RELEASE=v2.0.0b0 | ||
|
||
# Download the correct version based on the platform | ||
case "$(uname -s)" in | ||
Linux) | ||
if [[ $(uname -m) == "aarch64" ]]; then | ||
PLATFORM="linux-aarch64-libchdb.tar.gz" | ||
else | ||
PLATFORM="linux-x86_64-libchdb.tar.gz" | ||
fi | ||
;; | ||
Darwin) | ||
if [[ $(uname -m) == "arm64" ]]; then | ||
PLATFORM="macos-arm64-libchdb.tar.gz" | ||
else | ||
PLATFORM="macos-x86_64-libchdb.tar.gz" | ||
fi | ||
;; | ||
*) | ||
echo "Unsupported platform" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
DOWNLOAD_URL="https://github.com/chdb-io/chdb/releases/download/$LATEST_RELEASE/$PLATFORM" | ||
|
||
echo "Downloading $PLATFORM from $DOWNLOAD_URL" | ||
|
||
# Download the file | ||
curl -L -o libchdb.tar.gz $DOWNLOAD_URL | ||
|
||
# Untar the file | ||
tar -xzf libchdb.tar.gz | ||
|
||
# Set execute permission for libchdb.so | ||
chmod +x libchdb.so | ||
|
||
# Clean up | ||
rm -f libchdb.tar.gz |