From 64f7de522f459b724a49db8eba88fb17ff38adfd Mon Sep 17 00:00:00 2001 From: minerharry <35383543+minerharry@users.noreply.github.com> Date: Wed, 21 Oct 2026 05:24:23 +0000 Subject: [PATCH] Fix subdirectory and launcher install structure build and package both assume that the git repo will be sourced at $srcdir, but the released source tarball contains a further top-level directory containing the repository. Added logic to detect the name of this repository and make installation relative to that, which I called $srcrepo. Also, fixed package() trying to write the install script without first creating the directory structure in fakeroot. --- tools/linux/PKGBUILD | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tools/linux/PKGBUILD b/tools/linux/PKGBUILD index 196752e7b..e1101739e 100644 --- a/tools/linux/PKGBUILD +++ b/tools/linux/PKGBUILD @@ -26,50 +26,53 @@ source=("$pkgname-$pkgver.tar.gz::https://github.com/MonoEven/Autohotkey_Linux/a sha256sums=('abb9e087e34ec957b9cda88752e5c0bb1ea11e5d1cf4dd106c50e7bfc557b27d') build() { + export srcrepo="$srcdir"/$(tar --exclude='*/*' -tvf "$srcdir"/"$pkgname-$pkgver.tar.gz" | awk '{print $NF}') + cd $srcrepo cmake -S . -B build-core -G Ninja \ -DCMAKE_BUILD_TYPE=Release cmake --build build-core } package() { - install -Dm755 "$srcdir"/build-core/source/linux/core/ahk_core \ + install -Dm755 "$srcrepo"/build-core/source/linux/core/ahk_core \ "$pkgdir"/usr/share/autohotkey/ahk_core - install -Dm755 "$srcdir"/build-core/source/linux/inputd/ahk-inputd \ + install -Dm755 "$srcrepo"/build-core/source/linux/inputd/ahk-inputd \ "$pkgdir"/usr/share/autohotkey/ahk-inputd - install -Dm644 "$srcdir"/tools/linux/systemd/ahk-inputd.socket \ + install -Dm644 "$srcrepo"/tools/linux/systemd/ahk-inputd.socket \ "$pkgdir"/usr/lib/systemd/system/ahk-inputd.socket sed 's|@INPUTD_EXEC@|/usr/share/autohotkey/ahk-inputd|g' \ - "$srcdir"/tools/linux/systemd/ahk-inputd.service.in \ + "$srcrepo"/tools/linux/systemd/ahk-inputd.service.in \ > "$pkgdir"/usr/lib/systemd/system/ahk-inputd.service chmod 644 "$pkgdir"/usr/lib/systemd/system/ahk-inputd.service # Official upstream AutoHotkey icon: SNI pixmap + freedesktop theme name. - install -Dm644 "$srcdir"/source/resources/icon_main.ico \ + install -Dm644 "$srcrepo"/source/resources/icon_main.ico \ "$pkgdir"/usr/share/autohotkey/icon_main.ico - install -Dm644 "$srcdir"/docs-v2/docs/static/ahk16.png \ + install -Dm644 "$srcrepo"/docs-v2/docs/static/ahk16.png \ "$pkgdir"/usr/share/autohotkey/autohotkey.png - install -Dm644 "$srcdir"/docs-v2/docs/static/ahk16.png \ + install -Dm644 "$srcrepo"/docs-v2/docs/static/ahk16.png \ "$pkgdir"/usr/share/icons/hicolor/16x16/apps/autohotkey.png # launcher: full --update/--uninstall/--check rendered from the shared # template; the package layout matches /usr, so the launcher's # install-method detection (pacman) works on Arch. + install -Dm755 "$srcrepo"/tools/linux/ahk-launcher.in "$pkgdir/usr/bin/ahk" sed -e 's|@PREFIX@|/usr|g' \ -e 's|@LIB_SUB@|share/autohotkey|g' \ -e 's|@BIN_SUB@|bin|g' \ -e 's|@DOC_SUB@|share/doc/autohotkey|g' \ -e "s|@AHK_VERSION@|$pkgver|g" \ - "$srcdir"/tools/linux/ahk-launcher.in > "$pkgdir/usr/bin/ahk" + "$srcrepo"/tools/linux/ahk-launcher.in > "$pkgdir/usr/bin/ahk" chmod 755 "$pkgdir/usr/bin/ahk" # docs install -d "$pkgdir/usr/share/doc/autohotkey" - cp -r "$srcdir"/docs-v2 "$pkgdir/usr/share/doc/autohotkey/docs-v2" - cp -r "$srcdir"/examples "$pkgdir/usr/share/doc/autohotkey/examples" - install -Dm644 "$srcdir/README.md" "$pkgdir/usr/share/doc/autohotkey/README.md" - install -Dm644 "$srcdir/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + cp -r "$srcrepo"/docs-v2 "$pkgdir/usr/share/doc/autohotkey/docs-v2" + cp -r "$srcrepo"/examples "$pkgdir/usr/share/doc/autohotkey/examples" + install -Dm644 "$srcrepo/README.md" "$pkgdir/usr/share/doc/autohotkey/README.md" + install -Dm644 "$srcrepo/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" # GNOME Shell global-hotkey extension (system-wide; pacman lifecycle: # upgrades replace it, removal deletes it; enable per user via # gnome-extensions enable, see post_install below). EXT="$pkgdir/usr/share/gnome-shell/extensions/ahk-global-hotkeys@autohotkey.org" install -d "$EXT" - install -Dm644 "$srcdir"/extension/ahk-global-hotkeys@autohotkey.org/metadata.json "$EXT/metadata.json" - install -Dm644 "$srcdir"/extension/ahk-global-hotkeys@autohotkey.org/extension.js "$EXT/extension.js" + install -Dm644 "$srcrepo"/extension/ahk-global-hotkeys@autohotkey.org/metadata.json "$EXT/metadata.json" + install -Dm644 "$srcrepo"/extension/ahk-global-hotkeys@autohotkey.org/extension.js "$EXT/extension.js" }