mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 01:58:16 +00:00
Merge branch 'main' into feature/go-transactions
This commit is contained in:
commit
dd56d92b6a
9 changed files with 248 additions and 97 deletions
|
@ -6,14 +6,40 @@ This driver uses the awesome [purego](https://github.com/ebitengine/purego) libr
|
|||
|
||||
## Embedded Library Support
|
||||
|
||||
This driver now includes an embedded library feature that allows you to distribute a single binary without requiring users to set environment variables. The library for your platform is automatically embedded, extracted at runtime, and loaded dynamically.
|
||||
This driver includes an embedded library feature that allows you to distribute a single binary without requiring users to set environment variables. The library for your platform is automatically embedded, extracted at runtime, and loaded dynamically.
|
||||
|
||||
To build with embedded library support:
|
||||
```
|
||||
# From the bindings/go directory
|
||||
### Building from Source
|
||||
|
||||
To build with embedded library support, follow these steps:
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/tursodatabase/limbo
|
||||
|
||||
# Navigate to the Go bindings directory
|
||||
cd limbo/bindings/go
|
||||
|
||||
# Build the library (defaults to release build)
|
||||
./build_lib.sh
|
||||
|
||||
# Alternatively, for faster builds during development:
|
||||
./build_lib.sh debug
|
||||
```
|
||||
|
||||
### Build Options:
|
||||
|
||||
* Release Build (default): ./build_lib.sh or ./build_lib.sh release
|
||||
|
||||
- Optimized for performance and smaller binary size
|
||||
- Takes longer to compile and requires more system resources
|
||||
- Recommended for production use
|
||||
|
||||
* Debug Build: ./build_lib.sh debug
|
||||
|
||||
- Faster compilation times with less resource usage
|
||||
- Larger binary size and slower runtime performance
|
||||
- Recommended during development or if release build fails
|
||||
|
||||
If the embedded library cannot be found or extracted, the driver will fall back to the traditional method of finding the library in the system paths.
|
||||
|
||||
## To use: (_UNSTABLE_ testing or development purposes only)
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
|
||||
set -e
|
||||
|
||||
echo "Building Limbo Go library for current platform..."
|
||||
# Accept build type as parameter, default to release
|
||||
BUILD_TYPE=${1:-release}
|
||||
|
||||
echo "Building Limbo Go library for current platform (build type: $BUILD_TYPE)..."
|
||||
|
||||
# Determine platform-specific details
|
||||
case "$(uname -s)" in
|
||||
|
@ -43,11 +46,25 @@ esac
|
|||
OUTPUT_DIR="libs/${PLATFORM}"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# Set cargo build arguments based on build type
|
||||
if [ "$BUILD_TYPE" == "debug" ]; then
|
||||
CARGO_ARGS=""
|
||||
TARGET_DIR="debug"
|
||||
echo "NOTE: Debug builds are faster to compile but less efficient at runtime."
|
||||
echo " For production use, consider using a release build with: ./build_lib.sh release"
|
||||
else
|
||||
CARGO_ARGS="--release"
|
||||
TARGET_DIR="release"
|
||||
echo "NOTE: Release builds may take longer to compile and require more system resources."
|
||||
echo " If this build fails or takes too long, try a debug build with: ./build_lib.sh debug"
|
||||
fi
|
||||
|
||||
# Build the library
|
||||
cargo build --package limbo-go
|
||||
echo "Running cargo build ${CARGO_ARGS} --package limbo-go"
|
||||
cargo build ${CARGO_ARGS} --package limbo-go
|
||||
|
||||
# Copy to the appropriate directory
|
||||
echo "Copying $OUTPUT_NAME to $OUTPUT_DIR/"
|
||||
cp "../../target/debug/$OUTPUT_NAME" "$OUTPUT_DIR/"
|
||||
cp "../../target/${TARGET_DIR}/$OUTPUT_NAME" "$OUTPUT_DIR/"
|
||||
|
||||
echo "Library built successfully for $PLATFORM"
|
||||
echo "Library built successfully for $PLATFORM ($BUILD_TYPE build)"
|
Loading…
Add table
Add a link
Reference in a new issue