-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from kevinaboos/packaging
Support packaging Robrix into app bundles using `cargo-packager`
- Loading branch information
Showing
11 changed files
with
922 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,8 @@ metadata.makepad-auto-version = "zqpv-Yj-K7WNVK2I8h5Okhho46Q=" | |
|
||
[dependencies] | ||
# makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "rik" } | ||
makepad-widgets = { git = "https://github.com/kevinaboos/makepad", branch = "modal_sends_dismissed_action_to_inner_modal_content" } | ||
makepad-widgets = { git = "https://github.com/kevinaboos/makepad", branch = "apple_bundle_resource_path" } | ||
|
||
|
||
## Including this crate automatically configures all `robius-*` crates to work with Makepad. | ||
robius-use-makepad = "0.1.0" | ||
|
@@ -98,3 +99,97 @@ all-features = true | |
# Temporarily include all debug info even for release builds. | ||
[profile.release] | ||
debug = "full" | ||
|
||
|
||
|
||
|
||
## Configuration for `cargo packager` | ||
[package.metadata.packager] | ||
product_name = "Robrix" | ||
identifier = "org.robius.robrix" | ||
category = "SocialNetworking" | ||
authors = ["Project Robius <[email protected]>", "Kevin Boos <[email protected]>"] | ||
publisher = "robius" | ||
license_file = "LICENSE-MIT" | ||
copyright = "Copyright 2023-2024, Project Robius" | ||
homepage = "https://github.com/project-robius" | ||
### Note: there is an 80-character max for each line of the `long_description`. | ||
long_description = """ | ||
Robrix is a multi-platform Matrix chat client written in pure Rust | ||
using the Makepad UI framework (https://github.com/makepad/makepad) | ||
and the Project Robius app dev framework and platform abstractions | ||
(https://github.com/project-robius). | ||
Robrix runs on all major desktop and mobile platforms: | ||
macOS, Windows, Linux, Android, and iOS. | ||
""" | ||
icons = ["./packaging/robrix_logo_alpha.png"] | ||
out_dir = "./dist" | ||
|
||
## The below command uses cargo-metadata to determine the path of the `makepad_widgets` crate on the host build system, | ||
## and copies the `makepad-widgets/resources` directory to the `./dist/resources/makepad_widgets` directory. | ||
## We also copy the Robrix project's `resources/` directory to the `./dist/resources/robrix` directory. | ||
## | ||
## This is necessary because the `cargo packager` command only supports defining resources at a known path | ||
## (see the below `resources = [...]` block below), | ||
## so we need to copy the resources to a known fixed (static) path before packaging, | ||
## such that cargo-packager can locate them and include them in the final package. | ||
before-packaging-command = """ | ||
cargo run --manifest-path packaging/before-packaging-command/Cargo.toml \ | ||
before-packaging \ | ||
--binary-name robrix \ | ||
--path-to-binary ./target/release/robrix | ||
""" | ||
|
||
## See the above paragraph comments for more info on how we create/populate the below `src` directories. | ||
resources = [ | ||
{ src = "./dist/resources/makepad_widgets", target = "makepad_widgets" }, | ||
{ src = "./dist/resources/robrix", target = "robrix" }, | ||
] | ||
|
||
## We then build the entire Robrix project and set the `MAKEPAD_PACKAGE_DIR` env var to the proper value. | ||
## * For macOS app bundles, this should be set to `.` because we set the `apple_bundle` cfg option | ||
## for Makepad, which causes Makepad to look for resources in the `Contents/Resources/` directory, | ||
## which is where the resources are located for an Apple app bundle (`.app` and `.dmg`). | ||
## * For Debian `.deb` packages, this should be set to `/usr/lib/<main-binary-name>`, | ||
## which is currently `/usr/lib/robrix`. | ||
## This is the directory in which `dpkg` copies app resource files to when installing the `.deb` package. | ||
## * On Linux, we also strip the binaries of unneeded content, as required for Debian packages. | ||
## * For Debian and Pacman (still a to-do!) packages, we also auto-generate the list of dependencies required by Robrix. | ||
## | ||
before-each-package-command = """ | ||
cargo run --manifest-path packaging/before-packaging-command/Cargo.toml \ | ||
before-each-package \ | ||
--binary-name robrix \ | ||
--path-to-binary ./target/release/robrix | ||
""" | ||
|
||
deep_link_protocols = [ | ||
{ schemes = ["robrix", "matrix"], role = "viewer" }, ## `name` is left as default | ||
] | ||
|
||
[package.metadata.packager.deb] | ||
depends = "./dist/depends_deb.txt" | ||
desktop_template = "./packaging/robrix.desktop" | ||
section = "utils" | ||
|
||
[package.metadata.packager.macos] | ||
minimum_system_version = "11.0" | ||
frameworks = [ ] | ||
signing_identity = "Developer ID Application: AppChef Inc. (SFVQ5V48GD)" | ||
|
||
|
||
## Configuration for `cargo packager`'s generation of a macOS `.dmg`. | ||
[package.metadata.packager.dmg] | ||
background = "./packaging/Robrix macOS dmg background.png" | ||
window_size = { width = 960, height = 540 } | ||
app_position = { x = 200, y = 250 } | ||
application_folder_position = { x = 760, y = 250 } | ||
|
||
|
||
## Configuration for `cargo packager`'s generation of a Windows `.exe` setup installer. | ||
[package.metadata.packager.nsis] | ||
## See this: <https://nsis.sourceforge.io/Docs/Chapter4.html#varconstant> | ||
appdata_paths = [ | ||
"$APPDATA/$PUBLISHER/$PRODUCTNAME", | ||
"$LOCALAPPDATA/$PRODUCTNAME", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Cargo generated directory | ||
/target | ||
|
||
.vscode | ||
.DS_Store | ||
|
Oops, something went wrong.