fix groovy compilation
more/packages/groovy.scm
1086 | 1086 | (replace 'install | |
1087 | 1087 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
1088 | 1088 | (let* ((out (assoc-ref outputs "out")) | |
1089 | - | (out-bin (string-append out "/bin"))) | |
1089 | + | (out-bin (string-append out "/bin")) | |
1090 | + | (out-lib (string-append out "/lib"))) | |
1090 | 1091 | (with-directory-excursion "src/bin" | |
1091 | 1092 | (substitute* "startGroovy" | |
1092 | 1093 | (("\"\\\\\"") "\"") | |
1093 | 1094 | (("\\\\\"\"") "\"") | |
1094 | 1095 | (("\\\\\\$") "$") | |
1095 | - | (("STARTER_CLASSPATH=.*") | |
1096 | - | (string-append | |
1097 | - | "STARTER_CLASSPATH=" | |
1098 | - | (string-join | |
1099 | - | (apply append | |
1100 | - | (map (lambda (input) | |
1101 | - | (find-files (assoc-ref inputs input) ".*.jar")) | |
1102 | - | '("groovy-bootstrap" "groovy-ant" "groovy-bsf" | |
1103 | - | "groovy-console" "groovy-docgenerator" | |
1104 | - | "groovy-groovydoc" "groovy-groovysh" | |
1105 | - | "groovy-jmx" "groovy-json" "groovy-jsr223" | |
1106 | - | "groovy-nio" "groovy-servlet" "groovy-sql" | |
1107 | - | "groovy-swing" "groovy-templates" "groovy-testng" | |
1108 | - | "java-commons-cli" "java-asm" | |
1109 | - | "java-classpathx-servletapi" "java-xstream" | |
1110 | - | "java-jansi" "java-jline-2" "antlr2"))) | |
1111 | - | ":"))) | |
1096 | + | (("@GROOVYJAR@") "groovy.jar") | |
1112 | 1097 | (("MAX_FD=\"maximum\"") | |
1113 | 1098 | (string-append | |
1114 | - | "MAX_FD=\"maximum\"\nJAVACMD=" | |
1115 | - | (assoc-ref inputs "jdk") "/bin/java"))) | |
1099 | + | "MAX_FD=\"maximum\"\nJAVAHOME=" | |
1100 | + | (assoc-ref inputs "jdk")))) | |
1101 | + | ;; Groovy uses class loading. It's not enough to put the class | |
1102 | + | ;; in the loader's classpath, as it causes breakages: | |
1103 | + | ;; the compiler would give this error: | |
1104 | + | ;; "Prohibited package name: java.lang" | |
1105 | + | ;; So we symlink dependencies in this package's output. The | |
1106 | + | ;; starter class (in groovy-bootstrap) is where the class loader | |
1107 | + | ;; will look for dependencies, so we put it there too. | |
1108 | + | (mkdir-p out-lib) | |
1109 | + | (for-each | |
1110 | + | (lambda (input) | |
1111 | + | (for-each | |
1112 | + | (lambda (jar) | |
1113 | + | (symlink jar (string-append out-lib "/" (basename jar)))) | |
1114 | + | (find-files (assoc-ref inputs input) ".*.jar"))) | |
1115 | + | '("groovy-bootstrap" "groovy-ant" "groovy-bsf" | |
1116 | + | "groovy-console" "groovy-docgenerator" | |
1117 | + | "groovy-groovydoc" "groovy-groovysh" | |
1118 | + | "groovy-jmx" "groovy-json" "groovy-jsr223" | |
1119 | + | "groovy-nio" "groovy-servlet" "groovy-sql" | |
1120 | + | "groovy-swing" "groovy-templates" "groovy-testng" | |
1121 | + | "java-commons-cli" "java-asm" | |
1122 | + | "java-classpathx-servletapi" "java-xstream" | |
1123 | + | "java-jansi" "java-jline-2")) | |
1124 | + | ;; antlr.jar is present twice in antlr2. Symlink doesn't like | |
1125 | + | ;; it, so we symlink it here. | |
1126 | + | (symlink (string-append (assoc-ref inputs "antlr2") "/lib/antlr.jar") | |
1127 | + | (string-append out-lib "/antlr.jar")) | |
1116 | 1128 | (for-each | |
1117 | 1129 | (lambda (tool) | |
1118 | 1130 | (install-file tool out-bin) |
more/packages/java.scm
4657 | 4657 | (lambda _ | |
4658 | 4658 | (chdir "logback-classic"))) | |
4659 | 4659 | (replace 'build | |
4660 | - | (lambda _ | |
4660 | + | (lambda* (#:key inputs #:allow-other-keys) | |
4661 | 4661 | (mkdir-p "build/classes") | |
4662 | + | (setenv "CLASSPATH" | |
4663 | + | (string-join | |
4664 | + | (apply append (map (lambda (input) | |
4665 | + | (find-files (assoc-ref inputs input) | |
4666 | + | ".*.jar")) | |
4667 | + | '("java-logback-core" "java-slf4j-api" | |
4668 | + | "java-commons-compiler" "java-tomcat"))) | |
4669 | + | ":")) | |
4670 | + | ;`(("java-javax-mail" ,java-javax-mail) | |
4671 | + | ; ("java-tomcat" ,java-tomcat) | |
4672 | + | ; ("java-commons-compiler" ,java-commons-compiler) | |
4673 | + | ; ("java-janino" ,java-janino))) | |
4662 | 4674 | (and | |
4663 | 4675 | ;; FIXME: Using groovyc from groovy directly fails | |
4664 | - | (zero? (apply system* "java" "-cp" (getenv "CLASSPATH") | |
4665 | - | "org.codehaus.groovy.tools.FileSystemCompiler" | |
4666 | - | "-d" "build/classes" "-j" | |
4667 | - | (find-files "src/main/" ".*\\.(groovy|java)$"))) | |
4676 | + | ;(zero? (apply system* "java" "-cp" (getenv "CLASSPATH") | |
4677 | + | ; "org.codehaus.groovy.tools.FileSystemCompiler" | |
4678 | + | ; "-d" "build/classes" "-j" | |
4679 | + | ; (find-files "src/main/" ".*\\.(groovy|java)$"))) | |
4680 | + | (apply invoke "groovyc" "-d" "build/classes" "-j" | |
4681 | + | (find-files "src/main/" ".*\\.(groovy|java)$")) | |
4668 | 4682 | (zero? (system* "ant" "jar")))))))) | |
4669 | 4683 | (inputs | |
4670 | 4684 | `(("java-logback-core" ,java-logback-core) | |
4671 | 4685 | ("java-slf4j-api" ,java-slf4j-api) | |
4672 | 4686 | ,@(package-inputs java-logback-core))) | |
4673 | 4687 | (native-inputs | |
4674 | - | `(("groovy-bootstrap" ,groovy-bootstrap) | |
4675 | - | ("java-commons-cli" ,java-commons-cli) | |
4676 | - | ("java-asm" ,java-asm) | |
4677 | - | ("antlr2" ,antlr2) | |
4678 | - | ;; for tests | |
4679 | - | ("java-junit" ,java-junit) | |
4680 | - | ("java-hamcrest-core" ,java-hamcrest-core) | |
4681 | - | ("java-dom4j" ,java-dom4j) | |
4682 | - | ("java-log4j-api" ,java-log4j-api) | |
4683 | - | ("java-osgi-framework" ,java-osgi-framework) | |
4684 | - | ("java-assertj" ,java-assertj) | |
4685 | - | ("java-mockito-1" ,java-mockito-1) | |
4686 | - | ("java-slf4j-api" ,java-slf4j-api) | |
4687 | - | ("java-logback-core" ,java-logback-core) | |
4688 | - | ("java-logback-core-tests" ,java-logback-core-tests))))) | |
4688 | + | `(("groovy" ,groovy))))) | |
4689 | 4689 | ||
4690 | 4690 | ;; TODO: build the native library | |
4691 | 4691 | (define-public java-native-access |