Archived
1
0
Fork 0

gnu: tuxguitar: Build and install ALSA plugin.

* gnu/packages/music.scm (tuxguitar): Allows MIDI sound output when using
a synthesizer like TiMidity++.
[inputs]: Add alsa-lib.
[arguments]: No longer change build directory context between phases.  Install
desktop, mime and manual files during the "install" phase.

Signed-off-by: Kei Kebreau <kkebreau@posteo.net>
This commit is contained in:
Mike Rosset 2020-01-16 11:48:26 -08:00 committed by Kei Kebreau
parent 039cb8e6b1
commit 44e70dee18
No known key found for this signature in database
GPG key ID: E6A5EE3C19467A0D

View file

@ -1749,58 +1749,84 @@ is subjective.")
#:tests? #f ; no tests #:tests? #f ; no tests
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-after 'unpack 'enter-dir (replace 'build
(lambda _ (chdir "TuxGuitar-lib") #t))
(add-after 'build 'build-libraries
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((initial-classpath (getenv "CLASSPATH")) (let* ((initial-classpath (getenv "CLASSPATH"))
(build-dir (lambda (dir) (build-dir (lambda (dir)
(chdir "..") (setenv
(setenv "CLASSPATH" "CLASSPATH"
(string-join (cons initial-classpath (string-join (cons initial-classpath
(find-files (getcwd) "\\.jar$")) (find-files (getcwd) "\\.jar$"))
":")) ":"))
(chdir dir) (with-directory-excursion dir
(if (file-exists? "build.xml") (if (file-exists? "build.xml")
((assoc-ref %standard-phases 'build) ((assoc-ref %standard-phases 'build)
#:build-target "build") #:build-target "build")
(begin (begin
;; Generate default build.xml. ;; Generate default build.xml.
((@@ (guix build ant-build-system) default-build.xml) ((@@ (guix build ant-build-system)
(string-append (string-downcase dir) ".jar") default-build.xml)
(string-append (assoc-ref outputs "out") (string-append (string-downcase dir) ".jar")
"/share/java")) (string-append (assoc-ref outputs "out")
((assoc-ref %standard-phases 'build))))))) "/share/java"))
(map build-dir '("TuxGuitar-editor-utils" ((assoc-ref %standard-phases 'build))))))))
(map build-dir '("TuxGuitar-lib"
"TuxGuitar-editor-utils"
"TuxGuitar-ui-toolkit" "TuxGuitar-ui-toolkit"
"TuxGuitar-ui-toolkit-swt" "TuxGuitar-ui-toolkit-swt"
"TuxGuitar-awt-graphics"))))) "TuxGuitar-viewer"
(add-after 'build-libraries 'build-application "TuxGuitar"
"TuxGuitar-gm-utils"
"TuxGuitar-alsa"
"TuxGuitar-midi"
"TuxGuitar-midi-ui"))
#t)))
(add-after 'build 'build-jni
(lambda _ (lambda _
(chdir "../TuxGuitar") (setenv "CC" "gcc")
((assoc-ref %standard-phases 'build) (setenv "CFLAGS" (string-append
#:build-target "build"))) "-fpic -I"
(getcwd)
"/build-scripts/native-modules/common-include"))
(invoke "make" "-C" "./TuxGuitar-alsa/jni" "-f" "GNUmakefile")))
(replace 'install (replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin")) (bin (string-append out "/bin"))
(share (string-append out "/share")) (share (string-append out "/share"))
(jni-lib (string-append out "/lib"))
(lib (string-append share "/java")) (lib (string-append share "/java"))
(swt (assoc-ref inputs "java-swt"))) (swt (assoc-ref inputs "java-swt"))
(mime (string-append share "/mime/packages"))
(app (string-append share "/applications"))
(man (string-append share "/man/man1")))
(mkdir-p bin) (mkdir-p bin)
;; Install all jars. ;; Install all jars.
(for-each (lambda (file) (for-each (lambda (file)
(install-file file lib)) (install-file file lib))
(find-files ".." "\\.jar$")) (find-files "." "\\.jar$"))
;; Install jni libraries
(for-each (lambda (file)
(install-file file jni-lib))
(find-files "." "\\-jni.so$"))
;; Install all resources. ;; Install all resources.
(copy-recursively "share" share) (copy-recursively "./TuxGuitar/share" share)
;; Install desktop and mime files
(install-file "./misc/tuxguitar.xml" mime)
(install-file "./misc/tuxguitar.desktop" app)
;; Install manaual
(install-file "./misc/tuxguitar.1" man)
;; Create wrapper. ;; Create wrapper.
(call-with-output-file (string-append bin "/tuxguitar") (call-with-output-file (string-append bin "/tuxguitar")
(lambda (port) (lambda (port)
(let ((classpath (string-join (append (find-files lib "\\.jar$") (let ((classpath (string-join (append (find-files lib "\\.jar$")
(find-files swt "\\.jar$")) (find-files swt "\\.jar$"))
":"))) ":")))
(format (format
port port
@ -1810,12 +1836,14 @@ is subjective.")
" -Dtuxguitar.home.path=" out " -Dtuxguitar.home.path=" out
" -Dtuxguitar.share.path=" out "/share" " -Dtuxguitar.share.path=" out "/share"
" -Dswt.library.path=" swt "/lib" " -Dswt.library.path=" swt "/lib"
" -Djava.library.path=" out "/lib"
" org.herac.tuxguitar.app.TGMainSingleton" " org.herac.tuxguitar.app.TGMainSingleton"
" \"$1\" \"$2\""))))) " \"$1\" \"$2\"")))))
(chmod (string-append bin "/tuxguitar") #o555) (chmod (string-append bin "/tuxguitar") #o555)
#t)))))) #t))))))
(inputs (inputs
`(("java-swt" ,java-swt))) `(("alsa-lib" ,alsa-lib)
("java-swt" ,java-swt)))
(home-page "http://tuxguitar.com.ar/") (home-page "http://tuxguitar.com.ar/")
(synopsis "Multitrack tablature editor and player") (synopsis "Multitrack tablature editor and player")
(description (description