diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 403c446a82..0245b299f8 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -116,6 +116,8 @@ (base32 "1qqldrp74pzpy5ly421srqn30qppmm9cvjiqdngk8hf47dv2rc0c")))) (build-system gnu-build-system) + (native-inputs + `(("gcc" ,gcc-5))) (home-page "http://jikes.sourceforge.net/") (synopsis "Compiler for the Java language") (description "Jikes is a compiler that translates Java source files as @@ -152,13 +154,43 @@ and binary format defined in The Java Virtual Machine Specification.") "--disable-gjdoc") #:phases (modify-phases %standard-phases + (add-after 'unpack 'foo + (lambda _ + (substitute* "native/jni/native-lib/cpio.c" + (("\\(stat\\(filename, &statbuf\\) < 0\\)") + "(stat(filename, &statbuf) != 0)")) + (substitute* "native/jni/java-io/java_io_VMFile.c" + (("return result == CPNATIVE_OK \\? 1 : 0;") + "return ((result == CPNATIVE_OK) ? 1 : 0);") + (("result = cpio_isFileExists.*" m) + (string-append m "\nfprintf(stderr, \"exists? %s : %d -- %d;\\n\", filename, result, ((result == CPNATIVE_OK) ? 1 : 0));"))) + (substitute* "java/io/File.java" + (("String filename = ") "filename =") + (("File file;" m) + (string-append m "\nString filename;")) + + ;; (("while \\(VMFile.exists\\(file.path\\)\\)") + ;; "while (false)") + (("while \\(VMFile.exists\\(file.path\\)\\)") + "while (VMFile.exists(directory.path + \"/\" + filename))") + (("// Grab the system" m) + (string-append "System.err.println(\"classpath called createTempFile: prefix \" + prefix + \" suffix \" + suffix + \" directory \" + directory.path );\n" + m)) + (("// Verify that we" m) + (string-append "System.err.println(\"classpath after loop with: \" + prefix);\n +file = new File(directory, filename);" + m)) + (("file = new File.*" m) + (string-append m "\nSystem.err.println(\"classpath trying to create: \" + file.path + \" exists? \" + String.valueOf(VMFile.exists(file.path)));\n"))) + #t)) (add-after 'install 'install-data (lambda _ (invoke "make" "install-data")))))) (native-inputs `(("jikes" ,jikes) ("fastjar" ,fastjar) ("libltdl" ,libltdl) - ("pkg-config" ,pkg-config))) + ("pkg-config" ,pkg-config) + ("gcc" ,gcc-5))) (home-page "https://www.gnu.org/software/classpath/") (synopsis "Essential libraries for Java") (description "GNU Classpath is a project to create core class libraries @@ -191,6 +223,8 @@ language.") `(("classpath" ,classpath-bootstrap) ("jikes" ,jikes) ("zlib" ,zlib))) + (native-inputs + `(("gcc-5" ,gcc-5))) (home-page "http://jamvm.sourceforge.net/") (synopsis "Small Java Virtual Machine") (description "JamVM is a Java Virtual Machine conforming to the JVM @@ -225,7 +259,6 @@ JNI.") #:tests? #f ; no "check" target #:phases (modify-phases %standard-phases - (delete 'bootstrap) (delete 'configure) (replace 'build (lambda* (#:key inputs #:allow-other-keys) @@ -244,9 +277,12 @@ JNI.") (setenv "HOME" "/tmp") (with-output-to-file "/tmp/.ant.properties" (lambda _ (display ""))) + (with-output-to-file ".ant.properties" + (lambda _ (display ""))) ;; Use jikes instead of javac for tags in build.xml - (setenv "ANT_OPTS" "-Dbuild.compiler=jikes") + (setenv "ANT_OPTS" + "-Dbuild.compiler=jikes -Djava.io.tmpdir=/tmp") ;; jikes produces lots of warnings, but they are not very ;; interesting, so we silence them. @@ -254,15 +290,49 @@ JNI.") ;; Without these JamVM options the build may freeze. (substitute* "bootstrap.sh" + ;;(("-emacs") "-debug") (("^\"\\$\\{JAVACMD\\}\" " m) ,@(if (string-prefix? "armhf" (or (%current-system) (%current-target-system))) `((string-append m "-Xnocompact ")) `((string-append m "-Xnocompact -Xnoinlining "))))) + (substitute* "src/main/org/apache/tools/ant/version.txt" + (("VERSION=.*") (string-append "VERSION=" ,version "\n")) + (("DATE=.*") "DATE=reproducible")) + + ;; XXX: Copying the source files appears to be necessary because + ;; ant won't find the XML and txt resources in src/main for some + ;; reason. It really shouldn't be needed, so maybe this can be + ;; avoided by setting some environment variable. + (substitute* "bootstrap.sh" + (("cp src/script/antRun bin" m) + (string-append m " +cp -ar {src/main,build/classes}/org/apache/tools/ant/version.txt +cp -ar {src/main,build/classes}/org/apache/tools/ant/antlib.xml +"))) + (substitute* "src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java" + (("tmpFile = FILE_UTILS.createTempFile" m) + (string-append "attributes.log(\"REKADO createTempFile\", Project.MSG_WARN);" + m)) + (("out = new.*" m) + (string-append m + "\nattributes.log(\"REKADO created\", Project.MSG_WARN);")) + (("exe.execute\\(\\)" m) + (string-append "attributes.log(\"REKADO executing\", Project.MSG_WARN);" + m))) + + (substitute* "src/main/org/apache/tools/ant/util/FileUtils.java" + (("result = File.*" m) + (string-append "System.err.println(\"Trying to create \" + prefix);\n" + m + "\nSystem.err.println(\"Created file \" + result);"))) + ;; Disable tests because we are bootstrapping and thus don't have ;; any of the dependencies required to build and run the tests. (substitute* "build.xml" + ;; (("includeantruntime=\"false\"") + ;; (string-append "includeantruntime=\"true\" createMissingPackageInfoClass=\"false\" fork=\"true\"")) (("depends=\"jars,test-jar\"") "depends=\"jars\"")) (invoke "bash" "bootstrap.sh" (string-append "-Ddist.dir="