Skip to content

Commit

Permalink
[V3-Linux] Support for deb,rpm,arch linux packager packaging (#3909)
Browse files Browse the repository at this point in the history
* Support for linux deb,rpm,arch linux packager packaging

* remove optional tasks from linux:package task

CHANGELOG.md

* Update Taskfile.linux.yml

* Integrated nfpm into CLI.
Fixed task update.

* package tool fixes and add bundle name field

empty name guard

* add linux depdencies

* Add some docs

* Fixed tests. Updated task to latest.

* Update v3/internal/commands/tool_package.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Remove doctor references to nfpm

---------

Co-authored-by: Lea Anthony <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 30, 2024
1 parent 43659cc commit 9173537
Show file tree
Hide file tree
Showing 28 changed files with 892 additions and 90 deletions.
1 change: 1 addition & 0 deletions mkdocs-website/docs/en/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Support of linux packaging of deb,rpm, and arch linux packager builds by @atterpac in [#3909](https://github.com/wailsapp/wails/3909)
- Added Support for darwin universal builds and packages by [ansxuman](https://github.com/ansxuman) in [#3902](https://github.com/wailsapp/wails/pull/3902)
- Events documentation to the mkdocs webite by [atterpac](https://github.com/atterpac) in [#3867](https://github.com/wailsapp/wails/pull/3867)
- Templates for sveltekit and sveltekit-ts that are set for non-SSR development by [atterpac](https://github.com/atterpac) in [#3829](https://github.com/wailsapp/wails/pull/3829)
Expand Down
38 changes: 37 additions & 1 deletion mkdocs-website/docs/en/getting-started/your-first-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,42 @@ You'll notice that the build time was faster this time. That's because the new b

You should see a new executable in the `build` directory.

## Step 6: Packaging Your Application

Once your application is ready for distribution, you can create platform-specific packages:

=== "Mac"

To create a `.app` bundle:
```bash
wails3 package
```
This will create a production build and package it into a `.app` bundle in the `bin` directory.

=== "Windows"

To create an NSIS installer:
```bash
wails3 package
```
This will create a production build and package it into an NSIS installer in the `bin` directory.

=== "Linux"

Wails supports multiple package formats for Linux distribution:
```bash
# Create all package types (AppImage, deb, rpm, and Arch Linux)
wails3 package

# Or create specific package types
wails3 task linux:create:appimage # AppImage format
wails3 task linux:create:deb # Debian package
wails3 task linux:create:rpm # Red Hat package
wails3 task linux:create:aur # Arch Linux package
```

For more detailed information about packaging options and configuration, check out our [Packaging Guide](../learn/guides/packaging.md).

## Conclusion

Congratulations! You've just created and built your first Wails application. This is just the beginning of what you can achieve with Wails v3 Alpha. Explore the documentation, experiment with different features, and start building amazing applications!
Congratulations! You've just created, developed and packaged your first Wails application. This is just the beginning of what you can achieve with Wails v3. Explore the documentation, experiment with different features, and start building amazing applications!
68 changes: 68 additions & 0 deletions mkdocs-website/docs/en/learn/guides/packaging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Packaging Your Application

This guide explains how to package your Wails application for different platforms.

## Windows

Windows applications are packaged as `.exe` files. Wails automatically handles this during the build process, creating a standalone executable that includes all necessary resources.

## macOS

macOS applications are packaged as `.app` bundles. Wails creates these bundles automatically during the build process, including proper code signing and notarization if configured.

## Linux

Linux applications can be packaged in various formats. Wails v3 uses [nfpm](https://github.com/goreleaser/nfpm), an excellent packaging tool that makes it easy to create `.deb`, `.rpm`, and Arch Linux packages. nfpm is a powerful tool that handles the complexities of Linux packaging, making it easy to create professional-grade packages.

### Package Types

Wails supports creating the following types of Linux packages:
- Debian packages (`.deb`) - for Debian, Ubuntu, and related distributions
- Red Hat packages (`.rpm`) - for Red Hat, Fedora, CentOS, and related distributions
- Arch Linux packages - for Arch Linux and related distributions
- AppImage - a distribution-independent package format

### Building Packages

Wails provides several task commands for building Linux packages. These are defined in `Taskfile.linux.yml` and can be invoked using the `wails3 task` command:

```bash
# Build all package types (AppImage, deb, rpm, and Arch Linux)
wails3 task linux:package

# Build specific package types
wails3 task linux:create:appimage # Create an AppImage
wails3 task linux:create:deb # Create a Debian package
wails3 task linux:create:rpm # Create a Red Hat package
wails3 task linux:create:aur # Create an Arch Linux package
```

Each of these tasks will:
1. Build your application in production mode
2. Generate necessary desktop integration files
3. Create the appropriate package using nfpm

### Configuration

The package configuration file should follow the nfpm configuration format and is typically located at `build/nfpm/nfpm.yaml`. Here's an example:

```yaml
name: "myapp"
arch: "amd64"
version: "v1.0.0"
maintainer: "Your Name <[email protected]>"
description: |
A short description of your application
vendor: "Your Company"
homepage: "https://yourcompany.com"
license: "MIT"
contents:
- src: ./build/bin/myapp
dst: /usr/bin/myapp
- src: ./assets/icon.png
dst: /usr/share/icons/myapp.png
- src: ./assets/myapp.desktop
dst: /usr/share/applications/myapp.desktop
```
For detailed information about all available configuration options, please refer to the [nfpm configuration documentation](https://nfpm.goreleaser.com/configuration/).
3 changes: 2 additions & 1 deletion mkdocs-website/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ nav:
- Guides:
- Customising Windows: learn/guides/customising-windows.md
- File Associations: learn/guides/file-associations.md
- Packaging: learn/guides/packaging.md
- Feedback: getting-started/feedback.md
- Feedback: getting-started/feedback.md
- What's New in v3?: whats-new.md
Expand All @@ -175,4 +176,4 @@ watch:
- overrides
- shared
copyright:
Copyright © 2024 Lea Anthony
Copyright 2024 Lea Anthony
1 change: 1 addition & 0 deletions v3/cmd/wails3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func main() {
tool.NewSubCommandFunction("watcher", "Watches files and runs a command when they change", commands.Watcher)
tool.NewSubCommandFunction("cp", "Copy files", commands.Cp)
tool.NewSubCommandFunction("buildinfo", "Show Build Info", commands.BuildInfo)
tool.NewSubCommandFunction("package", "Generate Linux packages (deb, rpm, archlinux)", commands.ToolPackage)

app.NewSubCommandFunction("version", "Print the version", commands.Version)
app.NewSubCommand("sponsor", "Sponsor the project").Action(openSponsor)
Expand Down
85 changes: 64 additions & 21 deletions v3/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ require (
github.com/atterpac/refresh v0.8.3
github.com/bep/debounce v1.2.1
github.com/ebitengine/purego v0.4.0-alpha.4
github.com/go-git/go-git/v5 v5.11.0
github.com/go-git/go-git/v5 v5.12.0
github.com/go-ole/go-ole v1.2.6
github.com/go-task/task/v3 v3.31.0
github.com/go-task/task/v3 v3.40.0
github.com/godbus/dbus/v5 v5.1.0
github.com/google/go-cmp v0.6.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/google/uuid v1.3.0
github.com/google/uuid v1.4.0
github.com/jackmordaunt/icns/v2 v2.2.7
github.com/jaypipes/ghw v0.12.0
github.com/leaanthony/clir v1.6.0
Expand All @@ -32,63 +32,106 @@ require (
github.com/tc-hib/winres v0.3.1
github.com/wailsapp/go-webview2 v1.0.18-0.20241130004144-dd8667af33c1
github.com/wailsapp/mimetype v1.4.1
golang.org/x/term v0.25.0
golang.org/x/tools v0.23.0
golang.org/x/sys v0.27.0
golang.org/x/term v0.20.0
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.21.0
)

require (
atomicgo.dev/cursor v0.1.1 // indirect
atomicgo.dev/keyboard v0.2.8 // indirect
dario.cat/mergo v1.0.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/AlekSi/pointer v1.2.0 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Ladicle/tabwriter v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/caarlos0/go-version v0.1.1 // indirect
github.com/cavaliergopher/cpio v1.0.1 // indirect
github.com/cloudflare/circl v1.3.8 // indirect
github.com/containerd/console v1.0.4 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/dominikbraun/graph v0.23.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-billy/v5 v5.6.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/go-task/template v0.1.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a // indirect
github.com/gookit/color v1.5.2 // indirect
github.com/goreleaser/chglog v0.6.1 // indirect
github.com/goreleaser/fileglob v1.3.0 // indirect
github.com/goreleaser/nfpm/v2 v2.41.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.12.0 // indirect
github.com/jaypipes/pcidb v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/lithammer/fuzzysearch v1.1.5 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-zglob v0.0.4 // indirect
github.com/mattn/go-zglob v0.0.6 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/mango v0.1.0 // indirect
github.com/muesli/mango-cobra v1.2.0 // indirect
github.com/muesli/mango-pflag v0.1.0 // indirect
github.com/muesli/roff v0.1.0 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/radovskyb/watcher v1.0.7 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rjeczalik/notify v0.9.3 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sajari/fuzzy v1.0.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/whilp/git-urls v1.0.0 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
gitlab.com/digitalxero/go-conventional-commit v1.0.7 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/image v0.21.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.19.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
Expand All @@ -103,5 +146,5 @@ require (
modernc.org/opt v0.1.3 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.0.1 // indirect
mvdan.cc/sh/v3 v3.7.0 // indirect
mvdan.cc/sh/v3 v3.10.0 // indirect
)
Loading

0 comments on commit 9173537

Please sign in to comment.