fix openjdk doc non determinism
more/packages/java.scm
26 | 26 | #:use-module (guix cvs-download) | |
27 | 27 | #:use-module (guix hg-download) | |
28 | 28 | #:use-module (guix utils) | |
29 | + | #:use-module (guix build syscalls) | |
29 | 30 | #:use-module (guix build-system ant) | |
30 | 31 | #:use-module (guix build-system gnu) | |
31 | 32 | #:use-module (guix build-system trivial) | |
… | |||
2849 | 2850 | (("@IgnoreJRERequirement") ""))) | |
2850 | 2851 | #t))))))) | |
2851 | 2852 | ||
2853 | + | (define-public java-guava-25 | |
2854 | + | (package | |
2855 | + | (inherit java-guava) | |
2856 | + | (version "25.1") | |
2857 | + | (source (origin | |
2858 | + | (method url-fetch) | |
2859 | + | (uri (string-append "https://github.com/google/guava/" | |
2860 | + | "archive/v" version ".tar.gz")) | |
2861 | + | (file-name (string-append "java-guava-" version ".tar.gz")) | |
2862 | + | (sha256 | |
2863 | + | (base32 | |
2864 | + | "0jxwp8kfjcj4hyjwvnakk4d0yszp9np2l8c3hwz3ipxmwxk4dx7k")))) | |
2865 | + | (arguments | |
2866 | + | `(#:tests? #f ; no tests included | |
2867 | + | #:jar-name "guava.jar" | |
2868 | + | #:source-dir "guava/src" | |
2869 | + | #:jdk ,openjdk9 | |
2870 | + | #:phases | |
2871 | + | (modify-phases %standard-phases | |
2872 | + | (add-after 'unpack 'trim-sources | |
2873 | + | (lambda _ | |
2874 | + | (with-directory-excursion "guava/src/com/google/common" | |
2875 | + | ;; Remove annotations to avoid extra dependencies: | |
2876 | + | ;; * "j2objc" annotations are used when converting Java to | |
2877 | + | ;; Objective C; | |
2878 | + | ;; * "errorprone" annotations catch common Java mistakes at | |
2879 | + | ;; compile time; | |
2880 | + | ;; * "IgnoreJRERequirement" is used for Android. | |
2881 | + | (substitute* (find-files "." "\\.java$") | |
2882 | + | (("import com.google.j2objc.*") "") | |
2883 | + | (("import com.google.errorprone.annotation.*") "") | |
2884 | + | (("import org.codehaus.mojo.animal_sniffer.*") "") | |
2885 | + | (("@CanIgnoreReturnValue") "") | |
2886 | + | (("@LazyInit") "") | |
2887 | + | (("@WeakOuter") "") | |
2888 | + | (("@RetainedWith") "") | |
2889 | + | (("@Weak") "") | |
2890 | + | (("@ForOverride") "") | |
2891 | + | (("@J2ObjCIncompatible") "") | |
2892 | + | (("@CompatibleWith\\(\"[A-Z]\"\\)") "") | |
2893 | + | (("@Immutable\\([^\\)]*\\)") "") | |
2894 | + | (("@Immutable") "") | |
2895 | + | (("@ReflectionSupport\\([^\\)]*\\)") "") | |
2896 | + | (("@DoNotMock.*") "") | |
2897 | + | (("@MustBeClosed") "") | |
2898 | + | (("@IgnoreJRERequirement") ""))) | |
2899 | + | #t))))))) | |
2900 | + | ||
2852 | 2901 | ;(define-public java-xml-commons | |
2853 | 2902 | ; (package | |
2854 | 2903 | ; (name "java-xml-commons") | |
… | |||
4308 | 4357 | (build-system gnu-build-system) | |
4309 | 4358 | (outputs '("out" "jdk" "doc")) | |
4310 | 4359 | (arguments | |
4311 | - | `(#:tests? #f; TODO: requires jtreg | |
4360 | + | `(#:tests? #f; require jtreg | |
4361 | + | #:imported-modules | |
4362 | + | (;(guix build gnu-build-system) | |
4363 | + | (guix build syscalls) | |
4364 | + | ,@%gnu-build-system-modules) | |
4312 | 4365 | #:phases | |
4313 | 4366 | (modify-phases %standard-phases | |
4314 | 4367 | (delete 'patch-source-shebangs) | |
… | |||
4329 | 4382 | (setenv "GUIX_LD_WRAPPER_ALLOW_IMPURITIES" "yes") | |
4330 | 4383 | (invoke "make" "all") | |
4331 | 4384 | #t)) | |
4332 | - | (replace 'check | |
4333 | - | (lambda _ | |
4334 | - | (invoke "make" "test") | |
4385 | + | ;(replace 'check | |
4386 | + | ; (lambda _ | |
4387 | + | ; (invoke "make" "test") | |
4388 | + | ; #t)) | |
4389 | + | ;; Some of the libraries in the lib/ folder link to libjvm.so. | |
4390 | + | ;; But that shared object is located in the server/ folder, so it | |
4391 | + | ;; cannot be found. This phase creates a symbolic link in the | |
4392 | + | ;; lib/ folder so that the other libraries can find it. | |
4393 | + | ;; | |
4394 | + | ;; See: | |
4395 | + | ;; https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00169.html | |
4396 | + | ;; | |
4397 | + | ;; FIXME: Find the bug in the build system, so that this symlink is | |
4398 | + | ;; not needed. | |
4399 | + | (add-after 'install 'install-libjvm | |
4400 | + | (lambda* (#:key inputs outputs #:allow-other-keys) | |
4401 | + | (let* ((lib-out (string-append (assoc-ref outputs "out") | |
4402 | + | "/lib")) | |
4403 | + | (lib-jdk (string-append (assoc-ref outputs "jdk") | |
4404 | + | "/lib"))) | |
4405 | + | (symlink (string-append lib-jdk "/server/libjvm.so") | |
4406 | + | (string-append lib-jdk "/libjvm.so")) | |
4407 | + | (symlink (string-append lib-out "/server/libjvm.so") | |
4408 | + | (string-append lib-out "/libjvm.so"))) | |
4335 | 4409 | #t)) | |
4336 | 4410 | (replace 'install | |
4337 | 4411 | (lambda* (#:key outputs #:allow-other-keys) | |
4338 | 4412 | (let ((out (assoc-ref outputs "out")) | |
4339 | 4413 | (jdk (assoc-ref outputs "jdk")) | |
4340 | 4414 | (doc (assoc-ref outputs "doc")) | |
4341 | - | (images (car (find-files "build" ".*-server-release")))) | |
4415 | + | (images (car (find-files "build" ".*-server-release" | |
4416 | + | #:directories? #t)))) | |
4342 | 4417 | (copy-recursively (string-append images "/images/jdk") jdk) | |
4343 | 4418 | (copy-recursively (string-append images "/images/jre") out) | |
4344 | 4419 | (copy-recursively (string-append images "/images/docs") doc)) | |
4420 | + | #t)) | |
4421 | + | (add-after 'install 'strip-zip-timestamps | |
4422 | + | (lambda* (#:key outputs #:allow-other-keys) | |
4423 | + | (use-modules (guix build syscalls)) | |
4424 | + | (for-each (lambda (zip) | |
4425 | + | (let ((dir (mkdtemp! "zip-contents.XXXXXX"))) | |
4426 | + | (with-directory-excursion dir | |
4427 | + | (invoke "unzip" zip)) | |
4428 | + | (delete-file zip) | |
4429 | + | (for-each (lambda (file) | |
4430 | + | (let ((s (lstat file))) | |
4431 | + | (unless (eq? (stat:type s) 'symlink) | |
4432 | + | (format #t "reset ~a~%" file) | |
4433 | + | (utime file 0 0 0 0)))) | |
4434 | + | (find-files dir #:directories? #t)) | |
4435 | + | (with-directory-excursion dir | |
4436 | + | (let ((files (find-files "." ".*" #:directories? #t))) | |
4437 | + | (apply invoke "zip" "-0" "-X" zip files))))) | |
4438 | + | (find-files (assoc-ref outputs "doc") ".*.zip$")) | |
4345 | 4439 | #t))))) | |
4346 | 4440 | (inputs | |
4347 | 4441 | `(("alsa-lib" ,alsa-lib) |