Subject: [bug#36477] [PATCH v3 06/48] gnu: groff: Fix cross compilation.

From: Ludovic Courtès <[email-masked]>
Date: Wed, 04 Sep 2019 15:23:59 +0200

Mathieu Othacehe <[email-masked]> skribis:

> * gnu/packages/groff.scm (groff)[arguments]: Replace build phase to pass
> GROFF_BIN_PATH and GROFFBIN variables when cross-compiling.
>
> Also add native groff as a native-input when cross-compiling.

Please mention changes to ‘groff-minimal’.

[...]

> +	,@(if (%current-target-system)
> +              '((replace 'build
> +		  (lambda* (#:key
> +			    make-flags parallel-build?
> +			    native-inputs target #:allow-other-keys)
> +		    ;; When cross-compiling, native groff is needed, see:
> +		    ;; http://www.mail-archive.com/[email-masked]/msg01335.html
> +		    (let ((parallel
> +			   (if parallel-build?
> +			       `("-j" ,(number->string (parallel-job-count)))
> +			       '()))
> +			  (flags
> +			   (if target
> +			       (let ((groff (or
> +					     (assoc-ref native-inputs "groff")
> +					     (assoc-ref native-inputs "self"))))
> +				 (append
> +				  make-flags
> +				  (list
> +				   (string-append "GROFF_BIN_PATH=" groff)
> +				   (string-append "GROFFBIN=" groff
> +						  "/bin/groff"))))
> +			       make-flags)))

Wouldn’t it be easier to have:

  (arguments
    `(,@(if (%current-target-system)
            `(#:make-flags (list (string-append "GROFF_BIN_PATH="
                                                (assoc-ref %build-native-inputs "self)
                                                …)))
             '()
      …))

?

>      (native-inputs `(("bison" ,bison)
> -                     ("perl" ,perl)))
> +                     ("perl" ,perl)
> +                     ("groff" ,groff)))

Should probably be:

  ("self" ,this-package)

for consistency.

Thanks,
Ludo’.