|
| 1 | +--- |
| 2 | +title: AUR |
| 3 | +sidebar: |
| 4 | + order: 1 |
| 5 | +--- |
| 6 | + |
| 7 | +# Publishing To The Arch User Repository |
| 8 | + |
| 9 | +## Setup |
| 10 | + |
| 11 | +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. |
| 12 | + |
| 13 | +```sh |
| 14 | +git clone https://aur.archlinux.org/your-repo-name |
| 15 | +``` |
| 16 | + |
| 17 | +After completing the steps above, create a file with the name `PKGBUILD`. Once the file is created you can move onto the next step. |
| 18 | + |
| 19 | +### Writing a PKGBUILD file |
| 20 | + |
| 21 | +```ini title="PKGBUILD" |
| 22 | +pkgname=<pkgname> |
| 23 | +pkgver=1.0.0 |
| 24 | +pkgrel=1 |
| 25 | +pkgdesc="Description of your app" |
| 26 | +arch=('x86_64' 'aarch64') |
| 27 | +url="https://github.com/<user>/<project>" |
| 28 | +license=('mit') |
| 29 | +depends=('cairo' 'desktop-file-utils' 'gdk-pixbuf2' 'glib2' 'gtk3' 'hicolor-icon-theme' 'libsoup' 'pango' 'webkit2gtk') |
| 30 | +options=('!strip' '!emptydirs') |
| 31 | +install=${pkgname}.install |
| 32 | +source_x86_64=("https://github.com/<user>/<project>/releases/download/v$pkgver/appname_"$pkgver"_amd64.deb") |
| 33 | +source_aarch64=("https://github.com/<user>/<project>/releases/download/v$pkgver/appname_"$pkgver"_arm64.deb") |
| 34 | +``` |
| 35 | + |
| 36 | +- At the top of the file, define your package name and assign it the variable `pkgname`. |
| 37 | +- Set your `pkgver` variable. Typically it is best to use this variable in the source variable to increase maintainability. |
| 38 | +- The `pkgdesc` variable on your aur repo's page and tells vistors what your app does. |
| 39 | +- The `arch` variable controls what architectures can install your package. |
| 40 | +- The `url` variable, while not required, helps to make your package appear more professional. |
| 41 | +- The `install` variable defines a file that runs the installation commands. |
| 42 | +- 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. |
| 43 | +- 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. |
| 44 | + |
| 45 | +### Generating `SRCINFO` |
| 46 | + |
| 47 | +In order to push your repo to the aur you must generate an `srcinfo` file. This can be done with this command. |
| 48 | + |
| 49 | +```sh |
| 50 | +makepkg --printsrcinfo >> .SRCINFO |
| 51 | +``` |
| 52 | + |
| 53 | +### Testing |
| 54 | + |
| 55 | +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 |
| 56 | + |
| 57 | +### Publishing |
| 58 | + |
| 59 | +Finally, after the testing phase is over, you can publish the application to the arch user repository with these commands. |
| 60 | + |
| 61 | +```sh |
| 62 | +git add . |
| 63 | + |
| 64 | +git commit -m "Initial Commit" |
| 65 | + |
| 66 | +git push |
| 67 | +``` |
| 68 | + |
| 69 | +If all goes well, your repository should now appear on the aur website. |
| 70 | + |
| 71 | +## Examples |
| 72 | + |
| 73 | +### Extracting From A Debian Package |
| 74 | + |
| 75 | +```ini title="PKGBUILD" |
| 76 | +# Maintainer: |
| 77 | +# Contributor: |
| 78 | +pkgname=<pkgname> |
| 79 | +pkgver=1.0.0 |
| 80 | +pkgrel=1 |
| 81 | +pkgdesc="Description of your app" |
| 82 | +arch=('x86_64' 'aarch64') |
| 83 | +url="https://github.com/<user>/<project>" |
| 84 | +license=('mit') |
| 85 | +depends=('cairo' 'desktop-file-utils' 'gdk-pixbuf2' 'glib2' 'gtk3' 'hicolor-icon-theme' 'libsoup' 'pango' 'webkit2gtk') |
| 86 | +options=('!strip' '!emptydirs') |
| 87 | +install=${pkgname}.install |
| 88 | +source_x86_64=("https://github.com/<user>/<project>/releases/download/v$pkgver/appname_"$pkgver"_amd64.deb") |
| 89 | +source_aarch64=("https://github.com/<user>/<project>/releases/download/v$pkgver/appname_"$pkgver"_arm64.deb") |
| 90 | +sha256sums_x86_64=('ca85f11732765bed78f93f55397b4b4cbb76685088553dad612c5062e3ec651f') |
| 91 | +sha256sums_aarch64=('ed2dc3169d34d91188fb55d39867713856dd02a2360ffe0661cb2e19bd701c3c') |
| 92 | +package() { |
| 93 | + |
| 94 | + # Extract package data |
| 95 | + tar -xz -f data.tar.gz -C "${pkgdir}" |
| 96 | + |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +```ini title="my-tauri-app.install" |
| 101 | +post_install() { |
| 102 | + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor |
| 103 | + update-desktop-database -q |
| 104 | +} |
| 105 | + |
| 106 | +post_upgrade() { |
| 107 | + post_install |
| 108 | +} |
| 109 | + |
| 110 | +post_remove() { |
| 111 | + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor |
| 112 | + update-desktop-database -q |
| 113 | +} |
| 114 | + |
| 115 | +``` |
| 116 | + |
| 117 | +### Building from source |
| 118 | + |
| 119 | +```ini title="PKGBUILD" |
| 120 | +# Maintainer: |
| 121 | +pkgname=<pkgname>-git |
| 122 | +pkgver=1.1.0 |
| 123 | +pkgrel=1 |
| 124 | +pkgdesc="Description of your app" |
| 125 | +arch=('any') |
| 126 | +url="https://github.com/<user>/<project>" |
| 127 | +license=('mit') |
| 128 | +depends=('cairo' 'desktop-file-utils' 'gdk-pixbuf2' 'glib2' 'gtk3' 'hicolor-icon-theme' 'libsoup' 'pango' 'webkit2gtk') |
| 129 | +makedepends=('git' 'file' 'openssl' 'appmenu-gtk-module' 'libappindicator-gtk3' 'librsvg' 'base-devel' 'curl' 'wget' 'rustup' 'npm' 'nodejs' 'dpkg') |
| 130 | +provides=('<pkgname>') |
| 131 | +conflicts=('<binname>' '<pkgname>') |
| 132 | +options=('!strip' '!emptydirs') |
| 133 | +source=('git+https://github.com/<user>/<project>') |
| 134 | +sha256sums=('SKIP') |
| 135 | +prepare() { |
| 136 | + cd <project> |
| 137 | + npm install |
| 138 | + npm run tauri build |
| 139 | +} |
| 140 | +package() { |
| 141 | + cd "$srcdir"/<project>/src-tauri/target/*unknown-linux*/release/bundle/deb |
| 142 | + dpkg-deb -x *.deb here |
| 143 | + cd here |
| 144 | + |
| 145 | + install -Dm755 usr/bin/myapp "$pkgdir"/usr/bin/myapp |
| 146 | + |
| 147 | + # Install desktop file |
| 148 | + install -Dm644 usr/share/applications/myapp.desktop "$pkgdir"/usr/share/applications/myapp.desktop |
| 149 | + |
| 150 | + # Install icons |
| 151 | + install -Dm644 usr/share/icons/hicolor/128x128/apps/myapp.png "$pkgdir"/usr/share/icons/hicolor/128x128/apps/myapp.png |
| 152 | + install -Dm644 usr/share/icons/hicolor/256x256@2/apps/myapp.png "$pkgdir"/usr/share/icons/hicolor/256x256@2/apps/myapp.png |
| 153 | + install -Dm644 usr/share/icons/hicolor/32x32/apps/myapp.png "$pkgdir"/usr/share/icons/hicolor/32x32/apps/myapp.png |
| 154 | + # Extract package data |
| 155 | +} |
| 156 | +``` |
| 157 | + |
| 158 | +[`async_runtime::spawn`]: https://docs.rs/tauri/2.0.0-beta/tauri/async_runtime/fn.spawn.html |
| 159 | +[`serde::serialize`]: https://docs.serde.rs/serde/trait.Serialize.html |
| 160 | +[`serde::deserialize`]: https://docs.serde.rs/serde/trait.Deserialize.html |
| 161 | +[`thiserror`]: https://github.com/dtolnay/thiserror |
| 162 | +[`result`]: https://doc.rust-lang.org/std/result/index.html |
0 commit comments