Subject: Re: [bug#32947] [PATCH 3/3] gnu: Add java-xalan.

From: Julien Lepiller <[email-masked]>
Date: Fri, 05 Oct 2018 17:46:47 +0200

Le 2018-10-05 17:20, Danny Milosavljevic a écrit :
> * gnu/packages/java.scm (java-xalan): New variable.
> ---
>  gnu/packages/java.scm | 54 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index 863a4b79c..02a8f65e8 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -9709,6 +9709,60 @@ the DOM level 3 load/save API's are in use.")
>  for Java.")
>      (license license:asl2.0)))
> 
> +(define-public java-xalan
> +  (package
> +    (name "java-xalan")
> +    (version "2.7.2")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (string-append
> "https://archive.apache.org/dist/xalan/xalan-j/source/"
> +                            "xalan-j_" (string-join (string-split
> version #\.) "_")
> +                            "-src.tar.gz"))

Could you use mirror://apache/xalan/xalan-j/source/...?

> +        (sha256
> +         (base32
> +          "166vg9i11qzi0vbv09abfb50q8caq8wr6zrwg0cwqws9k394l62w"))))
> +    (build-system ant-build-system)
> +    (arguments
> +     `(#:build-target "jar"
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'patch-classpath
> +           (lambda _
> +             (substitute* "src/MANIFEST.MF"
> +              (("^Class-Path: .*$") "\n"))
> +             #t))
> +         (add-after 'unpack 'replace-prebuilt-jars
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (for-each delete-file
> +                       (find-files "." "\\.jar$"))

I think it's better to remove these files in a snippet. Also, there are 
.tar.gz files in the source archive that we could remove.

> +             (symlink (string-append (assoc-ref inputs 
> "java-commons-bcel")
> +                                     "/share/java/bcel.jar")
> +                      "lib/BCEL.jar")
> +             (symlink (string-append (assoc-ref inputs "java-cup")
> +                                     
> "/share/java/java-cup-11b-runtime.jar")
> +                      "lib/runtime.jar")
> +             (symlink (string-append (assoc-ref inputs 
> "java-jakarta-regexp")
> +                                     
> "/share/java/jakarta-regexp-1.5.jar")
> +                      "lib/regexp.jar")

maybe something like
(let ((regexp (assoc-ref inputs "java-jakarta-regexp")))
   (symlink (string-append regexp "/share/java/javakarta-regexp-" 
(package-version regexp) ".jar")
            "lib/regexp.jar"))

would be more future-proof in case we update regexp? Same with the other 
dependencies.

> +             #t))
> +          (replace 'install
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (let* ((out (assoc-ref outputs "out"))
> +                     (out-share (string-append out "/share/java")))
> +                (mkdir-p out-share)
> +                (install-file "build/xalan.jar" out-share)
> +                #t))))))
> +    (propagated-inputs
> +     `(("java-commons-bcel" ,java-commons-bcel)
> +       ("java-cup" ,java-cup)
> +       ("java-jakarta-regexp" ,java-jakarta-regexp)
> +       ("java-xerces" ,java-xerces)))
> +    (home-page "https://xml.apache.org/xalan-j/")
> +    (synopsis "XSLT processor for Java")
> +    (description "@code{xalan} is an XSLT processor for Java.")
> +    (license license:asl2.0)))
> +
>  (define-public java-jline
>    (package
>      (name "java-jline")