forked from sheetjs/docs.sheetjs.com
60 lines
1.3 KiB
Bash
Executable File
60 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# https://docs.sheetjs.com/docs/demos/engines/jsc#rust-example
|
|
|
|
set -e
|
|
|
|
OS="$(uname -s)"
|
|
ARCH="$(uname -m)"
|
|
|
|
case "$OS" in
|
|
Darwin) PLATFORM="macos" ;;
|
|
Linux) PLATFORM="linux" ;;
|
|
*) echo "Unsupported OS: $OS" ; exit 1 ;;
|
|
esac
|
|
|
|
echo "Detected platform: $PLATFORM ($ARCH)"
|
|
|
|
case "$PLATFORM" in
|
|
linux)
|
|
# This test requires the WebKit build from the C demo
|
|
cd /tmp
|
|
if [[ ! -d "sheetjs-jsc" ]]; then
|
|
echo "Please run the C demo from https://docs.sheetjs.com/docs/demos/engines/jsc#c"
|
|
exit 1
|
|
fi
|
|
|
|
cd sheetjs-jsc
|
|
if [[ ! -d "Release" ]]; then
|
|
echo "Please run the C demo from https://docs.sheetjs.com/docs/demos/engines/jsc#c"
|
|
exit 1
|
|
fi
|
|
|
|
cd /tmp
|
|
rm -rf sheetjs-jsc-rust
|
|
mkdir -p sheetjs-jsc-rust
|
|
cd sheetjs-jsc-rust
|
|
|
|
cargo new sheetjs-jsc-rust
|
|
cd sheetjs-jsc-rust
|
|
;;
|
|
|
|
macos)
|
|
cd /tmp
|
|
rm -rf sheetjs-jsc-rust
|
|
mkdir -p sheetjs-jsc-rust
|
|
cd sheetjs-jsc-rust
|
|
|
|
cargo new sheetjs-jsc-rust
|
|
cd sheetjs-jsc-rust
|
|
;;
|
|
esac
|
|
|
|
curl -L -o src/xlsx.full.min.js https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
|
|
curl -LO https://docs.sheetjs.com/pres.numbers
|
|
curl -L -o src/main.rs https://docs.sheetjs.com/jsc/main.rs
|
|
curl -L -o build.rs https://docs.sheetjs.com/jsc/build.rs
|
|
|
|
cargo add libc
|
|
cargo run --release -- pres.numbers
|
|
npx -y xlsx-cli sheetjsw.xlsb
|