-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild-wheel
More file actions
executable file
·51 lines (42 loc) · 1.43 KB
/
Copy pathbuild-wheel
File metadata and controls
executable file
·51 lines (42 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Build a fastled wheel that bundles the native Rust CLI binary.
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*) EXE_NAME="fastled.exe" ;;
*) EXE_NAME="fastled" ;;
esac
echo "Compiling fastled CLI (release)..."
if ! command -v soldr &> /dev/null; then
echo "Error: soldr is required for Rust builds. Install with: uv tool install soldr" >&2
exit 1
fi
soldr cargo build --release --bin fastled
if [[ -n "${CARGO_BUILD_TARGET:-}" ]]; then
BIN_SRC="$SCRIPT_DIR/target/${CARGO_BUILD_TARGET}/release/${EXE_NAME}"
else
BIN_SRC="$SCRIPT_DIR/target/release/${EXE_NAME}"
fi
case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*)
ARCH="$(uname -m)"
if [[ "$ARCH" = "x86_64" ]]; then
TARGET_TRIPLE="x86_64-pc-windows-msvc"
else
TARGET_TRIPLE="aarch64-pc-windows-msvc"
fi
if [[ -f "$SCRIPT_DIR/target/${TARGET_TRIPLE}/release/${EXE_NAME}" ]]; then
BIN_SRC="$SCRIPT_DIR/target/${TARGET_TRIPLE}/release/${EXE_NAME}"
fi
;;
esac
if [[ ! -f "$BIN_SRC" ]]; then
echo "Error: built binary not found at $BIN_SRC" >&2
exit 1
fi
PACKAGE_BIN_DIR="$SCRIPT_DIR/src/fastled/bin"
mkdir -p "$PACKAGE_BIN_DIR"
cp -f "$BIN_SRC" "$PACKAGE_BIN_DIR/$EXE_NAME"
echo "Staged $BIN_SRC -> $PACKAGE_BIN_DIR/$EXE_NAME"
echo "Building wheel..."
uv run --with "setuptools>=69" --with "wheel>=0.43" python setup.py bdist_wheel "$@"