Unbound: Build (Cross compile on Fedora) it for Windows

Hi,

here are the steps to cross compile the Windows executables for unbound from source on (Fedora 42) linux.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
michael@feddev ~ # sudo dnf install mingw32-binutils mingw32-cpp mingw32-filesystem mingw32-gcc mingw32-openssl mingw32-openssl-static zip mingw32-termcap mingw32-zlib mingw32-zlib-static mingw32-nsis perl-FindBin perl-IPC-Cmd perl-File-Compare perl-File-Copy make mingw-w64-tools
michael@feddev ~ # sudo dnf install mingw64-binutils mingw64-cpp mingw64-filesystem mingw64-gcc mingw64-openssl mingw64-openssl-static mingw64-termcap mingw64-zlib mingw64-zlib-static mingw64-nsis
michael@feddev ~ # sudo dnf install @development-tools @Development-Libraries gcc-c++ mingw32-gcc-c++ mingw64-gcc-c++
michael@feddev ~ # sudo dnf install git
michael@feddev ~ # mkdir unbound-build
michael@feddev ~ # mkdir $HOME/ubound/
michael@feddev ~ # cd unbound-build
michael@feddev ~/unbound-build # git clone https://github.com/NLnetLabs/unbound unbound-git
michael@feddev ~/unbound-build # cd unbound-git
michael@feddev ~/unbound-build/unbound-git # wget https://github.com/libexpat/libexpat/releases/download/R_2_7_1/expat-2.7.1.tar.bz2 -O $HOME/unbound-build/expat-2.7.1.tar.bz2
michael@feddev ~/unbound-build/unbound-git # wget https://github.com/openssl/openssl/releases/download/openssl-3.5.0/openssl-3.5.0.tar.gz -O $HOME/unbound-build/openssl-3.5.0.tar.gz
michael@feddev ~/unbound-build/unbound-git # ./makedist.sh  -wssl $HOME/unbound-build/openssl-3.5.0.tar.gz -wxp $HOME/unbound-build/expat-2.7.1.tar.bz2  -wdir $HOME/ubound -w --enable-staticexe
test of unbound-1.23.1.zip OK
./makedist.sh: info: Creating installer
Processing config: /etc/nsisconf.nsh
Processing script file: "../winrc/setup_ed.nsi" (UTF8)
 
Processed 1 file, writing output (x86-unicode):
 
Output: "unbound_setup_1.23.1.exe"
Install: 7 pages (448 bytes), 3 sections (2 required) (98376 bytes), 526 instructions (14728 bytes), 278 strings (13470 bytes), 1 language table (378 bytes).
Uninstall: 4 pages (320 bytes), 1 section (32792 bytes), 388 instructions (10864 bytes), 194 strings (6068 bytes), 1 language table (286 bytes).
Datablock optimizer saved 3348 bytes (~0.0%).
 
Using zlib compression.
 
EXE header size:              137728 / 110080 bytes
Install code:                   6941 / 78712 bytes
Install data:               27963923 / 69753226 bytes
Uninstall code+data:           46237 / 59345 bytes
CRC (0x2CE5D4E2):                  4 / 4 bytes
 
Total size:                 28154833 / 70001367 bytes (40.2%)
./makedist.sh: info: Created installer
./makedist.sh: info: Deleting temporary working directory.
hash of unbound_setup_1.23.1.exe.{sha1,sha256}
sha1 f078d28f8fa3554576fc04a4bfeda03e420f914c
sha256 ce9e1597107ee52e8a260a869a1ad2a5b54d3fc77f1c34970ddeec4fb7f6a48b
hash of unbound-1.23.1.zip.{sha1,sha256}
sha1 e53e337de088f15ad7e190007a64f87d90cf1055
sha256 f642d1c198d101df85e607d45ee95be6334622f0762cc1c518e72837e6aa4f87
-rw-r--r--. 1 michael 28154833 17. Jun 20:53 unbound_setup_1.23.1.exe
-rw-r--r--. 1 michael 31763950 17. Jun 20:53 unbound-1.23.1.zip
create signed versions with:
  gpg --armor --detach-sign --digest-algo SHA256 unbound_setup_1.23.1.exe
  gpg --armor --detach-sign --digest-algo SHA256 unbound-1.23.1.zip
./makedist.sh: info: Done

Michael