Package Details: swayimg 1.4-2

Git Clone URL: https://aur.archlinux.org/swayimg.git (read-only, click to copy)
Package Base: swayimg
Description: Image viewer for Sway/Wayland
Upstream URL: https://github.com/artemsen/swayimg
Keywords: sway wayland
Licenses: MIT
Submitter: artem
Maintainer: artem
Last Packager: artem
Votes: 2
Popularity: 1.13
First Submitted: 2020-08-11 10:07
Last Updated: 2021-06-15 06:54

Latest Comments

artem commented on 2021-06-15 07:00

It looks like I didn't fully understand the concept of the AUR. This is really not a project build system. Fixed by now. Thank you, tinywrkb!

tinywrkb commented on 2021-06-14 09:59

You forces the usage of all supported formats even if they are not available on a target system, but build will fail if (for instance) you don't have libavif.

When you package an app you set in stone the app build-time optional features that are enabled during the build.
This is not the project buildsystem, there's a difference between build-time optional features and run-time optional features.
This app has zero run-time optional features so everything the optdepends should be dropped or moved to depends according to what you as a package maintainer decided should be enabled.

librsvg and libwebp are mandatory dependencies for now, but some optional libs are not mentioned at all.

As I said in my previous post, all the libs are actually being supplied by being in the dependency tree of the packages in the updated depends array.

And what hicolor-icon-theme does here?

While this is not documented, according to namcap, you must include it because of the installed icon, and it's the convention, just look up the packages requiring it.

swayimg E: Dependency hicolor-icon-theme detected and not included (needed for hicolor theme hierarchy)

artem commented on 2021-06-14 05:47

tinywrkb, your patch looks vary strange for me. librsvg and libwebp are mandatory dependencies for now, but some optional libs are not mentioned at all. And what hicolor-icon-theme does here? You forces the usage of all supported formats even if they are not available on a target system, but build will fail if (for instance) you don't have libavif.

tinywrkb commented on 2021-06-13 22:13

The optdepends is pretty much wrong unless you're going to implement a loader with dlopen(), and even then you need those libs in the makedepends array.

Here's a patch to fix the packaging plus some extra changes derived from the Arch Linux Meson guideline, what I saw in other (official) packages, building in a chroot and testing with namecap.

Because we get some of the libs from the dependency tree of those in the depends array, I decided that it's better to be safe and explicitly set the optional features in the meson_options array.
You can definitely drop this and this not the common convention but I'm not fond of keeping track of what changed in dependencies and I prefer to have the build fail when something changed.

diff --git a/PKGBUILD b/PKGBUILD
index 0c38e5f..841dd8e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,27 +2,33 @@

 pkgname=swayimg
 pkgver=1.3
-pkgrel=1
+pkgrel=2
 pkgdesc='Image viewer for Sway/Wayland'
 arch=('x86_64')
 license=('MIT')
-makedepends=('meson' 'ninja' 'wayland-protocols')
-depends=('wayland' 'cairo' 'json-c' 'libxkbcommon')
-optdepends=('libjpeg: JPEG images support'
-            'giflib: GIF images support'
-            'librsvg: SVG images support'
-            'libwebp: WebP images support')
+makedepends=('bash-completion' 'meson' 'wayland-protocols')
+depends=('hicolor-icon-theme' 'json-c' 'librsvg' 'libwebp' 'libxkbcommon' 'wayland')
+optdepends=('bash-completion: Bash completions')
 url='https://github.com/artemsen/swayimg'
 source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
 md5sums=('50eda0c8cc0c0c3883612b267bdba774')

 build() {
-    cd "${srcdir}/${pkgname}-${pkgver}"
-    meson --prefix=/usr "${srcdir}/build"
-    ninja -C "${srcdir}/build"
+    local meson_options=(
+      -D jpeg=enabled
+      -D gif=enabled
+      -D svg=enabled
+      -D webp=enabled
+      -D avif=enabled
+      -D bash=enabled
+      -D man=true
+      -D desktop=true
+    )
+    arch-meson ${pkgname}-${pkgver} build "${meson_options[@]}"
+    meson compile -C build
 }

 package(){
-    cd "${srcdir}/${pkgname}-${pkgver}"
-    DESTDIR="${pkgdir}" ninja -C "${srcdir}/build" install
+    meson install -C build --destdir "${pkgdir}"
+    install -Dm644 ${pkgname}-${pkgver}/LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}/
 }