unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: tuxguitar: Update to 1.3.2.
@ 2016-08-03 16:45 Ricardo Wurmus
  2016-08-04  8:43 ` Andreas Enge
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2016-08-03 16:45 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/music.scm (tuxguitar): Update to 1.3.2.
[arguments]: Use ant-build-system and rearrange build phases.
[native-inputs]: Remove field.
---
 gnu/packages/music.scm | 97 +++++++++++++++++++++++++++++++++++---------------
 1 file changed, 69 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 8dbdf2c..9ec75c1 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -31,6 +31,7 @@
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system python)
   #:use-module (guix build-system waf)
@@ -904,45 +905,85 @@ is subjective.")
 (define-public tuxguitar
   (package
     (name "tuxguitar")
-    (version "1.2")
+    (version "1.3.2")
     (source (origin
               (method url-fetch)
               (uri (string-append
                     "mirror://sourceforge/tuxguitar/TuxGuitar/TuxGuitar-"
-                    version "/tuxguitar-src-" version ".tar.gz"))
+                    version "/tuxguitar-" version "-src.tar.gz"))
               (sha256
                (base32
-                "1g1yf2gd06fzdhqb8kb8dmdcmr602s9y24f01kyl4940wimgr944"))))
-    (build-system gnu-build-system)
+                "0ldml31zvywid1w28mfd65ramyiics55fdl0ch846vm7j7nwv58j"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Delete pre-built classes
+               '(delete-file-recursively "TuxGuitar-android/bin"))))
+    (build-system ant-build-system)
     (arguments
-     `(#:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
-                                         (assoc-ref %outputs "out") "/lib")
-                          (string-append "PREFIX="
-                                         (assoc-ref %outputs "out"))
-                          (string-append "SWT_PATH="
-                                         (assoc-ref %build-inputs "java-swt")
-                                         "/share/java/swt.jar"))
-       #:tests? #f ;no "check" target
-       #:parallel-build? #f ;not supported
+     `(#:build-target "build"
+       #:tests? #f ; no tests
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
-         (add-before 'build 'enter-dir-and-set-flags
-          (lambda* (#:key inputs #:allow-other-keys)
-            (chdir "TuxGuitar")
-            (substitute* "GNUmakefile"
-              (("GCJFLAGS\\+=(.*)" _ rest)
-               (string-append "GCJFLAGS=-fsource=1.4 -fPIC " rest))
-              (("PROPERTIES\\?=")
-               (string-append "PROPERTIES?= -Dswt.library.path="
-                              (assoc-ref inputs "java-swt") "/lib"))
-              (("\\$\\(GCJ\\) -o") "$(GCJ) $(LDFLAGS) -o"))
-            #t)))))
+         (add-after 'unpack 'enter-dir-and-set-flags
+           (lambda _ (chdir "TuxGuitar-lib") #t))
+         (add-after 'build 'build-editor-utils
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (chdir "..")
+             (let ((cwd (getcwd)))
+               (setenv "CLASSPATH"
+                       (string-append
+                        cwd "/TuxGuitar-lib/tuxguitar-lib.jar" ":"
+                        cwd "/TuxGuitar-editor-utils/build/jar/tuxguitar-editor-utils.jar" ":"
+                        (getenv "CLASSPATH"))))
+             (chdir "TuxGuitar-editor-utils")
+             ;; Generate default build.xml
+             ((@@ (guix build ant-build-system) default-build.xml)
+              "tuxguitar-editor-utils.jar"
+              (string-append (assoc-ref outputs "out")
+                             "/share/java"))
+             ((assoc-ref %standard-phases 'build))))
+         (add-after 'build-editor-utils 'build-application
+           (lambda _
+             (chdir "../TuxGuitar")
+             ((assoc-ref %standard-phases 'build)
+              #:build-target "build")))
+         (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"))
+                    (lib   (string-append share "/java"))
+                    (swt   (assoc-ref inputs "java-swt")))
+               (mkdir-p bin)
+               (mkdir-p lib)
+               ;; install all jars
+               (for-each (lambda (file)
+                           (install-file file lib))
+                         (find-files ".." "\\.jar$"))
+               ;; install all resources
+               (for-each (lambda (file)
+                           (install-file file share))
+                         (find-files "share" ".*"))
+               ;; create wrapper
+               (call-with-output-file (string-append bin "/tuxguitar")
+                 (lambda (port)
+                   (let ((classpath (string-join (append (find-files lib "\\.jar$")
+                                                         (find-files swt "\\.jar$"))
+                                                 ":")))
+                     (format
+                      port
+                      (string-append "#!/bin/sh\n"
+                                     (which "java")
+                                     " -cp " classpath
+                                     " -Dtuxguitar.home.path=" out
+                                     " -Dtuxguitar.share.path=" out "/share"
+                                     " -Dswt.library.path=" swt "/lib"
+                                     " org.herac.tuxguitar.app.TGMainSingleton"
+                                     " \"$1\" \"$2\"")))))
+               (chmod (string-append bin "/tuxguitar") #o555)
+               #t))))))
     (inputs
      `(("java-swt" ,java-swt)))
-    (native-inputs
-     `(("gcj" ,gcj)
-       ("pkg-config" ,pkg-config)))
     (home-page "http://tuxguitar.com.ar")
     (synopsis "Multitrack tablature editor and player")
     (description
-- 
2.8.4

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

end of thread, other threads:[~2016-08-04 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03 16:45 [PATCH] gnu: tuxguitar: Update to 1.3.2 Ricardo Wurmus
2016-08-04  8:43 ` Andreas Enge
2016-08-04 12:41   ` Ricardo Wurmus
2016-08-04 12:45     ` Andreas Enge

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).