1# Building from Source for Windows 2 3Building on Windows is complicated due to the required 3rd party libraries. 4As a result, the Windows build is done on Linux using a cross-compile and 5Wine to run the regression tests. 6Alternatively, this procedure is also done on [Ubuntu 20.04 LTS on Windows](https://www.microsoft.com/en-us/p/ubuntu-2004-lts/9n6svws3rx71?activetab=pivot:overviewtab) 7 8## install dependencies 9 10First, make sure that 32-bit builds work and install dependencies: 11 12```sh 13sudo dpkg --add-architecture i386 14sudo apt-get update 15sudo apt-get install build-essential autoconf pkg-config libtool mtools unzip zip xdelta3 wine wine-binfmt gcc-mingw-w64-x86-64 16 17# I had to manually import the wine binfmt description on one install. You'll 18# know this is an issue if running `fwup.exe` doesn't work. 19sudo update-binfmts --import /usr/share/binfmts/wine 20``` 21 22## build executable 23 24Then, run a static build using the mingw compiler: 25 26```sh 27export CROSS_COMPILE=x86_64-w64-mingw32 28export CC=$CROSS_COMPILE-gcc 29 30./autogen.sh # only necessary if building from a git source tree 31./scripts/build_static.sh 32``` 33 34When all tests passed (or skipped), you successfully get a `fwup.exe` on the current directory. 35 36## build nupkg for Chocolatey 37 38If you'd like to build an `fwup.*.nupkg` for Chocolatey, try running the 39build_pkg.sh script. Chocolatey is tricky to install, so see 40scripts/ubuntu_install_chocolatey.sh if something goes wrong. 41 42```sh 43./scripts/build_pkg.sh 44``` 45 46The script should exit successfully and you should have a `fwup.*.nupkg` Chocolatey package. 47You may set `$DISPLAY` to avoid an error about `Wine Mono is not installed`. 48 49To install a pre-release Chocolatey Package: 50 51```sh 52choco install fwup.*.nupkg -pre 53``` 54