1
0
Fork 0

Use correct /lib directory for actual-server

master
Sudoer777's Guix Server 2024-05-31 01:36:51 -05:00
parent f340c82f0d
commit 07f326214e
No known key found for this signature in database
GPG Key ID: 030A38A3A5035E37
1 changed files with 59 additions and 50 deletions

View File

@ -94,7 +94,8 @@
#:use-module
(guix build utils)
#:use-module
(gnu packages elf))
(gnu packages elf)
#:use-module (ice-9 pretty-print))
(define-public actual-server
(package
@ -103,51 +104,6 @@
(source (origin
(method url-fetch)
(uri (string-append "file://" ,directory "/actual-server.tar.gz"))
(snippet
'(begin
;; Guile code to pretty-print to a file
(use-modules (ice-9 pretty-print))
(let (
(run-output-file "actual-server-start"))
(call-with-output-file run-output-file
(lambda (port)
(format port "#!/usr/bin/env guile~%!#~%")
(pretty-print
'(begin
(use-modules
(ice-9 popen)
(ice-9 rdelim)
(srfi srfi-1)
(rnrs io ports)
(rnrs bytevectors)
(rnrs files)
(ice-9 pretty-print)
(ice-9 ftw))
(define (run-and-display-command command)
(let* ((port (open-pipe* OPEN_READ "sh" "-c" command))
(status #f))
(let loop ()
(let ((line (read-line port 'concat)))
(if (eof-object? line)
(begin
(set! status (close-pipe port))
(if (not (zero? status))
(error "Command failed" command status)))
(begin (display line) (force-output) (loop)))))))
(define ld-library-path "/lib") ;(getenv "LD_LIBRARY_PATH"))
(define home-path (getenv "HOME"))
(define sym-source (string-append home-path "/.cache/node"))
(define sym-target (string-append ld-library-path "/actual-server/node"))
; (mkdir (string-append home-path "/.cache"))
(symlink sym-target sym-source)
(run-and-display-command (string-append "cd " ld-library-path "/actual-server/proj && corepack enable && yarn start"))
; (run-and-display-command "corepack enable")
; (run-and-display-command "yarn start")
)
port))))))
(sha256
(base32 ,checksum))))
(build-system gnu-build-system)
@ -171,11 +127,64 @@
(let ((out (assoc-ref outputs "out")))
(copy-recursively "." (string-append out "/lib"))
(mkdir-p (string-append out "/bin"))
(format #t "Checking if actual-server-start exists: ~a~%" (file-exists? (string-append out "/lib/actual-server-start")))
(rename-file (string-append out "/lib/actual-server-start") (string-append out "/bin/actual-server"))
(chmod (string-append out "/bin/actual-server") #o755)
#t)))
(add-after 'copy-files 'patch-runpath
(add-after
'copy-files
'create-guile-script
(lambda* (#:key outputs #:allow-other-keys)
(use-modules (ice-9 pretty-print))
(let* ((out (assoc-ref outputs "out"))
(run-output-file (string-append out "/bin/actual-server")))
(call-with-output-file
run-output-file
(lambda (port)
(format port "#!/usr/bin/env guile~%!#~%")
(pretty-print
`(begin
(use-modules
(ice-9 popen)
(ice-9 rdelim)
(srfi srfi-1)
(rnrs io ports)
(rnrs bytevectors)
(rnrs files)
(ice-9 pretty-print)
(ice-9 ftw))
(define (run-and-display-command command)
(let* ((port (open-pipe*
OPEN_READ
"sh"
"-c"
command))
(status #f))
(let loop ()
(let ((line (read-line port 'concat)))
(if (eof-object? line)
(begin
(set! status (close-pipe port))
(if (not (zero? status))
(error "Command failed" command status)))
(begin
(display line)
(force-output)
(loop)))))))
(define ld-library-path ,(string-append out "/lib"))
(define home-path (getenv "HOME"))
(define sym-source
(string-append home-path "/.cache/node"))
(define sym-target
(string-append
ld-library-path
"/actual-server/node"))
(symlink sym-target sym-source)
(run-and-display-command
(string-append
"cd "
ld-library-path
"/actual-server/proj && corepack enable && yarn start")))
port)))
(chmod run-output-file #o755))))
(add-after 'copy-files 'create-guile-script
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(gcc-lib (string-append (assoc-ref inputs "gcc") "/lib")))