Package Details: fmodengine 2.02.25-1

Git Clone URL: https://aur.archlinux.org/fmodengine.git (read-only, click to copy)
Package Base: fmodengine
Description: FMOD Engine API and tools - Audio engine and toolset for games.
Upstream URL: https://www.fmod.com/
Licenses: custom
Submitter: Neko_Rikka
Maintainer: Neko_Rikka
Last Packager: Neko_Rikka
Votes: 0
Popularity: 0.000000
First Submitted: 2024-09-01 10:37 (UTC)
Last Updated: 2024-11-11 13:45 (UTC)

Dependencies (3)

Required by (1)

Sources (1)

Latest Comments

Neko_Rikka commented on 2024-11-11 13:32 (UTC) (edited on 2024-11-12 00:01 (UTC) by Neko_Rikka)

@dundarious

Here's a response:

Thank you for your suggestions! I've incorporated some of your improvements into the package:

  • Added patchelf to makedepends
  • Implemented the rpath fix to avoid the need for LD_LIBRARY_PATH
  • Fixed the file permissions issues

However, I couldn't implement the manual download step (bash -c '. ./PKGBUILD && _download') as it would break compatibility with AUR helpers like yay. The package needs to maintain automated build capability for AUR users.

Thanks again for your valuable feedback and contributions to improving the package!

dundarious commented on 2024-11-11 07:35 (UTC) (edited on 2024-11-11 07:38 (UTC) by dundarious)

Just realized the /opt/fmodengine dir contents are not all owned by root. Probably caused by the extraction being done manually. I just put the file details in source=() and sha256sums=(), and made the download step manual (bash -c '. ./PKGBUILD && _download'). I don't use yay or any of the AUR aware package managers, so I don't know if that manual step breaks them, but it resolved the issue for me.

Realized this when I used patchelf to avoid the need for LD_LIBRARY_PATH="/usr/lib/fmodengine" -- I ran patchelf --add-rpath /usr/lib/fmodengine /opt/fmodengine/bin/fsbank and it succeeded without needing root permissions.

Easy to add patchelf to makedepends and do that in prepare(). Works for my workflow where I only use fsbank (cli, not gui), didn't test the other exes.

Patch if you want it:

diff --git a/PKGBUILD b/PKGBUILD
index 6842cf7..7d05124 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,23 +3,20 @@

 pkgname=fmodengine
 pkgver=2.02.24
-pkgrel=3
+pkgrel=4
 pkgdesc="FMOD Engine API and tools."
 arch=('x86_64')
 url="https://www.fmod.com/"
 license=('custom')
-makedepends=('jq')
+makedepends=(jq patchelf)
 depends=('glibc')
 options=('!strip')
-_filename="fmodstudioapi${pkgver//./}linux.tar.gz"
-_sha256="118d82791746344e8d909b79b679453d33003810fce3a99c4aa2da1acce00c71"
-
-build() {
-    local file="${SRCDEST}/${_filename}"
-    local sha256="$(sha256sum "$file" 2>/dev/null | awk '{print $1}')" || true
-    # Only use _sha256 to skip re-downloading, not used in general as an integrity check.
-    if test "$sha256" = "${_sha256:-}" ; then return 0 ; fi
+source=("fmodstudioapi${pkgver//./}linux.tar.gz")
+sha256sums=("118d82791746344e8d909b79b679453d33003810fce3a99c4aa2da1acce00c71")

+# run like bash -c '. ./PKGBUILD && _download'
+_download() {
+    local file="./${source[0]}"
     echo "Downloading FMOD Engine requires an FMOD.com account"
     local username="${FMOD_LOGIN:-}"
     local password="${FMOD_PASSWORD:-}"
@@ -56,10 +53,10 @@ build() {
             fi
         fi 

-        echo "Downloading $_filename..."
+        echo "Downloading $file..."
         if output=$(curl -G "https://fmod.com/api-get-download-link" \
                     --data-urlencode path="files/fmodstudio/api/Linux/" \
-                    --data-urlencode filename="$_filename" \
+                    --data-urlencode filename="$(basename "$file")" \
                     -H "Authorization: FMOD $token") &&
                     downloadurl=$(echo "$output" | jq -r '.url | strings') && [[ -n $downloadurl ]]
         then
@@ -86,9 +83,17 @@ build() {
     done
 }

+prepare() {
+    local e
+    for e in "$srcdir/fmodstudioapi${pkgver//./}linux/bin/"{fmodprofiler,fsbank,fsbank_gui} ; do
+        patchelf --add-rpath /usr/lib/fmodengine "$e"
+        chmod 0755 "$e"
+    done
+}
+
 package() {
     install -d "${pkgdir}/opt/$pkgname"
-    tar -xzf "${SRCDEST}/${_filename}" -C "${pkgdir}/opt/$pkgname" --strip-components=1
+    cp -r "$srcdir/fmodstudioapi${pkgver//./}linux/"{plugins,bin,doc,api} "${pkgdir}/opt/$pkgname"

     install -d "${pkgdir}/usr/bin"
     ln -s "/opt/$pkgname/bin/fmodprofiler" "${pkgdir}/usr/bin/fmodprofiler"

Neko_Rikka commented on 2024-10-30 08:33 (UTC) (edited on 2024-11-06 02:51 (UTC) by Neko_Rikka)

@dundarious

Thank you for your valuable suggestions! I've implemented the recommended changes.

dundarious commented on 2024-10-29 19:15 (UTC) (edited on 2024-10-29 19:18 (UTC) by dundarious)

Suggested changes:

  1. fix prepare() to work in a chroot and when package not already installed, because the *.so glob on a path in /opt/... will fail. instead, glob on paths in "$pkgdir/opt/..." but still make the symlink point to /opt/...
  2. jq is a build dependency, add it to makedepends
  3. skip downloading if file matches checksum
  4. use PKGBUILD's $CARCH as the variable for current architecture instead of the $arch array
  5. don't bother stripping binaries
  6. trivial: replace . in pkgver using just bash
  7. trivial: quote variable expansion for username and password
diff --git a/PKGBUILD b/PKGBUILD
index 29dde33..cce1af4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,14 +8,21 @@ pkgdesc="FMOD Engine API and tools"
 arch=('x86_64')
 url="https://www.fmod.com/"
 license=('custom')
+makedepends=('jq')
 depends=('glibc')
-_filename=fmodstudioapi$(echo "${pkgver}" | sed 's/\.//g')linux.tar.gz
+options=('!strip')
+_filename="fmodstudioapi${pkgver//./}linux.tar.gz"
+_sha256="118d82791746344e8d909b79b679453d33003810fce3a99c4aa2da1acce00c71"

 build() {
-    echo "Downloading FMOD Engine requires an FMOD.com account"
     local file="${SRCDEST}/${_filename}"
-    local username=$FMOD_LOGIN
-    local password=$FMOD_PASSWORD
+    local sha256="$(sha256sum "$file" 2>/dev/null | awk '{print $1}')" || true
+    # Only use _sha256 to skip re-downloading, not used in general as an integrity check.
+    if test "$sha256" = "${_sha256:-}" ; then return 0 ; fi
+
+    echo "Downloading FMOD Engine requires an FMOD.com account"
+    local username="${FMOD_LOGIN:-}"
+    local password="${FMOD_PASSWORD:-}"
     local token
     local completed=0

@@ -89,7 +96,10 @@ package() {
     ln -s "/opt/$pkgname/bin/fsbank_gui" "${pkgdir}/usr/bin/fsbank_gui"

     install -d "${pkgdir}/usr/lib/$pkgname"
-    ln -s "/opt/$pkgname/api/core/lib/${arch}"/*.so "${pkgdir}/usr/lib/$pkgname"
-    ln -s "/opt/$pkgname/api/fsbank/lib/${arch}"/*.so "${pkgdir}/usr/lib/$pkgname"
-    ln -s "/opt/$pkgname/api/studio/lib/${arch}"/*.so "${pkgdir}/usr/lib/$pkgname"
+    local i d
+    for d in core fsbank studio ; do
+        for i in "$pkgdir/opt/$pkgname/api/$d/lib/$CARCH/"*.so ; do
+            ln -s "/opt/$pkgname/api/$d/lib/$CARCH/$(basename "$i")" "$pkgdir/usr/lib/$pkgname"
+        done
+    done
 }

Neko_Rikka commented on 2024-10-04 13:16 (UTC)

Don't forget to add the following line to your .bashrc or other environment configuration export LD_LIBRARY_PATH="/usr/lib/fmodengine" after install complete