robius-packaging-commands
A multi-platform companion tool to help package your Rust app when using cargo-packager.
Quick example of usage
This program should be invoked by cargo-packager's "before-package" and "before-each-package" hooks,
which you must specify in your Cargo.toml file under the [package.metadata.packager] section.
[!IMPORTANT] You must build in release mode (using
cargo packager --release).
See the example below for an app called "Robrix" with a binary named "robrix".
## Configuration for `cargo packager`
[]
= "Robrix"
[]
## You can use `-` as the value for `signing_identity`,
## if you just want to test the packaging on macOS without signing the app.
= "-"
...
## Note: for Makepad apps, you only need to specify `before-packaging-command`
## if you're using Makepad versions **BEFORE** v1.0.
## If using Makepad v1.0 or higher, you can omit this.
##
## This runs just one time before packaging starts.
= """
robius-packaging-commands before-packaging \
--binary-name robrix \
--path-to-binary ./target/release/robrix
"""
...
## This runs once before building each separate kind of package,
## so it is used to build your app specifically for each package kind.
= """
robius-packaging-commands before-each-package \
--binary-name robrix \
--path-to-binary ./target/release/robrix
"""
## Note: if you're using Makepad versions **BEFORE** v1.0, you only need these resources:
= [
{ = "./dist/resources/makepad_widgets", = "makepad_widgets" },
{ = "./dist/resources/robrix", = "robrix" },
]
## Note: if you're using Makepad v1.0 or higher, you need to specify more resource files:
= [
{ = "./dist/resources/makepad_widgets", = "makepad_widgets" },
{ = "./dist/resources/makepad_fonts_chinese_bold", = "makepad_fonts_chinese_bold" },
{ = "./dist/resources/makepad_fonts_chinese_bold_2", = "makepad_fonts_chinese_bold_2" },
{ = "./dist/resources/makepad_fonts_chinese_regular", = "makepad_fonts_chinese_regular" },
{ = "./dist/resources/makepad_fonts_chinese_regular_2", = "makepad_fonts_chinese_regular_2" },
{ = "./dist/resources/makepad_fonts_emoji", = "makepad_fonts_emoji" },
{ = "./dist/resources/robrix", = "robrix" },
]
Once you have this package metadata fully completed in your app crate's Cargo.toml,
you are ready to run.
- Install
cargo-packager:
- Install this appropriate version of this crate, either from
crates.ioor from this git repo.
[!IMPORTANT] For Makepad apps using Makepad versions before v1.0, install
robius-packaging-commands--version 0.1.For Makepad apps using Makepad versions after v1.0, install
robius-packaging-commands--version 0.2.
# From crates.io
# From this git repo
- Then run the packaging routine:
More info
This program must be run from the root of the project directory,
which is also where the cargo-packager command must be invoked from,
so that shouldn't present any problems.
This program runs in two modes, one for each kind of before-packaging step in cargo-packager:
before-packaging: specifies that thebefore-packaging-commandis being run by cargo-packager, which gets executed only once before cargo-packager generates any package bundles.
[!IMPORTANT] The
before-packagingcommand is not needed if building an app using Makepad v1.0 or higher.
before-each-package: specifies that thebefore-each-package-commandis being run by cargo-packager, which gets executed multiple times: once for each package that cargo-packager is going to generate.
- The environment variable
CARGO_PACKAGER_FORMATis set by cargo-packager to the declare which package format is about to be generated, which include the values given here: https://docs.rs/cargo-packager/latest/cargo_packager/enum.PackageFormat.html.app,dmg: for macOS.deb,appimage,pacman: for Linux.nsis: for Windows;nsisgenerates an installersetup.exe.wix: (UNSUPPORTED) for Windows; generates an.msiinstaller package.
This program uses the CARGO_PACKAGER_FORMAT environment variable to determine
which specific build commands and configuration options should be used.
License
MIT