[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#60358] [PATCH v9 3/4] gnu: Add gnulib.
From: |
Liliana Marie Prikler |
Subject: |
[bug#60358] [PATCH v9 3/4] gnu: Add gnulib. |
Date: |
Sun, 01 Jan 2023 17:25:19 +0100 |
User-agent: |
Evolution 3.46.0 |
Am Dienstag, dem 27.12.2022 um 17:23 +0100 schrieb Vivien Kraus:
> * gnu/packages/build-tools.scm (gnulib-checkout, gnulib): New
> variables
Missing the dot :)
> ---
> gnu/packages/build-tools.scm | 201
> +++++++++++++++++++++++++++++++++++
> 1 file changed, 201 insertions(+)
>
> diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-
> tools.scm
> index 6c1350c44f..3e6a16f3f5 100644
> --- a/gnu/packages/build-tools.scm
> +++ b/gnu/packages/build-tools.scm
> @@ -32,27 +32,37 @@
> ;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
>
> (define-module (gnu packages build-tools)
> + #:use-module (ice-9 optargs)
> #:use-module ((guix licenses) #:prefix license:)
> #:use-module (guix utils)
> #:use-module (guix packages)
> #:use-module (guix gexp)
> #:use-module (guix download)
> #:use-module (guix git-download)
> + #:use-module (guix git)
> #:use-module (guix build-system cmake)
> + #:use-module (guix build-system copy)
> + #:use-module (guix modules)
> #:use-module (gnu packages)
> #:use-module (gnu packages adns)
> + #:use-module (gnu packages autotools)
> #:use-module (gnu packages base)
> #:use-module (gnu packages bash)
> #:use-module (gnu packages check)
> + #:use-module (gnu packages code)
> #:use-module (gnu packages compression)
> #:use-module (gnu packages cpp)
> + #:use-module (gnu packages cppi)
> #:use-module (gnu packages elf)
> + #:use-module (gnu packages gcc)
> #:use-module (gnu packages linux)
> + #:use-module (gnu packages lisp)
> #:use-module (gnu packages logging)
> #:use-module (gnu packages lua)
> #:use-module (gnu packages ninja)
> #:use-module (gnu packages package-management)
> #:use-module (gnu packages pcre)
> + #:use-module (gnu packages perl)
> #:use-module (gnu packages pkg-config)
> #:use-module (gnu packages pretty-print)
> #:use-module (gnu packages protobuf)
> @@ -65,6 +75,7 @@ (define-module (gnu packages build-tools)
> #:use-module (gnu packages rpc)
> #:use-module (gnu packages sqlite)
> #:use-module (gnu packages tls)
> + #:use-module (gnu packages unicode)
> #:use-module (gnu packages version-control)
> #:use-module (guix build-system gnu)
> #:use-module (guix build-system python))
> @@ -803,3 +814,193 @@ (define-public genie
> same settings to multiple projects. It supports generating projects
> using GNU
> Makefiles, JSON Compilation Database, and experimentally Ninja.")
> (license license:bsd-3))))
> +
> +(define*-public (gnulib-checkout #:key
> + version
> + (revision "1")
> + commit
> + hash)
> + "Return as a package the exact gnulib checkout."
> + (package
> + (name "gnulib")
> + (version (git-version version revision commit))
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://git.savannah.gnu.org/git/gnulib.git/")
> + (commit commit)))
> + (file-name (git-file-name name version))
> + (sha256 hash)
> + (snippet
> + (with-imported-modules (source-module-closure '((guix build
> utils)))
> + #~(begin
> + (use-modules (guix build utils)
> + (ice-9 ftw)
> + (ice-9 rdelim))
> + ;; .c, .h and .gperf files whose first line is /* DO
> NOT EDIT!
> + ;; GENERATED AUTOMATICALLY! */ are generated
> automatically based
> + ;; on the unicode database. Since we replace the
> unicode
> + ;; database with our own, we need to regenerate them.
> So, they
> + ;; are removed from the source. They are sprinkled all
> over the
> + ;; place unfortunately, so we can’t exclude whole
> directories.
> + (let ((generated-automatically?
> + (lambda (filename . unused)
> + (and (or (string-suffix? ".c" filename)
> + (string-suffix? ".h" filename)
> + (string-suffix? ".gperf" filename))
> + (call-with-input-file filename
> + (lambda (port)
> + (let ((first-line (read-line port)))
> + (equal?
> + first-line
> + "/* DO NOT EDIT! GENERATED
> AUTOMATICALLY! */"))))))))
> + (for-each delete-file (find-files (getcwd)
> generated-automatically?)))
> + ;; Other files are copied from UCD.
> + (for-each delete-file
> + '("tests/unigbrk/GraphemeBreakTest.txt"
> + "tests/uninorm/NormalizationTest.txt"
> + "tests/uniname/UnicodeData.txt"
> + "tests/uniname/NameAliases.txt"
> + ;; FIXME:
> tests/uniname/HangulSyllableNames.txt
> + ;; seems like a UCD file but it is not
> distributed
> + ;; with UCD.
> + "tests/uniwbrk/WordBreakTest.txt")))))))
> + (build-system copy-build-system)
> + (arguments
> + (list
> + #:install-plan
> + #~'(("./gnulib-tool" "bin/")
> + ("." "src/gnulib" #:exclude-regexp ("\\.git.*")))
> + #:modules '((ice-9 match)
> + (guix build utils)
> + (guix build copy-build-system)
> + ((guix build gnu-build-system) #:prefix gnu:))
> + #:phases
> + #~(modify-phases %standard-phases
> + (add-before 'install 'gnu:check
> + (assoc-ref gnu:%standard-phases 'check)
> )
Use just "check" for the phase name.
> + (add-before 'gnu:check 'fix-tests
> + (lambda _
> + (substitute* "Makefile"
> + (("-f maint.mk syntax-check")
> + "_gl-Makefile=yes -f maint.mk syntax-check"))
> + (invoke "git" "init")
> + (invoke "git" "config" "user.name" "Guix")
> + (invoke "git" "config" "user.email" "guix@localhost")
> + (invoke "git" "add" ".")
> + ;; Syntax checks are only run against committed files.
> + (invoke "git" "commit" "-m" "Prepare for tests.")))
> + (add-before 'gnu:check 'disable-failing-tests
> + (lambda _
> + (substitute* "cfg.mk"
> + (("local-checks-to-skip =")
> + ;; sc_copyright_check fails because the fake commit
> date may
> + ;; be later than the copyright year.
> + "local-checks-to-skip = \\
> + sc_Wundef_boolean \\
> + sc_copyright_check \\
> + sc_file_system \\
> + sc_indent \\
> + sc_keep_gnulib_texi_files_mostly_ascii \\
> + sc_prohibit_assert_without_use \\
> + sc_prohibit_close_stream_without_use \\
> + sc_prohibit_defined_have_decl_tests \\
> + sc_prohibit_doubled_word \\
> + sc_prohibit_empty_lines_at_EOF \\
> + sc_prohibit_intprops_without_use \\
> + sc_prohibit_openat_without_use \\
> + sc_prohibit_test_minus_ao \\
> + sc_unportable_grep_q"))
Can we provide these via #:make-flags (assuming they get forwarded
through copy-build-system)?
> + (substitute* "Makefile"
> + (("sc_(\
> +check_(sym_list|copyright)\
> +|cpp_indent_check\
> +|prohibit_(AC_LIBOBJ_in_m4|leading_TABs)\
> +|prefer_ac_check_funcs_once)" rule)
I do think splitting this into 4 separate rules is a comfy middle
ground between obivously splitting a regexp over multiple lines and
listing 10 rules separately.
> + (string-append "disabled_" rule)))))
> + (add-before 'gnu:check 'regenerate-unicode
> + (lambda* (#:key inputs #:allow-other-keys)
> + (define (find-ucd-file name)
> + (search-input-file inputs (string-append
> "share/ucd/" name)))
> + (define (find-ucd-files . names)
> + (map find-ucd-file names))
> + (with-directory-excursion "lib"
> + ;; See the compile-command buffer-local variable in
> + ;; lib/gen-uni-tables.c
> + (invoke #+(file-append gcc "/bin/gcc") "-O" "-Wall"
> "gen-uni-tables.c"
> + "-Iunictype" "-o" "gen-uni-tables")
> + (apply invoke
> + "./gen-uni-tables"
> + (append
> + (find-ucd-files "UnicodeData.txt"
> + "PropList.txt"
> + "DerivedCoreProperties.txt"
> + "emoji/emoji-data.txt"
> + "ArabicShaping.txt"
> + "Scripts.txt"
> + "Blocks.txt")
> + (list
> + #$(origin
> + (method url-fetch)
> + (uri (string-append
> + "https://www.unicode.org/Public/"
> + "3.0-Update1/PropList-
> 3.0.1.txt"))
> + (sha256
> + (base32
> +
> "0k6wyijyzdl5g3nibcwfm898kfydx1pqaz28v7fdvnzdvd5fz7lh"))))
> + (find-ucd-files "EastAsianWidth.txt"
> + "LineBreak.txt"
> +
> "auxiliary/WordBreakProperty.txt"
> +
> "auxiliary/GraphemeBreakProperty.txt"
> + "CompositionExclusions.txt"
> + "SpecialCasing.txt"
> + "CaseFolding.txt")
> + (list #$(package-version (this-package-
> native-input "ucd")))))
> + (invoke "clisp" "-C" "uniname/gen-uninames.lisp"
> + (search-input-file inputs
> "share/ucd/UnicodeData.txt")
> + "uniname/uninames.h"
> + (search-input-file inputs
> "share/ucd/NameAliases.txt"))
Why not (find-ucd-file "UnicodeData.txt") and (find-ucd-file
"NameAliases.txt") respectively?
> + (for-each
> + (match-lambda
> + ((ucd-file . directory)
> + (copy-file (find-ucd-file ucd-file)
> + (string-append "../tests/" directory
> "/"
> + (basename ucd-file)))))
> + '(("NameAliases.txt" . "uniname")
> + ("UnicodeData.txt" . "uniname")
> + ("NormalizationTest.txt" . "uninorm")
> + ("auxiliary/GraphemeBreakTest.txt" . "unigbrk")
> + ("auxiliary/WordBreakTest.txt" . "uniwbrk")))
LGTM.
Cheers