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

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

Le 2018-10-05 17:20, Danny Milosavljevic a écrit :
> * gnu/packages/java.scm (java-cup): New variable.
> ---
>  gnu/packages/java.scm | 44 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index 96da495c2..4ddffb357 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -69,6 +69,7 @@
>    #:use-module (gnu packages perl)
>    #:use-module (gnu packages popt)
>    #:use-module (gnu packages kerberos)
> +  #:use-module (gnu packages version-control)
>    #:use-module (gnu packages xml)
>    #:use-module (gnu packages xorg)
>    #:use-module (gnu packages texinfo)
> @@ -9634,6 +9635,49 @@ Candidate Recommendation, and will correctly
> serialize XML 1.1 documents if
>  the DOM level 3 load/save API's are in use.")
>      (license license:asl2.0)))
> 
> +(define-public java-cup
> +  (package
> +    (name "java-cupx")

Why x?

> +    (version "11b-20160615")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (string-append
> +              
> "http://www2.cs.tum.edu/projects/cup/releases/java-cup-src-"
> +              version ".tar.gz"))
> +        (sha256
> +         (base32
> +          "1ymz3plngxclh7x3xr31537rvvak7lwyd0qkmnl1mkj5drh77rz0"))))
> +    (build-system ant-build-system)
> +    (arguments
> +     `(#:build-target "dist"
> +       #:test-target "test"
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'remove-prebuilt-jars
> +           (lambda _
> +             (for-each delete-file
> +                       (find-files "." "\\.jar$"))
> +             #t))

Maybe use a snippet instead?

> +         (add-before 'build 'chdir
> +           (lambda _
> +             (chdir "..")
> +             #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 "dist/java-cup-11b-runtime.jar" 
> out-share)
> +               (install-file "dist/java-cup-11b.jar" out-share)
> +               #t))))))
> +    (native-inputs
> +     `(("git" ,git)))
> +    (home-page "http://www2.cs.tum.edu/projects/cup/")
> +    (synopsis "LALR parser generator for Java")
> +    (description "@code{java_cup} is a LALR parser generator for 
> Java.")
> +    (license license:asl2.0)))
> +
>  (define-public java-jline
>    (package
>      (name "java-jline")

I don't know if that's an issue, but the source code bundles generated 
source by java-cup and jflex. I've tried to bootstrap both correctly, 
but there is no version of jflex you can build without jflex and cup. I 
have a recipe for java-jflex and java-cup that are built without 
pre-generated source, using two bootstrap jars. Then, I could use them 
to build other packages that I need for the future maven-build-system. I 
wasn't able to build java-jflex with the latest java-cup.

Do you want me to send these recipes for comparison?