Skip to content

Commit

Permalink
Fix Windows installer and other tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Dec 6, 2023
1 parent 77f6f1f commit 29aa0a6
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 11 deletions.
9 changes: 9 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[target.'cfg(target_arch = "x86_64")']
# Require AES-NI on x86-64 by default
rustflags = ["-C", "target-feature=+aes"]

[target.'cfg(target_arch = "aarch64")']
# TODO: Try to remove once https://github.com/paritytech/substrate/issues/11538 is resolved
# TODO: AES flag is such that we have decent performance on ARMv8, remove once `aes` crate bumps MSRV to at least
# 1.61: https://github.com/RustCrypto/block-ciphers/issues/373
rustflags = ["--cfg", "aes_armv8"]
42 changes: 33 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
CARGO_INCREMENTAL: 0

jobs:
executables:
release:
strategy:
matrix:
build:
Expand Down Expand Up @@ -105,22 +105,46 @@ jobs:

# TODO: Package Linux and macOS

- name: Install cargo-wix (Windows)
uses: taiki-e/cache-cargo-install-action@1b76958d032c4d048c599f9fdfa48abe804d6319 # v1.2.2
with:
tool: cargo-wix
if: runner.os == 'Windows'

- name: Package (Windows)
run: |
Remove-Item -Recurse -Force target/gtk4
New-Item target/gtk4 -ItemType Directory
Copy-Item -Path C:\gtk-build\gtk\x64\release\bin\*.dll -Destination target\gtk4
heat dir target\gtk4 -gg -sfrag -template:fragment -out target\gtk4\gtk4.wxs -cg GTK -dr GTK
# TODO
cargo wix --include target\gtk4\gtk4.wxs --profile production
Remove-Item target\wix\gtk4 -Recurse -Confirm:$false -ErrorAction SilentlyContinue
New-Item target\wix\gtk4\bin -ItemType Directory
New-Item target\wix\gtk4\share\glib-2.0\schemas -ItemType Directory
Copy-Item -Path C:\gtk-build\gtk\x64\release\bin\*.dll -Destination target\wix\gtk4\bin
Copy-Item -Path C:\gtk-build\gtk\x64\release\bin\gdbus.exe -Destination target\wix\gtk4\bin
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
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
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
# 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
# & "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
# TODO: This is a workaround for missing `--target` support: https://github.com/volks73/cargo-wix/issues/272
New-Item target\production -ItemType Directory -Force
Copy-Item -Path ${{ env.PRODUCTION_TARGET }}\space-acres.exe -Destination target\production\space-acres.exe
cargo wix --profile production --no-build --nocapture
Remove-Item target\production -Recurse -Confirm:$false
Remove-Item target\wix\gtk4 -Recurse -Confirm:$false -ErrorAction SilentlyContinue
if: runner.os == 'Windows'

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

Expand All @@ -129,5 +153,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["target/wix/*.exe"]'
asset_paths: '["target/wix/*.msi"]'
if: runner.os == 'Windows' && github.event_name == 'push' && github.ref_type == 'tag'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Current features:
* Farmer plotting/farming with a single farm with displayed plotting/replotting progress

Some of the upcoming features/capabilities (not necessarily in priority order):
* Automatic builds in CI with pre-built executables
* Testing on Windows and macOS
* Automatic builds in CI with pre-built executables/installers (Linux and macOS)
* Testing on macOS
* Welcome screen
* Writing logs to a file
* Displaying of earned farming rewards or at least link to block explorers
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![windows_subsystem = "windows"]
#![feature(const_option, trait_alias, try_blocks)]

mod backend;
Expand Down
60 changes: 60 additions & 0 deletions wix/space-acres.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,64 @@
Source='$(var.CargoTargetBinDir)\space-acres.exe'
KeyPath='yes'/>
</Component>
<Component Id='gtk4' Guid='f34c20a7-fec1-4afa-b06c-0945bbbc420f'>
<File Id='gdbus.exe' Name='gdbus.exe' DiskId='1' Source='target\wix\gtk4\bin\gdbus.exe' />

<File Id='asprintf.dll' Name='asprintf.dll' DiskId='1' Source='target\wix\gtk4\bin\asprintf.dll' />
<File Id='cairo_2.dll' Name='cairo-2.dll' DiskId='1' Source='target\wix\gtk4\bin\cairo-2.dll' />
<File Id='cairo_gobject_2.dll' Name='cairo-gobject-2.dll' DiskId='1' Source='target\wix\gtk4\bin\cairo-gobject-2.dll' />
<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' />
<File Id='epoxy_0.dll' Name='epoxy-0.dll' DiskId='1' Source='target\wix\gtk4\bin\epoxy-0.dll' />
<File Id='ffi_8.dll' Name='ffi-8.dll' DiskId='1' Source='target\wix\gtk4\bin\ffi-8.dll' />
<File Id='fontconfig_1.dll' Name='fontconfig-1.dll' DiskId='1' Source='target\wix\gtk4\bin\fontconfig-1.dll' />
<File Id='freetype_6.dll' Name='freetype-6.dll' DiskId='1' Source='target\wix\gtk4\bin\freetype-6.dll' />
<File Id='fribidi_0.dll' Name='fribidi-0.dll' DiskId='1' Source='target\wix\gtk4\bin\fribidi-0.dll' />
<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' />
<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' />
<File Id='gettextpo.dll' Name='gettextpo.dll' DiskId='1' Source='target\wix\gtk4\bin\gettextpo.dll' />
<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' />
<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' />
<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' />
<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' />
<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' />
<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' />
<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' />
<File Id='gtk_4_1.dll' Name='gtk-4-1.dll' DiskId='1' Source='target\wix\gtk4\bin\gtk-4-1.dll' />
<File Id='harfbuzz_cairo.dll' Name='harfbuzz-cairo.dll' DiskId='1' Source='target\wix\gtk4\bin\harfbuzz-cairo.dll' />
<File Id='harfbuzz_gobject.dll' Name='harfbuzz-gobject.dll' DiskId='1' Source='target\wix\gtk4\bin\harfbuzz-gobject.dll' />
<File Id='harfbuzz_subset.dll' Name='harfbuzz-subset.dll' DiskId='1' Source='target\wix\gtk4\bin\harfbuzz-subset.dll' />
<File Id='harfbuzz.dll' Name='harfbuzz.dll' DiskId='1' Source='target\wix\gtk4\bin\harfbuzz.dll' />
<File Id='iconv.dll' Name='iconv.dll' DiskId='1' Source='target\wix\gtk4\bin\iconv.dll' />
<File Id='intl.dll' Name='intl.dll' DiskId='1' Source='target\wix\gtk4\bin\intl.dll' />
<File Id='jpeg62.dll' Name='jpeg62.dll' DiskId='1' Source='target\wix\gtk4\bin\jpeg62.dll' />
<File Id='libexpat.dll' Name='libexpat.dll' DiskId='1' Source='target\wix\gtk4\bin\libexpat.dll' />
<File Id='libpng16.dll' Name='libpng16.dll' DiskId='1' Source='target\wix\gtk4\bin\libpng16.dll' />
<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' />
<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' />
<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' />
<File Id='pcre2_16.dll' Name='pcre2-16.dll' DiskId='1' Source='target\wix\gtk4\bin\pcre2-16.dll' />
<File Id='pcre2_32.dll' Name='pcre2-32.dll' DiskId='1' Source='target\wix\gtk4\bin\pcre2-32.dll' />
<File Id='pcre2_8.dll' Name='pcre2-8.dll' DiskId='1' Source='target\wix\gtk4\bin\pcre2-8.dll' />
<File Id='pcre2_posix.dll' Name='pcre2-posix.dll' DiskId='1' Source='target\wix\gtk4\bin\pcre2-posix.dll' />
<File Id='pixman_1_0.dll' Name='pixman-1-0.dll' DiskId='1' Source='target\wix\gtk4\bin\pixman-1-0.dll' />
<File Id='pkgconf_4.dll' Name='pkgconf-4.dll' DiskId='1' Source='target\wix\gtk4\bin\pkgconf-4.dll' />
<File Id='textstyle.dll' Name='textstyle.dll' DiskId='1' Source='target\wix\gtk4\bin\textstyle.dll' />
<File Id='tiff.dll' Name='tiff.dll' DiskId='1' Source='target\wix\gtk4\bin\tiff.dll' />
<File Id='turbojpeg.dll' Name='turbojpeg.dll' DiskId='1' Source='target\wix\gtk4\bin\turbojpeg.dll' />
<File Id='zlib1.dll' Name='zlib1.dll' DiskId='1' Source='target\wix\gtk4\bin\zlib1.dll' />
</Component>
</Directory>

<Directory Id='share' Name='share'>
<Directory Id='glib_2.0' Name='glib-2.0'>
<Directory Id='schemas' Name='schemas'>
<Component Id='glib_2.0_schemas' Guid='89a44ead-b959-44d6-970e-367184effca4'>
<File Id='gschemas.compiled' Name='gschemas.compiled' DiskId='1' Source='target\wix\gtk4\share\glib-2.0\schemas\gschemas.compiled' />
<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' />
<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' />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
Expand Down Expand Up @@ -181,6 +239,8 @@
<!--<ComponentRef Id='License'/>-->

<ComponentRef Id='binary0'/>
<ComponentRef Id='gtk4'/>
<ComponentRef Id='glib_2.0_schemas'/>

<Feature
Id='Environment'
Expand Down

0 comments on commit 29aa0a6

Please sign in to comment.