...
authoralex <[email protected]>
Mon, 26 Jun 2023 05:50:10 +0000 (22:50 -0700)
committeralex <[email protected]>
Mon, 26 Jun 2023 05:50:10 +0000 (22:50 -0700)
osu.scm

diff --git a/osu.scm b/osu.scm
index 981b92260de509f01e9422a391fe5f90fd3fe80c..551ce2b224c2a9e4f37bc27aef1e73634f279fac 100644 (file)
--- a/osu.scm
+++ b/osu.scm
@@ -1,8 +1,16 @@
 (define-module (infiniteadaptability packages osu)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bootstrap)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages elf)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages glib)
+  #:use-module (gnu packages linux)
   #:use-module (guix download)
   #:use-module (guix gexp)
   #:use-module (nonguix build-system binary)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses)
+                #:prefix license:)
   #:use-module (guix packages))
 
 (define-public osu
                  (base32
                   "0qjri6rjzlfxlphx0v7ydi19c7ai3bblyn9d22ij75glgm75n0a0"))))
       (build-system binary-build-system)
+      (inputs (list `(,gcc "lib")
+                   glibc
+                   zlib))
+      (native-inputs (list patchelf))
       (arguments
-       (list #:phases #~(modify-phases %standard-phases
-                       (delete 'strip-binaries)
-                       (delete 'validate-runpath)
-                       (delete 'make-dynamic-linker-cache)
-                          (add-after 'install 'symlink-binary-file-and-cleanup
-                            (lambda _
-                              (delete-file (string-append #$output
-                                            "/environment-variables"))
-                              (chmod (string-append #$output "/osu.AppImage")
-                                     #o755)
-                              (mkdir-p (string-append #$output "/bin"))
-                              (symlink (string-append #$output "/osu.AppImage")
-                                       (string-append #$output "/bin/osu")))))))
+       (list 
+        #:patchelf-plan `(("osu.AppImage" ("gcc" "zlib")))
+        #:phases #~(modify-phases %standard-phases
+                          (delete 'strip)
+                          (delete 'validate-runpath)
+                          (delete 'make-dynamic-linker-cache)
+                         (add-before 'patchelf 'patchelf-writable
+                                     (lambda _
+                                         (make-file-writable "osu.AppImage")))
+                         (add-before 'install 'extract-appimage
+                                   (lambda _
+                                     (chmod "osu.AppImage" #o755)
+                                     (invoke "./osu.AppImage" "--appimage-extract")))
+                         (add-after 'extract-appimage 'patch-osu-executable
+                                    (lambda _
+                              (let ((ld-so (string-append #$(this-package-input
+                                                             "glibc")
+                                                          #$(glibc-dynamic-linker))))
+                                (invoke "patchelf" "--set-interpreter" ld-so "squashfs-root/usr/bin/osu!")))))))
       (home-page "https://osu.ppy.sh/home")
       (synopsis "The bestest free-to-win rhythm game")
       (description "osu!")
-      (license unlicense))))
+      (license license:unlicense))))
 
 osu