AppImage
AppImage
是一种分发格式,它不依赖于系统安装的软件包,而是打包应用所需的所有依赖和文件。因此,输出文件更大但更容易分发,因为它在许多 Linux 发行版上都受支持,并且无需安装即可执行。用户只需使文件可执行 (chmod a+x MyProject.AppImage
),然后就可以运行它 (./MyProject.AppImage
)。
¥AppImage
is a distribution format that does not rely on the system installed packages and instead bundles all dependencies and files needed by the application. For this reason, the output file is larger but easier to distribute since it is supported on many Linux distributions and can be executed without installation. The user just needs to make the file executable (chmod a+x MyProject.AppImage
) and can then run it (./MyProject.AppImage
).
如果你无法制作针对发行版的包管理器的包,AppImages 非常方便,可以简化分发过程。不过,当文件大小从 2-6 MB 范围增长到 70+ MB 时,你应该谨慎使用它。
¥AppImages are convenient, simplifying the distribution process if you cannot make a package targeting the distribution’s package manager. Still, you should carefully use it as the file size grows from the 2-6 MB range to 70+ MB.
通过 GStreamer 支持多媒体
¥Multimedia support via GStreamer
如果你的应用播放音频/视频,则需要启用 tauri.conf.json > bundle > linux > appimage > bundleMediaFramework
。这将增加 AppImage 包的大小以包含媒体播放所需的其他 gstreamer 文件。此标志目前仅在 Ubuntu 构建系统上完全受支持。确保你的构建系统具有你的应用在运行时可能需要的所有插件。
¥If your app plays audio/video you need to enable tauri.conf.json > bundle > linux > appimage > bundleMediaFramework
. This will increase the size of the AppImage bundle to include additional gstreamer files needed for media playback. This flag is currently only fully supported on Ubuntu build systems. Make sure that your build system has all the plugins your app may need at runtime.
:::caution 提醒
ugly
包中的 GStreamer 插件的许可方式可能使其难以作为应用的一部分分发。
¥GStreamer plugins in the ugly
package are licensed in a way that may make it hard to distribute them as part of your app.
:::
自定义文件
¥Custom Files
要将你不想通过 Tauri 的 resources
功能 包含的自定义文件包含在 AppImage 中,你可以在 tauri.conf.json > bundle > linux > appimage > files
中提供文件或文件夹列表。配置对象将 AppImage 中的路径映射到文件系统上文件的路径,相对于 tauri.conf.json
文件。以下是示例配置:
¥To include custom files in the AppImage that you do not want to include via Tauri’s resources
feature, you can provide a list of files or folders in tauri.conf.json > bundle > linux > appimage > files
. The configuration object maps the path in the AppImage to the path to the file on your filesystem, relative to the tauri.conf.json
file. Here’s an example configuration:
{ "bundle": { "linux": { "appimage": { "files": { "/usr/share/README.md": "../README.md", // copies the ../README.md file to <appimage>/usr/share/README.md "/usr/assets": "../assets/" // copies the entire ../assets directory to <appimage>/usr/assets } } } }}
:::note 注意
请注意,目标路径当前必须以 /usr/
开头。
¥Note that the destination paths must currently begin with /usr/
.
:::
基于 ARM 的设备的 AppImages
¥AppImages for ARM-based devices
linuxdeploy
,Tauri 使用的 AppImage 工具,目前为 不支持交叉编译 ARM AppImages。这意味着 ARM AppImages 只能在 ARM 设备或模拟器上构建。
¥linuxdeploy
, the AppImage tooling Tauri uses, currently does not support cross-compiling ARM AppImages. This means ARM AppImages can only be built on ARM devices or emulators.
查看我们的 GitHub Action 指南,了解利用 QEMU 构建应用的示例工作流程。请注意,这非常慢,仅推荐在 Build Minutes 免费的公共存储库中使用。在私有存储库中,GitHub 的 ARM 运行器应该更具成本效益,并且更容易设置。
¥Check out our GitHub Action guide for an example workflow that leverages QEMU to build the app. Note that this is extremely slow and only recommended in public repositories where Build Minutes are free. In private repositories GitHub’s ARM runners should be more cost-efficient and much easier to set up.
Tauri 中文网 - 粤ICP备13048890号