dcrdex icon indicating copy to clipboard operation
dcrdex copied to clipboard

dexc-desktop: Windows builder, installer

Open peterzen opened this issue 1 year ago • 10 comments

This PR implements the build environment for Windows:

  • window and tray icons (incorporates/supersedes @chappjc 's #2351)
  • script that automates setting up the build toolchain/environment/dependencies
  • MSI (Windows Installer) builder

Tested on Windows 10, Windows 11, Windows 2019/2022

peterzen avatar Dec 17 '23 16:12 peterzen

Uhmm, @peterzen what's the correct cmd to use?

this? curl -O https://raw.githubusercontent.com/peterzen/dcrdex/windows_build/client/cmd/dexc-desktop/pkg/setup-windows.cmd

ukane-philemon avatar Jan 14 '24 23:01 ukane-philemon

Uhmm, @peterzen what's the correct cmd to use?

this? curl -O https://raw.githubusercontent.com/peterzen/dcrdex/windows_build/client/cmd/dexc-desktop/pkg/setup-windows.cmd

curl -O https://github.com/peterzen/dcrdex/blob/windows-build/client/cmd/dexc-desktop/pkg/setup-windows.cmd

peterzen avatar Jan 15 '24 19:01 peterzen

Tried to run from the normal windows cmd but got this error:

C:\Windows\system32>setup-windows.cmd

C:\Windows\system32>{"payload":{"allShortcutsEnabled":false,"fileTree":{"client/cmd/dexc-desktop/pkg":{"items":[{"name":"windows-msi","path":"client/cmd/dexc-desktop/pkg/windows-msi","contentType":"directory"},{"name":"Build-Windows.md","path":"client/cmd/dexc-desktop/pkg/Build-Windows.md","contentType":"file"},{"name":"build-windows.cmd","path":"client/cmd/dexc-desktop/pkg/build-windows.cmd","contentType":"file"},{"name":"create-dmg.sh","path":"client/cmd/dexc-desktop/pkg/create-dmg.sh","contentType":"file"},{"name":"makecert.ps1","path":"client/cmd/dexc-desktop/pkg/makecert.ps1","contentType":"file"},{"name":"pkg-darwin.sh","path":"client/cmd/dexc-desktop/pkg/pkg-darwin.sh","contentType":"file"},{"name":"pkg-debian.sh","path":"client/cmd/dexc-desktop/pkg/pkg-debian.sh","contentType":"file"},{"name":"pkg-windows.cmd","path":"client/cmd/dexc-desktop/pkg/pkg-windows.cmd","contentType":"file"},{"name":"setup-windows-stage2.ps1","path":"client/cmd/dexc-desktop/pkg/setup-windows-stage2.ps1","contentType":"file"},{"name":"setup-windows.cmd","path":"client/cmd/dexc-desktop/pkg/setup-windows.cmd","contentType":"file"},{"name":"sign-windows.cmd","path":"client/cmd/dexc-desktop/pkg/sign-windows.cmd","contentType":"file"},{"name":"template.applescript","path":"client/cmd/dexc-desktop/pkg/template.applescript","contentType":"file"}],"totalCount":12},"client/cmd/dexc-desktop":{"items":[{"name":"pkg","path":"client/cmd/dexc-desktop/pkg","contentType":"directory"},{"name":"src","path":"client/cmd/dexc-desktop/src","contentType":"directory"},{"name":".gitignore","path":"client/cmd/dexc-desktop/.gitignore","contentType":"file"},{"name":"README.md","path":"client/cmd/dexc-desktop/README.md","contentType":"file"},{"name":"app.go","path":"client/cmd/dexc-desktop/app.go","contentType":"file"},{"name":"app_darwin.go","path":"client/cmd/dexc-desktop/app_darwin.go","contentType":"file"},{"name":"config.go","path":"client/cmd/dexc-desktop/config.go","contentType":"file"},{"name":"gen.go","path":"client/cmd/dexc-desktop/gen.go","contentType":"file"},{"name":"go.mod","path":"client/cmd/dexc-desktop/go.mod","contentType":"file"},{"name":"go.sum","path":"client/cmd/dexc-desktop/go.sum","contentType":"file"},{"name":"icon.go","path":"client/cmd/dexc-desktop/icon.go","contentType":"file"},{"name":"icon_darwin.go","path":"client/cmd/dexc-desktop/icon_darwin.go","contentType":"file"},{"name":"icon_linux.go","path":"client/cmd/dexc-desktop/icon_linux.go","contentType":"file"},{"name":"icon_windows.go","path":"client/cmd/dexc-desktop/icon_windows.go","contentType":"file"},{"name":"main.go","path":"client/cmd/dexc-desktop/main.go","contentType":"file"},{"name":"rsrc_windows_386.syso","path":"client/cmd/dexc-desktop/rsrc_windows_386.syso","contentType":"file"},{"name":"rsrc_windows_amd64.syso","path":"client/cmd/dexc-desktop/rsrc_windows_amd64.syso","contentType":"file"},{"name":"syncserver.go","path":"client/cmd/dexc-desktop/syncserver.go","contentType":"file"},{"name":"winres.json","path":"client/cmd/dexc-desktop/winres.json","contentType":"file"}],"totalCount":19},"client/cmd":{"items":[{"name":"assetseed","path":"client/cmd/assetseed","contentType":"directory"},{"name":"dexc-desktop","path":"client/cmd/dexc-desktop","contentType":"directory"},{"name":"dexc","path":"client/cmd/dexc","contentType":"directory"},{"name":"dexcctl","path":"client/cmd/dexcctl","contentType":"directory"},{"name":"simnet-trade-tests","path":"client/cmd/simnet-trade-tests","contentType":"directory"},{"name":"testbinance","path":"client/cmd/testbinance","contentType":"directory"}],"totalCount":6},"client":{"items":[{"name":"app","path":"client/app","contentType":"directory"},{"name":"asset","path":"client/asset","contentType":"directory"},{"name":"cmd","path":"client/cmd","contentType":"directory"},{"name":"comms","path":"client/comms","contentType":"directory"},{"name":"core","path":"client/core","contentType":"directory"},{"name":"db","path":"client/db","contentType":"directory"},{"name":"mm","path":"client/mm","contentType":"directory"},{"name":"orderbook","path":"client/orderbook","contentType":"directory"},{"name":"rpcserver","path":"client/rpcserver","contentType":"directory"},{"name":"webserver","path":"client/webserver","contentType":"directory"},{"name":"websocket","path":"client/websocket","contentType":"directory"},{"name":"Dockerfile","path":"client/Dockerfile","contentType":"file"},{"name":"Dockerfile.release","path":"client/Dockerfile.release","contentType":"file"}],"totalCount":13},"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":"client","path":"client","contentType":"directory"},{"name":"dex","path":"dex","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"server","path":"server","contentType":"directory"},{"name":"spec","path":"spec","contentType":"directory"},{"name":".dockerignore","path":".dockerignore","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".golangci.yml","path":".golangci.yml","contentType":"file"},{"name":".markdownlint.json","path":".markdownlint.json","contentType":"file"},{"name":"AUTHORS","path":"AUTHORS","contentType":"file"},{"name":"LICENSE.md","path":"LICENSE.md","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"go.mod","path":"go.mod","contentType":"file"},{"name":"go.sum","path":"go.sum","contentType":"file"},{"name":"pkg.sh","path":"pkg.sh","contentType":"file"},{"name":"run_tests.sh","path":"run_tests.sh","contentType":"file"}],"totalCount":17}},"fileTreeProcessingTime":17.728129,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":312919554,"defaultBranch":"master","name":"dcrdex","ownerLogin":"peterzen","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2020-11-14T23:15:57.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/5878500?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"windows-build","listCacheKey":"v0:1705019983.0","canEdit":false,"refType":"branch","currentOid":"33f37e042ff88b3489745b2958a9c0d54d8af31c"},"path":"client/cmd/dexc-desktop/pkg/setup-windows.cmd","currentUser":null,"blob":{"rawLines":[":: This script bootstraps the build environment for Windows.  It installs git and",":: PowerShell, clones the dcrdex repo and runs the setup-windows-stage2.ps1 script ",":: which will install the toolchain and libraries required for the build.","::",":: Running the script:",":: setup-windows.cmd <repoBranch> <repoUrl> ","::",":: Both parameters are optional.  If not provided, https://github.com/decred/dcrdex@master",":: will be cloned.","","@echo off","","set GitVersion=2.43.0","set PowerShellVersion=7.4.0","","if \"\" neq \"\" (","    set repoBranch=",") else (","    set repoBranch=master",")","","if \"\" neq \"\" (","    set repoUrl=",") else (","    set repoUrl=https://github.com/decred/dcrdex",")","","@echo Installing git... ","set GitInstaller=Git--64-bit.exe","curl -sLO https://github.com/git-for-windows/git/releases/download/v.windows.1/","",":: Create a silent install file","(","  echo [Setup]","  echo Lang=default","  echo Dir=C:\\Program Files\\Git","  echo Group=Git","  echo NoIcons=0","  echo SetupType=default","  echo Components=ext,ext\\shellhere,ext\\guihere,gitlfs,assoc,assoc_sh,scalar","  echo Tasks=","  echo EditorOption=VIM","  echo CustomEditorPath=","  echo DefaultBranchOption= ","  echo PathOption=Cmd","  echo SSHOption=OpenSSH","  echo TortoiseOption=false","  echo CURLOption=OpenSSL","  echo CRLFOption=CRLFCommitAsIs","  echo BashTerminalOption=MinTTY","  echo GitPullBehaviorOption=Rebase","  echo UseCredentialManager=Enabled","  echo PerformanceTweaksFSCache=Enabled","  echo EnableSymlinks=Disabled","  echo EnablePseudoConsoleSupport=Disabled","  echo EnableFSMonitor=Disabled",") > git_install_options.ini","","start /wait  /VERYSILENT /NORESTART /NOCANCEL /LOADINF=git_install_options.ini","","if 0 neq 0 (","    echo Installation failed.","    exit /b 1",")","del ","del git_install_options.ini","",":: Install PowerShell","@echo Installing PowerShell...","set PowerShellInstaller=PowerShell--win-x64.msi","curl -OLs
The filename, directory name, or volume label syntax is incorrect.

Maybe it has to do with this: Install PowerShell","@echo Installing PowerShell...","set PowerShellInstaller=PowerShell--win-x64.msi","curl -OLs The filename, directory name, or volume label syntax is incorrect?

ukane-philemon avatar Jan 15 '24 19:01 ukane-philemon

Maybe it has to do with this: Install PowerShell","@echo Installing PowerShell...","set PowerShellInstaller=PowerShell--win-x64.msi","curl -OLs The filename, directory name, or volume label syntax is incorrect?

Apologies, that URL wasn't correct - you need to get the raw script. The documentation points to the correct URL but to the decred/dcrdex repo but for testing the PR that must be adjusted.

curl -O https://raw.githubusercontent.com/peterzen/dcrdex/windows-build/client/cmd/dexc-desktop/pkg/setup-windows.cmd

peterzen avatar Jan 16 '24 13:01 peterzen

curl -O https://raw.githubusercontent.com/peterzen/dcrdex/windows-build/client/cmd/dexc-desktop/pkg/setup-windows.cmd

The build file was downloaded successfully but git failed to install (Windows 10): Screenshot 2024-01-16 at 3 22 24 PM

ukane-philemon avatar Jan 16 '24 14:01 ukane-philemon

The build file was downloaded successfully but git failed to install (Windows 10):

Could you doblecheck that a file named git_install_options.ini exists in the current directory? If not, it may be a permission issue in \Windows\system32 - if it's not there, could you move the setup-windows.cmd to another directory (e.g. \Users\Administrator) and run it from there?

Edit: I was able to reproduce this when running in \Windows\system32 - the command should be run in the Admin home directory. I'll update the documentation.

peterzen avatar Jan 16 '24 14:01 peterzen

Okay, will check and try again.

ukane-philemon avatar Jan 16 '24 15:01 ukane-philemon

Okay, will check and try again.

Thanks. I've updated the script to change to %UserProfile%.

peterzen avatar Jan 16 '24 15:01 peterzen

Could you doblecheck that a file named git_install_options.ini exists in the current directory?

It's there. Maybe I should delete this yh?

C:\Windows\system32>dir /s git_install_options.ini
 Volume in drive C has no label.
 Volume Serial Number is 74A5-A215

 Directory of C:\Windows\system32

16/01/2024  15:21               542 git_install_options.ini
               1 File(s)            542 bytes

     Total Files Listed:
               1 File(s)            542 bytes
               0 Dir(s)  47,346,356,224 bytes free

C:\Windows\system32>

ukane-philemon avatar Jan 16 '24 22:01 ukane-philemon

Could you doblecheck that a file named git_install_options.ini exists in the current directory?

It's there. Maybe I should delete this yh?

Yes, though it doesn't hurt. The script now has a fix, basically it needs to be run from any writable directory, e.g. %UserProfile%

peterzen avatar Jan 17 '24 05:01 peterzen