all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#53908] [PATCH] Adding a package for ditaa
@ 2022-02-09 21:48 Frank Pursel
  2022-02-10 16:02 ` [bug#53908] [PATCH] Cleanups for the ditaa pkg Frank Pursel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Frank Pursel @ 2022-02-09 21:48 UTC (permalink / raw)
  To: 53908

From 0d0df722f31d306c1c95229408fc2bcc43c4a59e Mon Sep 17 00:00:00 2001
Message-Id: <0d0df722f31d306c1c95229408fc2bcc43c4a59e.1644442953.git.frank.pursel@gmail.com>
From: Frank Pursel <frank.pursel@gmail.com>
Date: Wed, 9 Feb 2022 09:07:50 -0800
Subject: [PATCH] Adding ditaa executable

* gnu/packages/batik.scm (java-batik-all-jar): Providing dependent class files
  for the ditaa package.

* gnu/packages/graph.scm (ditaa): Adding the ditaa package.
---
 gnu/packages/batik.scm |  60 ++++++++++++++++++++
 gnu/packages/graph.scm | 121 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 181 insertions(+)

diff --git a/gnu/packages/batik.scm b/gnu/packages/batik.scm
index 2072dd467c..74f2d5b82a 100644
--- a/gnu/packages/batik.scm
+++ b/gnu/packages/batik.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2022 Frank Pursel <frank.pursel@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -254,3 +255,62 @@ (define-public java-xmlgraphics-commons
     (description "This package provides XMLGraphics constants (originally
 from @code{batik}).")
     (license license:asl2.0)))
+
+(define-public java-batik-all-jar
+  (let ((short-pkg-name "batik") (ver "1.14")
+        (hash "1g1vqg2gqw31bk2655vszxqrs8whj3sd5rbk649a9qqvqgqfdv13"))
+    (package
+      (name "java-batik-all-jar")
+      (version ver)
+      (source (origin
+                (method url-fetch)
+                (uri (string-append
+                      "https://archive.apache.org/dist/xmlgraphics/batik/source/"
+                      short-pkg-name "-src-"
+                      version ".tar.gz"))
+                (sha256
+                 (base32
+                  hash))))
+      (build-system ant-build-system)
+      (arguments
+       `(#:build-target "jars"
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'fix-build.xml
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (substitute* "build.xml"
+                 (("batik-all/target/batik-all-.*jar") (string-append "batik-"
+                                                        ,version
+                                                        "/lib/batik-all-"
+                                                        ,version ".jar"))
+                 (("<target name=\"jars\" depends=\"init\">")
+                  "<target name=\"jars\" depends=\"all-jar\">")) #t))
+           (replace 'install
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((name+ver (string-append ,short-pkg-name "-"
+                                               ,version)))
+                 (copy-recursively (string-append "./" name+ver)
+                                   (assoc-ref outputs "out"))
+                 (copy-file (string-append "./"
+                                           name+ver
+                                           "/lib/"
+                                           ,short-pkg-name
+                                           "-all-"
+                                           ,version
+                                           ".jar")
+                            (string-append (assoc-ref outputs "out")
+                                           "/lib/batik.jar"))) #t))
+           (delete 'generate-jar-indices)
+           (delete 'check))))
+      (inputs (list java-junit java-hamcrest-core))
+      (home-page "https://xmlgraphics.apache.org/batik/")
+      (synopsis
+       "Jar of the complete set of batik classes for dependency fulfullment")
+      (description
+       "Batik is a Java-based toolkit for applications or applets that want to
+use images in the Scalable Vector Graphics (SVG) format for various purposes,
+such as display, generation or manipulation.  This package provides the
+batik-all.jar upon whch other packages may depend but no executable or other
+content.")
+      (license license:asl2.0))))
+
diff --git a/gnu/packages/graph.scm b/gnu/packages/graph.scm
index 4b46904318..45dd83edb8 100644
--- a/gnu/packages/graph.scm
+++ b/gnu/packages/graph.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2021 Alexandre Hannud Abdo <abdo@member.fsf.org>
 ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2022 Frank Pursel <frank.pursel@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,6 +33,7 @@ (define-module (gnu packages graph)
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix utils)
+  #:use-module (guix build-system ant)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
@@ -39,6 +41,7 @@ (define-module (gnu packages graph)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages batik)
   #:use-module (gnu packages bioconductor)
   #:use-module (gnu packages bioinformatics)
   #:use-module (gnu packages boost)
@@ -50,6 +53,7 @@ (define-module (gnu packages graph)
   #:use-module (gnu packages graphics)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
@@ -652,3 +656,120 @@ (define-public python-graph-tool
 time) to that of a pure C/C++ library.")
     (home-page "https://graph-tool.skewed.de/")
     (license license:lgpl3+)))
+
+(define-public ditaa
+  (let* ((ver "0.11.0") (hash
+                         "1y3g17wp1wvb05m56pp25avww2njpgh0gk0jsbsf25scj7hyyj26"))
+    (package
+      (name "ditaa")
+      (version ver)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/stathissideris/ditaa")
+                      (commit (string-append "v" version))))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  hash))))
+      (build-system ant-build-system)
+      (inputs (list java-batik-all-jar java-commons-cli
+                    `(,icedtea "jdk") java-junit))
+      (arguments
+       `(#:build-target "release-all"
+         #:phases
+         (modify-phases %standard-phases
+           ;; Ant's buildfile and build tree need to be modified to provide
+           ;; access to the guix builds of the batik and the java-commons-cli
+           ;; jar files.  Also some of the source requires java7.
+           (add-before 'build 'build-prep
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((batik-jar
+                       (search-input-file inputs "lib/batik.jar"))
+                      (commons-cli-jar
+                       (search-input-file
+                        inputs
+                        "lib/m2/commons-cli/commons-cli/1.4/commons-cli-1.4.jar")))
+                 (mkdir-p "lib")
+                 (copy-file batik-jar "./lib/batik.jar")
+                 (copy-file commons-cli-jar "./lib/commons-cli.jar"))
+               (copy-recursively "service/web/lib" "lib"
+                                 #:log
+                                 (current-output-port))
+               (with-directory-excursion "build"
+                                         (substitute* "release.xml"
+                                           (("source=\"1.6\"") "source=\"7\"")
+                                           (("<file name=\"commons-cli-1.2.jar\"/>")
+                                            (string-append
+                                             "<file name=\"commons-cli.jar\"/>"
+                                             "
+" "<file name=\"batik.jar\"/>")))
+                                         ;; (invoke "ant" "clean")
+                                         ) #t))
+           (replace 'build
+             (lambda* _
+               ;; (invoke "ant" "-f" "release.xml" "release-jar")
+               (setenv "ANT_OPTS"
+                       (string-append "-Dversion.string="
+                                      ,version))
+               (with-directory-excursion "build"
+                                         ;; (invoke "ant" "compile")
+                                         (invoke "ant" "-f" "release.xml"
+                                                 "release-jar")) #t))
+           (replace 'check
+             (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+               (if tests?
+                   (begin
+                     (setenv "ANT_OPTS"
+                             (string-append "-Dversion.string="
+                                            ,version))
+                     (mkdir-p "tests/testlib")
+                     (with-directory-excursion "build"
+                       (invoke "ant" "-f" "release.xml"
+                               "generate-test-images")
+                       (invoke "ant" "test"))))
+               #t))
+           (replace 'install
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out")) (lib (string-append out
+                                                            "/lib"))
+                      (bin (string-append out "/bin"))
+                      (bash (search-input-file inputs "bin/bash"))
+                      (java (search-input-file inputs "bin/java"))
+                      (jre (search-input-directory inputs "jre"))
+                      (ditaa (string-append out "/bin/ditaa"))
+                      (jar-name (string-append ,name
+                                               ,version ".jar")))
+                 (with-directory-excursion "releases"
+                                           (install-file jar-name lib))
+                 (mkdir-p bin)
+                 (with-output-to-file ditaa
+                   (lambda ()
+                     (display (string-append "#!"
+                                             bash
+                                             "
+"
+                                             "JAVA_HOME="
+                                             jre
+                                             " "
+                                             java
+                                             " -jar "
+                                             out
+                                             "/lib/"
+                                             jar-name
+                                             " $@"))))
+                 (chmod ditaa 493)) #t))
+           (add-after 'install 'install-docs
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((doc (string-append (assoc-ref outputs "out")
+                                         "/share/doc/")))
+                 (for-each (lambda (filen)
+                             (install-file filen doc))
+                           (find-files "." ".*README\\.md"))) #t)))))
+      (home-page "https://github.com/stathissideris/ditaa")
+      (synopsis "Create graphics from ascii art")
+      (description
+       "@code{ditaa} is a small command-line utility that can convert diagrams
+drawn using ascii art ('drawings' that contain characters that resemble lines
+like | / - ), into proper bitmap or svg graphics.")
+      (license license:lgpl3))))
-- 
2.34.0






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

* [bug#53908] [PATCH] Cleanups for the ditaa pkg
  2022-02-09 21:48 [bug#53908] [PATCH] Adding a package for ditaa Frank Pursel
@ 2022-02-10 16:02 ` Frank Pursel
  2022-02-11 21:04 ` [bug#53908] [PATCH] Opportunities Frank Pursel
  2023-01-20 23:37 ` bug#53908: " Frank Pursel
  2 siblings, 0 replies; 5+ messages in thread
From: Frank Pursel @ 2022-02-10 16:02 UTC (permalink / raw)
  To: 53908

Hi,

After sleeping on my earlier submission I see things that I should've
seen before.  I love what guix style does, but not always: converting
#o755 to decimal in a chmod seems counterproductive.  I also removed
some unhelpful comments and a pointless recursive copy that can only
create needless questions.  No practical change but it's a bit cleaner.  

Regards,
Frank

Please, too.  Let me know if this is formatted optimally.  This is
an emacs production of "C-u, Esc ! cd ~/src/guix; git format-patch
<since-git-hash>" appended to my waiting emacs message buffer.
In this case I think it suffices but if a git merge were to be needed it
might not be so.

Hey! -- guix is genius.  Thank you for making it so. 



From 9e1050ef106e004c71d7b3c69e661e64ab0eaf03 Mon Sep 17 00:00:00 2001
Message-Id: <9e1050ef106e004c71d7b3c69e661e64ab0eaf03.1644508366.git.frank.pursel@gmail.com>
From: Frank Pursel <frank.pursel@gmail.com>
Date: Thu, 10 Feb 2022 07:28:20 -0800
Subject: [PATCH] Removed some unneeded comments and commands.  Tweaked
 formatting.

---
 gnu/packages/graph.scm | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/graph.scm b/gnu/packages/graph.scm
index 45dd83edb8..a763f02da8 100644
--- a/gnu/packages/graph.scm
+++ b/gnu/packages/graph.scm
@@ -658,8 +658,8 @@ (define-public python-graph-tool
     (license license:lgpl3+)))
 
 (define-public ditaa
-  (let* ((ver "0.11.0") (hash
-                         "1y3g17wp1wvb05m56pp25avww2njpgh0gk0jsbsf25scj7hyyj26"))
+  (let* ((ver "0.11.0")
+         (hash "1y3g17wp1wvb05m56pp25avww2njpgh0gk0jsbsf25scj7hyyj26"))
     (package
       (name "ditaa")
       (version ver)
@@ -693,9 +693,6 @@ (define-public ditaa
                  (mkdir-p "lib")
                  (copy-file batik-jar "./lib/batik.jar")
                  (copy-file commons-cli-jar "./lib/commons-cli.jar"))
-               (copy-recursively "service/web/lib" "lib"
-                                 #:log
-                                 (current-output-port))
                (with-directory-excursion "build"
                                          (substitute* "release.xml"
                                            (("source=\"1.6\"") "source=\"7\"")
@@ -704,16 +701,13 @@ (define-public ditaa
                                              "<file name=\"commons-cli.jar\"/>"
                                              "
 " "<file name=\"batik.jar\"/>")))
-                                         ;; (invoke "ant" "clean")
                                          ) #t))
            (replace 'build
              (lambda* _
-               ;; (invoke "ant" "-f" "release.xml" "release-jar")
                (setenv "ANT_OPTS"
                        (string-append "-Dversion.string="
                                       ,version))
                (with-directory-excursion "build"
-                                         ;; (invoke "ant" "compile")
                                          (invoke "ant" "-f" "release.xml"
                                                  "release-jar")) #t))
            (replace 'check
@@ -758,7 +752,8 @@ (define-public ditaa
                                              "/lib/"
                                              jar-name
                                              " $@"))))
-                 (chmod ditaa 493)) #t))
+                 (chmod ditaa #o755))
+               #t))
            (add-after 'install 'install-docs
              (lambda* (#:key outputs #:allow-other-keys)
                (let ((doc (string-append (assoc-ref outputs "out")
-- 
2.34.0





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

* [bug#53908] [PATCH] Opportunities
  2022-02-09 21:48 [bug#53908] [PATCH] Adding a package for ditaa Frank Pursel
  2022-02-10 16:02 ` [bug#53908] [PATCH] Cleanups for the ditaa pkg Frank Pursel
@ 2022-02-11 21:04 ` Frank Pursel
  2022-08-05  2:00   ` [bug#53908] [PATCH] Adding a package for ditaa 宋文武 via Guix-patches via
  2023-01-20 23:37 ` bug#53908: " Frank Pursel
  2 siblings, 1 reply; 5+ messages in thread
From: Frank Pursel @ 2022-02-11 21:04 UTC (permalink / raw)
  To: 53908

Hi,

My intentions were good but this isn't good.  I now see that though this
ditaa package will build and work this package isn't yet ready for guix.
If you want to help advance this, read on!  I'll point out what I
perceive I missed on the first go around.  I still eventually hope to
get ditaa officially packaged for guix.  

I belatedly see that I've stumbled into some less than desirable
practices here.  So, to be quick, ditaa in guix needs to wait until the
underlying dependencies in java-batik-all-jar are under approriate build
control.

I now see that the current java-batik-all-jar build depends on the use
of several jars embedded in the apache source package.  It isn't guixy
to use these. We need to provide guix built packages to replace those
jars (some of which already exists).  If we keep ditaa as the end goal
replication of all these jars is likely not necessary (though it would
be nice); it should be possible to significantly narrow the scope of
these packages to only those required to build ditaa.

I also see that there are guix conventions that help the java/ant-build
system ecosystem better integrate.  Specifically I now see that java
libraries go into the share/java directory as a single jar file.

I still hope to get ditaa packaged for guix.  I do not think it is
important for guix but ditaa is a good example of the use of free
software to scratch an itch nobody else was going to get to (I think it
used to be packaged with emacs org mode).  I naively thought this was
clean on the first go but now I see that good guix standard requires a
little more digging into the sources.

Working on it,
Frank




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

* [bug#53908] [PATCH] Adding a package for ditaa
  2022-02-11 21:04 ` [bug#53908] [PATCH] Opportunities Frank Pursel
@ 2022-08-05  2:00   ` 宋文武 via Guix-patches via
  0 siblings, 0 replies; 5+ messages in thread
From: 宋文武 via Guix-patches via @ 2022-08-05  2:00 UTC (permalink / raw)
  To: Frank Pursel; +Cc: 53908

Hello, a friendly ping here.

Frank Pursel <frank.pursel@gmail.com> writes:

> Hi,
>
> My intentions were good but this isn't good.  I now see that though this
> ditaa package will build and work this package isn't yet ready for guix.
> If you want to help advance this, read on!  I'll point out what I
> perceive I missed on the first go around.  I still eventually hope to
> get ditaa officially packaged for guix.  
>
> I belatedly see that I've stumbled into some less than desirable
> practices here.  So, to be quick, ditaa in guix needs to wait until the
> underlying dependencies in java-batik-all-jar are under approriate build
> control.
>
> I now see that the current java-batik-all-jar build depends on the use
> of several jars embedded in the apache source package.  It isn't guixy
> to use these. We need to provide guix built packages to replace those
> jars (some of which already exists).

I find that the batik source package of debian didn't have jars:
http://deb.debian.org/debian/pool/main/b/batik/batik_1.14-2.debian.tar.xz

So maybe it's actually not needed, and we can safely remove them in a
source snippet?




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

* bug#53908: [PATCH] Adding a package for ditaa
  2022-02-09 21:48 [bug#53908] [PATCH] Adding a package for ditaa Frank Pursel
  2022-02-10 16:02 ` [bug#53908] [PATCH] Cleanups for the ditaa pkg Frank Pursel
  2022-02-11 21:04 ` [bug#53908] [PATCH] Opportunities Frank Pursel
@ 2023-01-20 23:37 ` Frank Pursel
  2 siblings, 0 replies; 5+ messages in thread
From: Frank Pursel @ 2023-01-20 23:37 UTC (permalink / raw)
  To: 53908-done

I have not given up.  See the improved 60976.

Regards,
Frank Pursel

aka #irc:acrow




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

end of thread, other threads:[~2023-01-20 23:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-09 21:48 [bug#53908] [PATCH] Adding a package for ditaa Frank Pursel
2022-02-10 16:02 ` [bug#53908] [PATCH] Cleanups for the ditaa pkg Frank Pursel
2022-02-11 21:04 ` [bug#53908] [PATCH] Opportunities Frank Pursel
2022-08-05  2:00   ` [bug#53908] [PATCH] Adding a package for ditaa 宋文武 via Guix-patches via
2023-01-20 23:37 ` bug#53908: " Frank Pursel

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.