Subject: Re: [bug#70047] [PATCH] gnu: highlight: Update to 4.11.

From: Z572 <[email-masked]>
Date: Sun, 31 Mar 2024 00:24:48 +0800

chris <[email-masked]> writes:

> *  (highlight): Update to 4.11.

please add more info for commit message

* gnu/packages/pretty-print.scm (highlight): Update to 4.11.
[source]: Switch to git-fetch
[home-page]: Switch to html page.

>
> `guix lint highlight` moved the "arguments" nesting, otherwise few changes.
> The source is changed to gitlab and the php not-found homepage url is changed
> to an available html url
>
> Change-Id: I0c402fcea5708c4882b52309b3e072301f0a5614
> ---
>  gnu/packages/pretty-print.scm | 163 +++++++++++++++++-----------------
>  1 file changed, 81 insertions(+), 82 deletions(-)
>
> diff --git a/gnu/packages/pretty-print.scm b/gnu/packages/pretty-print.scm
> index b95f56729a..13668712d1 100644
> --- a/gnu/packages/pretty-print.scm
> +++ b/gnu/packages/pretty-print.scm
> @@ -11,6 +11,7 @@
>  ;;; Copyright © 2022 Zhu Zihao  <[email-masked]>
>  ;;; Copyright © 2022, 2023 Maxim Cournoyer  <[email-masked]>
>  ;;; Copyright © 2023 gemmaro <[email-masked]>
> +;;; Copyright © 2024 chris <[email-masked]>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -352,93 +353,91 @@ (define-public source-highlight
>  (define-public highlight
>    (package
>      (name "highlight")
> -    (version "4.8")
> +    (version "4.11")
>      (outputs (list "out" "gui"))
> -    (source (origin
> -              (method url-fetch)
> -              (uri (string-append "http://www.andre-simon.de/zip/highlight-"
> -                                  version ".tar.bz2"))
> -              (sha256
> -               (base32
> -                "1iggdw4c8pfz1z1c51fyd6x79y1mnc82b6lfkg3vbb44739m5cjs"))
> -              (patches (search-patches "highlight-gui-data-dir.patch"))))
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://gitlab.com/saalen/highlight")

In fact http://www.andre-simon.de/zip/highlight-4.11.tar.bz2 can download,
but I also think git-fetch is better.

> +             (commit version)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "0xb9jm7249qnbain4l94nakgxsmia4w4x246dagr669fkmffcdmg"))
> +       (patches (search-patches "highlight-gui-data-dir.patch"))))
>      (build-system gnu-build-system)
>      (arguments
> -     (list #:tests? #f ;no tests
> -           #:make-flags #~(let ((confdir (string-append %output
> -                                          "/share/highlight/config/")))
> -                            (list (string-append "PREFIX=" %output)
> -                                  (string-append "HL_CONFIG_DIR=" confdir)
> -                                  (string-append "conf_dir=" confdir)))
> -           #:phases #~(modify-phases %standard-phases
> -                        (delete 'configure) ;no configure script
> -                        (add-after 'unpack 'fix-search-for-lua
> -                          (lambda _
> -                            (let ((ver #$(version-major+minor (package-version
> -                                                               lua))))
> -                              (substitute* "src/makefile"
> -                                (("(LUA_PKG_NAME=).*" _ assignment)
> -                                 (string-append assignment "lua-" ver "\n")))
> -                              (substitute* "src/gui-qt/highlight.pro"
> -                                (("(PKGCONFIG \\+= lua)" _ assignment)
> -                                 (string-append assignment "-" ver)))
> -                              (substitute* "extras/swig/makefile"
> -                                (("lua")
> -                                 (string-append "lua-" ver))))))
> -                        (add-after 'build 'build-gui
> -                          (lambda* (#:key inputs outputs #:allow-other-keys)
> -                            (let* ((out (assoc-ref outputs "out"))
> -                                   (data (string-append out
> -                                                        "/share/highlight/"))
> -                                   (conf (string-append out "/etc/highlight/"))
> -                                   (doc (string-append out
> -                                         "/share/doc/highlight/"))
> -                                   (gui (assoc-ref outputs "gui"))
> -                                   (gui-data (string-append gui
> -                                              "/share/highlight/")))
> -                              ;; modified version of gui task in makefile
> -                              (invoke "make"
> -                                      "-C"
> -                                      "./src"
> -                                      "-f"
> -                                      "./makefile"
> -                                      (string-append "HL_DATA_DIR=" data)
> -                                      (string-append "HL_CONFIG_DIR=" conf)
> -                                      (string-append "HL_DOC_DIR=" doc)
> -                                      (string-append "GUI_DATA_DIR=" gui-data)
> -                                      "gui-qt"))))
> -                        (replace 'install
> -                          (lambda* (#:key outputs #:allow-other-keys)
> -                            (let ((out (assoc-ref outputs "out")))
> -                              (invoke "make" "install"
> -                                      (string-append "PREFIX=" out)))))
> -                        (add-after 'install 'install-perl-bindings
> -                          (lambda* (#:key outputs #:allow-other-keys)
> -                            (let* ((out (assoc-ref outputs "out"))
> -                                   (data (string-append out
> -                                                        "/share/highlight/"))
> -                                   (conf (string-append out "/etc/highlight/"))
> -                                   (perldir (string-append out
> -                                             "/lib/perl5/site_perl/"
> -                                             #$(package-version perl)))
> -                                   (autodir (string-append perldir
> -                                                           "/auto/highlight")))
> -                              (with-directory-excursion "extras/swig"
> -                                (invoke "make" "perl"
> -                                        (string-append "hl_data_dir=" data)
> -                                        (string-append "hl_conf_dir=" conf))
> -                                (invoke "perl" "-I" "." "testmod.pl")
> -                                (install-file "highlight.pm" perldir)
> -                                (install-file "highlight.so" autodir)))))
> -                        (add-after 'install 'install-gui
> -                          (lambda* (#:key outputs #:allow-other-keys)
> -                            (let ((gui (assoc-ref outputs "gui")))
> -                              (mkdir-p (string-append gui "/bin"))
> -                              (invoke "make" "install-gui"
> -                                      (string-append "PREFIX=" gui))))))))
> +     (list
> +      #:tests? #f ;no tests
> +      #:make-flags #~(let ((confdir (string-append %output
> +                                                   "/share/highlight/config/")))
> +                       (list (string-append "PREFIX=" %output)

An optional suggestion, please replace "%output" with "#$output"

> +                             (string-append "HL_CONFIG_DIR=" confdir)
> +                             (string-append "conf_dir=" confdir)))
> +      #:phases #~(modify-phases %standard-phases
> +                   (delete 'configure) ;no configure script
> +                   (add-after 'unpack 'fix-search-for-lua
> +                     (lambda _
> +                       (let ((ver #$(version-major+minor (package-version lua))))

can you use `(this-package-input "lua")' replace `lua' ? It allow user
replace with a different version lua

> +                         (substitute* "src/makefile"
> +                           (("(LUA_PKG_NAME=).*" _ assignment)
> +                            (string-append assignment "lua-" ver "\n")))
> +                         (substitute* "src/gui-qt/highlight.pro"
> +                           (("(PKGCONFIG \\+= lua)" _ assignment)
> +                            (string-append assignment "-" ver)))
> +                         (substitute* "extras/swig/makefile"
> +                           (("lua")
> +                            (string-append "lua-" ver))))))
> +                   (add-after 'build 'build-gui
> +                     (lambda* (#:key inputs outputs #:allow-other-keys)
> +                       (let* ((out (assoc-ref outputs "out"))
> +                              (data (string-append out "/share/highlight/"))
> +                              (conf (string-append out "/etc/highlight/"))
> +                              (doc (string-append out "/share/doc/highlight/"))
> +                              (gui (assoc-ref outputs "gui"))
> +                              (gui-data (string-append gui "/share/highlight/")))
> +                         ;; modified version of gui task in makefile
> +                         (invoke "make"
> +                                 "-C"
> +                                 "./src"
> +                                 "-f"
> +                                 "./makefile"
> +                                 (string-append "HL_DATA_DIR=" data)
> +                                 (string-append "HL_CONFIG_DIR=" conf)
> +                                 (string-append "HL_DOC_DIR=" doc)
> +                                 (string-append "GUI_DATA_DIR=" gui-data)
> +                                 "gui-qt"))))
> +                   (replace 'install
> +                     (lambda* (#:key outputs #:allow-other-keys)
> +                       (let ((out (assoc-ref outputs "out")))
> +                         (invoke "make" "install"
> +                                 (string-append "PREFIX=" out)))))
> +                   (add-after 'install 'install-perl-bindings
> +                     (lambda* (#:key outputs #:allow-other-keys)
> +                       (let* ((out (assoc-ref outputs "out"))
> +                              (data (string-append out "/share/highlight/"))
> +                              (conf (string-append out "/etc/highlight/"))
> +                              (perldir (string-append out
> +                                                      "/lib/perl5/site_perl/"
> +                                                      #$(package-version perl)))

can you use `(this-package-input "perl")' replace `perl' ? It allow user
replace with a different version perl

> +                              (autodir (string-append perldir
> +                                                      "/auto/highlight")))
> +                         (with-directory-excursion "extras/swig"
> +                           (invoke "make" "perl"
> +                                   (string-append "hl_data_dir=" data)
> +                                   (string-append "hl_conf_dir=" conf))
> +                           (invoke "perl" "-I" "." "testmod.pl")
> +                           (install-file "highlight.pm" perldir)
> +                           (install-file "highlight.so" autodir)))))
> +                   (add-after 'install 'install-gui
> +                     (lambda* (#:key outputs #:allow-other-keys)
> +                       (let ((gui (assoc-ref outputs "gui")))
> +                         (mkdir-p (string-append gui "/bin"))
> +                         (invoke "make" "install-gui"
> +                                 (string-append "PREFIX=" gui))))))))
>      (inputs (list lua boost perl qtbase-5))
>      (native-inputs (list pkg-config swig))
> -    (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.php")
> +    (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.html")
>      (synopsis "Convert code to documents with syntax highlighting")
>      (description
>       "Highlight converts source code to HTML, XHTML, RTF, LaTeX,
>
> base-commit: c2c1098585b10f42bed7647f2130a2727c0488f8