Subject: Re: bug#75856: [PATCH] gnu: eureka: Update to 2.0.2.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 13 Feb 2025 11:31:21 +0900

Hi Andrew,

Andrew Wong <[email-masked]> writes:

> * gnu/packages/game-development.scm (eureka): Update to 2.0.2.
> [source]: Switch source from tarballs to git.
> [arguments] <configure-flags>: Disable unit tests.
> <phases>: Revise 'prepare-install-directories for new build system.

It looks like yo forgot to mention newly added inputs like libxpm and
glu in the above change log.

> Change-Id: I6114be8ef3b05ceb6b80efef29e20da9451b3dbc
> ---
> Here's v3. Liliana: I tried to unbundle googletest by replacing the
> FetchContent block with find_package, but I ran into an issue with ld
> not finding certain symbols in the googletest package; it seems like
> it depends on the source itself, somehow.

FetchContent doesn't need to be patched out; CMake has some variables
you can set to tell it to prefer a system version.  See
"-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS" in the jami package
definition for an example, and

--8<---------------cut here---------------start------------->8---
info --index-search FETCHCONTENT_TRY_FIND_PACKAGE_MODE cmake
--8<---------------cut here---------------end--------------->8---

for its documentation.

>  gnu/packages/game-development.scm | 75 +++++++++++++++----------------
>  1 file changed, 35 insertions(+), 40 deletions(-)
>
> diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
> index dc642bf052..149962a3e1 100644
> --- a/gnu/packages/game-development.scm
> +++ b/gnu/packages/game-development.scm
> @@ -31,6 +31,7 @@
>  ;;; Copyright © 2023, 2024 John Kehayias <[email-masked]>
>  ;;; Copyright © 2024 Nicolas Graves <[email-masked]>
>  ;;; Copyright © 2024 Maxim Cournoyer <[email-masked]>
> +;;; Copyright © 2025 Andrew Wong <[email-masked]>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -2407,47 +2408,41 @@ (define-public entt
>  (define-public eureka
>    (package
>      (name "eureka")
> -    (version "1.24")
> -    (source (origin
> -              (method url-fetch)
> -              (uri (string-append "mirror://sourceforge/eureka-editor/Eureka/"
> -                                  version "/eureka-"
> -                                  ;; version without dots e.g 1.21 => 121
> -                                  (string-join (string-split version #\.) "")
> -                                  "-source.tar.gz"))
> -              (sha256
> -               (base32
> -                "1x4idjniz9sma3j9ss6ni7fafmz22zs2jnpsqw4my9rsnmra5d9v"))))
> -    (build-system gnu-build-system)
> +    (version "2.0.2")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/ioan-chera/eureka-editor")
> +             (commit (string-append "eureka-" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "10bq7kr7vidrlw5l1mq35x83xsrzb9lhdzqdr07gkj40x0w493a0"))
> +       (patches (search-patches "eureka-unbundle-googletest.patch"))))

I don't see a patch; you must have forgotten to remove it above?

> +    (build-system cmake-build-system)
>      (arguments
> -     '(#:tests? #f
> -       #:make-flags
> -       (let ((out (assoc-ref %outputs "out")))
> -         (list (string-append "PREFIX=" out)))
> -       #:phases
> -       (modify-phases %standard-phases
> -         (delete 'configure)
> -         (add-before 'build 'prepare-install-directories
> -           (lambda* (#:key outputs #:allow-other-keys)
> -             (let ((out (assoc-ref outputs "out")))
> -               (mkdir-p (string-append out "/bin"))
> -               (mkdir-p (string-append out "/share"))
> -
> -               (with-fluids ((%default-port-encoding #f))
> -                 (substitute* "./src/main.cc"
> -                   (("/usr/local") out)))
> -
> -               (substitute* "Makefile"
> -                 (("-o root") ""))))))))
> -    (inputs `(("mesa" ,mesa)
> -              ("libxft" ,libxft)
> -              ("libxinerama" ,libxinerama)
> -              ("libfontconfig" ,fontconfig)
> -              ("libjpeg" ,libjpeg-turbo)
> -              ("libpng" ,libpng)
> -              ("fltk" ,fltk)
> -              ("zlib" ,zlib)))
> -    (native-inputs (list pkg-config xdg-utils))
> +     (list
> +      #:tests? #f ;tests cause attempted download/build of googletests.
> +      #:configure-flags #~(list "-DENABLE_UNIT_TESTS=OFF")

If my above suggestion to use the
-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=always configure flag works, adjust
the above accordingly.

> +      #:phases #~(modify-phases %standard-phases
> +                   (add-after 'unpack 'prepare-install-directories
> +                     (lambda* (#:key outputs #:allow-other-keys)
> +                       (let ((out (assoc-ref outputs "out")))
> +                         (with-fluids ((%default-port-encoding #f))
> +                                      (substitute* "./src/main.cc"
> +                                        (("/usr/local")
> +                                         out)))))))))

Nitpick: the modern way to access outputs is via the gexp variables like
#$output.

> +    (native-inputs (list xdg-utils))
> +    (inputs
> +     (list fltk
> +           libxft
> +           libxinerama
> +           fontconfig
> +           libjpeg-turbo
> +           libpng
> +           libxpm
> +           glu
> +           zlib))

Please keep the inputs sorted lexicographically.

-- 
Thanks,
Maxim