all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#67026] [PATCH] gnu: josm: Reduce closure size.
@ 2023-11-09 18:57 Julien Lepiller
  2023-11-09 19:13 ` [bug#67026] [PATCH 1/3] gnu: javacc: Do not reference a jdk Julien Lepiller
  2023-12-02 10:21 ` [bug#67026] [PATCH] " Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Julien Lepiller @ 2023-11-09 18:57 UTC (permalink / raw)
  To: 67026

Hi Guix!

This small patchset reduces josm's (the Java OSM editor) closure size
from 1.781MB to 544MB (1.2GB reduction!).

This is mostly due to no longer referencing two JDKs.




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

* [bug#67026] [PATCH 1/3] gnu: javacc: Do not reference a jdk.
  2023-11-09 18:57 [bug#67026] [PATCH] gnu: josm: Reduce closure size Julien Lepiller
@ 2023-11-09 19:13 ` Julien Lepiller
  2023-11-09 19:13   ` [bug#67026] [PATCH 2/3] gnu: java-openjfx-graphics: Make java-swt optional Julien Lepiller
  2023-11-09 19:13   ` [bug#67026] [PATCH 3/3] gnu: josm: Reduce closure size Julien Lepiller
  2023-12-02 10:21 ` [bug#67026] [PATCH] " Ludovic Courtès
  1 sibling, 2 replies; 6+ messages in thread
From: Julien Lepiller @ 2023-11-09 19:13 UTC (permalink / raw)
  To: 67026

The jdk provides java and javac, while a jre only provides the necessary
java, reducing the closure size by 350MB.

* gnu/packages/java.scm (javacc): Remove #t at end of phases.
[inputs]: Add icedtea-8 as the jre.
[arguments]: Use it instead of the jdk.

Change-Id: Icb218c40915550b7ff1db96a48a3c48fa6ef52b4
---
 gnu/packages/java.scm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 7c8c4e0a36..eded386a03 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2465,8 +2465,7 @@ (define-public javacc
        (modules '((guix build utils)))
        ;; Delete bundled jars.
        (snippet '(begin (for-each delete-file-recursively
-                                  '("bootstrap" "lib"))
-                        #t))))
+                                  '("bootstrap" "lib"))))))
     (arguments
      `(#:make-flags                     ; bootstrap from javacc-4
        ,#~(list (string-append "-Dbootstrap-jar="
@@ -2487,17 +2486,16 @@ (define-public javacc
                  (lambda _
                    (display
                      (string-append "#!/bin/sh\n"
-                                    (assoc-ref inputs "jdk") "/bin/java"
+                                    (assoc-ref inputs "icedtea") "/bin/java"
                                     " -cp " dir "/javacc.jar" " `basename $0`" " $*"))))
                (chmod javacc #o755)
                ;; symlink to different names to affect the first argument and
                ;; change the behavior of the jar file.
                (symlink javacc (string-append bin "/jjdoc"))
-               (symlink javacc (string-append bin "/jjtree"))
-               #t))))))
-
+               (symlink javacc (string-append bin "/jjtree"))))))))
     (native-inputs
-     (list javacc-4))))
+     (list javacc-4))
+    (inputs (list icedtea-8))))
 
 (define-public java-ecj
   (package
-- 
2.41.0





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

* [bug#67026] [PATCH 2/3] gnu: java-openjfx-graphics: Make java-swt optional.
  2023-11-09 19:13 ` [bug#67026] [PATCH 1/3] gnu: javacc: Do not reference a jdk Julien Lepiller
@ 2023-11-09 19:13   ` Julien Lepiller
  2023-11-09 19:13   ` [bug#67026] [PATCH 3/3] gnu: josm: Reduce closure size Julien Lepiller
  1 sibling, 0 replies; 6+ messages in thread
From: Julien Lepiller @ 2023-11-09 19:13 UTC (permalink / raw)
  To: 67026

It is used for an optional part of openjfx and not used by current
packages in Guix. Swt has a reference to a library in the JDK and has a
huge closure size because of that.  This reduces closure by 1GB for this
package and dependents (including josm).

* gnu/packages/java.scm (java-openjfx-graphics)[native-inputs]: Move java-swt...
[inputs]: ...to here.

Change-Id: I7d8cb14569d5a9f451944695225a2dff143bf190
---
 gnu/packages/java.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index eded386a03..d73550c042 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2311,7 +2311,9 @@ (define-public java-openjfx-graphics
                                         (string-append target new-name))))
                          (find-files "netbeans" "\\.so$"))))))))
     (propagated-inputs
-     (list java-openjfx-base java-swt))
+     (list java-openjfx-base))
+    (inputs
+     (list java-swt))
     ;; XXX: for unknown reasons
     ;; modules/graphics/src/main/native-prism-sw/JNativeSurface.c is missing
     ;; in this revision.
-- 
2.41.0





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

* [bug#67026] [PATCH 3/3] gnu: josm: Reduce closure size.
  2023-11-09 19:13 ` [bug#67026] [PATCH 1/3] gnu: javacc: Do not reference a jdk Julien Lepiller
  2023-11-09 19:13   ` [bug#67026] [PATCH 2/3] gnu: java-openjfx-graphics: Make java-swt optional Julien Lepiller
@ 2023-11-09 19:13   ` Julien Lepiller
  1 sibling, 0 replies; 6+ messages in thread
From: Julien Lepiller @ 2023-11-09 19:13 UTC (permalink / raw)
  To: 67026

This saves 240MB of closure size.

* gnu/packages/geo.scm (josm)[inputs]: Add openjdk11.
[arguments]: Filter native inputs out of CLASSPATH.  Use `java' from
openjdk11 instead of the JDK.

Change-Id: Ifa03b5cd033c5866d22e7557119284be0ea25a0e
---
 gnu/packages/geo.scm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index dbc8440141..746b22a082 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -1970,7 +1970,8 @@ (define-public josm
            java-openjfx-media
            java-parsson ; runtime dependency
            java-signpost-core
-           java-svg-salamander))
+           java-svg-salamander
+           openjdk11))
     (arguments
      `(#:tests? #f
        #:jar-name "josm.jar"
@@ -2070,9 +2071,16 @@ (define-public josm
                  (lambda _
                    (display
                      (string-append "#!/bin/sh\n"
-                                    (assoc-ref inputs "jdk") "/bin/java"
+                                    (assoc-ref inputs "openjdk") "/bin/java"
                                     " -cp " out "/share/java/josm.jar:"
-                                    (getenv "CLASSPATH")
+                                    ;; CLASSPATH, but remove native inputs
+                                    (string-join
+                                      (filter
+                                        (lambda (jar)
+                                          (and (not (string-contains jar "-jdk/"))
+                                               (not (string-contains jar "-javacc-"))))
+                                        (string-split (getenv "CLASSPATH") #\:))
+                                      ":")
                                     " org.openstreetmap.josm.gui.MainApplication"))))
                (chmod (string-append bin "/josm") #o755))
              #t)))))
-- 
2.41.0





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

* [bug#67026] [PATCH] gnu: josm: Reduce closure size.
  2023-11-09 18:57 [bug#67026] [PATCH] gnu: josm: Reduce closure size Julien Lepiller
  2023-11-09 19:13 ` [bug#67026] [PATCH 1/3] gnu: javacc: Do not reference a jdk Julien Lepiller
@ 2023-12-02 10:21 ` Ludovic Courtès
  2023-12-02 18:10   ` bug#67026: " Julien Lepiller
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2023-12-02 10:21 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 67026

Hi Julien,

Julien Lepiller <julien@lepiller.eu> skribis:

> This small patchset reduces josm's (the Java OSM editor) closure size
> from 1.781MB to 544MB (1.2GB reduction!).

Wo0t, well done!

> This is mostly due to no longer referencing two JDKs.

Heh.

LGTM!

Ludo’.




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

* bug#67026: [PATCH] gnu: josm: Reduce closure size.
  2023-12-02 10:21 ` [bug#67026] [PATCH] " Ludovic Courtès
@ 2023-12-02 18:10   ` Julien Lepiller
  0 siblings, 0 replies; 6+ messages in thread
From: Julien Lepiller @ 2023-12-02 18:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 67026-done

Le Sat, 02 Dec 2023 11:21:19 +0100,
Ludovic Courtès <ludo@gnu.org> a écrit :

> Hi Julien,
> 
> Julien Lepiller <julien@lepiller.eu> skribis:
> 
> > This small patchset reduces josm's (the Java OSM editor) closure
> > size from 1.781MB to 544MB (1.2GB reduction!).  
> 
> Wo0t, well done!
> 
> > This is mostly due to no longer referencing two JDKs.  
> 
> Heh.
> 
> LGTM!
> 
> Ludo’.

Thanks, pushed to master as 406e46a15965bcb9e68e7c0bf09f14b9c72c6498 -
06ebc45e15f2a1bd4526a5a716eed657c902a0c1




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

end of thread, other threads:[~2023-12-02 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 18:57 [bug#67026] [PATCH] gnu: josm: Reduce closure size Julien Lepiller
2023-11-09 19:13 ` [bug#67026] [PATCH 1/3] gnu: javacc: Do not reference a jdk Julien Lepiller
2023-11-09 19:13   ` [bug#67026] [PATCH 2/3] gnu: java-openjfx-graphics: Make java-swt optional Julien Lepiller
2023-11-09 19:13   ` [bug#67026] [PATCH 3/3] gnu: josm: Reduce closure size Julien Lepiller
2023-12-02 10:21 ` [bug#67026] [PATCH] " Ludovic Courtès
2023-12-02 18:10   ` bug#67026: " Julien Lepiller

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.