-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_win.sh
36 lines (29 loc) · 1.01 KB
/
build_win.sh
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
#!/bin/bash
set -euo pipefail
# Get latest release info from GitHub API
LIBUSB_RELEASE_INFO=$(wget -qO- https://api.github.com/repos/libusb/libusb/releases/latest)
# Extract Windows release asset URL (only .7z file)
LIBUSB_WIN_URL=$(echo "$LIBUSB_RELEASE_INFO" | \
jq -r '.assets[] | select(.name | endswith(".7z")) | .browser_download_url')
LIBUSB_FILENAME=$(basename "$LIBUSB_WIN_URL")
# Create vendor directory if it doesn't exist
mkdir -p vendor/libusb
# Download and extract
cd vendor
if [ ! -f "$LIBUSB_FILENAME" ]; then
wget -N "$LIBUSB_WIN_URL"
else
echo $LIBUSB_FILENAME already exists, skipping download.
fi
7z x "$LIBUSB_FILENAME" -aos -olibusb
# Clean up downloaded archive
#rm libusb.7z
cd ..
pyinstaller --onedir \
--add-binary /mingw64/lib/libgphoto2_port/0.12.2/:. \
--add-binary /mingw64/lib/libgphoto2/2.5.31/:. \
--add-binary ./vendor/libusb/MinGW64/dll/libusb-1.0.dll:. \
--add-data ui:ui main.py \
--runtime-hook ./build_win_hook.py \
--noconfirm \
--name byzanz-capture