5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 22:04:16 +08:00
wails/mkdocs-website/docs/en/learn/guides/packaging.md
Atterpac 9173537ce5
[V3-Linux] Support for deb,rpm,arch linux packager packaging (#3909)
* 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 <lea.anthony@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-11-30 13:31:56 +11:00

2.7 KiB

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, 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:

# 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:

name: "myapp"
arch: "amd64"
version: "v1.0.0"
maintainer: "Your Name <your.email@example.com>"
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.