Skip to content
Tauri 中文网

AUR

发布到 Arch 用户存储库

¥Publishing To The Arch User Repository

设置

¥Setup

首先转到 https://aur.archlinux.org 并创建一个账户。请务必添加正确的 ssh 密钥。接下来,使用此命令克隆一个空的 git 存储库。

¥First go to https://aur.archlinux.org and make an account. Be sure to add the proper ssh keys. Next, clone an empty git repository using this command.

Terminal window
git clone https://aur.archlinux.org/your-repo-name

完成上述步骤后,创建一个名为 PKGBUILD 的文件。创建文件后,你可以进入下一步。

¥After completing the steps above, create a file with the name PKGBUILD. Once the file is created you can move onto the next step.

编写 PKGBUILD 文件

¥Writing a PKGBUILD file

PKGBUILD
pkgname=<pkgname>
pkgver=1.0.0
pkgrel=1
pkgdesc="Description of your app"
arch=('x86_64' 'aarch64')
url="https://github.com/<user>/<project>"
license=('mit')
depends=('cairo' 'desktop-file-utils' 'gdk-pixbuf2' 'glib2' 'gtk3' 'hicolor-icon-theme' 'libsoup' 'pango' 'webkit2gtk-4.1')
options=('!strip' '!emptydirs')
install=${pkgname}.install
source_x86_64=("https://github.com/<user>/<project>/releases/download/v$pkgver/appname_"$pkgver"_amd64.deb")
source_aarch64=("https://github.com/<user>/<project>/releases/download/v$pkgver/appname_"$pkgver"_arm64.deb")
  • 在文件顶部,定义你的包名称并为其分配变量 pkgname

    ¥At the top of the file, define your package name and assign it the variable pkgname.

  • 设置你的 pkgver 变量。通常,最好在源变量中使用此变量来提高可维护性。

    ¥Set your pkgver variable. Typically it is best to use this variable in the source variable to increase maintainability.

  • aur repo 页面上的 pkgdesc 变量告诉访问者你的应用的作用。

    ¥The pkgdesc variable on your aur repo’s page and tells vistors what your app does.

  • arch 变量控制哪些架构可以安装你的软件包。

    ¥The arch variable controls what architectures can install your package.

  • url 变量虽然不是必需的,但有助于使你的包看起来更专业。

    ¥The url variable, while not required, helps to make your package appear more professional.

  • install 变量定义运行安装命令的文件。

    ¥The install variable defines a file that runs the installation commands.

  • depends 变量包含使应用运行所需的项目列表。对于任何 Tauri 应用,你必须包含上面显示的所有依赖。

    ¥The depends variable includes a list of items that are required to make your app run. For any Tauri app you must include all of the dependencies shown above.

  • source 变量是必需的,它定义上游包的位置。你可以通过将体系结构添加到变量名称末尾来使 source 体系结构特定。

    ¥The source variable is required and defines the location where your upstream package is. You can make a source architecture specific by adding the architecture to the end of the variable name.

生成 SRCINFO

¥Generating SRCINFO

为了将你的 repo 推送到 aur,你必须生成一个 srcinfo 文件。可以使用此命令完成此操作。

¥In order to push your repo to the aur you must generate an srcinfo file. This can be done with this command.

Terminal window
makepkg --printsrcinfo >> .SRCINFO

测试

¥Testing

测试应用非常简单。你所要做的就是在与 pkgbuild 文件相同的目录中运行 makepkg -f,看看它是否有效

¥Testing the app is extremely simple. All you have to do is run makepkg -f within the same directory as the pkgbuild file and see if it works

发布

¥Publishing

最后,测试阶段结束后,你可以使用这些命令将应用发布到 arch 用户存储库。

¥Finally, after the testing phase is over, you can publish the application to the arch user repository with these commands.

Terminal window
git add .
git commit -m "Initial Commit"
git push

如果一切顺利,你的存储库现在应该出现在 aur 网站上。

¥If all goes well, your repository should now appear on the aur website.

示例

¥Examples

从 Debian 包中提取

¥Extracting From A Debian Package

PKGBUILD
# Maintainer:
# Contributor:
pkgname=<pkgname>
pkgver=1.0.0
pkgrel=1
pkgdesc="Description of your app"
arch=('x86_64' 'aarch64')
url="https://github.com/<user>/<project>"
license=('mit')
depends=('cairo' 'desktop-file-utils' 'gdk-pixbuf2' 'glib2' 'gtk3' 'hicolor-icon-theme' 'libsoup' 'pango' 'webkit2gtk-4.1')
options=('!strip' '!emptydirs')
install=${pkgname}.install
source_x86_64=("https://github.com/<user>/<project>/releases/download/v$pkgver/appname_"$pkgver"_amd64.deb")
source_aarch64=("https://github.com/<user>/<project>/releases/download/v$pkgver/appname_"$pkgver"_arm64.deb")
sha256sums_x86_64=('ca85f11732765bed78f93f55397b4b4cbb76685088553dad612c5062e3ec651f')
sha256sums_aarch64=('ed2dc3169d34d91188fb55d39867713856dd02a2360ffe0661cb2e19bd701c3c')
package() {
# Extract package data
tar -xz -f data.tar.gz -C "${pkgdir}"
}
my-tauri-app.install
post_install() {
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
update-desktop-database -q
}
post_upgrade() {
post_install
}
post_remove() {
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
update-desktop-database -q
}

从源代码构建

¥Building from source

PKGBUILD
# Maintainer:
pkgname=<pkgname>-git
pkgver=1.1.0
pkgrel=1
pkgdesc="Description of your app"
arch=('any')
url="https://github.com/<user>/<project>"
license=('mit')
depends=('cairo' 'desktop-file-utils' 'gdk-pixbuf2' 'glib2' 'gtk3' 'hicolor-icon-theme' 'libsoup' 'pango' 'webkit2gtk-4.1')
makedepends=('git' 'file' 'openssl' 'appmenu-gtk-module' 'libappindicator-gtk3' 'librsvg' 'base-devel' 'curl' 'wget' 'rustup' 'npm' 'nodejs' 'dpkg')
provides=('<pkgname>')
conflicts=('<binname>' '<pkgname>')
options=('!strip' '!emptydirs')
source=('git+https://github.com/<user>/<project>')
sha256sums=('SKIP')
prepare() {
cd <project>
npm install
npm run tauri build
}
package() {
cd "$srcdir"/<project>/src-tauri/target/*unknown-linux*/release/bundle/deb
dpkg-deb -x *.deb here
cd here
install -Dm755 usr/bin/myapp "$pkgdir"/usr/bin/myapp
# Install desktop file
install -Dm644 usr/share/applications/myapp.desktop "$pkgdir"/usr/share/applications/myapp.desktop
# Install icons
install -Dm644 usr/share/icons/hicolor/128x128/apps/myapp.png "$pkgdir"/usr/share/icons/hicolor/128x128/apps/myapp.png
install -Dm644 usr/share/icons/hicolor/256x256@2/apps/myapp.png "$pkgdir"/usr/share/icons/hicolor/256x256@2/apps/myapp.png
install -Dm644 usr/share/icons/hicolor/32x32/apps/myapp.png "$pkgdir"/usr/share/icons/hicolor/32x32/apps/myapp.png
# Extract package data
}

Tauri v2.4 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站