app: windows automated build script

This commit is contained in:
jkds
2026-01-08 11:33:51 +01:00
parent 54974eeada
commit 037172617d
4 changed files with 133 additions and 1 deletions

View File

@@ -52,6 +52,16 @@ android-debug: $(SRC) fonts assets/forest_720x1280.mp4
podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build $(DEBUG_FEATURES)
-mv $(DEBUG_APK) darkfi-app_debug.apk
# Windows cross-compilation using Docker/Podman
win-docker-release: $(SRC)
podman run -v $(shell pwd):/root/build -w /root/build/ -t windows \
cargo build --release --target x86_64-pc-windows-gnu $(RELEASE_FEATURES)
./release/win/package.sh release
win-docker-debug: $(SRC)
podman run -v $(shell pwd):/root/build -w /root/build/ -t windows \
cargo build --target x86_64-pc-windows-gnu $(DEBUG_FEATURES)
./release/win/package.sh debug
build-release: $(SRC) fonts assets/forest_1920x1080.ivf
$(CARGO) build --release $(RELEASE_FEATURES)
-mv target/release/darkfi-app .

View File

@@ -1,4 +1,42 @@
# Windows Build Guide (MSVC)
# Windows Build Guide
## Automated Cross-Compilation (Recommended)
The easiest way to build for Windows from Linux is using Docker/Podman with cross-compilation. This eliminates the need for a Windows VM.
### Prerequisites
- Podman (or Docker)
- Make
### Build Instructions
```bash
# Build the Windows cross-compilation container
podman build -t windows -f Dockerfile.windows .
# Build Windows release
make win-docker-release
# Output files:
# - darkfi-win64-release.zip (portable archive)
# - darkfi-win64-release-installer.exe (installer with shortcuts)
```
### Distribution
- **ZIP archive**: Extract and run `darkfi-app.exe` - no installation required
- **Installer**: Run `darkfi-win64-release-installer.exe` for proper installation with Start Menu/Desktop shortcuts
### Debug Builds
```bash
make win-docker-debug
```
---
## Manual VM Build (Legacy)
Skip the first step if you're already using Windows.

View File

@@ -0,0 +1,52 @@
!define APPNAME "DarkFi"
!define COMPANYNAME "Dyne.org"
!define DESCRIPTION "DarkFi UI App"
!define VERSIONMAJOR 0
!define VERSIONMINOR 1
!define VERSIONBUILD 0
!define HELPURL "https://dark.fi"
!define UPDATEURL "https://dark.fi"
!define ABOUTURL "https://dark.fi"
!define INSTALLSIZE 100000
!define VERSION "@VERSION@"
!define DIST_DIR "@DIST_DIR@"
!define OUTPUT_FILE "@OUTPUT_FILE@"
RequestExecutionLevel admin
InstallDir "$PROGRAMFILES\${APPNAME}"
Page directory
Page instfiles
Section "install"
SetOutPath $INSTDIR
File /r "${DIST_DIR}\*"
; Desktop shortcut
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\darkfi-app.exe"
; Start Menu shortcut
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\darkfi-app.exe"
; Uninstaller
WriteUninstaller "$INSTDIR\uninstall.exe"
; Add to Add/Remove Programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${COMPANYNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSION}"
SectionEnd
Section "uninstall"
Delete "$DESKTOP\${APPNAME}.lnk"
RMDir /r "$SMPROGRAMS\${APPNAME}"
RMDir /r $INSTDIR
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
SectionEnd
!finalize "${OUTPUT_FILE}"

32
bin/app/release/win/package.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
set -e
VERSION=${1:-"dev"}
DIST_DIR="darkfi-win64-${VERSION}"
rm -rf "${DIST_DIR}"
mkdir -p "${DIST_DIR}"
# Copy binary
cp target/x86_64-pc-windows-gnu/release/darkfi-app.exe "${DIST_DIR}/"
# Copy assets
cp -r assets "${DIST_DIR}/"
# Create README
cat > "${DIST_DIR}/README.txt" <<EOF
DarkFi App v${VERSION}
To run: double-click darkfi-app.exe
EOF
# Create ZIP
zip -r "${DIST_DIR}.zip" "${DIST_DIR}"
echo "Created: ${DIST_DIR}.zip"
# Create NSIS installer
makensis -DVERSION="${VERSION}" -DDIST_DIR="${DIST_DIR}" \
-DOUTPUT_FILE="darkfi-win64-${VERSION}-installer.exe" \
release/win/installer.nsi
echo "Created: darkfi-win64-${VERSION}-installer.exe"
rm -rf "${DIST_DIR}"