Dough Git

commit

Fix AUR Build

commit
5ac87eefc8a3a68175f495ac06d306c6874d266a
author
Clove Twilight <[email protected]>
date
2026-08-30 16:37

diff --git a/packaging/aur/PKGBUILD b/packaging/aur/PKGBUILD
index a814eaa..1188e47 100644
--- a/packaging/aur/PKGBUILD
+++ b/packaging/aur/PKGBUILD
@@ -11,7 +11,7 @@
 # It repackages the published Electron AppImage rather than building from
 # source (Arch's guidelines would call that a `-bin` package; the unsuffixed
 # name is a deliberate maintainer preference). The AppImage bundles its own
-# Chromium/Electron runtime, so `depends` below is just the system libraries
+# Chromium/Electron runtime; `depends` below is only the system libraries
 # Chromium dlopen()s at runtime.
 
 pkgname=doughmination-music
@@ -24,9 +24,16 @@ license=('LicenseRef-DASL-1.0')
 depends=(
   'gtk3'
   'nss'
+  'nspr'
   'alsa-lib'
-  'libnotify'
+  'at-spi2-core'
+  'libcups'
+  'libxkbcommon'
+  'libxtst'
   'libxss'
+  'libnotify'
+  'mesa'
+  'libdrm'
   # Owns the /usr/share/icons/hicolor hierarchy this package drops icons into.
   'hicolor-icon-theme'
   # Sign-in hands the OIDC flow to the system browser (shell.openExternal ->
@@ -56,32 +63,47 @@ prepare() {
 }
 
 package() {
-  cd "$srcdir/squashfs-root"
-
-  # Electron needs its resources (app.asar, locales, …) adjacent to the
-  # binary, so install the whole tree under /opt and symlink into PATH.
+  # electron-builder's AppImage keeps the whole app at the root of the mount:
+  # the Electron binary (our `executableName`, == $pkgname), plus resources/,
+  # locales/, *.pak, *.bin, *.so and chrome-sandbox. Electron needs those
+  # adjacent, so install the tree under /opt and symlink into PATH.
   install -dm755 "$pkgdir/opt/$pkgname"
-  cp -a usr/lib/"$pkgname"/. "$pkgdir/opt/$pkgname/"
-  chmod 4755 "$pkgdir/opt/$pkgname/chrome-sandbox" 2>/dev/null || true
+  cp -a --no-preserve=ownership squashfs-root/. "$pkgdir/opt/$pkgname/"
+
+  # Drop the AppImage-only bits — the runtime doesn't use them, and the
+  # usr/share tree is installed to real system paths below instead.
+  rm -rf "$pkgdir/opt/$pkgname/usr" \
+         "$pkgdir/opt/$pkgname/AppRun" \
+         "$pkgdir/opt/$pkgname/AppRun.wrapped" \
+         "$pkgdir/opt/$pkgname/.DirIcon"
+  rm -f "$pkgdir/opt/$pkgname"/*.desktop
+
+  if [ ! -x "$pkgdir/opt/$pkgname/$pkgname" ]; then
+    echo "::error:: expected Electron binary /opt/$pkgname/$pkgname not found — AppImage layout changed" >&2
+    ls -la "$pkgdir/opt/$pkgname" >&2
+    return 1
+  fi
+
+  # Electron's sandbox helper must be setuid root.
+  chmod 4755 "$pkgdir/opt/$pkgname/chrome-sandbox"
 
   install -dm755 "$pkgdir/usr/bin"
   ln -s "/opt/$pkgname/$pkgname" "$pkgdir/usr/bin/$pkgname"
 
-  install -Dm644 usr/share/applications/*.desktop \
-    "$pkgdir/usr/share/applications/$pkgname.desktop"
-  # Point Exec at the installed path and make sure the deep-link callback URL
-  # is forwarded (Exec needs a %u for the doughmination:// sign-in bounce).
-  sed -i \
-    -e "s|^Exec=.*|Exec=/usr/bin/$pkgname %u|" \
-    "$pkgdir/usr/share/applications/$pkgname.desktop"
+  # .desktop from the AppImage (globbed — electron-builder's basename has
+  # varied). Repoint Exec at the installed path; keep %u so the
+  # doughmination:// sign-in callback is forwarded to the app.
+  local desktop
+  desktop=$(find squashfs-root/usr/share/applications -name '*.desktop' 2>/dev/null | head -1)
+  if [ -n "$desktop" ]; then
+    install -Dm644 "$desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
+    sed -i "s|^Exec=.*|Exec=/usr/bin/$pkgname %u|" \
+      "$pkgdir/usr/share/applications/$pkgname.desktop"
+  fi
 
-  local icon dir
-  for icon in usr/share/icons/hicolor/*/apps/"$pkgname".png; do
-    [ -f "$icon" ] || continue
-    dir="${icon#usr/share/icons/hicolor/}"
-    dir="${dir%%/*}"
-    install -Dm644 "$icon" "$pkgdir/usr/share/icons/hicolor/$dir/apps/$pkgname.png"
-  done
+  if [ -d squashfs-root/usr/share/icons ]; then
+    cp -a --no-preserve=ownership squashfs-root/usr/share/icons "$pkgdir/usr/share/"
+  fi
 
   install -Dm644 "$srcdir/LICENCE-$pkgver.md" \
     "$pkgdir/usr/share/licenses/$pkgname/LICENCE.md"