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