| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 |
|
| 28 | (define-module (gnu packages java-bootstrap)
|
| 29 | #:use-module ((guix licenses) #:prefix license:)
|
| 30 | #:use-module (guix packages)
|
| 31 | #:use-module (guix download)
|
| 32 | #:use-module (guix git-download)
|
| 33 | #:use-module (guix utils)
|
| 34 | #:use-module (guix gexp)
|
| 35 | #:use-module (guix build-system gnu)
|
| 36 | #:use-module (guix build-system trivial)
|
| 37 | #:use-module (gnu packages)
|
| 38 | #:use-module (gnu packages autotools)
|
| 39 | #:use-module (gnu packages bash)
|
| 40 | #:use-module (gnu packages compression)
|
| 41 | #:use-module (gnu packages gettext)
|
| 42 | #:use-module (gnu packages guile)
|
| 43 | #:use-module (gnu packages libffi)
|
| 44 | #:use-module (gnu packages pkg-config)
|
| 45 | #:use-module (gnu packages texinfo)
|
| 46 | #:export (classpath-devel
|
| 47 | ecj4-javac-wrapper
|
| 48 | jamvm-with-ecj4
|
| 49 | ant-bootstrap))
|
| 50 |
|
| 51 |
|
| 52 | |
| 53 | |
| 54 | |
| 55 |
|
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 |
|
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 |
|
| 77 | (define jikes
|
| 78 | (package
|
| 79 | (name "jikes")
|
| 80 | (version "1.22")
|
| 81 | (source (origin
|
| 82 | (method url-fetch)
|
| 83 | (uri (string-append "mirror://sourceforge/jikes/Jikes/"
|
| 84 | version "/jikes-" version ".tar.bz2"))
|
| 85 | (sha256
|
| 86 | (base32
|
| 87 | "1qqldrp74pzpy5ly421srqn30qppmm9cvjiqdngk8hf47dv2rc0c"))))
|
| 88 | (build-system gnu-build-system)
|
| 89 | (home-page "https://jikes.sourceforge.net/")
|
| 90 | (synopsis "Compiler for the Java language")
|
| 91 | (description "Jikes is a compiler that translates Java source files as
|
| 92 | defined in The Java Language Specification into the bytecoded instruction set
|
| 93 | and binary format defined in The Java Virtual Machine Specification.")
|
| 94 | (license license:ibmpl1.0)))
|
| 95 |
|
| 96 | |
| 97 | (define classpath-bootstrap
|
| 98 | (package
|
| 99 | (name "classpath")
|
| 100 | (version "0.93")
|
| 101 | (source (origin
|
| 102 | (method url-fetch)
|
| 103 | (uri (string-append "mirror://gnu/classpath/classpath-"
|
| 104 | version ".tar.gz"))
|
| 105 | (sha256
|
| 106 | (base32
|
| 107 | "0i99wf9xd3hw1sj2sazychb9prx8nadxh2clgvk3zlmb28v0jbfz"))
|
| 108 | (patches (search-patches "classpath-aarch64-support.patch"
|
| 109 | "classpath-miscompilation.patch"))))
|
| 110 | (build-system gnu-build-system)
|
| 111 | (arguments
|
| 112 | `(#:configure-flags
|
| 113 | (list (string-append "JAVAC="
|
| 114 | (search-input-file %build-inputs "/bin/jikes"))
|
| 115 | "CFLAGS=-g -O2 -Wno-error=implicit-function-declaration"
|
| 116 | "--disable-Werror"
|
| 117 | "--disable-gmp"
|
| 118 | "--disable-gtk-peer"
|
| 119 | "--disable-gconf-peer"
|
| 120 | "--disable-plugin"
|
| 121 | "--disable-dssi"
|
| 122 | "--disable-alsa"
|
| 123 | "--disable-gjdoc")
|
| 124 | #:phases
|
| 125 | (modify-phases %standard-phases
|
| 126 | (add-after 'install 'install-data
|
| 127 | (lambda _ (invoke "make" "install-data"))))))
|
| 128 | (native-inputs
|
| 129 | (list jikes fastjar libltdl pkg-config))
|
| 130 | (home-page "https://www.gnu.org/software/classpath/")
|
| 131 | (synopsis "Essential libraries for Java")
|
| 132 | (description "GNU Classpath is a project to create core class libraries
|
| 133 | for use with runtimes, compilers and tools for the Java programming
|
| 134 | language.")
|
| 135 | |
| 136 | (license license:gpl2+)))
|
| 137 |
|
| 138 | |
| 139 | |
| 140 | (define jamvm-1-bootstrap
|
| 141 | (package
|
| 142 | (name "jamvm")
|
| 143 | (version "1.5.1")
|
| 144 | (source (origin
|
| 145 | (method url-fetch)
|
| 146 | (uri (string-append "mirror://sourceforge/jamvm/jamvm/"
|
| 147 | "JamVM%20" version "/jamvm-"
|
| 148 | version ".tar.gz"))
|
| 149 | (patches (search-patches "jamvm-1.5.1-aarch64-support.patch"
|
| 150 | "jamvm-1.5.1-armv7-support.patch"))
|
| 151 | (sha256
|
| 152 | (base32
|
| 153 | "06lhi03l3b0h48pc7x58bk9my2nrcf1flpmglvys3wyad6yraf36"))
|
| 154 | |
| 155 | (snippet
|
| 156 | '(delete-file "lib/classes.zip"))))
|
| 157 | (build-system gnu-build-system)
|
| 158 | (arguments
|
| 159 | `(#:configure-flags
|
| 160 | (list (string-append "--with-classpath-install-dir="
|
| 161 | (assoc-ref %build-inputs "classpath"))
|
| 162 | "--disable-int-caching"
|
| 163 | "--enable-runtime-reloc-checks"
|
| 164 | "--enable-ffi"
|
| 165 | ,(string-append
|
| 166 | "CFLAGS=-g -O2"
|
| 167 | " -Wno-error=implicit-function-declaration"
|
| 168 | " -Wno-error=incompatible-pointer-types"))
|
| 169 | #:phases
|
| 170 | ,(if (string-prefix? "aarch64" (or (%current-system)
|
| 171 | (%current-target-system)))
|
| 172 | |
| 173 | |
| 174 | '(modify-phases %standard-phases
|
| 175 | (replace 'bootstrap
|
| 176 | (lambda _ (invoke "autoreconf" "-vif"))))
|
| 177 | '%standard-phases)))
|
| 178 | (inputs
|
| 179 | (list classpath-bootstrap jikes libffi
|
| 180 | zip zlib))
|
| 181 | (native-inputs
|
| 182 | (if (string-prefix? "aarch64" (or (%current-system)
|
| 183 | (%current-target-system)))
|
| 184 | |
| 185 | `(("autoconf" ,autoconf)
|
| 186 | ("automake" ,automake)
|
| 187 | ("libtool" ,libtool))
|
| 188 | '()))
|
| 189 | (home-page "https://jamvm.sourceforge.net/")
|
| 190 | (synopsis "Small Java Virtual Machine")
|
| 191 | (description "JamVM is a Java Virtual Machine conforming to the JVM
|
| 192 | specification edition 2 (blue book). It is extremely small. However, unlike
|
| 193 | other small VMs it supports the full spec, including object finalisation and
|
| 194 | JNI.")
|
| 195 | (license license:gpl2+)))
|
| 196 |
|
| 197 | (define ant-bootstrap
|
| 198 | (package
|
| 199 | (name "ant-bootstrap")
|
| 200 | |
| 201 | |
| 202 | |
| 203 | (version "1.8.4")
|
| 204 | (source (origin
|
| 205 | (method url-fetch)
|
| 206 | (uri (string-append "mirror://apache/"
|
| 207 | "ant/source/apache-ant-"
|
| 208 | version "-src.tar.bz2"))
|
| 209 | (sha256
|
| 210 | (base32
|
| 211 | "1cg0lga887qz5iizh6mlkxp01lciymrhmp7wzxpl6zpnldxmzrjx"))))
|
| 212 | (build-system gnu-build-system)
|
| 213 | (arguments
|
| 214 | `(#:modules ((srfi srfi-1)
|
| 215 | (guix build gnu-build-system)
|
| 216 | (guix build utils))
|
| 217 | #:tests? #f |
| 218 | #:phases
|
| 219 | (modify-phases %standard-phases
|
| 220 | (delete 'bootstrap)
|
| 221 | (delete 'configure)
|
| 222 | (add-before 'build 'define-java-environment-variables
|
| 223 | (lambda* (#:key inputs #:allow-other-keys)
|
| 224 | |
| 225 | (setenv "JAVA_HOME" (assoc-ref inputs "jamvm"))
|
| 226 | (setenv "JAVACMD" (search-input-file inputs "/bin/jamvm"))
|
| 227 | (setenv "JAVAC" (search-input-file inputs "/bin/jikes"))
|
| 228 | (setenv "CLASSPATH" (search-input-file inputs "/lib/rt.jar"))))
|
| 229 | (replace 'build
|
| 230 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 231 | |
| 232 | (setenv "HOME" "/tmp")
|
| 233 | (with-output-to-file "/tmp/.ant.properties"
|
| 234 | (lambda _ (display "")))
|
| 235 |
|
| 236 | |
| 237 | (setenv "ANT_OPTS" "-Dbuild.compiler=jikes")
|
| 238 |
|
| 239 | |
| 240 | |
| 241 | (setenv "$BOOTJAVAC_OPTS" "-nowarn")
|
| 242 |
|
| 243 | |
| 244 | (substitute* "bootstrap.sh"
|
| 245 | (("^\"\\$\\{JAVACMD\\}\" " m)
|
| 246 | ,@(if (string-prefix? "armhf" (or (%current-system)
|
| 247 | (%current-target-system)))
|
| 248 | `((string-append m "-Xnocompact "))
|
| 249 | `((string-append m "-Xnocompact -Xnoinlining ")))))
|
| 250 |
|
| 251 | |
| 252 | |
| 253 | (substitute* "build.xml"
|
| 254 | (("depends=\"jars,test-jar\"") "depends=\"jars\""))
|
| 255 | (invoke "bash" "bootstrap.sh"
|
| 256 | (string-append "-Ddist.dir="
|
| 257 | (assoc-ref outputs "out")))))
|
| 258 | (add-after 'build 'strip-jar-timestamps |
| 259 | (lambda* (#:key outputs #:allow-other-keys)
|
| 260 | (define (repack-archive jar)
|
| 261 | (let* ((dir (mkdtemp "jar-contents.XXXXXX"))
|
| 262 | (manifest (string-append dir "/META-INF/MANIFESTS.MF")))
|
| 263 | (with-directory-excursion dir
|
| 264 | (invoke "unzip" jar))
|
| 265 | (delete-file jar)
|
| 266 | |
| 267 | (for-each (lambda (file)
|
| 268 | (let ((s (lstat file)))
|
| 269 | (unless (eq? (stat:type s) 'symlink)
|
| 270 | (utime file 0 0 0 0))))
|
| 271 | (find-files dir #:directories? #t))
|
| 272 | |
| 273 | (with-directory-excursion dir
|
| 274 | (let* ((files (find-files "." ".*" #:directories? #t))
|
| 275 | |
| 276 | |
| 277 | |
| 278 | (command (if (file-exists? manifest)
|
| 279 | `("zip" "-0" "-X" ,jar ,manifest
|
| 280 | ,@files)
|
| 281 | `("zip" "-0" "-X" ,jar ,@files))))
|
| 282 | (apply invoke command)))))
|
| 283 | (for-each repack-archive
|
| 284 | (find-files
|
| 285 | (string-append (assoc-ref %outputs "out") "/lib")
|
| 286 | "\\.jar$"))))
|
| 287 | (delete 'install))))
|
| 288 | (native-inputs
|
| 289 | (list jikes jamvm-1-bootstrap unzip zip))
|
| 290 | (home-page "https://ant.apache.org")
|
| 291 | (synopsis "Build tool for Java")
|
| 292 | (description
|
| 293 | "Ant is a platform-independent build tool for Java. It is similar to
|
| 294 | make but is implemented using the Java language, requires the Java platform,
|
| 295 | and is best suited to building Java projects. Ant uses XML to describe the
|
| 296 | build process and its dependencies, whereas Make uses Makefile format.")
|
| 297 | (license license:asl2.0)))
|
| 298 |
|
| 299 | |
| 300 | |
| 301 | (define ecj-bootstrap
|
| 302 | (package
|
| 303 | (name "ecj-bootstrap")
|
| 304 | (version "3.2.2")
|
| 305 | (source (origin
|
| 306 | (method url-fetch)
|
| 307 | (uri (string-append "http://archive.eclipse.org/eclipse/"
|
| 308 | "downloads/drops/R-" version
|
| 309 | "-200702121330/ecjsrc.zip"))
|
| 310 | (sha256
|
| 311 | (base32
|
| 312 | "05hj82kxd23qaglsjkaqcj944riisjha7acf7h3ljhrjyljx8307"))))
|
| 313 | |
| 314 | |
| 315 | |
| 316 | (build-system gnu-build-system)
|
| 317 | (arguments
|
| 318 | `(#:tests? #f |
| 319 | #:phases
|
| 320 | (modify-phases %standard-phases
|
| 321 | (replace 'configure
|
| 322 | (lambda* (#:key inputs #:allow-other-keys)
|
| 323 | (setenv "CLASSPATH"
|
| 324 | (string-join
|
| 325 | (cons (search-input-file inputs "/lib/rt.jar")
|
| 326 | (find-files (string-append
|
| 327 | (assoc-ref inputs "ant-bootstrap")
|
| 328 | "/lib")
|
| 329 | "\\.jar$"))
|
| 330 | ":"))))
|
| 331 | (replace 'build
|
| 332 | (lambda* (#:key inputs #:allow-other-keys)
|
| 333 | |
| 334 | (chdir "..")
|
| 335 |
|
| 336 | |
| 337 | (with-output-to-file "manifest"
|
| 338 | (lambda _
|
| 339 | (display "Manifest-Version: 1.0
|
| 340 | Main-Class: org.eclipse.jdt.internal.compiler.batch.Main\n")))
|
| 341 |
|
| 342 | |
| 343 | (and (apply invoke "jikes"
|
| 344 | (find-files "." "\\.java$"))
|
| 345 | (invoke "fastjar" "cvfm"
|
| 346 | "ecj-bootstrap.jar" "manifest" "."))))
|
| 347 | (replace 'install
|
| 348 | (lambda* (#:key outputs #:allow-other-keys)
|
| 349 | (let ((share (string-append (assoc-ref outputs "out")
|
| 350 | "/share/java/")))
|
| 351 | (mkdir-p share)
|
| 352 | (install-file "ecj-bootstrap.jar" share)))))))
|
| 353 | (native-inputs
|
| 354 | (list ant-bootstrap
|
| 355 | unzip
|
| 356 | jikes
|
| 357 | jamvm-1-bootstrap
|
| 358 | fastjar))
|
| 359 | (home-page "https://eclipse.org")
|
| 360 | (synopsis "Eclipse Java development tools core batch compiler")
|
| 361 | (description "This package provides the Eclipse Java core batch compiler
|
| 362 | for bootstrapping purposes. The @dfn{Eclipse compiler for Java} (ecj) is a
|
| 363 | requirement for all GNU Classpath releases after version 0.93.")
|
| 364 | (license license:epl1.0)))
|
| 365 |
|
| 366 | (define ecj-javac-wrapper
|
| 367 | (package (inherit ecj-bootstrap)
|
| 368 | (name "ecj-javac-wrapper")
|
| 369 | (source #f)
|
| 370 | (build-system trivial-build-system)
|
| 371 | (arguments
|
| 372 | `(#:modules ((guix build utils))
|
| 373 | #:builder
|
| 374 | ,#~(begin
|
| 375 | (use-modules (guix build utils))
|
| 376 | (let* ((bin (string-append #$output "/bin"))
|
| 377 | (target (string-append bin "/javac"))
|
| 378 | (guile (string-append (assoc-ref %build-inputs "guile")
|
| 379 | "/bin/guile"))
|
| 380 | (ecj (string-append #$(this-package-native-input "ecj-bootstrap")
|
| 381 | "/share/java/ecj-bootstrap.jar"))
|
| 382 | (java (string-append #$(this-package-native-input "jamvm")
|
| 383 | "/bin/jamvm"))
|
| 384 | (bootcp (let ((jvmlib (string-append
|
| 385 | #$(this-package-native-input "classpath")
|
| 386 | "/share/classpath")))
|
| 387 | (string-append jvmlib "/glibj.zip:"
|
| 388 | jvmlib "/tools.zip"))))
|
| 389 | (mkdir-p bin)
|
| 390 | (with-output-to-file target
|
| 391 | (lambda _
|
| 392 | (format #t "#!~a --no-auto-compile\n!#\n" guile)
|
| 393 | (write
|
| 394 | `(begin (use-modules (ice-9 match)
|
| 395 | (ice-9 receive)
|
| 396 | (ice-9 hash-table)
|
| 397 | (srfi srfi-1)
|
| 398 | (srfi srfi-26))
|
| 399 | (define defaults
|
| 400 | '(("-bootclasspath" ,bootcp)
|
| 401 | ("-source" "1.5")
|
| 402 | ("-target" "1.5")
|
| 403 | ("-cp" ".")))
|
| 404 | (define (main args)
|
| 405 | (let ((classpath (getenv "CLASSPATH")))
|
| 406 | (setenv "CLASSPATH"
|
| 407 | (string-join (list ,ecj (or classpath ""))
|
| 408 | ":")))
|
| 409 | (receive (vm-args other-args)
|
| 410 | |
| 411 | (partition (cut string-prefix? "-J" <>)
|
| 412 | (fold (lambda (default acc)
|
| 413 | (if (member (first default) acc)
|
| 414 | acc (append default acc)))
|
| 415 | args defaults))
|
| 416 | (apply system* ,java
|
| 417 | (append
|
| 418 | |
| 419 | (map (cut string-drop <> 2) vm-args)
|
| 420 | '("org.eclipse.jdt.internal.compiler.batch.Main")
|
| 421 | (cons "-nowarn" other-args)))))
|
| 422 | |
| 423 | (let ((args (cdr (command-line))))
|
| 424 | (if (null? args)
|
| 425 | (format (current-error-port) "javac: no arguments given!\n")
|
| 426 | (main args)))))))
|
| 427 | (chmod target #o755)))))
|
| 428 | (native-inputs
|
| 429 | (list guile-3.0 ecj-bootstrap jamvm-1-bootstrap classpath-bootstrap))
|
| 430 | (description "This package provides a wrapper around the @dfn{Eclipse
|
| 431 | compiler for Java} (ecj) with a command line interface that is compatible with
|
| 432 | the standard javac executable.")))
|
| 433 |
|
| 434 | |
| 435 | |
| 436 | |
| 437 | (define classpath-0.99
|
| 438 | (package (inherit classpath-bootstrap)
|
| 439 | (version "0.99")
|
| 440 | (source (origin
|
| 441 | (method url-fetch)
|
| 442 | (uri (string-append "mirror://gnu/classpath/classpath-"
|
| 443 | version ".tar.gz"))
|
| 444 | (sha256
|
| 445 | (base32
|
| 446 | "1j7cby4k66f1nvckm48xcmh352b1d1b33qk7l6hi7dp9i9zjjagr"))
|
| 447 | (patches (search-patches "classpath-aarch64-support.patch"))))
|
| 448 | (arguments
|
| 449 | `(#:configure-flags
|
| 450 | (list (string-append "--with-ecj-jar="
|
| 451 | (assoc-ref %build-inputs "ecj-bootstrap")
|
| 452 | "/share/java/ecj-bootstrap.jar")
|
| 453 | (string-append "JAVAC="
|
| 454 | (assoc-ref %build-inputs "ecj-javac-wrapper")
|
| 455 | "/bin/javac")
|
| 456 | (string-append "JAVA="
|
| 457 | (assoc-ref %build-inputs "jamvm")
|
| 458 | "/bin/jamvm")
|
| 459 | "GCJ_JAVAC_TRUE=no"
|
| 460 | "ac_cv_prog_java_works=yes" |
| 461 | "--disable-Werror"
|
| 462 | "--disable-gmp"
|
| 463 | "--disable-gtk-peer"
|
| 464 | "--disable-gconf-peer"
|
| 465 | "--disable-plugin"
|
| 466 | "--disable-dssi"
|
| 467 | "--disable-alsa"
|
| 468 | "--disable-gjdoc")
|
| 469 | #:phases
|
| 470 | (modify-phases %standard-phases
|
| 471 | (add-after 'install 'install-data
|
| 472 | (lambda _ (invoke "make" "install-data"))))))
|
| 473 | (native-inputs
|
| 474 | (list classpath-bootstrap
|
| 475 | ecj-bootstrap ecj-javac-wrapper
|
| 476 | fastjar jamvm-1-bootstrap
|
| 477 | libltdl pkg-config))))
|
| 478 |
|
| 479 | |
| 480 | |
| 481 | (define classpath-jamvm-wrappers
|
| 482 | (package (inherit classpath-0.99)
|
| 483 | (name "classpath-jamvm-wrappers")
|
| 484 | (source #f)
|
| 485 | (build-system trivial-build-system)
|
| 486 | (arguments
|
| 487 | (list
|
| 488 | #:modules '((guix build utils))
|
| 489 | #:builder
|
| 490 | #~(begin
|
| 491 | (use-modules (guix build utils))
|
| 492 | (let ((bash #$(this-package-native-input "bash-minimal"))
|
| 493 | (jamvm #$(this-package-native-input "jamvm"))
|
| 494 | (classpath #$(this-package-native-input "classpath"))
|
| 495 | (bin (string-append #$output "/bin/")))
|
| 496 | (mkdir-p bin)
|
| 497 | (for-each (lambda (tool)
|
| 498 | (with-output-to-file (string-append bin tool)
|
| 499 | (lambda _
|
| 500 | #$@(if (target-arm32?)
|
| 501 | `((format #t "#!~a/bin/sh
|
| 502 | ~a/bin/jamvm -classpath ~a/share/classpath/tools.zip \
|
| 503 | gnu.classpath.tools.~a.~a $@"
|
| 504 | bash jamvm classpath tool
|
| 505 | (if (string=? "native2ascii" tool)
|
| 506 | "Native2ASCII" "Main")))
|
| 507 | `((format #t "#!~a/bin/sh
|
| 508 | ~a/bin/jamvm -Xnocompact -Xnoinlining -classpath ~a/share/classpath/tools.zip \
|
| 509 | gnu.classpath.tools.~a.~a $@"
|
| 510 | bash jamvm classpath tool
|
| 511 | (if (string=? "native2ascii" tool)
|
| 512 | "Native2ASCII" "Main"))))))
|
| 513 | (chmod (string-append bin tool) #o755))
|
| 514 | (list "javah"
|
| 515 | "rmic"
|
| 516 | "rmid"
|
| 517 | "orbd"
|
| 518 | "rmiregistry"
|
| 519 | "native2ascii"))))))
|
| 520 | (native-inputs
|
| 521 | (list bash-minimal jamvm-1-bootstrap classpath-0.99))
|
| 522 | (inputs '())
|
| 523 | (synopsis "Executables from GNU Classpath")
|
| 524 | (description "This package provides wrappers around the tools provided by
|
| 525 | the GNU Classpath library. They are executed by the JamVM virtual
|
| 526 | machine.")))
|
| 527 |
|
| 528 | |
| 529 | |
| 530 | (define classpath-devel
|
| 531 | (let ((commit "e7c13ee0cf2005206fbec0eca677f8cf66d5a103")
|
| 532 | (revision "1"))
|
| 533 | (package (inherit classpath-bootstrap)
|
| 534 | (version (string-append "0.99-" revision "." (string-take commit 9)))
|
| 535 | (source (origin
|
| 536 | (method git-fetch)
|
| 537 | (uri (git-reference
|
| 538 | (url "https://git.savannah.gnu.org/git/classpath.git")
|
| 539 | (commit commit)))
|
| 540 | (file-name (string-append "classpath-" version "-checkout"))
|
| 541 | (sha256
|
| 542 | (base32
|
| 543 | "1v2rww76ww322mpg3s12a1kkc6gkp31bm9gcxs532h0wq285fiw4"))
|
| 544 | (patches (search-patches "classpath-aarch64-support.patch"))))
|
| 545 | (arguments
|
| 546 | `(#:make-flags
|
| 547 | |
| 548 | |
| 549 | |
| 550 | '("JAVAC_MEM_OPT=-J-Xms512M -J-Xmx768M")
|
| 551 | #:configure-flags
|
| 552 | (list (string-append "--with-ecj-jar="
|
| 553 | (assoc-ref %build-inputs "ecj-bootstrap")
|
| 554 | "/share/java/ecj-bootstrap.jar")
|
| 555 | (string-append "--with-javac="
|
| 556 | (assoc-ref %build-inputs "ecj-javac-wrapper")
|
| 557 | "/bin/javac")
|
| 558 | (string-append "JAVA="
|
| 559 | (assoc-ref %build-inputs "jamvm")
|
| 560 | "/bin/jamvm")
|
| 561 | "GCJ_JAVAC_TRUE=no"
|
| 562 | "ac_cv_prog_java_works=yes" |
| 563 | "--disable-Werror"
|
| 564 | "--disable-gmp"
|
| 565 | "--disable-gtk-peer"
|
| 566 | "--disable-gconf-peer"
|
| 567 | "--disable-plugin"
|
| 568 | "--disable-dssi"
|
| 569 | "--disable-alsa"
|
| 570 | "--disable-gjdoc")
|
| 571 | #:phases
|
| 572 | (modify-phases %standard-phases
|
| 573 | |
| 574 | |
| 575 | (replace 'bootstrap
|
| 576 | (lambda _ (invoke "autoreconf" "-vif")))
|
| 577 | (add-after 'unpack 'remove-unsupported-annotations
|
| 578 | (lambda _
|
| 579 | (substitute* (find-files "java" "\\.java$")
|
| 580 | (("@Override") ""))))
|
| 581 | (add-after 'install 'install-data
|
| 582 | (lambda _ (invoke "make" "install-data"))))))
|
| 583 | (native-inputs
|
| 584 | (list autoconf automake libltdl libtool gettext-minimal texinfo
|
| 585 | pkg-config
|
| 586 | classpath-jamvm-wrappers |
| 587 | ecj-bootstrap ecj-javac-wrapper fastjar
|
| 588 | jamvm-1-bootstrap)))))
|
| 589 |
|
| 590 | (define jamvm
|
| 591 | (package (inherit jamvm-1-bootstrap)
|
| 592 | (version "2.0.0")
|
| 593 | (source (origin
|
| 594 | (method url-fetch)
|
| 595 | (uri (string-append "mirror://sourceforge/jamvm/jamvm/"
|
| 596 | "JamVM%20" version "/jamvm-"
|
| 597 | version ".tar.gz"))
|
| 598 | (sha256
|
| 599 | (base32
|
| 600 | "1nl0zxz8y5x8gwsrm7n32bry4dx8x70p8z3s9jbdvs8avyb8whkn"))
|
| 601 | (patches
|
| 602 | (search-patches "jamvm-2.0.0-disable-branch-patching.patch"
|
| 603 | "jamvm-2.0.0-opcode-guard.patch"
|
| 604 | "jamvm-2.0.0-aarch64-support.patch"))
|
| 605 | |
| 606 | (snippet
|
| 607 | '(delete-file "src/classlib/gnuclasspath/lib/classes.zip"))))
|
| 608 | (build-system gnu-build-system)
|
| 609 | (arguments
|
| 610 | (substitute-keyword-arguments (package-arguments jamvm-1-bootstrap)
|
| 611 | ((#:configure-flags _)
|
| 612 | '(list (string-append "--with-classpath-install-dir="
|
| 613 | (assoc-ref %build-inputs "classpath"))))))
|
| 614 | (inputs
|
| 615 | `(("classpath" ,classpath-devel)
|
| 616 | ("ecj-javac-wrapper" ,ecj-javac-wrapper)
|
| 617 | ("zip" ,zip)
|
| 618 | ("zlib" ,zlib)))))
|
| 619 |
|
| 620 | (define ecj-javac-wrapper-final
|
| 621 | (package (inherit ecj-javac-wrapper)
|
| 622 | (native-inputs
|
| 623 | (list guile-3.0 ecj-bootstrap jamvm classpath-devel))))
|
| 624 |
|
| 625 | |
| 626 | |
| 627 | |
| 628 | (define ecj4-bootstrap
|
| 629 | (package
|
| 630 | (name "ecj-bootstrap")
|
| 631 | (version "4.2.1")
|
| 632 | (source (origin
|
| 633 | (method url-fetch)
|
| 634 | (uri (string-append "http://archive.eclipse.org/eclipse/"
|
| 635 | "downloads/drops4/R-" version
|
| 636 | "-201209141800/ecjsrc-" version ".jar"))
|
| 637 | (sha256
|
| 638 | (base32
|
| 639 | "1x281p87m14zylvinkiz6gc23ss7pzlx419qjbql11jriwav4qfj"))))
|
| 640 | |
| 641 | |
| 642 | |
| 643 | (build-system gnu-build-system)
|
| 644 | (arguments
|
| 645 | `(#:tests? #f |
| 646 | #:phases
|
| 647 | (modify-phases %standard-phases
|
| 648 | (replace 'unpack
|
| 649 | (lambda* (#:key source #:allow-other-keys)
|
| 650 | (mkdir "src")
|
| 651 | (with-directory-excursion "src"
|
| 652 | (invoke "gjar" "-xf" source))
|
| 653 | (chdir "src")))
|
| 654 | (replace 'configure
|
| 655 | (lambda* (#:key inputs #:allow-other-keys)
|
| 656 | (setenv "CLASSPATH"
|
| 657 | (string-join
|
| 658 | (cons (search-input-file inputs "/lib/rt.jar")
|
| 659 | (find-files (string-append
|
| 660 | (assoc-ref inputs "ant-bootstrap")
|
| 661 | "/lib")
|
| 662 | "\\.jar$"))
|
| 663 | ":"))
|
| 664 | |
| 665 | (substitute* (find-files "." "\\.java$")
|
| 666 | (("@Override") ""))))
|
| 667 | (replace 'build
|
| 668 | (lambda* (#:key inputs #:allow-other-keys)
|
| 669 | |
| 670 | |
| 671 | (delete-file "org/eclipse/jdt/core/JDTCompilerAdapter.java")
|
| 672 | (delete-file-recursively "org/eclipse/jdt/internal/antadapter")
|
| 673 |
|
| 674 | |
| 675 | (mkdir-p "META-INF")
|
| 676 | (with-output-to-file "META-INF/MANIFESTS.MF"
|
| 677 | (lambda _
|
| 678 | (display "Manifest-Version: 1.0
|
| 679 | Main-Class: org.eclipse.jdt.internal.compiler.batch.Main\n")))
|
| 680 |
|
| 681 | |
| 682 | (apply invoke "javac"
|
| 683 | (find-files "." "\\.java$"))
|
| 684 |
|
| 685 | |
| 686 | |
| 687 | |
| 688 | (for-each (lambda (file)
|
| 689 | (let ((s (lstat file)))
|
| 690 | (unless (eq? (stat:type s) 'symlink)
|
| 691 | (utime file 0 0 0 0))))
|
| 692 | (find-files "." #:directories? #t))
|
| 693 |
|
| 694 | |
| 695 | (apply invoke "zip" "-0" "-X" "ecj-bootstrap.jar"
|
| 696 | "META-INF/MANIFESTS.MF"
|
| 697 | (delete "./META-INF/MANIFESTS.MF"
|
| 698 | (find-files "." ".*" #:directories? #t)))))
|
| 699 | (replace 'install
|
| 700 | (lambda* (#:key outputs #:allow-other-keys)
|
| 701 | (let ((share (string-append (assoc-ref outputs "out")
|
| 702 | "/share/java/")))
|
| 703 | (mkdir-p share)
|
| 704 | (install-file "ecj-bootstrap.jar" share)))))))
|
| 705 | (native-inputs
|
| 706 | (list ant-bootstrap classpath-devel ecj-javac-wrapper-final jamvm
|
| 707 | unzip zip))
|
| 708 | (home-page "https://eclipse.org")
|
| 709 | (synopsis "Eclipse Java development tools core batch compiler")
|
| 710 | (description "This package provides the Eclipse Java core batch compiler
|
| 711 | for bootstrapping purposes. The @dfn{Eclipse compiler for Java} (ecj) is a
|
| 712 | requirement for all GNU Classpath releases after version 0.93. This version
|
| 713 | supports sufficient parts of Java 7 to build Icedtea 2.x.")
|
| 714 | (license license:epl1.0)))
|
| 715 |
|
| 716 | (define ecj4-javac-wrapper
|
| 717 | (package
|
| 718 | (inherit ecj-javac-wrapper)
|
| 719 | (native-inputs
|
| 720 | (list guile-3.0 ecj4-bootstrap jamvm classpath-devel))))
|
| 721 |
|
| 722 | (define jamvm-with-ecj4
|
| 723 | (package
|
| 724 | (inherit jamvm)
|
| 725 | (inputs
|
| 726 | (modify-inputs (package-inputs jamvm)
|
| 727 | (replace "ecj-javac-wrapper" ecj4-javac-wrapper)))))
|
| 728 |
|