Skip to content

Commit 3f00124

Browse files
authored
Merge pull request #4 from nazar-pc/fix-windows-packaging
Fix Windows installer and other tweaks
2 parents 3fc1605 + 29aa0a6 commit 3f00124

File tree

5 files changed

+105
-11
lines changed

5 files changed

+105
-11
lines changed

.cargo/config.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[target.'cfg(target_arch = "x86_64")']
2+
# Require AES-NI on x86-64 by default
3+
rustflags = ["-C", "target-feature=+aes"]
4+
5+
[target.'cfg(target_arch = "aarch64")']
6+
# TODO: Try to remove once https://github.com/paritytech/substrate/issues/11538 is resolved
7+
# TODO: AES flag is such that we have decent performance on ARMv8, remove once `aes` crate bumps MSRV to at least
8+
# 1.61: https://github.com/RustCrypto/block-ciphers/issues/373
9+
rustflags = ["--cfg", "aes_armv8"]

.github/workflows/release.yml

+33-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
CARGO_INCREMENTAL: 0
1515

1616
jobs:
17-
executables:
17+
release:
1818
strategy:
1919
matrix:
2020
build:
@@ -105,22 +105,46 @@ jobs:
105105

106106
# TODO: Package Linux and macOS
107107

108+
- name: Install cargo-wix (Windows)
109+
uses: taiki-e/cache-cargo-install-action@1b76958d032c4d048c599f9fdfa48abe804d6319 # v1.2.2
110+
with:
111+
tool: cargo-wix
112+
if: runner.os == 'Windows'
113+
108114
- name: Package (Windows)
109115
run: |
110-
Remove-Item -Recurse -Force target/gtk4
111-
New-Item target/gtk4 -ItemType Directory
112-
Copy-Item -Path C:\gtk-build\gtk\x64\release\bin\*.dll -Destination target\gtk4
113-
heat dir target\gtk4 -gg -sfrag -template:fragment -out target\gtk4\gtk4.wxs -cg GTK -dr GTK
114-
# TODO
115-
cargo wix --include target\gtk4\gtk4.wxs --profile production
116+
Remove-Item target\wix\gtk4 -Recurse -Confirm:$false -ErrorAction SilentlyContinue
117+
118+
New-Item target\wix\gtk4\bin -ItemType Directory
119+
New-Item target\wix\gtk4\share\glib-2.0\schemas -ItemType Directory
120+
121+
Copy-Item -Path C:\gtk-build\gtk\x64\release\bin\*.dll -Destination target\wix\gtk4\bin
122+
Copy-Item -Path C:\gtk-build\gtk\x64\release\bin\gdbus.exe -Destination target\wix\gtk4\bin
123+
124+
Copy-Item -Path C:\gtk-build\gtk\x64\release\share\glib-2.0\schemas\gschemas.compiled -Destination target\wix\gtk4\share\glib-2.0\schemas\gschemas.compiled
125+
Copy-Item -Path C:\gtk-build\gtk\x64\release\share\glib-2.0\schemas\org.gtk.gtk4.Settings.Debug.gschema.xml -Destination target\wix\gtk4\share\glib-2.0\schemas\org.gtk.gtk4.Settings.Debug.gschema.xml
126+
Copy-Item -Path C:\gtk-build\gtk\x64\release\share\glib-2.0\schemas\org.gtk.gtk4.Settings.FileChooser.gschema.xml -Destination target\wix\gtk4\share\glib-2.0\schemas\org.gtk.gtk4.Settings.FileChooser.gschema.xml
127+
128+
# TODO: Ideally something like this would have worked and we wouldn't need to hardcode stuff in `space-acres.wxs`: https://github.com/volks73/cargo-wix/issues/271
129+
# & "C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe" dir target\wix\gtk4 -gg -sfrag -template:fragment -out target\wix\gtk4.wxs -cg GTK -dr GTK
130+
131+
# TODO: This is a workaround for missing `--target` support: https://github.com/volks73/cargo-wix/issues/272
132+
New-Item target\production -ItemType Directory -Force
133+
Copy-Item -Path ${{ env.PRODUCTION_TARGET }}\space-acres.exe -Destination target\production\space-acres.exe
134+
135+
cargo wix --profile production --no-build --nocapture
136+
137+
Remove-Item target\production -Recurse -Confirm:$false
138+
139+
Remove-Item target\wix\gtk4 -Recurse -Confirm:$false -ErrorAction SilentlyContinue
116140
if: runner.os == 'Windows'
117141

118142
- name: Upload node and farmer executables to artifacts (Windows)
119143
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # @v3.1.1
120144
with:
121145
name: installer-${{ matrix.build.suffix }}
122146
path: |
123-
target/wix/*.exe
147+
target/wix/*.msi
124148
if-no-files-found: error
125149
if: runner.os == 'Windows'
126150

@@ -129,5 +153,5 @@ jobs:
129153
env:
130154
GITHUB_TOKEN: ${{ github.token }}
131155
with:
132-
asset_paths: '["target/wix/*.exe"]'
156+
asset_paths: '["target/wix/*.msi"]'
133157
if: runner.os == 'Windows' && github.event_name == 'push' && github.ref_type == 'tag'

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Current features:
1919
* Farmer plotting/farming with a single farm with displayed plotting/replotting progress
2020

2121
Some of the upcoming features/capabilities (not necessarily in priority order):
22-
* Automatic builds in CI with pre-built executables
23-
* Testing on Windows and macOS
22+
* Automatic builds in CI with pre-built executables/installers (Linux and macOS)
23+
* Testing on macOS
2424
* Welcome screen
2525
* Writing logs to a file
2626
* Displaying of earned farming rewards or at least link to block explorers

src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![windows_subsystem = "windows"]
12
#![feature(const_option, trait_alias, try_blocks)]
23

34
mod backend;

wix/space-acres.wxs

+60
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,64 @@
128128
Source='$(var.CargoTargetBinDir)\space-acres.exe'
129129
KeyPath='yes'/>
130130
</Component>
131+
<Component Id='gtk4' Guid='f34c20a7-fec1-4afa-b06c-0945bbbc420f'>
132+
<File Id='gdbus.exe' Name='gdbus.exe' DiskId='1' Source='target\wix\gtk4\bin\gdbus.exe' />
133+
134+
<File Id='asprintf.dll' Name='asprintf.dll' DiskId='1' Source='target\wix\gtk4\bin\asprintf.dll' />
135+
<File Id='cairo_2.dll' Name='cairo-2.dll' DiskId='1' Source='target\wix\gtk4\bin\cairo-2.dll' />
136+
<File Id='cairo_gobject_2.dll' Name='cairo-gobject-2.dll' DiskId='1' Source='target\wix\gtk4\bin\cairo-gobject-2.dll' />
137+
<File Id='cairo_script_interpreter_2.dll' Name='cairo-script-interpreter-2.dll' DiskId='1' Source='target\wix\gtk4\bin\cairo-script-interpreter-2.dll' />
138+
<File Id='epoxy_0.dll' Name='epoxy-0.dll' DiskId='1' Source='target\wix\gtk4\bin\epoxy-0.dll' />
139+
<File Id='ffi_8.dll' Name='ffi-8.dll' DiskId='1' Source='target\wix\gtk4\bin\ffi-8.dll' />
140+
<File Id='fontconfig_1.dll' Name='fontconfig-1.dll' DiskId='1' Source='target\wix\gtk4\bin\fontconfig-1.dll' />
141+
<File Id='freetype_6.dll' Name='freetype-6.dll' DiskId='1' Source='target\wix\gtk4\bin\freetype-6.dll' />
142+
<File Id='fribidi_0.dll' Name='fribidi-0.dll' DiskId='1' Source='target\wix\gtk4\bin\fribidi-0.dll' />
143+
<File Id='gdk_pixbuf_2.0_0.dll' Name='gdk_pixbuf-2.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\gdk_pixbuf-2.0-0.dll' />
144+
<File Id='gettextlib_0.21.0.dll' Name='gettextlib-0.21.0.dll' DiskId='1' Source='target\wix\gtk4\bin\gettextlib-0.21.0.dll' />
145+
<File Id='gettextpo.dll' Name='gettextpo.dll' DiskId='1' Source='target\wix\gtk4\bin\gettextpo.dll' />
146+
<File Id='gettextsrc_0.21.0.dll' Name='gettextsrc-0.21.0.dll' DiskId='1' Source='target\wix\gtk4\bin\gettextsrc-0.21.0.dll' />
147+
<File Id='gio_2.0_0.dll' Name='gio-2.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\gio-2.0-0.dll' />
148+
<File Id='glib_2.0_0.dll' Name='glib-2.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\glib-2.0-0.dll' />
149+
<File Id='gmodule_2.0_0.dll' Name='gmodule-2.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\gmodule-2.0-0.dll' />
150+
<File Id='gobject_2.0_0.dll' Name='gobject-2.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\gobject-2.0-0.dll' />
151+
<File Id='graphene_1.0_0.dll' Name='graphene-1.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\graphene-1.0-0.dll' />
152+
<File Id='gthread_2.0_0.dll' Name='gthread-2.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\gthread-2.0-0.dll' />
153+
<File Id='gtk_4_1.dll' Name='gtk-4-1.dll' DiskId='1' Source='target\wix\gtk4\bin\gtk-4-1.dll' />
154+
<File Id='harfbuzz_cairo.dll' Name='harfbuzz-cairo.dll' DiskId='1' Source='target\wix\gtk4\bin\harfbuzz-cairo.dll' />
155+
<File Id='harfbuzz_gobject.dll' Name='harfbuzz-gobject.dll' DiskId='1' Source='target\wix\gtk4\bin\harfbuzz-gobject.dll' />
156+
<File Id='harfbuzz_subset.dll' Name='harfbuzz-subset.dll' DiskId='1' Source='target\wix\gtk4\bin\harfbuzz-subset.dll' />
157+
<File Id='harfbuzz.dll' Name='harfbuzz.dll' DiskId='1' Source='target\wix\gtk4\bin\harfbuzz.dll' />
158+
<File Id='iconv.dll' Name='iconv.dll' DiskId='1' Source='target\wix\gtk4\bin\iconv.dll' />
159+
<File Id='intl.dll' Name='intl.dll' DiskId='1' Source='target\wix\gtk4\bin\intl.dll' />
160+
<File Id='jpeg62.dll' Name='jpeg62.dll' DiskId='1' Source='target\wix\gtk4\bin\jpeg62.dll' />
161+
<File Id='libexpat.dll' Name='libexpat.dll' DiskId='1' Source='target\wix\gtk4\bin\libexpat.dll' />
162+
<File Id='libpng16.dll' Name='libpng16.dll' DiskId='1' Source='target\wix\gtk4\bin\libpng16.dll' />
163+
<File Id='pango_1.0_0.dll' Name='pango-1.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\pango-1.0-0.dll' />
164+
<File Id='pangocairo_1.0_0.dll' Name='pangocairo-1.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\pangocairo-1.0-0.dll' />
165+
<File Id='pangowin32_1.0_0.dll' Name='pangowin32-1.0-0.dll' DiskId='1' Source='target\wix\gtk4\bin\pangowin32-1.0-0.dll' />
166+
<File Id='pcre2_16.dll' Name='pcre2-16.dll' DiskId='1' Source='target\wix\gtk4\bin\pcre2-16.dll' />
167+
<File Id='pcre2_32.dll' Name='pcre2-32.dll' DiskId='1' Source='target\wix\gtk4\bin\pcre2-32.dll' />
168+
<File Id='pcre2_8.dll' Name='pcre2-8.dll' DiskId='1' Source='target\wix\gtk4\bin\pcre2-8.dll' />
169+
<File Id='pcre2_posix.dll' Name='pcre2-posix.dll' DiskId='1' Source='target\wix\gtk4\bin\pcre2-posix.dll' />
170+
<File Id='pixman_1_0.dll' Name='pixman-1-0.dll' DiskId='1' Source='target\wix\gtk4\bin\pixman-1-0.dll' />
171+
<File Id='pkgconf_4.dll' Name='pkgconf-4.dll' DiskId='1' Source='target\wix\gtk4\bin\pkgconf-4.dll' />
172+
<File Id='textstyle.dll' Name='textstyle.dll' DiskId='1' Source='target\wix\gtk4\bin\textstyle.dll' />
173+
<File Id='tiff.dll' Name='tiff.dll' DiskId='1' Source='target\wix\gtk4\bin\tiff.dll' />
174+
<File Id='turbojpeg.dll' Name='turbojpeg.dll' DiskId='1' Source='target\wix\gtk4\bin\turbojpeg.dll' />
175+
<File Id='zlib1.dll' Name='zlib1.dll' DiskId='1' Source='target\wix\gtk4\bin\zlib1.dll' />
176+
</Component>
177+
</Directory>
178+
179+
<Directory Id='share' Name='share'>
180+
<Directory Id='glib_2.0' Name='glib-2.0'>
181+
<Directory Id='schemas' Name='schemas'>
182+
<Component Id='glib_2.0_schemas' Guid='89a44ead-b959-44d6-970e-367184effca4'>
183+
<File Id='gschemas.compiled' Name='gschemas.compiled' DiskId='1' Source='target\wix\gtk4\share\glib-2.0\schemas\gschemas.compiled' />
184+
<File Id='org.gtk.gtk4.Settings.Debug.gschema.xml' Name='org.gtk.gtk4.Settings.Debug.gschema.xml' DiskId='1' Source='target\wix\gtk4\share\glib-2.0\schemas\org.gtk.gtk4.Settings.Debug.gschema.xml' />
185+
<File Id='org.gtk.gtk4.Settings.FileChooser.gschema.xml' Name='org.gtk.gtk4.Settings.FileChooser.gschema.xml' DiskId='1' Source='target\wix\gtk4\share\glib-2.0\schemas\org.gtk.gtk4.Settings.FileChooser.gschema.xml' />
186+
</Component>
187+
</Directory>
188+
</Directory>
131189
</Directory>
132190
</Directory>
133191
</Directory>
@@ -181,6 +239,8 @@
181239
<!--<ComponentRef Id='License'/>-->
182240

183241
<ComponentRef Id='binary0'/>
242+
<ComponentRef Id='gtk4'/>
243+
<ComponentRef Id='glib_2.0_schemas'/>
184244

185245
<Feature
186246
Id='Environment'

0 commit comments

Comments
 (0)