| 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 gexp)
|
| 25 | #:use-module (guix git-download)
|
| 26 | #:use-module (guix modules)
|
| 27 | #:use-module (guix utils)
|
| 28 | #:use-module (guix build-system ant)
|
| 29 | #:use-module (guix build utils)
|
| 30 | #:use-module (gnu packages)
|
| 31 | #:use-module (gnu packages bash)
|
| 32 | #:use-module (gnu packages batik)
|
| 33 | #:use-module (gnu packages java)
|
| 34 | #:use-module (gnu packages java-xml)
|
| 35 | #:use-module (gnu packages xml)
|
| 36 | #:use-module (gnu packages xorg)
|
| 37 | #:use-module (ice-9 match))
|
| 38 |
|
| 39 | (define-public ditaa
|
| 40 | (package
|
| 41 | (name "ditaa")
|
| 42 | (version "0.11.0")
|
| 43 | (source (origin
|
| 44 | (method git-fetch)
|
| 45 | (uri (git-reference
|
| 46 | (url "https://github.com/stathissideris/ditaa")
|
| 47 | (commit (string-append "v" version))))
|
| 48 | (file-name (git-file-name name version))
|
| 49 | (sha256
|
| 50 | (base32
|
| 51 | "1y3g17wp1wvb05m56pp25avww2njpgh0gk0jsbsf25scj7hyyj26"))
|
| 52 | (modules '((guix build utils)))
|
| 53 | (snippet '(begin
|
| 54 | (format #t "~%~a~%"
|
| 55 | "Finding and removing embedded jars.")
|
| 56 | (for-each (lambda (jarf)
|
| 57 | (delete-file jarf)
|
| 58 | (format #t "Deleted: ~a~%" jarf))
|
| 59 | (find-files "." "\\.jar$"))))))
|
| 60 | (build-system ant-build-system)
|
| 61 | (inputs (list bash-minimal))
|
| 62 | (native-inputs (list
|
| 63 | java-commons-cli
|
| 64 | java-jericho-html
|
| 65 | java-junit
|
| 66 | java-libbatik
|
| 67 | java-w3c-svg))
|
| 68 | (arguments
|
| 69 | `(#:build-target "release-all"
|
| 70 | #:phases (modify-phases %standard-phases
|
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | (add-before 'build 'build-prep
|
| 76 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 77 | (let* ((batik-jar
|
| 78 | (search-input-file
|
| 79 | inputs
|
| 80 | "share/java/batik.jar"))
|
| 81 | (commons-cli-jar
|
| 82 | (search-input-file
|
| 83 | inputs
|
| 84 | "lib/m2/commons-cli/commons-cli/1.4/commons-cli-1.4.jar")))
|
| 85 | (mkdir-p "lib")
|
| 86 | (copy-file batik-jar "./lib/batik.jar")
|
| 87 | (copy-file commons-cli-jar "./lib/commons-cli.jar"))
|
| 88 | (with-directory-excursion "build"
|
| 89 | (substitute* "release.xml"
|
| 90 | (("source=\"1.6\"")
|
| 91 | "source=\"7\"")
|
| 92 | (("<file name=\"commons-cli-1.2.jar\"/>")
|
| 93 | (string-append "<file name=\"commons-cli.jar\"/>"
|
| 94 | "\n" "<file name=\"batik.jar\"/>"))))))
|
| 95 | (replace 'build
|
| 96 | (lambda* _
|
| 97 | (setenv "ANT_OPTS"
|
| 98 | (string-append "-Dversion.string="
|
| 99 | ,version))
|
| 100 | (with-directory-excursion "build"
|
| 101 | (invoke "ant" "-f" "release.xml" "release-jar"))))
|
| 102 | (replace 'check
|
| 103 | (lambda* (#:key tests? #:allow-other-keys)
|
| 104 | (if tests?
|
| 105 | (begin
|
| 106 | (setenv "ANT_OPTS"
|
| 107 | (string-append "-Dversion.string="
|
| 108 | ,version))
|
| 109 | (mkdir-p "tests/testlib")
|
| 110 | (with-directory-excursion "build"
|
| 111 | (invoke "ant" "-f" "release.xml"
|
| 112 | "generate-test-images")
|
| 113 | (invoke "ant" "test"))) #f)))
|
| 114 | (replace 'install
|
| 115 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 116 | (let* ((out (assoc-ref outputs "out"))
|
| 117 | (lib (string-append out "/lib"))
|
| 118 | (bin (string-append out "/bin"))
|
| 119 | (bash (search-input-file inputs "bin/bash"))
|
| 120 | (java (search-input-file inputs "bin/java"))
|
| 121 | (jre (search-input-directory inputs "jre"))
|
| 122 | (ditaa (string-append out "/bin/ditaa"))
|
| 123 | (jar-name (string-append ,name
|
| 124 | ,version ".jar")))
|
| 125 | (with-directory-excursion "releases"
|
| 126 | (install-file jar-name lib))
|
| 127 | (mkdir-p bin)
|
| 128 | (with-output-to-file ditaa
|
| 129 | (lambda _
|
| 130 | (format #t
|
| 131 | "#!~a~%JAVA_HOME=~a ~a -jar ~a/~a $@~%"
|
| 132 | bash
|
| 133 | jre
|
| 134 | java
|
| 135 | lib
|
| 136 | jar-name)))
|
| 137 | (chmod ditaa #o755))))
|
| 138 | (add-after 'install 'install-docs
|
| 139 | (lambda* (#:key outputs #:allow-other-keys)
|
| 140 | (let ((doc (string-append (assoc-ref outputs "out")
|
| 141 | "/share/doc/")))
|
| 142 | (for-each (lambda (filen)
|
| 143 | (install-file filen doc))
|
| 144 | (find-files "." ".*README\\.md"))))))))
|
| 145 | (home-page "https://github.com/stathissideris/ditaa")
|
| 146 | (synopsis "Create graphics from ascii art")
|
| 147 | (description
|
| 148 | "ditaa is a small command-line utility that converts diagrams drawn using
|
| 149 | ascii art drawings that contain characters that resemble lines like @samp{|}
|
| 150 | @samp{/} @samp{-}), into proper bitmap graphics.")
|
| 151 | (license license:lgpl3)))
|
| 152 |
|
| 153 | (define-public java-flatlaf
|
| 154 | (package
|
| 155 | (name "java-flatlaf")
|
| 156 | (version "3.5.4")
|
| 157 | (source (origin
|
| 158 | (method git-fetch)
|
| 159 | (uri (git-reference
|
| 160 | (url "https://github.com/JFormDesigner/FlatLaf")
|
| 161 | (commit version)))
|
| 162 | (file-name (git-file-name name version))
|
| 163 | (sha256
|
| 164 | (base32
|
| 165 | "017n1w6hds4wrz597jk7v8r6pz0kz5j9xwd240nq7s8hc58d4c2q"))
|
| 166 | (modules '((guix build utils)))
|
| 167 | (snippet
|
| 168 | |
| 169 | '(for-each delete-file
|
| 170 | (find-files "." "\\.(dll|dylib|so)$")))))
|
| 171 | (build-system ant-build-system)
|
| 172 | (arguments
|
| 173 | (list
|
| 174 | #:jdk openjdk17
|
| 175 | #:tests? #false |
| 176 | #:modules '((guix build ant-build-system)
|
| 177 | (guix build java-utils)
|
| 178 | (guix build utils)
|
| 179 | (sxml simple))
|
| 180 | #:phases
|
| 181 | #~(modify-phases %standard-phases
|
| 182 | (add-before 'configure 'build-native-code
|
| 183 | (lambda* (#:key inputs #:allow-other-keys)
|
| 184 | (let* ((jdk (assoc-ref inputs "jdk"))
|
| 185 | (suffix #$(match (%current-system)
|
| 186 | ("i686-linux" "i686")
|
| 187 | ("armhf-linux" "armhf")
|
| 188 | ("aarch64-linux" "aarch64")
|
| 189 | ("x86_64-linux" "x86_64")
|
| 190 | (_ "generic")))
|
| 191 | (lib #$(match (%current-system)
|
| 192 | ("i686-linux"
|
| 193 | "/lib/i386")
|
| 194 | ("x86_64-linux"
|
| 195 | "/lib/amd64")
|
| 196 | ("armhf-linux"
|
| 197 | "/lib/arm")
|
| 198 | ("aarch64-linux"
|
| 199 | "/lib/aarch64")
|
| 200 | ("powerpc-linux"
|
| 201 | "/lib/ppc")
|
| 202 | |
| 203 | |
| 204 | (_
|
| 205 | (string-append
|
| 206 | "/lib/"
|
| 207 | (string-drop-right
|
| 208 | (%current-system) 6)))))
|
| 209 | (filename
|
| 210 | (string-append "libflatlaf-linux-" suffix ".so"))
|
| 211 | (target-dir
|
| 212 | (string-append (getcwd)
|
| 213 | "/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives")))
|
| 214 | (with-directory-excursion "flatlaf-natives/flatlaf-natives-linux/"
|
| 215 | (invoke "gcc" "-shared" "-O3" "-fPIC"
|
| 216 | "src/main/cpp/ApiVersion.cpp"
|
| 217 | "src/main/cpp/X11WmUtils.cpp"
|
| 218 | "-Isrc/main/headers"
|
| 219 | "-ljawt"
|
| 220 | (string-append "-L" jdk lib)
|
| 221 | (string-append "-I" jdk "/include")
|
| 222 | (string-append "-I" jdk "/include/linux")
|
| 223 | "-o" filename)
|
| 224 | (install-file filename target-dir)))))
|
| 225 | (add-before 'build 'copy-resources
|
| 226 | (lambda _
|
| 227 | (copy-recursively "flatlaf-core/src/main/resources"
|
| 228 | "build/classes")))
|
| 229 | (add-before 'build 'generate-pom
|
| 230 | (lambda _
|
| 231 | (call-with-output-file "pom.xml"
|
| 232 | (lambda (port)
|
| 233 | (sxml->xml
|
| 234 | `(*TOP*
|
| 235 | (*PI* xml "version=\"1.0\" encoding=\"UTF-8\"")
|
| 236 | (project
|
| 237 | (modelVersion "4.0.0")
|
| 238 | (groupId "com.formdev")
|
| 239 | (artifactId "flatlaf")
|
| 240 | (version ,#$version)))
|
| 241 | port)))))
|
| 242 | (replace 'build
|
| 243 | (lambda* (#:key inputs #:allow-other-keys)
|
| 244 | (let* ((jdk (assoc-ref inputs "jdk"))
|
| 245 | (src-dir "flatlaf-core/src/main/java")
|
| 246 | (java9-dir "flatlaf-core/src/main/java9")
|
| 247 | (classes-dir "build/classes")
|
| 248 | (classes9-dir "build/classes9")
|
| 249 | (jar-file
|
| 250 | (string-append "build/flatlaf-" #$version ".jar")))
|
| 251 | |
| 252 | (apply invoke "javac"
|
| 253 | "--release" "8"
|
| 254 | "-d" classes-dir
|
| 255 | (find-files src-dir "\\.java$"))
|
| 256 | |
| 257 | (mkdir-p classes9-dir)
|
| 258 | (apply invoke "javac"
|
| 259 | "--release" "9"
|
| 260 | "-cp" classes-dir
|
| 261 | "-d" classes9-dir
|
| 262 | (find-files java9-dir "\\.java$"))
|
| 263 | |
| 264 | (let ((meta-versions
|
| 265 | (string-append classes-dir
|
| 266 | "/META-INF/versions/9")))
|
| 267 | (mkdir-p meta-versions)
|
| 268 | (copy-recursively classes9-dir meta-versions))
|
| 269 | (call-with-output-file "build/manifest.mf"
|
| 270 | (lambda (port)
|
| 271 | (display "Multi-Release: true\n" port)))
|
| 272 | (invoke "jar" "--create"
|
| 273 | "--file" jar-file
|
| 274 | "--manifest" "build/manifest.mf"
|
| 275 | "-C" classes-dir "."))))
|
| 276 | (replace 'install
|
| 277 | (install-from-pom "pom.xml")))))
|
| 278 | (inputs
|
| 279 | (list libx11 libxt))
|
| 280 | (home-page "https://www.formdev.com/flatlaf/")
|
| 281 | (synopsis "Flat Look and Feel for Java Swing applications")
|
| 282 | (description "FlatLaf is a cross-platform Look and Feel for Java Swing
|
| 283 | desktop applications. It looks almost flat (no shadows or gradients), clean,
|
| 284 | simple and elegant. FlatLaf comes with Light, Dark, IntelliJ and Darcula
|
| 285 | themes, scales on HiDPI displays and runs on Java 8 or newer.
|
| 286 |
|
| 287 | The look is heavily inspired by Darcula and IntelliJ themes from IntelliJ IDEA
|
| 288 | 2019.2+ and uses almost the same colors and icons.")
|
| 289 | (license license:asl2.0)))
|
| 290 |
|
| 291 | (define-public java-flatlaf-intellij-themes
|
| 292 | (package
|
| 293 | (inherit java-flatlaf)
|
| 294 | (name "java-flatlaf-intellij-themes")
|
| 295 | (arguments
|
| 296 | (list
|
| 297 | #:tests? #false |
| 298 | #:jar-name "flatlaf-intellij-themes.jar"
|
| 299 | #:source-dir '(list "flatlaf-intellij-themes/src/main/java")
|
| 300 | #:phases
|
| 301 | #~(modify-phases %standard-phases
|
| 302 | (add-before 'build 'copy-resources
|
| 303 | (lambda _
|
| 304 | (copy-recursively "flatlaf-intellij-themes/src/main/resources"
|
| 305 | "build/classes"))))))
|
| 306 | (inputs (list java-flatlaf))
|
| 307 | (synopsis "FlatLaf addon with popular themes")
|
| 308 | (description "This addon for FlatLaf bundles many popular third party
|
| 309 | themes from JetBrains Plugins Repository into a JAR and provides Java classes
|
| 310 | to use them.")))
|
| 311 |
|
| 312 | (define-public java-piccolo2d-core
|
| 313 | (package
|
| 314 | (name "java-piccolo2d-core")
|
| 315 | (version "3.0.1")
|
| 316 | (source (origin
|
| 317 | (method git-fetch)
|
| 318 | (uri (git-reference
|
| 319 | (url "https://github.com/piccolo2d/piccolo2d.java")
|
| 320 | (commit (string-append "piccolo2d-complete-" version))))
|
| 321 | (file-name (git-file-name name version))
|
| 322 | (sha256
|
| 323 | (base32
|
| 324 | "1k6gw643k83516lcw04mgac2yi75phdrng44pz9xk6hz066ip21s"))))
|
| 325 | (build-system ant-build-system)
|
| 326 | (arguments
|
| 327 | `(#:jar-name "piccolo2d-core.jar"
|
| 328 | #:phases
|
| 329 | (modify-phases %standard-phases
|
| 330 | (add-after 'unpack 'chdir
|
| 331 | (lambda _ (chdir "core") #t)))))
|
| 332 | (inputs
|
| 333 | (list java-junit))
|
| 334 | (home-page "http://piccolo2d.org")
|
| 335 | (synopsis "Structured 2D graphics framework")
|
| 336 | (description "Piccolo2D is a framework (in the Jazz ZUI tradition) to
|
| 337 | create robust, full-featured graphical applications in Java, with features
|
| 338 | such as zooming and multiple representation. This package provides the core
|
| 339 | libraries.")
|
| 340 | (license license:bsd-3)))
|
| 341 |
|
| 342 | (define-public java-piccolo2d-extras
|
| 343 | (package (inherit java-piccolo2d-core)
|
| 344 | (name "java-piccolo2d-extras")
|
| 345 | (arguments
|
| 346 | `(#:jar-name "piccolo2d-extras.jar"
|
| 347 | #:phases
|
| 348 | (modify-phases %standard-phases
|
| 349 | (add-after 'unpack 'chdir
|
| 350 | (lambda _ (chdir "extras") #t))
|
| 351 | (add-after 'chdir 'remove-failing-test
|
| 352 | (lambda _
|
| 353 | |
| 354 | (delete-file "src/test/java/org/piccolo2d/extras/nodes/PShadowTest.java")
|
| 355 | (delete-file "src/test/java/org/piccolo2d/extras/util/ShadowUtilsTest.java")
|
| 356 | #t))
|
| 357 | (add-before 'check 'start-xorg-server
|
| 358 | (lambda* (#:key inputs #:allow-other-keys)
|
| 359 | |
| 360 | (system "Xvfb :1 -screen 0 640x480x24 &")
|
| 361 | (setenv "DISPLAY" ":1")
|
| 362 | #t)))))
|
| 363 | (inputs
|
| 364 | (list java-piccolo2d-core java-junit))
|
| 365 | (native-inputs
|
| 366 | (list xorg-server-for-tests)) |
| 367 | (description "Piccolo2D is a framework (in the Jazz ZUI tradition) to
|
| 368 | create robust, full-featured graphical applications in Java, with features
|
| 369 | such as zooming and multiple representation. This package provides additional
|
| 370 | features not found in the core libraries.")))
|
| 371 |
|
| 372 | (define-public java-marlin-renderer
|
| 373 | (package
|
| 374 | (name "java-marlin-renderer")
|
| 375 | (version "0.9.4.8")
|
| 376 | (source (origin
|
| 377 | (method git-fetch)
|
| 378 | (uri (git-reference
|
| 379 | (url "https://github.com/bourgesl/marlin-renderer")
|
| 380 | (commit (string-append "v" (string-map (match-lambda
|
| 381 | (#\. #\_)
|
| 382 | (c c))
|
| 383 | version)))))
|
| 384 | (file-name (git-file-name name version))
|
| 385 | (sha256
|
| 386 | (base32
|
| 387 | "0gcqp9iq0j5n08gdssh8gp0daj3n5zrx0dll1l4ljhbj2b9jm9ym"))))
|
| 388 | (build-system ant-build-system)
|
| 389 | (arguments
|
| 390 | (list
|
| 391 | #:jar-name "marlin.jar"
|
| 392 | #:test-include '(list "src/test/java/RunJUnitTest.java")
|
| 393 | #:phases
|
| 394 | '(modify-phases %standard-phases
|
| 395 | (add-before 'build 'copy-resources
|
| 396 | (lambda _
|
| 397 | (copy-recursively "src/main/resources" "build/classes"))))))
|
| 398 | (inputs
|
| 399 | (list java-hamcrest-core java-junit))
|
| 400 | (home-page "https://github.com/bourgesl/marlin-renderer/")
|
| 401 | (synopsis "Rendering engine")
|
| 402 | (description "Marlin is a Java2D @code{RenderingEngine} optimized for
|
| 403 | performance (improved memory usage and footprint, better multi-threading) and
|
| 404 | better visual quality based on OpenJDK's @code{pisces} implementation. It
|
| 405 | handles shape rendering (@code{Graphics2D} @code{draw(Shape)} /
|
| 406 | @code{fill(Shape)} with stroke and dash attributes.")
|
| 407 | |
| 408 | (license license:gpl2)))
|