Compare commits
3 Commits
v0.1.0-alp
...
v0.1.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e54616000 | |||
| 3633793972 | |||
| 7f799a914d |
@@ -63,37 +63,50 @@ jobs:
|
|||||||
- name: Install system dependencies
|
- name: Install system dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y --no-install-recommends zip libportaudio2
|
sudo apt-get install -y --no-install-recommends zip libportaudio2 nsis msitools
|
||||||
|
|
||||||
- name: Cross-build Windows distribution
|
- name: Cross-build Windows distribution
|
||||||
run: |
|
run: |
|
||||||
chmod +x build-dist-windows.sh
|
chmod +x build-dist-windows.sh
|
||||||
./build-dist-windows.sh "${{ gitea.ref_name }}"
|
./build-dist-windows.sh "${{ gitea.ref_name }}"
|
||||||
|
|
||||||
- name: Upload build artifact
|
- name: Upload build artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: LedGrab-${{ gitea.ref_name }}-win-x64
|
name: LedGrab-${{ gitea.ref_name }}-win-x64
|
||||||
path: build/LedGrab-*.zip
|
path: |
|
||||||
|
build/LedGrab-*.zip
|
||||||
|
build/LedGrab-*-setup.exe
|
||||||
retention-days: 90
|
retention-days: 90
|
||||||
|
|
||||||
- name: Attach ZIP to release
|
- name: Attach assets to release
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ gitea.ref_name }}"
|
|
||||||
RELEASE_ID="${{ needs.create-release.outputs.release_id }}"
|
RELEASE_ID="${{ needs.create-release.outputs.release_id }}"
|
||||||
BASE_URL="${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}"
|
BASE_URL="${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}"
|
||||||
|
|
||||||
|
# Upload ZIP
|
||||||
ZIP_FILE=$(ls build/LedGrab-*.zip | head -1)
|
ZIP_FILE=$(ls build/LedGrab-*.zip | head -1)
|
||||||
ZIP_NAME=$(basename "$ZIP_FILE")
|
if [ -f "$ZIP_FILE" ]; then
|
||||||
|
curl -s -X POST \
|
||||||
|
"$BASE_URL/releases/$RELEASE_ID/assets?name=$(basename "$ZIP_FILE")" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@$ZIP_FILE"
|
||||||
|
echo "Uploaded: $(basename "$ZIP_FILE")"
|
||||||
|
fi
|
||||||
|
|
||||||
curl -s -X POST \
|
# Upload installer
|
||||||
"$BASE_URL/releases/$RELEASE_ID/assets?name=$ZIP_NAME" \
|
SETUP_FILE=$(ls build/LedGrab-*-setup.exe 2>/dev/null | head -1)
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
if [ -f "$SETUP_FILE" ]; then
|
||||||
-H "Content-Type: application/octet-stream" \
|
curl -s -X POST \
|
||||||
--data-binary "@$ZIP_FILE"
|
"$BASE_URL/releases/$RELEASE_ID/assets?name=$(basename "$SETUP_FILE")" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
echo "Uploaded: $ZIP_NAME"
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@$SETUP_FILE"
|
||||||
|
echo "Uploaded: $(basename "$SETUP_FILE")"
|
||||||
|
fi
|
||||||
|
|
||||||
# ── Linux tarball ──────────────────────────────────────────
|
# ── Linux tarball ──────────────────────────────────────────
|
||||||
build-linux:
|
build-linux:
|
||||||
@@ -165,20 +178,25 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
TAG="${{ gitea.ref_name }}"
|
TAG="${{ gitea.ref_name }}"
|
||||||
VERSION="${TAG#v}"
|
VERSION="${TAG#v}"
|
||||||
REGISTRY="${{ gitea.server_url }}/${{ gitea.repository }}"
|
# Strip protocol and lowercase for Docker registry path
|
||||||
# Lowercase the registry path (Docker requires it)
|
SERVER_HOST=$(echo "${{ gitea.server_url }}" | sed -E 's|https?://||')
|
||||||
REGISTRY=$(echo "$REGISTRY" | tr '[:upper:]' '[:lower:]' | sed 's|https\?://||')
|
REPO=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||||
|
REGISTRY="${SERVER_HOST}/${REPO}"
|
||||||
|
|
||||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
echo "registry=$REGISTRY" >> "$GITHUB_OUTPUT"
|
echo "registry=$REGISTRY" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "server_host=$SERVER_HOST" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Login to Gitea Container Registry
|
- name: Login to Gitea Container Registry
|
||||||
|
id: docker-login
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.GITEA_TOKEN }}" | docker login \
|
echo "${{ secrets.GITEA_TOKEN }}" | docker login \
|
||||||
"$(echo '${{ gitea.server_url }}' | sed 's|https\?://||')" \
|
"${{ steps.meta.outputs.server_host }}" \
|
||||||
-u "${{ gitea.actor }}" --password-stdin
|
-u "${{ gitea.actor }}" --password-stdin
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
|
if: steps.docker-login.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ gitea.ref_name }}"
|
TAG="${{ gitea.ref_name }}"
|
||||||
REGISTRY="${{ steps.meta.outputs.registry }}"
|
REGISTRY="${{ steps.meta.outputs.registry }}"
|
||||||
@@ -196,6 +214,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Push Docker image
|
- name: Push Docker image
|
||||||
|
if: steps.docker-login.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ gitea.ref_name }}"
|
TAG="${{ gitea.ref_name }}"
|
||||||
REGISTRY="${{ steps.meta.outputs.registry }}"
|
REGISTRY="${{ steps.meta.outputs.registry }}"
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ echo ""
|
|||||||
# ── Clean ────────────────────────────────────────────────────
|
# ── Clean ────────────────────────────────────────────────────
|
||||||
|
|
||||||
if [ -d "$DIST_DIR" ]; then
|
if [ -d "$DIST_DIR" ]; then
|
||||||
echo "[1/8] Cleaning previous build..."
|
echo "[1/9] Cleaning previous build..."
|
||||||
rm -rf "$DIST_DIR"
|
rm -rf "$DIST_DIR"
|
||||||
fi
|
fi
|
||||||
mkdir -p "$DIST_DIR"
|
mkdir -p "$DIST_DIR"
|
||||||
@@ -57,7 +57,7 @@ mkdir -p "$DIST_DIR"
|
|||||||
PYTHON_ZIP_URL="https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-embed-amd64.zip"
|
PYTHON_ZIP_URL="https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-embed-amd64.zip"
|
||||||
PYTHON_ZIP_PATH="$BUILD_DIR/python-embed-win.zip"
|
PYTHON_ZIP_PATH="$BUILD_DIR/python-embed-win.zip"
|
||||||
|
|
||||||
echo "[2/8] Downloading Windows embedded Python ${PYTHON_VERSION}..."
|
echo "[2/9] Downloading Windows embedded Python ${PYTHON_VERSION}..."
|
||||||
if [ ! -f "$PYTHON_ZIP_PATH" ]; then
|
if [ ! -f "$PYTHON_ZIP_PATH" ]; then
|
||||||
curl -sL "$PYTHON_ZIP_URL" -o "$PYTHON_ZIP_PATH"
|
curl -sL "$PYTHON_ZIP_URL" -o "$PYTHON_ZIP_PATH"
|
||||||
fi
|
fi
|
||||||
@@ -66,7 +66,7 @@ unzip -qo "$PYTHON_ZIP_PATH" -d "$PYTHON_DIR"
|
|||||||
|
|
||||||
# ── Patch ._pth to enable site-packages ──────────────────────
|
# ── Patch ._pth to enable site-packages ──────────────────────
|
||||||
|
|
||||||
echo "[3/8] Patching Python path configuration..."
|
echo "[3/9] Patching Python path configuration..."
|
||||||
PTH_FILE=$(ls "$PYTHON_DIR"/python*._pth 2>/dev/null | head -1)
|
PTH_FILE=$(ls "$PYTHON_DIR"/python*._pth 2>/dev/null | head -1)
|
||||||
if [ -z "$PTH_FILE" ]; then
|
if [ -z "$PTH_FILE" ]; then
|
||||||
echo "ERROR: Could not find python*._pth in $PYTHON_DIR" >&2
|
echo "ERROR: Could not find python*._pth in $PYTHON_DIR" >&2
|
||||||
@@ -86,76 +86,85 @@ fi
|
|||||||
echo " Patched $(basename "$PTH_FILE")"
|
echo " Patched $(basename "$PTH_FILE")"
|
||||||
|
|
||||||
# ── Bundle tkinter into embedded Python ───────────────────────
|
# ── Bundle tkinter into embedded Python ───────────────────────
|
||||||
# Embedded Python doesn't include tkinter. We download it from the
|
# Embedded Python doesn't include tkinter. We download the individual
|
||||||
# official Windows Python nuget package (same version) which contains
|
# MSI packages from python.org (tcltk.msi + lib.msi) and extract them
|
||||||
# the _tkinter.pyd, tkinter/ package, and Tcl/Tk DLLs.
|
# using msiextract (from msitools).
|
||||||
|
|
||||||
echo "[3b/8] Bundling tkinter for screen overlay support..."
|
echo "[4/9] Bundling tkinter for screen overlay support..."
|
||||||
|
|
||||||
# Python minor version for nuget package (e.g., 3.11.9 -> 3.11)
|
TK_EXTRACT="$BUILD_DIR/tk-extract"
|
||||||
PYTHON_MINOR="${PYTHON_VERSION%.*}"
|
rm -rf "$TK_EXTRACT"
|
||||||
|
mkdir -p "$TK_EXTRACT"
|
||||||
|
|
||||||
# Download the full Python nuget package (contains all stdlib + DLLs)
|
MSI_BASE="https://www.python.org/ftp/python/${PYTHON_VERSION}/amd64"
|
||||||
NUGET_URL="https://www.nuget.org/api/v2/package/python/${PYTHON_VERSION}"
|
|
||||||
NUGET_PKG="$BUILD_DIR/python-nuget.zip"
|
# Download tcltk.msi (contains _tkinter.pyd, tcl/tk DLLs, tcl8.6/, tk8.6/)
|
||||||
if [ ! -f "$NUGET_PKG" ]; then
|
TCLTK_MSI="$BUILD_DIR/tcltk.msi"
|
||||||
curl -sL "$NUGET_URL" -o "$NUGET_PKG"
|
if [ ! -f "$TCLTK_MSI" ]; then
|
||||||
|
curl -sL "$MSI_BASE/tcltk.msi" -o "$TCLTK_MSI"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NUGET_DIR="$BUILD_DIR/python-nuget"
|
# Download lib.msi (contains tkinter/ Python package in the stdlib)
|
||||||
rm -rf "$NUGET_DIR"
|
LIB_MSI="$BUILD_DIR/lib.msi"
|
||||||
mkdir -p "$NUGET_DIR"
|
if [ ! -f "$LIB_MSI" ]; then
|
||||||
unzip -qo "$NUGET_PKG" -d "$NUGET_DIR"
|
curl -sL "$MSI_BASE/lib.msi" -o "$LIB_MSI"
|
||||||
|
|
||||||
# Copy _tkinter.pyd (the C extension)
|
|
||||||
TKINTER_PYD=$(find "$NUGET_DIR" -name "_tkinter.pyd" | head -1)
|
|
||||||
if [ -n "$TKINTER_PYD" ]; then
|
|
||||||
cp "$TKINTER_PYD" "$PYTHON_DIR/"
|
|
||||||
echo " Copied _tkinter.pyd"
|
|
||||||
else
|
|
||||||
echo " WARNING: _tkinter.pyd not found in nuget package"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy tkinter Python package from the stdlib zip or Lib/
|
if command -v msiextract &>/dev/null; then
|
||||||
# The nuget package has Lib/tkinter/
|
# Extract both MSIs
|
||||||
TKINTER_PKG=$(find "$NUGET_DIR" -type d -name "tkinter" | head -1)
|
(cd "$TK_EXTRACT" && msiextract "$TCLTK_MSI" 2>/dev/null)
|
||||||
if [ -n "$TKINTER_PKG" ]; then
|
(cd "$TK_EXTRACT" && msiextract "$LIB_MSI" 2>/dev/null)
|
||||||
mkdir -p "$PYTHON_DIR/Lib"
|
|
||||||
cp -r "$TKINTER_PKG" "$PYTHON_DIR/Lib/tkinter"
|
|
||||||
echo " Copied tkinter/ package"
|
|
||||||
else
|
|
||||||
echo " WARNING: tkinter package not found in nuget package"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy Tcl/Tk DLLs (tcl86t.dll, tk86t.dll, etc.)
|
# Copy _tkinter.pyd
|
||||||
for dll in tcl86t.dll tk86t.dll; do
|
TKINTER_PYD=$(find "$TK_EXTRACT" -name "_tkinter.pyd" 2>/dev/null | head -1)
|
||||||
DLL_PATH=$(find "$NUGET_DIR" -name "$dll" | head -1)
|
if [ -n "$TKINTER_PYD" ]; then
|
||||||
if [ -n "$DLL_PATH" ]; then
|
cp "$TKINTER_PYD" "$PYTHON_DIR/"
|
||||||
cp "$DLL_PATH" "$PYTHON_DIR/"
|
echo " Copied _tkinter.pyd"
|
||||||
echo " Copied $dll"
|
else
|
||||||
|
echo " WARNING: _tkinter.pyd not found in tcltk.msi"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
# Copy Tcl/Tk data directories (tcl8.6, tk8.6)
|
# Copy Tcl/Tk DLLs
|
||||||
for tcldir in tcl8.6 tk8.6; do
|
for dll in tcl86t.dll tk86t.dll; do
|
||||||
TCL_PATH=$(find "$NUGET_DIR" -type d -name "$tcldir" | head -1)
|
DLL_PATH=$(find "$TK_EXTRACT" -name "$dll" 2>/dev/null | head -1)
|
||||||
if [ -n "$TCL_PATH" ]; then
|
if [ -n "$DLL_PATH" ]; then
|
||||||
cp -r "$TCL_PATH" "$PYTHON_DIR/$tcldir"
|
cp "$DLL_PATH" "$PYTHON_DIR/"
|
||||||
echo " Copied $tcldir/"
|
echo " Copied $dll"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Copy tkinter Python package
|
||||||
|
TKINTER_PKG=$(find "$TK_EXTRACT" -type d -name "tkinter" 2>/dev/null | head -1)
|
||||||
|
if [ -n "$TKINTER_PKG" ]; then
|
||||||
|
mkdir -p "$PYTHON_DIR/Lib"
|
||||||
|
cp -r "$TKINTER_PKG" "$PYTHON_DIR/Lib/tkinter"
|
||||||
|
echo " Copied tkinter/ package"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
# Copy tcl/tk data directories
|
||||||
|
for tcldir in tcl8.6 tk8.6; do
|
||||||
|
TCL_PATH=$(find "$TK_EXTRACT" -type d -name "$tcldir" 2>/dev/null | head -1)
|
||||||
|
if [ -n "$TCL_PATH" ]; then
|
||||||
|
cp -r "$TCL_PATH" "$PYTHON_DIR/$tcldir"
|
||||||
|
echo " Copied $tcldir/"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo " tkinter bundled successfully"
|
||||||
|
else
|
||||||
|
echo " WARNING: msiextract not found — skipping tkinter (install msitools)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add Lib to ._pth so tkinter package is importable
|
# Add Lib to ._pth so tkinter package is importable
|
||||||
if ! grep -q '^Lib$' "$PTH_FILE"; then
|
if ! grep -q '^Lib$' "$PTH_FILE"; then
|
||||||
echo 'Lib' >> "$PTH_FILE"
|
echo 'Lib' >> "$PTH_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "$NUGET_DIR"
|
rm -rf "$TK_EXTRACT"
|
||||||
echo " tkinter bundled successfully"
|
|
||||||
|
|
||||||
# ── Download pip and install into embedded Python ────────────
|
# ── Download pip and install into embedded Python ────────────
|
||||||
|
|
||||||
echo "[4/8] Installing pip into embedded Python..."
|
echo "[5/9] Installing pip into embedded Python..."
|
||||||
SITE_PACKAGES="$PYTHON_DIR/Lib/site-packages"
|
SITE_PACKAGES="$PYTHON_DIR/Lib/site-packages"
|
||||||
mkdir -p "$SITE_PACKAGES"
|
mkdir -p "$SITE_PACKAGES"
|
||||||
|
|
||||||
@@ -177,7 +186,7 @@ done
|
|||||||
|
|
||||||
# ── Download Windows wheels for all dependencies ─────────────
|
# ── Download Windows wheels for all dependencies ─────────────
|
||||||
|
|
||||||
echo "[5/8] Downloading Windows dependencies..."
|
echo "[6/9] Downloading Windows dependencies..."
|
||||||
WHEEL_DIR="$BUILD_DIR/win-wheels"
|
WHEEL_DIR="$BUILD_DIR/win-wheels"
|
||||||
mkdir -p "$WHEEL_DIR"
|
mkdir -p "$WHEEL_DIR"
|
||||||
|
|
||||||
@@ -280,14 +289,14 @@ echo " Installed $WHEEL_COUNT packages"
|
|||||||
|
|
||||||
# ── Build frontend ───────────────────────────────────────────
|
# ── Build frontend ───────────────────────────────────────────
|
||||||
|
|
||||||
echo "[6/8] Building frontend bundle..."
|
echo "[7/9] Building frontend bundle..."
|
||||||
(cd "$SERVER_DIR" && npm ci --loglevel error && npm run build) 2>&1 | {
|
(cd "$SERVER_DIR" && npm ci --loglevel error && npm run build) 2>&1 | {
|
||||||
grep -v 'RemoteException' || true
|
grep -v 'RemoteException' || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── Copy application files ───────────────────────────────────
|
# ── Copy application files ───────────────────────────────────
|
||||||
|
|
||||||
echo "[7/8] Copying application files..."
|
echo "[8/9] Copying application files..."
|
||||||
mkdir -p "$APP_DIR"
|
mkdir -p "$APP_DIR"
|
||||||
|
|
||||||
cp -r "$SERVER_DIR/src" "$APP_DIR/src"
|
cp -r "$SERVER_DIR/src" "$APP_DIR/src"
|
||||||
@@ -300,7 +309,7 @@ find "$APP_DIR" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|||||||
|
|
||||||
# ── Create launcher ──────────────────────────────────────────
|
# ── Create launcher ──────────────────────────────────────────
|
||||||
|
|
||||||
echo "[8/8] Creating launcher and packaging..."
|
echo "[8b/9] Creating launcher and packaging..."
|
||||||
|
|
||||||
cat > "$DIST_DIR/LedGrab.bat" << LAUNCHER
|
cat > "$DIST_DIR/LedGrab.bat" << LAUNCHER
|
||||||
@echo off
|
@echo off
|
||||||
@@ -390,8 +399,29 @@ rm -f "$ZIP_PATH"
|
|||||||
(cd "$BUILD_DIR" && zip -rq "$ZIP_NAME" "$DIST_NAME")
|
(cd "$BUILD_DIR" && zip -rq "$ZIP_NAME" "$DIST_NAME")
|
||||||
|
|
||||||
ZIP_SIZE=$(du -h "$ZIP_PATH" | cut -f1)
|
ZIP_SIZE=$(du -h "$ZIP_PATH" | cut -f1)
|
||||||
|
|
||||||
|
# ── Build NSIS installer (if makensis is available) ──────────
|
||||||
|
|
||||||
|
SETUP_NAME="LedGrab-v${VERSION_CLEAN}-win-x64-setup.exe"
|
||||||
|
SETUP_PATH="$BUILD_DIR/$SETUP_NAME"
|
||||||
|
|
||||||
|
if command -v makensis &>/dev/null; then
|
||||||
|
echo "[9/9] Building NSIS installer..."
|
||||||
|
makensis -DVERSION="${VERSION_CLEAN}" "$SCRIPT_DIR/installer.nsi"
|
||||||
|
if [ -f "$SETUP_PATH" ]; then
|
||||||
|
SETUP_SIZE=$(du -h "$SETUP_PATH" | cut -f1)
|
||||||
|
echo " Installer: $SETUP_PATH ($SETUP_SIZE)"
|
||||||
|
else
|
||||||
|
echo " WARNING: makensis ran but installer not found at $SETUP_PATH"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "[9/9] Skipping installer (makensis not found — install nsis to enable)"
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Build complete ==="
|
echo "=== Build complete ==="
|
||||||
echo " Archive: $ZIP_PATH"
|
echo " ZIP: $ZIP_PATH ($ZIP_SIZE)"
|
||||||
echo " Size: $ZIP_SIZE"
|
if [ -f "$SETUP_PATH" ]; then
|
||||||
|
echo " Installer: $SETUP_PATH ($SETUP_SIZE)"
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
146
installer.nsi
Normal file
146
installer.nsi
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
; LedGrab NSIS Installer Script
|
||||||
|
; Cross-compilable on Linux: apt install nsis && makensis installer.nsi
|
||||||
|
;
|
||||||
|
; Expects the portable build to already exist at build/LedGrab/
|
||||||
|
; (run build-dist-windows.sh first)
|
||||||
|
|
||||||
|
!include "MUI2.nsh"
|
||||||
|
!include "FileFunc.nsh"
|
||||||
|
|
||||||
|
; ── Metadata ────────────────────────────────────────────────
|
||||||
|
|
||||||
|
!define APPNAME "LedGrab"
|
||||||
|
!define DESCRIPTION "Ambient lighting system — captures screen content and drives LED strips in real time"
|
||||||
|
!define VERSIONMAJOR 0
|
||||||
|
!define VERSIONMINOR 1
|
||||||
|
!define VERSIONBUILD 0
|
||||||
|
|
||||||
|
; Set from command line: makensis -DVERSION=0.1.0 installer.nsi
|
||||||
|
!ifndef VERSION
|
||||||
|
!define VERSION "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
Name "${APPNAME} v${VERSION}"
|
||||||
|
OutFile "build\${APPNAME}-v${VERSION}-win-x64-setup.exe"
|
||||||
|
InstallDir "$LOCALAPPDATA\${APPNAME}"
|
||||||
|
InstallDirRegKey HKCU "Software\${APPNAME}" "InstallDir"
|
||||||
|
RequestExecutionLevel user
|
||||||
|
SetCompressor /SOLID lzma
|
||||||
|
|
||||||
|
; ── Modern UI Configuration ─────────────────────────────────
|
||||||
|
|
||||||
|
!define MUI_ABORTWARNING
|
||||||
|
|
||||||
|
; ── Pages ───────────────────────────────────────────────────
|
||||||
|
|
||||||
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
!insertmacro MUI_PAGE_COMPONENTS
|
||||||
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
!insertmacro MUI_UNPAGE_INSTFILES
|
||||||
|
|
||||||
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
|
||||||
|
; ── Installer Sections ──────────────────────────────────────
|
||||||
|
|
||||||
|
Section "!${APPNAME} (required)" SecCore
|
||||||
|
SectionIn RO
|
||||||
|
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
|
||||||
|
; Copy the entire portable build
|
||||||
|
File /r "build\LedGrab\python"
|
||||||
|
File /r "build\LedGrab\app"
|
||||||
|
File "build\LedGrab\LedGrab.bat"
|
||||||
|
|
||||||
|
; Create data and logs directories
|
||||||
|
CreateDirectory "$INSTDIR\data"
|
||||||
|
CreateDirectory "$INSTDIR\logs"
|
||||||
|
|
||||||
|
; Create uninstaller
|
||||||
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
; Start Menu shortcuts
|
||||||
|
CreateDirectory "$SMPROGRAMS\${APPNAME}"
|
||||||
|
CreateShortcut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\LedGrab.bat" \
|
||||||
|
"" "" "" SW_SHOWMINIMIZED "" "${DESCRIPTION}"
|
||||||
|
CreateShortcut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
; Registry: install location + Add/Remove Programs entry
|
||||||
|
WriteRegStr HKCU "Software\${APPNAME}" "InstallDir" "$INSTDIR"
|
||||||
|
WriteRegStr HKCU "Software\${APPNAME}" "Version" "${VERSION}"
|
||||||
|
|
||||||
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"DisplayName" "${APPNAME}"
|
||||||
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"DisplayVersion" "${VERSION}"
|
||||||
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"InstallLocation" "$INSTDIR"
|
||||||
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"Publisher" "Alexei Dolgolyov"
|
||||||
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"URLInfoAbout" "https://git.dolgolyov-family.by/alexei.dolgolyov/wled-screen-controller-mixed"
|
||||||
|
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"NoModify" 1
|
||||||
|
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"NoRepair" 1
|
||||||
|
|
||||||
|
; Calculate installed size for Add/Remove Programs
|
||||||
|
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||||
|
IntFmt $0 "0x%08X" $0
|
||||||
|
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
|
||||||
|
"EstimatedSize" "$0"
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Desktop shortcut" SecDesktop
|
||||||
|
CreateShortcut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\LedGrab.bat" \
|
||||||
|
"" "" "" SW_SHOWMINIMIZED "" "${DESCRIPTION}"
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Start with Windows" SecAutostart
|
||||||
|
CreateShortcut "$SMSTARTUP\${APPNAME}.lnk" "$INSTDIR\LedGrab.bat" \
|
||||||
|
"" "" "" SW_SHOWMINIMIZED "" "${DESCRIPTION}"
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
; ── Section Descriptions ────────────────────────────────────
|
||||||
|
|
||||||
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecCore} \
|
||||||
|
"Install ${APPNAME} server and all required files."
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} \
|
||||||
|
"Create a shortcut on your desktop."
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecAutostart} \
|
||||||
|
"Start ${APPNAME} automatically when you log in."
|
||||||
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||||
|
|
||||||
|
; ── Uninstaller ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
Section "Uninstall"
|
||||||
|
; Remove shortcuts
|
||||||
|
Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
|
||||||
|
Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
|
||||||
|
RMDir "$SMPROGRAMS\${APPNAME}"
|
||||||
|
Delete "$DESKTOP\${APPNAME}.lnk"
|
||||||
|
Delete "$SMSTARTUP\${APPNAME}.lnk"
|
||||||
|
|
||||||
|
; Remove application files (but NOT data/ — preserve user config)
|
||||||
|
RMDir /r "$INSTDIR\python"
|
||||||
|
RMDir /r "$INSTDIR\app"
|
||||||
|
Delete "$INSTDIR\LedGrab.bat"
|
||||||
|
Delete "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
; Remove logs (but keep data/)
|
||||||
|
RMDir /r "$INSTDIR\logs"
|
||||||
|
|
||||||
|
; Try to remove install dir (only succeeds if empty — data/ may remain)
|
||||||
|
RMDir "$INSTDIR"
|
||||||
|
|
||||||
|
; Remove registry keys
|
||||||
|
DeleteRegKey HKCU "Software\${APPNAME}"
|
||||||
|
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
|
||||||
|
SectionEnd
|
||||||
Reference in New Issue
Block a user