unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#39155] [PATCH] gnu: tuxguitar: Build and install alsa plugin.
@ 2020-01-16 19:48 Mike Rosset
  2020-01-24  2:02 ` bug#39155: " Kei Kebreau
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Rosset @ 2020-01-16 19:48 UTC (permalink / raw)
  To: 39155; +Cc: Mike Rosset

* gnu/packages/music.scm (tuxguitar): Allows midi sound output when using
  a synthesizer like timidity.

  [inputs]: Adds alsa-lib as an input.
  [phases]: No longer change build directory context between phases.
  [install]: Now install desktop, mime and manual files.
---
 gnu/packages/music.scm | 90 +++++++++++++++++++++++++++---------------
 1 file changed, 59 insertions(+), 31 deletions(-)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index ad369bd3a8..15594ab0ba 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -1746,60 +1746,86 @@ is subjective.")
     (arguments
      `(#:build-target "build"
        #:jdk ,icedtea-8
-       #:tests? #f                      ; no tests
+       #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'enter-dir
-           (lambda _ (chdir "TuxGuitar-lib") #t))
-         (add-after 'build 'build-libraries
+         (replace 'build
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((initial-classpath (getenv "CLASSPATH"))
                     (build-dir (lambda (dir)
-                                 (chdir "..")
-                                 (setenv "CLASSPATH"
-                                         (string-join (cons initial-classpath
-                                                            (find-files (getcwd) "\\.jar$"))
-                                                      ":"))
-                                 (chdir dir)
-                                 (if (file-exists? "build.xml")
-                                     ((assoc-ref %standard-phases 'build)
-                                      #:build-target "build")
-                                     (begin
-                                       ;; Generate default build.xml.
-                                       ((@@ (guix build ant-build-system) default-build.xml)
-                                        (string-append (string-downcase dir) ".jar")
-                                        (string-append (assoc-ref outputs "out")
-                                                       "/share/java"))
-                                       ((assoc-ref %standard-phases 'build)))))))
-               (map build-dir '("TuxGuitar-editor-utils"
+                                 (setenv
+                                  "CLASSPATH"
+                                  (string-join (cons initial-classpath
+                                                     (find-files (getcwd) "\\.jar$"))
+                                               ":"))
+                                 (with-directory-excursion dir
+                                   (if (file-exists? "build.xml")
+                                       ((assoc-ref %standard-phases 'build)
+                                        #:build-target "build")
+                                       (begin
+                                         ;; Generate default build.xml.
+                                         ((@@ (guix build ant-build-system)
+                                              default-build.xml)
+                                          (string-append (string-downcase dir) ".jar")
+                                          (string-append (assoc-ref outputs "out")
+                                                         "/share/java"))
+                                         ((assoc-ref %standard-phases 'build))))))))
+               (map build-dir '("TuxGuitar-lib"
+                                "TuxGuitar-editor-utils"
                                 "TuxGuitar-ui-toolkit"
                                 "TuxGuitar-ui-toolkit-swt"
-                                "TuxGuitar-awt-graphics")))))
-         (add-after 'build-libraries 'build-application
+                                "TuxGuitar-viewer"
+                                "TuxGuitar"
+                                "TuxGuitar-gm-utils"
+                                "TuxGuitar-alsa"
+                                "TuxGuitar-midi"
+                                "TuxGuitar-midi-ui"))
+               #t)))
+         (add-after 'build 'build-jni
            (lambda _
-             (chdir "../TuxGuitar")
-             ((assoc-ref %standard-phases 'build)
-              #:build-target "build")))
+               (setenv "CC" "gcc")
+               (setenv "CFLAGS" (string-append
+                                 "-fpic -I"
+                                 (getcwd)
+                                 "/build-scripts/native-modules/common-include"))
+               (invoke "make" "-C" "./TuxGuitar-alsa/jni" "-f" "GNUmakefile")))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out   (assoc-ref outputs "out"))
                     (bin   (string-append out "/bin"))
                     (share (string-append out "/share"))
+                    (jni-lib (string-append out "/lib"))
                     (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)
                ;; Install all jars.
                (for-each (lambda (file)
                            (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.
-               (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.
                (call-with-output-file (string-append bin "/tuxguitar")
                  (lambda (port)
-                   (let ((classpath (string-join (append (find-files lib "\\.jar$")
+                   (let ((classpath (string-join (append  (find-files lib "\\.jar$")
                                                          (find-files swt "\\.jar$"))
                                                  ":")))
                      (format
@@ -1810,12 +1836,14 @@ is subjective.")
                                      " -Dtuxguitar.home.path=" out
                                      " -Dtuxguitar.share.path=" out "/share"
                                      " -Dswt.library.path=" swt "/lib"
+                                     " -Djava.library.path=" out "/lib"
                                      " org.herac.tuxguitar.app.TGMainSingleton"
                                      " \"$1\" \"$2\"")))))
                (chmod (string-append bin "/tuxguitar") #o555)
                #t))))))
     (inputs
-     `(("java-swt" ,java-swt)))
+     `(("alsa-lib" ,alsa-lib)
+       ("java-swt" ,java-swt)))
     (home-page "http://tuxguitar.com.ar/")
     (synopsis "Multitrack tablature editor and player")
     (description
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#39155: [PATCH] gnu: tuxguitar: Build and install alsa plugin.
  2020-01-16 19:48 [bug#39155] [PATCH] gnu: tuxguitar: Build and install alsa plugin Mike Rosset
@ 2020-01-24  2:02 ` Kei Kebreau
  2020-01-24  2:16   ` [bug#39155] " Mike Rosset
  0 siblings, 1 reply; 3+ messages in thread
From: Kei Kebreau @ 2020-01-24  2:02 UTC (permalink / raw)
  To: Mike Rosset; +Cc: 39155-done

Hello Mike!

Mike Rosset <mike.rosset@gmail.com> writes:

> * gnu/packages/music.scm (tuxguitar): Allows midi sound output when using
>   a synthesizer like timidity.
>
>   [inputs]: Adds alsa-lib as an input.
>   [phases]: No longer change build directory context between phases.
>   [install]: Now install desktop, mime and manual files.

I've changed the format of this log message a bit so it's less
repetitive.

> ---
>  gnu/packages/music.scm | 90 +++++++++++++++++++++++++++---------------
>  1 file changed, 59 insertions(+), 31 deletions(-)
>
> diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
> index ad369bd3a8..15594ab0ba 100644
> --- a/gnu/packages/music.scm
> +++ b/gnu/packages/music.scm
> @@ -1746,60 +1746,86 @@ is subjective.")
>      (arguments
>       `(#:build-target "build"
>         #:jdk ,icedtea-8
> -       #:tests? #f                      ; no tests
> +       #:tests? #f

I left this comment in since it notes that TuxGuitar actually doesn't
have a test suite, and that we haven't just disabled it for another reason.

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

The rest of this LGTM!  This has been pushed to master as commit
44e70dee184c4e4190349def71dc07f05822f591.  Thanks for contributing!  Now
we guitarists can hear our beautiful
tablature! :-)

Kei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#39155] [PATCH] gnu: tuxguitar: Build and install alsa plugin.
  2020-01-24  2:02 ` bug#39155: " Kei Kebreau
@ 2020-01-24  2:16   ` Mike Rosset
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Rosset @ 2020-01-24  2:16 UTC (permalink / raw)
  To: Kei Kebreau; +Cc: 39155-done


>> ---
>>  gnu/packages/music.scm | 90 +++++++++++++++++++++++++++---------------
>>  1 file changed, 59 insertions(+), 31 deletions(-)
>>
>> diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
>> index ad369bd3a8..15594ab0ba 100644
>> --- a/gnu/packages/music.scm
>> +++ b/gnu/packages/music.scm
>> @@ -1746,60 +1746,86 @@ is subjective.")
>>      (arguments
>>       `(#:build-target "build"
>>         #:jdk ,icedtea-8
>> -       #:tests? #f                      ; no tests
>> +       #:tests? #f
>
> I left this comment in since it notes that TuxGuitar actually doesn't
> have a test suite, and that we haven't just disabled it for another reason.

Hello Kei,

Apologies for removing this comment. I had not thought of this when I
removed it, thanks for reviewing this and merging.

Mike

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-24  2:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-16 19:48 [bug#39155] [PATCH] gnu: tuxguitar: Build and install alsa plugin Mike Rosset
2020-01-24  2:02 ` bug#39155: " Kei Kebreau
2020-01-24  2:16   ` [bug#39155] " Mike Rosset

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).