Files
git/generate-configlist.sh
Junio C Hamano 5acfacc2a1 build: sed portability fixes
Recently generating the version-def.h file and the config-list.h
file have been updated, which broke versions of "sed" that do not
want to be fed a file that ends with an incomplete line, and/or that
do not understand the more recent "-E" option to use extended
regular expression.

Fix them in response to a build-failure reported on Solaris boxes.

cf. https://lore.kernel.org/git/09f954b8-d9c3-418f-ad4b-9cb9b063f4ae@comstyle.com/

Reported-by: Brad Smith <brad@comstyle.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-12 13:44:10 -07:00

40 lines
614 B
Bash
Executable File

#!/bin/sh
SOURCE_DIR="$1"
OUTPUT="$2"
if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
then
echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
exit 1
fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
sed -e '
/^`*[a-zA-Z].*\..*`*::$/ {
/deprecated/d;
s/::$//;
s/`//g;
s/^.*$/ "&",/;
s/, */",\n "/g;
p;};
d' \
"$SOURCE_DIR"/Documentation/*config.adoc \
"$SOURCE_DIR"/Documentation/config/*.adoc |
sort
cat <<EOF
NULL,
};
EOF
}
{
echo "/* Automatically generated by generate-configlist.sh */"
echo
echo
print_config_list
} >"$OUTPUT"