Subject: [PATCH v6 2/3] gnu: Add gnulib.

From: Vivien Kraus <[email-masked]>
Date: Tue, 27 Dec 2022 17:23:30 +0100

* gnu/packages/build-tools.scm (gnulib): New variable.
(gnulib-checkout): New function. It returns a package with a specific commit
of gnulib.
---
 gnu/packages/build-tools.scm | 498 +++++++++++++++++++++++++++++++++++
 1 file changed, 498 insertions(+)

diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 6c1350c44f..9592b82130 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -32,27 +32,36 @@
 ;;; 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 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 +74,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 +813,491 @@ (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))
+              (for-each delete-file-recursively
+                        `("tests/unicase/test-ignorable.c"
+                          "tests/unicase/test-uc_toupper.c"
+                          "tests/unicase/test-uc_tolower.c"
+                          "tests/unicase/test-cased.c"
+                          "tests/unicase/test-uc_totitle.c"
+                          "tests/unigbrk/test-uc-gbrk-prop.h"
+                          "tests/unictype/test-pr_zero_width.c"
+                          "tests/unictype/test-pr_ascii_hex_digit.c"
+                          "tests/unictype/test-ctype_xdigit.c"
+                          "tests/unictype/test-digit.h"
+                          "tests/unictype/test-pr_grapheme_extend.c"
+                          "tests/unictype/test-ctype_cntrl.c"
+                          "tests/unictype/test-pr_default_ignorable_code_point.c"
+                          "tests/unictype/test-categ_Nd.c"
+                          "tests/unictype/test-decdigit.h"
+                          "tests/unictype/test-pr_currency_symbol.c"
+                          "tests/unictype/test-pr_logical_order_exception.c"
+                          "tests/unictype/test-pr_bidi_common_separator.c"
+                          "tests/unictype/test-pr_space.c"
+                          "tests/unictype/test-pr_ids_trinary_operator.c"
+                          "tests/unictype/test-pr_decimal_digit.c"
+                          "tests/unictype/test-categ_Lo.c"
+                          "tests/unictype/test-categ_Cn.c"
+                          "tests/unictype/test-categ_Mn.c"
+                          "tests/unictype/test-pr_line_separator.c"
+                          "tests/unictype/test-ctype_upper.c"
+                          "tests/unictype/test-pr_extender.c"
+                          "tests/unictype/test-pr_other_default_ignorable_code_point.c"
+                          "tests/unictype/test-pr_uppercase.c"
+                          "tests/unictype/test-categ_Ll.c"
+                          "tests/unictype/test-ctype_alpha.c"
+                          "tests/unictype/test-pr_changes_when_lowercased.c"
+                          "tests/unictype/test-categ_Sm.c"
+                          "tests/unictype/test-pr_variation_selector.c"
+                          "tests/unictype/test-pr_white_space.c"
+                          "tests/unictype/test-pr_ideographic.c"
+                          "tests/unictype/test-joininggroup_of.h"
+                          "tests/unictype/test-ctype_lower.c"
+                          "tests/unictype/test-pr_quotation_mark.c"
+                          "tests/unictype/test-pr_bidi_block_separator.c"
+                          "tests/unictype/test-ctype_blank.c"
+                          "tests/unictype/test-pr_bidi_eur_num_terminator.c"
+                          "tests/unictype/test-pr_bidi_pdf.c"
+                          "tests/unictype/test-pr_deprecated.c"
+                          "tests/unictype/test-pr_grapheme_base.c"
+                          "tests/unictype/test-sy_java_whitespace.c"
+                          "tests/unictype/test-pr_other_alphabetic.c"
+                          "tests/unictype/test-categ_C.c"
+                          "tests/unictype/test-categ_Cc.c"
+                          "tests/unictype/test-pr_id_continue.c"
+                          "tests/unictype/test-pr_changes_when_uppercased.c"
+                          "tests/unictype/test-pr_bidi_control.c"
+                          "tests/unictype/test-pr_changes_when_casemapped.c"
+                          "tests/unictype/test-categ_S.c"
+                          "tests/unictype/test-pr_pattern_white_space.c"
+                          "tests/unictype/test-pr_format_control.c"
+                          "tests/unictype/test-categ_N.c"
+                          "tests/unictype/test-categ_LC.c"
+                          "tests/unictype/test-pr_bidi_arabic_right_to_left.c"
+                          "tests/unictype/test-categ_Nl.c"
+                          "tests/unictype/test-pr_other_uppercase.c"
+                          "tests/unictype/test-pr_other_grapheme_extend.c"
+                          "tests/unictype/test-pr_diacritic.c"
+                          "tests/unictype/test-pr_join_control.c"
+                          "tests/unictype/test-pr_composite.c"
+                          "tests/unictype/test-pr_extended_pictographic.c"
+                          "tests/unictype/test-pr_combining.c"
+                          "tests/unictype/test-categ_Lm.c"
+                          "tests/unictype/test-pr_other_id_continue.c"
+                          "tests/unictype/test-pr_xid_continue.c"
+                          "tests/unictype/test-pr_ids_binary_operator.c"
+                          "tests/unictype/test-pr_bidi_left_to_right.c"
+                          "tests/unictype/test-pr_bidi_non_spacing_mark.c"
+                          "tests/unictype/test-categ_Zl.c"
+                          "tests/unictype/test-pr_sentence_terminal.c"
+                          "tests/unictype/test-categ_Co.c"
+                          "tests/unictype/test-pr_non_break.c"
+                          "tests/unictype/test-pr_math.c"
+                          "tests/unictype/test-ctype_punct.c"
+                          "tests/unictype/test-pr_other_id_start.c"
+                          "tests/unictype/test-ctype_digit.c"
+                          "tests/unictype/test-pr_bidi_eur_num_separator.c"
+                          "tests/unictype/test-pr_id_start.c"
+                          "tests/unictype/test-pr_numeric.c"
+                          "tests/unictype/test-categ_Pe.c"
+                          "tests/unictype/test-pr_lowercase.c"
+                          "tests/unictype/test-pr_hex_digit.c"
+                          "tests/unictype/test-pr_emoji_presentation.c"
+                          "tests/unictype/test-pr_ignorable_control.c"
+                          "tests/unictype/test-categ_Pi.c"
+                          "tests/unictype/test-pr_bidi_boundary_neutral.c"
+                          "tests/unictype/test-pr_changes_when_titlecased.c"
+                          "tests/unictype/test-categ_Cf.c"
+                          "tests/unictype/test-pr_emoji_modifier.c"
+                          "tests/unictype/test-pr_alphabetic.c"
+                          "tests/unictype/test-pr_changes_when_casefolded.c"
+                          "tests/unictype/test-pr_left_of_pair.c"
+                          "tests/unictype/test-pr_radical.c"
+                          "tests/unictype/test-pr_pattern_syntax.c"
+                          "tests/unictype/test-categ_L.c"
+                          "tests/unictype/test-pr_other_lowercase.c"
+                          "tests/unictype/test-categ_Pf.c"
+                          "tests/unictype/test-ctype_print.c"
+                          "tests/unictype/test-pr_bidi_whitespace.c"
+                          "tests/unictype/test-numeric.h"
+                          "tests/unictype/test-pr_paired_punctuation.c"
+                          "tests/unictype/test-pr_emoji_modifier_base.c"
+                          "tests/unictype/test-categ_Ps.c"
+                          "tests/unictype/test-pr_dash.c"
+                          "tests/unictype/test-pr_bidi_european_digit.c"
+                          "tests/unictype/test-categ_P.c"
+                          "tests/unictype/test-pr_grapheme_link.c"
+                          "tests/unictype/test-categ_Lu.c"
+                          "tests/unictype/test-categ_No.c"
+                          "tests/unictype/test-pr_emoji.c"
+                          "tests/unictype/test-categ_M.c"
+                          "tests/unictype/test-pr_regional_indicator.c"
+                          "tests/unictype/test-categ_Zs.c"
+                          "tests/unictype/test-categ_Sk.c"
+                          "tests/unictype/test-sy_c_whitespace.c"
+                          "tests/unictype/test-pr_unified_ideograph.c"
+                          "tests/unictype/test-categ_Cs.c"
+                          "tests/unictype/test-pr_case_ignorable.c"
+                          "tests/unictype/test-categ_Sc.c"
+                          "tests/unictype/test-categ_So.c"
+                          "tests/unictype/test-pr_bidi_hebrew_right_to_left.c"
+                          "tests/unictype/test-categ_Po.c"
+                          "tests/unictype/test-joiningtype_of.h"
+                          "tests/unictype/test-pr_soft_dotted.c"
+                          "tests/unictype/test-categ_Pd.c"
+                          "tests/unictype/test-categ_Z.c"
+                          "tests/unictype/test-categ_Zp.c"
+                          "tests/unictype/test-ctype_space.c"
+                          "tests/unictype/test-pr_emoji_component.c"
+                          "tests/unictype/test-pr_bidi_other_neutral.c"
+                          "tests/unictype/test-pr_other_math.c"
+                          "tests/unictype/test-pr_private_use.c"
+                          "tests/unictype/test-pr_cased.c"
+                          "tests/unictype/test-pr_terminal_punctuation.c"
+                          "tests/unictype/test-categ_Me.c"
+                          "tests/unictype/test-ctype_graph.c"
+                          "tests/unictype/test-pr_unassigned_code_value.c"
+                          "tests/unictype/test-categ_Lt.c"
+                          "tests/unictype/test-categ_Pc.c"
+                          "tests/unictype/test-pr_punctuation.c"
+                          "tests/unictype/test-pr_bidi_segment_separator.c"
+                          "tests/unictype/test-pr_paragraph_separator.c"
+                          "tests/unictype/test-pr_xid_start.c"
+                          "tests/unictype/test-pr_bidi_embedding_or_override.c"
+                          "tests/unictype/test-categ_Mc.c"
+                          "tests/unictype/test-pr_bidi_arabic_digit.c"
+                          "tests/unictype/test-pr_titlecase.c"
+                          "tests/unictype/test-pr_iso_control.c"
+                          "tests/unictype/test-pr_not_a_character.c"
+                          "tests/unictype/test-pr_hyphen.c"
+                          "tests/unictype/test-ctype_alnum.c"
+                          "lib/unicase/ignorable.h"
+                          "lib/unicase/special-casing-table.gperf"
+                          "lib/unicase/tolower.h"
+                          "lib/unicase/toupper.h"
+                          "lib/unicase/tocasefold.h"
+                          "lib/unicase/totitle.h"
+                          "lib/unicase/cased.h"
+                          "lib/uniwidth/width0.h"
+                          "lib/uniwidth/width2.h"
+                          "lib/unigbrk/gbrkprop.h"
+                          "lib/uninorm/composition-table.gperf"
+                          "lib/uninorm/decomposition-table1.h"
+                          "lib/uninorm/decomposition-table2.h"
+                          "lib/uniname/uninames.h"
+                          "lib/uniwbrk/wbrkprop.h"
+                          "lib/unilbrk/lbrktables.c"
+                          "lib/unilbrk/lbrkprop1.h"
+                          "lib/unilbrk/lbrkprop2.h"
+                          "lib/unictype/pr_radical.h"
+                          "lib/unictype/pr_other_math.h"
+                          "lib/unictype/pr_dash.h"
+                          "lib/unictype/pr_combining.h"
+                          "lib/unictype/pr_not_a_character.h"
+                          "lib/unictype/pr_math.h"
+                          "lib/unictype/pr_terminal_punctuation.h"
+                          "lib/unictype/pr_id_start.h"
+                          "lib/unictype/pr_quotation_mark.h"
+                          "lib/unictype/pr_changes_when_titlecased.h"
+                          "lib/unictype/categ_Mc.h"
+                          "lib/unictype/pr_deprecated.h"
+                          "lib/unictype/categ_Cf.h"
+                          "lib/unictype/pr_zero_width.h"
+                          "lib/unictype/pr_emoji_modifier_base.h"
+                          "lib/unictype/ctype_blank.h"
+                          "lib/unictype/joininggroup_of.h"
+                          "lib/unictype/categ_Sk.h"
+                          "lib/unictype/pr_paired_punctuation.h"
+                          "lib/unictype/pr_decimal_digit.h"
+                          "lib/unictype/pr_other_uppercase.h"
+                          "lib/unictype/categ_Cn.h"
+                          "lib/unictype/categ_of.h"
+                          "lib/unictype/sy_c_whitespace.h"
+                          "lib/unictype/pr_composite.h"
+                          "lib/unictype/pr_other_grapheme_extend.h"
+                          "lib/unictype/pr_other_id_continue.h"
+                          "lib/unictype/pr_paragraph_separator.h"
+                          "lib/unictype/pr_bidi_whitespace.h"
+                          "lib/unictype/scripts.h"
+                          "lib/unictype/ctype_graph.h"
+                          "lib/unictype/pr_bidi_arabic_right_to_left.h"
+                          "lib/unictype/categ_Lu.h"
+                          "lib/unictype/pr_hyphen.h"
+                          "lib/unictype/pr_changes_when_casemapped.h"
+                          "lib/unictype/categ_Pe.h"
+                          "lib/unictype/pr_hex_digit.h"
+                          "lib/unictype/pr_id_continue.h"
+                          "lib/unictype/pr_pattern_white_space.h"
+                          "lib/unictype/joiningtype_of.h"
+                          "lib/unictype/ctype_upper.h"
+                          "lib/unictype/pr_extender.h"
+                          "lib/unictype/pr_iso_control.h"
+                          "lib/unictype/ctype_lower.h"
+                          "lib/unictype/categ_Ps.h"
+                          "lib/unictype/categ_Sc.h"
+                          "lib/unictype/ctype_print.h"
+                          "lib/unictype/sy_java_ident.h"
+                          "lib/unictype/ctype_alnum.h"
+                          "lib/unictype/pr_ideographic.h"
+                          "lib/unictype/pr_titlecase.h"
+                          "lib/unictype/categ_N.h"
+                          "lib/unictype/pr_changes_when_casefolded.h"
+                          "lib/unictype/pr_soft_dotted.h"
+                          "lib/unictype/categ_Z.h"
+                          "lib/unictype/categ_Lm.h"
+                          "lib/unictype/categ_P.h"
+                          "lib/unictype/pr_emoji_component.h"
+                          "lib/unictype/pr_space.h"
+                          "lib/unictype/pr_other_lowercase.h"
+                          "lib/unictype/pr_bidi_eur_num_separator.h"
+                          "lib/unictype/pr_bidi_eur_num_terminator.h"
+                          "lib/unictype/ctype_alpha.h"
+                          "lib/unictype/numeric.h"
+                          "lib/unictype/pr_grapheme_base.h"
+                          "lib/unictype/ctype_xdigit.h"
+                          "lib/unictype/pr_bidi_embedding_or_override.h"
+                          "lib/unictype/blocks.h"
+                          "lib/unictype/categ_No.h"
+                          "lib/unictype/pr_ascii_hex_digit.h"
+                          "lib/unictype/pr_bidi_european_digit.h"
+                          "lib/unictype/pr_format_control.h"
+                          "lib/unictype/pr_join_control.h"
+                          "lib/unictype/pr_case_ignorable.h"
+                          "lib/unictype/ctype_space.h"
+                          "lib/unictype/pr_bidi_control.h"
+                          "lib/unictype/pr_diacritic.h"
+                          "lib/unictype/categ_Zs.h"
+                          "lib/unictype/mirror.h"
+                          "lib/unictype/categ_Zl.h"
+                          "lib/unictype/pr_bidi_hebrew_right_to_left.h"
+                          "lib/unictype/decdigit.h"
+                          "lib/unictype/categ_Nd.h"
+                          "lib/unictype/pr_sentence_terminal.h"
+                          "lib/unictype/combiningclass.h"
+                          "lib/unictype/categ_S.h"
+                          "lib/unictype/pr_bidi_arabic_digit.h"
+                          "lib/unictype/digit.h"
+                          "lib/unictype/categ_So.h"
+                          "lib/unictype/pr_changes_when_uppercased.h"
+                          "lib/unictype/pr_other_alphabetic.h"
+                          "lib/unictype/pr_emoji_presentation.h"
+                          "lib/unictype/pr_ignorable_control.h"
+                          "lib/unictype/categ_Cs.h"
+                          "lib/unictype/sy_java_whitespace.h"
+                          "lib/unictype/pr_changes_when_lowercased.h"
+                          "lib/unictype/pr_ids_binary_operator.h"
+                          "lib/unictype/categ_Ll.h"
+                          "lib/unictype/pr_logical_order_exception.h"
+                          "lib/unictype/pr_bidi_pdf.h"
+                          "lib/unictype/sy_c_ident.h"
+                          "lib/unictype/categ_Sm.h"
+                          "lib/unictype/pr_non_break.h"
+                          "lib/unictype/categ_Zp.h"
+                          "lib/unictype/categ_Pc.h"
+                          "lib/unictype/pr_bidi_common_separator.h"
+                          "lib/unictype/pr_grapheme_extend.h"
+                          "lib/unictype/categ_Pd.h"
+                          "lib/unictype/categ_Mn.h"
+                          "lib/unictype/pr_extended_pictographic.h"
+                          "lib/unictype/categ_Lo.h"
+                          "lib/unictype/pr_currency_symbol.h"
+                          "lib/unictype/pr_unassigned_code_value.h"
+                          "lib/unictype/categ_Cc.h"
+                          "lib/unictype/pr_xid_continue.h"
+                          "lib/unictype/pr_numeric.h"
+                          "lib/unictype/categ_LC.h"
+                          "lib/unictype/pr_bidi_segment_separator.h"
+                          "lib/unictype/categ_M.h"
+                          "lib/unictype/ctype_cntrl.h"
+                          "lib/unictype/pr_ids_trinary_operator.h"
+                          "lib/unictype/pr_private_use.h"
+                          "lib/unictype/categ_Pi.h"
+                          "lib/unictype/categ_Lt.h"
+                          "lib/unictype/pr_variation_selector.h"
+                          "lib/unictype/categ_L.h"
+                          "lib/unictype/pr_emoji_modifier.h"
+                          "lib/unictype/pr_alphabetic.h"
+                          "lib/unictype/ctype_punct.h"
+                          "lib/unictype/pr_bidi_boundary_neutral.h"
+                          "lib/unictype/pr_uppercase.h"
+                          "lib/unictype/pr_xid_start.h"
+                          "lib/unictype/categ_Po.h"
+                          "lib/unictype/scripts_byname.gperf"
+                          "lib/unictype/pr_default_ignorable_code_point.h"
+                          "lib/unictype/pr_bidi_non_spacing_mark.h"
+                          "lib/unictype/bidi_of.h"
+                          "lib/unictype/pr_white_space.h"
+                          "lib/unictype/pr_left_of_pair.h"
+                          "lib/unictype/categ_Nl.h"
+                          "lib/unictype/pr_other_id_start.h"
+                          "lib/unictype/categ_C.h"
+                          "lib/unictype/pr_bidi_left_to_right.h"
+                          "lib/unictype/categ_Me.h"
+                          "lib/unictype/pr_cased.h"
+                          "lib/unictype/categ_Pf.h"
+                          "lib/unictype/pr_other_default_ignorable_code_point.h"
+                          "lib/unictype/pr_unified_ideograph.h"
+                          "lib/unictype/pr_grapheme_link.h"
+                          "lib/unictype/pr_pattern_syntax.h"
+                          "lib/unictype/pr_bidi_block_separator.h"
+                          "lib/unictype/categ_Co.h"
+                          "lib/unictype/pr_punctuation.h"
+                          "lib/unictype/pr_bidi_other_neutral.h"
+                          "lib/unictype/pr_line_separator.h"
+                          "lib/unictype/ctype_digit.h"
+                          "lib/unictype/pr_lowercase.h"
+                          "lib/unictype/pr_emoji.h"
+                          "tests/unigbrk/GraphemeBreakTest.txt"
+                          "tests/uninorm/NormalizationTest.txt"
+                          "tests/uniname/UnicodeData.txt"
+                          "tests/uniname/NameAliases.txt"
+                          ;; I could not find a replacement for tests/unigbrk/HangulSyllableNames.txt
+                          "tests/uniwbrk/WordBreakTest.txt")))))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack '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" ".")
+              (invoke "git" "commit" "-m"
+                      "Syntax checks are only run against committed files, so commit everything.")))
+          (add-after 'fix-tests 'disable-failing-tests
+            (lambda _
+              (substitute* "cfg.mk"
+                (("local-checks-to-skip =")
+                 "local-checks-to-skip = \\
+  sc_Wundef_boolean \\
+  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"))
+              (substitute* "Makefile"
+                (("sc_check_sym_list")
+                 "disabled_check_sym_list")
+                (("sc_cpp_indent_check")
+                 "disabled_cpp_indent_check")
+                (("sc_check_copyright")
+                 "disabled_check_copyright")
+                (("sc_prohibit_AC_LIBOBJ_in_m4")
+                 "disabled_prohibit_AC_LIBOBJ_in_m4")
+                (("sc_prefer_ac_check_funcs_once")
+                 "disabled_prefer_ac_check_funcs_once")
+                (("sc_prohibit_leading_TABs")
+                 "disabled_prohibit_leading_TABs"))))
+          (delete 'configure)
+          (add-after 'unpack 'regenerate-unicode
+            (lambda* (#:key inputs #:allow-other-keys)
+              (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"
+                       `(,@(map (lambda (f)
+                                  (search-input-file inputs f))
+                                '("share/ucd/UnicodeData.txt"
+                                  "share/ucd/PropList.txt"
+                                  "share/ucd/DerivedCoreProperties.txt"
+                                  "share/ucd/emoji/emoji-data.txt"
+                                  "share/ucd/ArabicShaping.txt"
+                                  "share/ucd/Scripts.txt"
+                                  "share/ucd/Blocks.txt"
+                                  "share/ucd/PropList-3.0.1.txt"
+                                  "share/ucd/EastAsianWidth.txt"
+                                  "share/ucd/LineBreak.txt"
+                                  "share/ucd/auxiliary/WordBreakProperty.txt"
+                                  "share/ucd/auxiliary/GraphemeBreakProperty.txt"
+                                  "share/ucd/CompositionExclusions.txt"
+                                  "share/ucd/SpecialCasing.txt"
+                                  "share/ucd/CaseFolding.txt"))
+                         #$(package-version 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"))
+                (copy-file (search-input-file inputs "share/ucd/NameAliases.txt")
+                           "../tests/uniname/NameAliases.txt")
+                (copy-file (search-input-file inputs "share/ucd/UnicodeData.txt")
+                           "../tests/uniname/UnicodeData.txt")
+                (copy-file (search-input-file inputs "share/ucd/NormalizationTest.txt")
+                           "../tests/uninorm/NormalizationTest.txt")
+                (copy-file (search-input-file inputs "share/ucd/auxiliary/GraphemeBreakTest.txt")
+                           "../tests/unigbrk/GraphemeBreakTest.txt")
+                (copy-file (search-input-file inputs "share/ucd/auxiliary/WordBreakTest.txt")
+                           "../tests/uniwbrk/WordBreakTest.txt")
+                (delete-file "gen-uni-tables"))))
+          (replace 'install
+            (lambda _
+              (install-file "gnulib-tool"
+                            (string-append #$output "/bin"))
+              (delete-file-recursively ".git")
+              (copy-recursively "." (string-append #$output "/src/gnulib/")))))))
+    (inputs ;; Shebangs for some auxiliary build files.
+     (list python perl clisp))
+    (native-inputs
+     (list
+      python perl clisp
+      ;; Unicode data:
+      ucd ucd3.0-update1
+      ;; Programs for the tests:
+      cppi indent git autoconf))
+    (home-page "https://www.gnu.org/software/gnulib/")
+    (synopsis "Source files to share among distributions")
+    (description
+     "Gnulib is a central location for common infrastructure needed by GNU
+packages.  It provides a wide variety of functionality, e.g., portability
+across many systems, working with Unicode strings, cryptographic computation,
+and much more.  The code is intended to be shared at the level of source
+files, rather than being a standalone library that is distributed, built, and
+installed.  The included @command{gnulib-tool} script helps with using Gnulib
+code in other packages.  Gnulib also includes copies of licensing and
+maintenance-related files, for convenience.")
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GNULIB_SRCDIR")
+            (files (list "src/gnulib")))))
+    (license (list license:lgpl2.0+ license:gpl3+))))
+
+(define-public gnulib
+  (gnulib-checkout
+   #:version "2022-12-28"
+   #:commit "14a7b0ce5462c90ce86d97bf952185ec2500d341"
+   #:hash (base32 "0fz25ccdlxf4xp37rjsl1fslc4g0x12qpvadz4qw0cq18dvx5kbx")))
-- 
2.38.1