| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 |
|
| 20 | (define-module (gnu packages java-graphics)
|
| 21 | #:use-module ((guix licenses) #:prefix license:)
|
| 22 | #:use-module (guix packages)
|
| 23 | #:use-module (guix download)
|
| 24 | #:use-module (guix git-download)
|
| 25 | #:use-module (guix modules)
|
| 26 | #:use-module (guix utils)
|
| 27 | #:use-module (guix build-system ant)
|
| 28 | #:use-module (guix build utils)
|
| 29 | #:use-module (gnu packages)
|
| 30 | #:use-module (gnu packages bash)
|
| 31 | #:use-module (gnu packages batik)
|
| 32 | #:use-module (gnu packages java)
|
| 33 | #:use-module (gnu packages java-xml)
|
| 34 | #:use-module (gnu packages xml)
|
| 35 | #:use-module (gnu packages xorg)
|
| 36 | #:use-module (ice-9 match))
|
| 37 |
|
| 38 | (define-public ditaa
|
| 39 | (package
|
| 40 | (name "ditaa")
|
| 41 | (version "0.11.0")
|
| 42 | (source (origin
|
| 43 | (method git-fetch)
|
| 44 | (uri (git-reference
|
| 45 | (url "https://github.com/stathissideris/ditaa")
|
| 46 | (commit (string-append "v" version))))
|
| 47 | (file-name (git-file-name name version))
|
| 48 | (sha256
|
| 49 | (base32
|
| 50 | "1y3g17wp1wvb05m56pp25avww2njpgh0gk0jsbsf25scj7hyyj26"))
|
| 51 | (modules '((guix build utils)))
|
| 52 | (snippet '(begin
|
| 53 | (format #t "~%~a~%"
|
| 54 | "Finding and removing embedded jars.")
|
| 55 | (for-each (lambda (jarf)
|
| 56 | (delete-file jarf)
|
| 57 | (format #t "Deleted: ~a~%" jarf))
|
| 58 | (find-files "." "\\.jar$"))))))
|
| 59 | (build-system ant-build-system)
|
| 60 | (inputs (list bash-minimal))
|
| 61 | (native-inputs (list
|
| 62 | java-commons-cli
|
| 63 | java-jericho-html
|
| 64 | java-junit
|
| 65 | java-libbatik
|
| 66 | java-w3c-svg))
|
| 67 | (arguments
|
| 68 | `(#:build-target "release-all"
|
| 69 | #:phases (modify-phases %standard-phases
|
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | (add-before 'build 'build-prep
|
| 75 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 76 | (let* ((batik-jar
|
| 77 | (search-input-file
|
| 78 | inputs
|
| 79 | "share/java/batik.jar"))
|
| 80 | (commons-cli-jar
|
| 81 | (search-input-file
|
| 82 | inputs
|
| 83 | "lib/m2/commons-cli/commons-cli/1.4/commons-cli-1.4.jar")))
|
| 84 | (mkdir-p "lib")
|
| 85 | (copy-file batik-jar "./lib/batik.jar")
|
| 86 | (copy-file commons-cli-jar "./lib/commons-cli.jar"))
|
| 87 | (with-directory-excursion "build"
|
| 88 | (substitute* "release.xml"
|
| 89 | (("source=\"1.6\"")
|
| 90 | "source=\"7\"")
|
| 91 | (("<file name=\"commons-cli-1.2.jar\"/>")
|
| 92 | (string-append "<file name=\"commons-cli.jar\"/>"
|
| 93 | "\n" "<file name=\"batik.jar\"/>"))))))
|
| 94 | (replace 'build
|
| 95 | (lambda* _
|
| 96 | (setenv "ANT_OPTS"
|
| 97 | (string-append "-Dversion.string="
|
| 98 | ,version))
|
| 99 | (with-directory-excursion "build"
|
| 100 | (invoke "ant" "-f" "release.xml" "release-jar"))))
|
| 101 | (replace 'check
|
| 102 | (lambda* (#:key tests? #:allow-other-keys)
|
| 103 | (if tests?
|
| 104 | (begin
|
| 105 | (setenv "ANT_OPTS"
|
| 106 | (string-append "-Dversion.string="
|
| 107 | ,version))
|
| 108 | (mkdir-p "tests/testlib")
|
| 109 | (with-directory-excursion "build"
|
| 110 | (invoke "ant" "-f" "release.xml"
|
| 111 | "generate-test-images")
|
| 112 | (invoke "ant" "test"))) #f)))
|
| 113 | (replace 'install
|
| 114 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 115 | (let* ((out (assoc-ref outputs "out"))
|
| 116 | (lib (string-append out "/lib"))
|
| 117 | (bin (string-append out "/bin"))
|
| 118 | (bash (search-input-file inputs "bin/bash"))
|
| 119 | (java (search-input-file inputs "bin/java"))
|
| 120 | (jre (search-input-directory inputs "jre"))
|
| 121 | (ditaa (string-append out "/bin/ditaa"))
|
| 122 | (jar-name (string-append ,name
|
| 123 | ,version ".jar")))
|
| 124 | (with-directory-excursion "releases"
|
| 125 | (install-file jar-name lib))
|
| 126 | (mkdir-p bin)
|
| 127 | (with-output-to-file ditaa
|
| 128 | (lambda _
|
| 129 | (format #t
|
| 130 | "#!~a~%JAVA_HOME=~a ~a -jar ~a/~a $@~%"
|
| 131 | bash
|
| 132 | jre
|
| 133 | java
|
| 134 | lib
|
| 135 | jar-name)))
|
| 136 | (chmod ditaa #o755))))
|
| 137 | (add-after 'install 'install-docs
|
| 138 | (lambda* (#:key outputs #:allow-other-keys)
|
| 139 | (let ((doc (string-append (assoc-ref outputs "out")
|
| 140 | "/share/doc/")))
|
| 141 | (for-each (lambda (filen)
|
| 142 | (install-file filen doc))
|
| 143 | (find-files "." ".*README\\.md"))))))))
|
| 144 | (home-page "https://github.com/stathissideris/ditaa")
|
| 145 | (synopsis "Create graphics from ascii art")
|
| 146 | (description
|
| 147 | "ditaa is a small command-line utility that converts diagrams drawn using
|
| 148 | ascii art drawings that contain characters that resemble lines like @samp{|}
|
| 149 | @samp{/} @samp{-}), into proper bitmap graphics.")
|
| 150 | (license license:lgpl3)))
|
| 151 |
|
| 152 | (define-public java-piccolo2d-core
|
| 153 | (package
|
| 154 | (name "java-piccolo2d-core")
|
| 155 | (version "3.0.1")
|
| 156 | (source (origin
|
| 157 | (method git-fetch)
|
| 158 | (uri (git-reference
|
| 159 | (url "https://github.com/piccolo2d/piccolo2d.java")
|
| 160 | (commit (string-append "piccolo2d-complete-" version))))
|
| 161 | (file-name (git-file-name name version))
|
| 162 | (sha256
|
| 163 | (base32
|
| 164 | "1k6gw643k83516lcw04mgac2yi75phdrng44pz9xk6hz066ip21s"))))
|
| 165 | (build-system ant-build-system)
|
| 166 | (arguments
|
| 167 | `(#:jar-name "piccolo2d-core.jar"
|
| 168 | #:phases
|
| 169 | (modify-phases %standard-phases
|
| 170 | (add-after 'unpack 'chdir
|
| 171 | (lambda _ (chdir "core") #t)))))
|
| 172 | (inputs
|
| 173 | (list java-junit))
|
| 174 | (home-page "http://piccolo2d.org")
|
| 175 | (synopsis "Structured 2D graphics framework")
|
| 176 | (description "Piccolo2D is a framework (in the Jazz ZUI tradition) to
|
| 177 | create robust, full-featured graphical applications in Java, with features
|
| 178 | such as zooming and multiple representation. This package provides the core
|
| 179 | libraries.")
|
| 180 | (license license:bsd-3)))
|
| 181 |
|
| 182 | (define-public java-piccolo2d-extras
|
| 183 | (package (inherit java-piccolo2d-core)
|
| 184 | (name "java-piccolo2d-extras")
|
| 185 | (arguments
|
| 186 | `(#:jar-name "piccolo2d-extras.jar"
|
| 187 | #:phases
|
| 188 | (modify-phases %standard-phases
|
| 189 | (add-after 'unpack 'chdir
|
| 190 | (lambda _ (chdir "extras") #t))
|
| 191 | (add-after 'chdir 'remove-failing-test
|
| 192 | (lambda _
|
| 193 | |
| 194 | (delete-file "src/test/java/org/piccolo2d/extras/nodes/PShadowTest.java")
|
| 195 | (delete-file "src/test/java/org/piccolo2d/extras/util/ShadowUtilsTest.java")
|
| 196 | #t))
|
| 197 | (add-before 'check 'start-xorg-server
|
| 198 | (lambda* (#:key inputs #:allow-other-keys)
|
| 199 | |
| 200 | (system "Xvfb :1 -screen 0 640x480x24 &")
|
| 201 | (setenv "DISPLAY" ":1")
|
| 202 | #t)))))
|
| 203 | (inputs
|
| 204 | (list java-piccolo2d-core java-junit))
|
| 205 | (native-inputs
|
| 206 | (list xorg-server)) |
| 207 | (description "Piccolo2D is a framework (in the Jazz ZUI tradition) to
|
| 208 | create robust, full-featured graphical applications in Java, with features
|
| 209 | such as zooming and multiple representation. This package provides additional
|
| 210 | features not found in the core libraries.")))
|
| 211 |
|
| 212 | (define-public java-marlin-renderer
|
| 213 | (package
|
| 214 | (name "java-marlin-renderer")
|
| 215 | (version "0.9.4.2")
|
| 216 | (source (origin
|
| 217 | (method git-fetch)
|
| 218 | (uri (git-reference
|
| 219 | (url "https://github.com/bourgesl/marlin-renderer")
|
| 220 | (commit (string-append "v" (string-map (match-lambda
|
| 221 | (#\. #\_)
|
| 222 | (c c))
|
| 223 | version)))))
|
| 224 | (file-name (git-file-name name version))
|
| 225 | (sha256
|
| 226 | (base32
|
| 227 | "12vb8fmxf1smnyv6w8i1khahy76v6r29j1qwabbykxff8i9ndxqv"))))
|
| 228 | (build-system ant-build-system)
|
| 229 | (arguments
|
| 230 | `(#:jar-name "marlin.jar"
|
| 231 | #:test-include (list "src/test/java/RunJUnitTest.java")))
|
| 232 | (inputs
|
| 233 | (list java-hamcrest-core java-junit))
|
| 234 | (home-page "https://github.com/bourgesl/marlin-renderer/")
|
| 235 | (synopsis "Rendering engine")
|
| 236 | (description "Marlin is a Java2D @code{RenderingEngine} optimized for
|
| 237 | performance (improved memory usage and footprint, better multi-threading) and
|
| 238 | better visual quality based on OpenJDK's @code{pisces} implementation. It
|
| 239 | handles shape rendering (@code{Graphics2D} @code{draw(Shape)} /
|
| 240 | @code{fill(Shape)} with stroke and dash attributes.")
|
| 241 | |
| 242 | (license license:gpl2)))
|