build: package haul.exe with an embedded icon
A plain `go build` links no icon resource, so Explorer and the Start menu draw the generic executable glyph. Inno's SetupIconFile only skins setup.exe, so the fix has to happen at build time: `fyne package` turns cmd/haul/Icon.png into a .syso and links it in, and adds -H=windowsgui itself. Documents the installer build alongside it, since the two steps are only useful together. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -250,6 +250,59 @@ xattr -dr com.apple.quarantine /Applications/haul.app
|
||||
Signing and notarising properly needs a paid Apple Developer ID, after which
|
||||
`fyne release --target darwin --certificate <name>` handles it.
|
||||
|
||||
### Packaging on Windows
|
||||
|
||||
The `go build` command [above](#building-on-windows) produces a working
|
||||
`haul.exe`, but one with **no icon** — Explorer, the taskbar and the Start menu
|
||||
all draw the generic executable glyph. A Windows binary carries its icon as a
|
||||
linked resource, and the Go compiler has nothing to link unless you give it a
|
||||
`.syso`. `fyne package` builds one:
|
||||
|
||||
```powershell
|
||||
go run fyne.io/tools/cmd/fyne@v1.7.2 package --target windows --src .\cmd\haul --release
|
||||
Move-Item .\cmd\haul\haul.exe .\bin\haul.exe
|
||||
```
|
||||
|
||||
Or, from the MSYS2 shell with `make` installed, `make package-windows`.
|
||||
|
||||
That converts `cmd/haul/Icon.png` to an icon resource, links it in, and adds
|
||||
`-H=windowsgui` itself — so unlike the manual build you don't pass any linker
|
||||
flags. It writes the binary *beside the source* as `cmd\haul\haul.exe`, hence
|
||||
the move: `Inno-compile.iss` expects it in `bin\`. As on macOS, `fyne package`
|
||||
rewrites `cmd/haul/FyneApp.toml` in place and bumps `Build`.
|
||||
|
||||
#### The installer
|
||||
|
||||
`Inno-compile.iss` wraps that binary in a setup program. Install [Inno
|
||||
Setup](https://jrsoftware.org/isdl.php) (`winget install JRSoftware.InnoSetup`),
|
||||
then from the repo root:
|
||||
|
||||
```powershell
|
||||
iscc Inno-compile.iss
|
||||
```
|
||||
|
||||
That writes `Output\haul-0.1.0-setup-x64.exe`. Every `Source:` path in the
|
||||
script is relative to the script itself, so it compiles from any clone — but it
|
||||
packages whatever is in `bin\` at that moment, and does not build anything
|
||||
itself. Run the packaging step above first.
|
||||
|
||||
It installs per-user into `%LOCALAPPDATA%\Programs\Haul`, so it needs no
|
||||
administrator rights and prompts for no UAC elevation.
|
||||
|
||||
The wizard offers two install types. **Standard** installs `haul.exe` alone.
|
||||
**Remote Desktop / virtual machine** adds every DLL from `bin\` as the optional
|
||||
`mesa` component — the software OpenGL renderer described
|
||||
[below](#running-over-remote-desktop-or-in-a-vm). That split is deliberate and
|
||||
worth keeping: those DLLs override the system OpenGL for anything in the same
|
||||
folder, so installing them by default would force software rendering on machines
|
||||
with a perfectly good GPU. Populate `bin\` with the Mesa DLLs only when you
|
||||
intend to build an installer that offers them.
|
||||
|
||||
Note that `cmd\haul\Icon.ico` is used by Inno for `setup.exe`'s own icon. The
|
||||
icon inside `haul.exe` comes from `Icon.png` via `fyne package` — the two are
|
||||
separate, and dropping the packaging step leaves you with a nicely-iconed
|
||||
installer that installs an icon-less application.
|
||||
|
||||
### Running over Remote Desktop (or in a VM)
|
||||
|
||||
A build that compiles perfectly will still fail to start in an RDP session with:
|
||||
@@ -315,7 +368,8 @@ Software rendering is slower than a GPU, but haul draws two tables and some text
|
||||
| `make run-xvfb` | Build, then run against a virtual X display |
|
||||
| `make dist` | Release binary into `./dist` |
|
||||
| `make package-darwin` | macOS `.app` bundle into `./haul.app` (run on a Mac) |
|
||||
| `make clean` | Remove `bin/`, `dist/` and `haul.app/` |
|
||||
| `make package-windows` | `bin/haul.exe` with an embedded icon (run on Windows) |
|
||||
| `make clean` | Remove `bin/`, `dist/`, `haul.app/` and `Output/` |
|
||||
|
||||
The Makefile picks up a Go toolchain at `~/.local/go/bin/go` if one is there,
|
||||
falling back to whatever `go` is on `PATH` — so it works on machines where Go
|
||||
|
||||
Reference in New Issue
Block a user