From 8872941fd21e2afe37032e7d9beec87b69aca9c9 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 19 Mar 2026 06:33:20 +0100 Subject: Introduce new "tools/" directory According to its readme, the "contrib/" directory's main intent is to collect stuff that is not an official part of Git, either because it is too specialized or because it is still considered experimental. The reality tells a bit of a different story though: while it _does_ contain such things, it also contains other things: - Our credential helpers, which are being distributed by many packagers nowadays and which can be considered "stable". - A bunch of tooling that relates to our build and test infrastructure. Especially the second category is somewhat of a sore spot. You really wouldn't expect build-related tooling to be considered an optional part of Git. Quite the opposite. Create a new top-level "tools/" directory to fix this discrepancy. This directory will contain all kind of tools that are related to our build infrastructure and that Git developers are likely to use day to day. For now, this directory doesn't contain anything yet except for a readme and a Meson skeleton. This will change in subsequent commits. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 1 + 1 file changed, 1 insertion(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 4b536e0124..1d66b5181e 100644 --- a/meson.build +++ b/meson.build @@ -2149,6 +2149,7 @@ else endif subdir('contrib') +subdir('tools') # Note that the target is intentionally configured after including the # 'contrib' directory, as some tool there also have their own manpages. -- cgit v1.3-6-g1900 From a767f2fd6c5a6104ff32a35a27f0c15aec546957 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 19 Mar 2026 06:33:24 +0100 Subject: builds: move build scripts into "tools/" We have a bunch of scripts used by our different build systems that are all located in the top-level directory. Now that we have introduced the new "tools/" directory though we have a better home for them. Move the scripts into the "tools/" directory. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- Makefile | 34 +++++----- check-builtins.sh | 34 ---------- config.mak.dev | 2 +- contrib/buildsystems/CMakeLists.txt | 18 +++--- contrib/subtree/meson.build | 2 +- detect-compiler | 58 ----------------- generate-cmdlist.sh | 120 ------------------------------------ generate-configlist.sh | 52 ---------------- generate-hooklist.sh | 33 ---------- generate-perl.sh | 37 ----------- generate-python.sh | 20 ------ generate-script.sh | 34 ---------- meson.build | 14 ++--- tools/check-builtins.sh | 34 ++++++++++ tools/detect-compiler | 58 +++++++++++++++++ tools/generate-cmdlist.sh | 120 ++++++++++++++++++++++++++++++++++++ tools/generate-configlist.sh | 52 ++++++++++++++++ tools/generate-hooklist.sh | 33 ++++++++++ tools/generate-perl.sh | 37 +++++++++++ tools/generate-python.sh | 20 ++++++ tools/generate-script.sh | 34 ++++++++++ 21 files changed, 423 insertions(+), 423 deletions(-) delete mode 100755 check-builtins.sh delete mode 100755 detect-compiler delete mode 100755 generate-cmdlist.sh delete mode 100755 generate-configlist.sh delete mode 100755 generate-hooklist.sh delete mode 100755 generate-perl.sh delete mode 100755 generate-python.sh delete mode 100755 generate-script.sh create mode 100755 tools/check-builtins.sh create mode 100755 tools/detect-compiler create mode 100755 tools/generate-cmdlist.sh create mode 100755 tools/generate-configlist.sh create mode 100755 tools/generate-hooklist.sh create mode 100755 tools/generate-perl.sh create mode 100755 tools/generate-python.sh create mode 100755 tools/generate-script.sh (limited to 'meson.build') diff --git a/Makefile b/Makefile index 8564b1be36..322f5940e3 100644 --- a/Makefile +++ b/Makefile @@ -2689,21 +2689,21 @@ $(BUILT_INS): git$X ln -s $< $@ 2>/dev/null || \ cp $< $@ -config-list.h: generate-configlist.sh +config-list.h: tools/generate-configlist.sh @mkdir -p .depend - $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@ .depend/config-list.h.d + $(QUIET_GEN)$(SHELL_PATH) ./tools/generate-configlist.sh . $@ .depend/config-list.h.d -include .depend/config-list.h.d -command-list.h: generate-cmdlist.sh command-list.txt +command-list.h: tools/generate-cmdlist.sh command-list.txt command-list.h: $(wildcard Documentation/git*.adoc) - $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \ + $(QUIET_GEN)$(SHELL_PATH) ./tools/generate-cmdlist.sh \ $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \ . $@ -hook-list.h: generate-hooklist.sh Documentation/githooks.adoc - $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@ +hook-list.h: tools/generate-hooklist.sh Documentation/githooks.adoc + $(QUIET_GEN)$(SHELL_PATH) ./tools/generate-hooklist.sh . $@ SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\ $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\ @@ -2716,8 +2716,8 @@ GIT-SCRIPT-DEFINES: FORCE echo "$$FLAGS" >$@; \ fi -$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES - $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \ +$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh tools/generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES + $(QUIET_GEN)./tools/generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \ mv $@+ $@ git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE @@ -2757,8 +2757,8 @@ endif PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir) -$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE - $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \ +$(SCRIPT_PERL_GEN): % : %.perl tools/generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE + $(QUIET_GEN)$(SHELL_PATH) tools/generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \ mv $@+ $@ PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES)) @@ -2786,8 +2786,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile perllibdir: @echo '$(perllibdir_SQ)' -git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES - $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \ +git-instaweb: git-instaweb.sh tools/generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES + $(QUIET_GEN)./tools/generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \ chmod +x $@+ && \ mv $@+ $@ else # NO_PERL @@ -2804,9 +2804,9 @@ endif # NO_PERL $(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS ifndef NO_PYTHON -$(SCRIPT_PYTHON_GEN): generate-python.sh +$(SCRIPT_PYTHON_GEN): tools/generate-python.sh $(SCRIPT_PYTHON_GEN): % : %.py - $(QUIET_GEN)$(SHELL_PATH) generate-python.sh ./GIT-BUILD-OPTIONS "$<" "$@" + $(QUIET_GEN)$(SHELL_PATH) tools/generate-python.sh ./GIT-BUILD-OPTIONS "$<" "$@" else # NO_PYTHON $(SCRIPT_PYTHON_GEN): % : unimplemented.sh $(QUIET_GEN) \ @@ -3226,9 +3226,9 @@ endif NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS)) endif -perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES +perl/build/lib/%.pm: perl/%.pm tools/generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES $(call mkdir_p_parent_template) - $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@" + $(QUIET_GEN)$(SHELL_PATH) tools/generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@" perl/build/man/man3/Git.3pm: perl/Git.pm $(call mkdir_p_parent_template) @@ -3936,7 +3936,7 @@ check-docs:: ### Make sure built-ins do not have dups and listed in git.c # check-builtins:: - ./check-builtins.sh + ./tools/check-builtins.sh ### Test suite coverage testing # diff --git a/check-builtins.sh b/check-builtins.sh deleted file mode 100755 index a0aaf3a347..0000000000 --- a/check-builtins.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -{ - cat <<\EOF -sayIt: - $(foreach b,$(BUILT_INS),echo XXX $(b:$X=) YYY;) -EOF - cat Makefile -} | -make -f - sayIt 2>/dev/null | -sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p' | -sort | -{ - bad=0 - while read builtin - do - base=$(expr "$builtin" : 'git-\(.*\)') - x=$(sed -ne 's/.*{ "'$base'", \(cmd_[^, ]*\).*/'$base' \1/p' git.c) - if test -z "$x" - then - echo "$base is builtin but not listed in git.c command list" - bad=1 - fi - for sfx in sh perl py - do - if test -f "$builtin.$sfx" - then - echo "$base is builtin but $builtin.$sfx still exists" - bad=1 - fi - done - done - exit $bad -} diff --git a/config.mak.dev b/config.mak.dev index e86b6e1b34..c8dcf78779 100644 --- a/config.mak.dev +++ b/config.mak.dev @@ -1,5 +1,5 @@ ifndef COMPILER_FEATURES -COMPILER_FEATURES := $(shell ./detect-compiler $(CC)) +COMPILER_FEATURES := $(shell ./tools/detect-compiler $(CC)) endif ifeq ($(filter no-error,$(DEVOPTS)),) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index c6cfb874ef..81b4306e72 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -636,7 +636,7 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS) list(REMOVE_ITEM EXCLUSION_PROGS empty) message("Generating command-list.h") - execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh" + execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/tools/generate-cmdlist.sh" ${EXCLUSION_PROGS} "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/command-list.h") @@ -644,14 +644,14 @@ endif() if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h) message("Generating config-list.h") - execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh" + execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/tools/generate-configlist.sh" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/config-list.h") endif() if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h) message("Generating hook-list.h") - execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh + execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/tools/generate-hooklist.sh "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/hook-list.h") endif() @@ -832,11 +832,11 @@ foreach(script ${git_shell_scripts}) endif() add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}" - COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh" + COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/tools/generate-script.sh" "${CMAKE_SOURCE_DIR}/${script}.sh" "${CMAKE_BINARY_DIR}/${shell_gen_path}" "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS" - DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh" + DEPENDS "${CMAKE_SOURCE_DIR}/tools/generate-script.sh" "${CMAKE_SOURCE_DIR}/${script}.sh" VERBATIM) list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path}) @@ -875,13 +875,13 @@ foreach(script ${git_perl_scripts} ${perl_modules}) file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}") add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}" - COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh" + COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/tools/generate-perl.sh" "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS" "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE" "${CMAKE_BINARY_DIR}/GIT-PERL-HEADER" "${CMAKE_SOURCE_DIR}/${script}" "${CMAKE_BINARY_DIR}/${perl_gen_path}" - DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh" + DEPENDS "${CMAKE_SOURCE_DIR}/tools/generate-perl.sh" "${CMAKE_SOURCE_DIR}/${script}" "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS" "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE" @@ -892,11 +892,11 @@ add_custom_target(perl-gen ALL DEPENDS ${perl_gen}) # Python script add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/git-p4" - COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-python.sh" + COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/tools/generate-python.sh" "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS" "${CMAKE_SOURCE_DIR}/git-p4.py" "${CMAKE_BINARY_DIR}/git-p4" - DEPENDS "${CMAKE_SOURCE_DIR}/generate-python.sh" + DEPENDS "${CMAKE_SOURCE_DIR}/tools/generate-python.sh" "${CMAKE_SOURCE_DIR}/git-p4.py" "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS" VERBATIM) diff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build index 161435abeb..804c315894 100644 --- a/contrib/subtree/meson.build +++ b/contrib/subtree/meson.build @@ -3,7 +3,7 @@ git_subtree = custom_target( output: 'git-subtree', command: [ shell, - meson.project_source_root() / 'generate-script.sh', + meson.project_source_root() / 'tools/generate-script.sh', '@INPUT@', '@OUTPUT@', meson.project_build_root() / 'GIT-BUILD-OPTIONS', diff --git a/detect-compiler b/detect-compiler deleted file mode 100755 index 124ebdd4c9..0000000000 --- a/detect-compiler +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# -# Probe the compiler for vintage, version, etc. This is used for setting -# optional make knobs under the DEVELOPER knob. - -CC="$*" - -# we get something like (this is at least true for gcc and clang) -# -# FreeBSD clang version 3.4.1 (tags/RELEASE...) -get_version_line() { - LANG=C LC_ALL=C $CC -v 2>&1 | sed -n '/ version /{p;q;}' -} - -get_family() { - get_version_line | sed 's/^\(.*\) version [0-9].*/\1/' -} - -get_version() { - # A string that begins with a digit up to the next SP - ver=$(get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/') - - # There are known -variant suffixes that do not affect the - # meaning of the main version number. Strip them. - ver=${ver%-win32} - ver=${ver%-posix} - - echo "$ver" -} - -print_flags() { - family=$1 - version=$(get_version | cut -f 1 -d .) - - # Print a feature flag not only for the current version, but also - # for any prior versions we encompass. This avoids needing to do - # numeric comparisons in make, which are awkward. - while test "$version" -gt 0 - do - echo $family$version - version=$((version - 1)) - done -} - -case "$(get_family)" in -gcc) - print_flags gcc - ;; -clang | *" clang") - print_flags clang - ;; -"Apple LLVM") - print_flags clang - ;; -*) - : unknown compiler family - ;; -esac diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh deleted file mode 100755 index 0ed39c4c5d..0000000000 --- a/generate-cmdlist.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh - -die () { - echo "$@" >&2 - exit 1 -} - -command_list () { - while read cmd rest - do - case "$cmd" in - "#"* | '') - # Ignore comments and allow empty lines - continue - ;; - *) - case "$exclude_programs" in - *":$cmd:"*) - ;; - *) - echo "$cmd $rest" - ;; - esac - esac - done <"$1" -} - -category_list () { - echo "$1" | - cut -d' ' -f2- | - tr ' ' '\012' | - grep -v '^$' | - LC_ALL=C sort -u -} - -define_categories () { - echo - echo "/* Command categories */" - bit=0 - echo "$1" | - while read cat - do - echo "#define CAT_$cat (1UL << $bit)" - bit=$(($bit+1)) - done - test "$bit" -gt 32 && die "Urgh.. too many categories?" -} - -define_category_names () { - echo - echo "/* Category names */" - echo "static const char *category_names[] = {" - bit=0 - echo "$1" | - while read cat - do - echo " \"$cat\", /* (1UL << $bit) */" - bit=$(($bit+1)) - done - echo " NULL" - echo "};" -} - -print_command_list () { - echo "static struct cmdname_help command_list[] = {" - - echo "$2" | - while read cmd rest - do - synopsis= - while read line - do - case "$line" in - "$cmd - "*) - synopsis=${line#$cmd - } - break - ;; - esac - done <"$1/Documentation/$cmd.adoc" - - printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis" - printf " | CAT_%s" $rest - echo " }," - done - echo "};" -} - -exclude_programs=: -while test "--exclude-program" = "$1" -do - shift - exclude_programs="$exclude_programs$1:" - shift -done - -if test "$#" -ne 2 -then - die "USAGE: $0 " -fi - -SOURCE_DIR="$1" -OUTPUT="$2" - -{ - commands="$(command_list "$SOURCE_DIR"/command-list.txt)" - categories="$(category_list "$commands")" - - echo "/* Automatically generated by generate-cmdlist.sh */ - struct cmdname_help { - const char *name; - const char *help; - uint32_t category; - }; - " - define_categories "$categories" - echo - define_category_names "$categories" - echo - print_command_list "$SOURCE_DIR" "$commands" -} >"$OUTPUT" diff --git a/generate-configlist.sh b/generate-configlist.sh deleted file mode 100755 index e28054f9e0..0000000000 --- a/generate-configlist.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -SOURCE_DIR="$1" -OUTPUT="$2" -DEPFILE="$3" - -if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" -then - echo >&2 "USAGE: $0 []" - exit 1 -fi - -print_config_list () { - cat <"$OUTPUT" - -if test -n "$DEPFILE" -then - QUOTED_OUTPUT="$(printf '%s\n' "$OUTPUT" | sed 's,[&/\],\\&,g')" - { - printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \ - "$SOURCE_DIR"/Documentation/config/*.adoc | - sed -e 's/[# ]/\\&/g' -e "s/^/$QUOTED_OUTPUT: /" - printf '%s:\n' "$SOURCE_DIR"/Documentation/*config.adoc \ - "$SOURCE_DIR"/Documentation/config/*.adoc | - sed -e 's/[# ]/\\&/g' - } >"$DEPFILE" -fi diff --git a/generate-hooklist.sh b/generate-hooklist.sh deleted file mode 100755 index e0cdf26944..0000000000 --- a/generate-hooklist.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# Usage: ./generate-hooklist.sh >hook-list.h - -SOURCE_DIR="$1" -OUTPUT="$2" - -if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" -then - echo >&2 "USAGE: $0 " - exit 1 -fi - -{ - -cat <"$OUTPUT" diff --git a/generate-perl.sh b/generate-perl.sh deleted file mode 100755 index 796d835932..0000000000 --- a/generate-perl.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -set -e - -if test $# -ne 5 -then - echo >&2 "USAGE: $0 " - exit 1 -fi - -GIT_BUILD_OPTIONS="$1" -GIT_VERSION_FILE="$2" -PERL_HEADER="$3" -INPUT="$4" -OUTPUT="$5" - -. "$GIT_BUILD_OPTIONS" -. "$GIT_VERSION_FILE" - -sed -e '1{' \ - -e " /^#!.*perl/!b" \ - -e " s|#!.*perl|#!$PERL_PATH|" \ - -e " r $PERL_HEADER" \ - -e ' G' \ - -e '}' \ - -e "s|@GIT_VERSION@|$GIT_VERSION|g" \ - -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \ - -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \ - -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \ - "$INPUT" >"$OUTPUT" - -case "$INPUT" in -*.perl|*git-contacts) - chmod a+x "$OUTPUT";; -*) - ;; -esac diff --git a/generate-python.sh b/generate-python.sh deleted file mode 100755 index 31ac115689..0000000000 --- a/generate-python.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -e - -if test $# -ne 3 -then - echo >&2 "USAGE: $0 " - exit 1 -fi - -GIT_BUILD_OPTIONS="$1" -INPUT="$2" -OUTPUT="$3" - -. "$GIT_BUILD_OPTIONS" - -sed -e "1s|#!.*python|#!$PYTHON_PATH|" \ - "$INPUT" >"$OUTPUT+" -chmod a+x "$OUTPUT+" -mv "$OUTPUT+" "$OUTPUT" diff --git a/generate-script.sh b/generate-script.sh deleted file mode 100755 index a149e4f0ba..0000000000 --- a/generate-script.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -set -e - -if test $# -ne 3 -then - echo >&2 "USAGE: $0 " - exit 1 -fi - -INPUT="$1" -OUTPUT="$2" -BUILD_OPTIONS="$3" - -. "$BUILD_OPTIONS" - -sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \ - -e "s|@SHELL_PATH@|$SHELL_PATH|" \ - -e "s|@DIFF@|$DIFF|" \ - -e "s|@LOCALEDIR@|$LOCALEDIR|g" \ - -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \ - -e "$BROKEN_PATH_FIX" \ - -e "s|@GITWEBDIR@|$GITWEBDIR|g" \ - -e "s|@PERL_PATH@|$PERL_PATH|g" \ - -e "s|@PAGER_ENV@|$PAGER_ENV|g" \ - "$INPUT" >"$OUTPUT" - -case "$(basename "$INPUT")" in -git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh) - ;; -*) - chmod a+x "$OUTPUT" - ;; -esac diff --git a/meson.build b/meson.build index 1d66b5181e..604fe89d2d 100644 --- a/meson.build +++ b/meson.build @@ -554,7 +554,7 @@ libgit_sources = [ libgit_sources += custom_target( input: 'command-list.txt', output: 'command-list.h', - command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'], + command: [shell, meson.current_source_dir() + '/tools/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'], env: script_environment, ) @@ -723,10 +723,10 @@ endif builtin_sources += custom_target( output: 'config-list.h', depfile: 'config-list.h.d', - depend_files: [ 'generate-configlist.sh' ], + depend_files: [ 'tools/generate-configlist.sh' ], command: [ shell, - meson.current_source_dir() / 'generate-configlist.sh', + meson.current_source_dir() / 'tools/generate-configlist.sh', meson.current_source_dir(), '@OUTPUT@', '@DEPFILE@', @@ -739,7 +739,7 @@ builtin_sources += custom_target( output: 'hook-list.h', command: [ shell, - meson.current_source_dir() + '/generate-hooklist.sh', + meson.current_source_dir() + '/tools/generate-hooklist.sh', meson.current_source_dir(), '@OUTPUT@', ], @@ -1959,7 +1959,7 @@ foreach script : scripts_sh output: fs.stem(script), command: [ shell, - meson.project_source_root() / 'generate-script.sh', + meson.project_source_root() / 'tools/generate-script.sh', '@INPUT@', '@OUTPUT@', meson.project_build_root() / 'GIT-BUILD-OPTIONS', @@ -2008,7 +2008,7 @@ if perl_features_enabled generate_perl_command = [ shell, - meson.project_source_root() / 'generate-perl.sh', + meson.project_source_root() / 'tools/generate-perl.sh', meson.project_build_root() / 'GIT-BUILD-OPTIONS', git_version_file.full_path(), perl_header, @@ -2057,7 +2057,7 @@ if target_python.found() output: fs.stem(script), command: [ shell, - meson.project_source_root() / 'generate-python.sh', + meson.project_source_root() / 'tools/generate-python.sh', meson.project_build_root() / 'GIT-BUILD-OPTIONS', '@INPUT@', '@OUTPUT@', diff --git a/tools/check-builtins.sh b/tools/check-builtins.sh new file mode 100755 index 0000000000..a0aaf3a347 --- /dev/null +++ b/tools/check-builtins.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +{ + cat <<\EOF +sayIt: + $(foreach b,$(BUILT_INS),echo XXX $(b:$X=) YYY;) +EOF + cat Makefile +} | +make -f - sayIt 2>/dev/null | +sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p' | +sort | +{ + bad=0 + while read builtin + do + base=$(expr "$builtin" : 'git-\(.*\)') + x=$(sed -ne 's/.*{ "'$base'", \(cmd_[^, ]*\).*/'$base' \1/p' git.c) + if test -z "$x" + then + echo "$base is builtin but not listed in git.c command list" + bad=1 + fi + for sfx in sh perl py + do + if test -f "$builtin.$sfx" + then + echo "$base is builtin but $builtin.$sfx still exists" + bad=1 + fi + done + done + exit $bad +} diff --git a/tools/detect-compiler b/tools/detect-compiler new file mode 100755 index 0000000000..124ebdd4c9 --- /dev/null +++ b/tools/detect-compiler @@ -0,0 +1,58 @@ +#!/bin/sh +# +# Probe the compiler for vintage, version, etc. This is used for setting +# optional make knobs under the DEVELOPER knob. + +CC="$*" + +# we get something like (this is at least true for gcc and clang) +# +# FreeBSD clang version 3.4.1 (tags/RELEASE...) +get_version_line() { + LANG=C LC_ALL=C $CC -v 2>&1 | sed -n '/ version /{p;q;}' +} + +get_family() { + get_version_line | sed 's/^\(.*\) version [0-9].*/\1/' +} + +get_version() { + # A string that begins with a digit up to the next SP + ver=$(get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/') + + # There are known -variant suffixes that do not affect the + # meaning of the main version number. Strip them. + ver=${ver%-win32} + ver=${ver%-posix} + + echo "$ver" +} + +print_flags() { + family=$1 + version=$(get_version | cut -f 1 -d .) + + # Print a feature flag not only for the current version, but also + # for any prior versions we encompass. This avoids needing to do + # numeric comparisons in make, which are awkward. + while test "$version" -gt 0 + do + echo $family$version + version=$((version - 1)) + done +} + +case "$(get_family)" in +gcc) + print_flags gcc + ;; +clang | *" clang") + print_flags clang + ;; +"Apple LLVM") + print_flags clang + ;; +*) + : unknown compiler family + ;; +esac diff --git a/tools/generate-cmdlist.sh b/tools/generate-cmdlist.sh new file mode 100755 index 0000000000..0ed39c4c5d --- /dev/null +++ b/tools/generate-cmdlist.sh @@ -0,0 +1,120 @@ +#!/bin/sh + +die () { + echo "$@" >&2 + exit 1 +} + +command_list () { + while read cmd rest + do + case "$cmd" in + "#"* | '') + # Ignore comments and allow empty lines + continue + ;; + *) + case "$exclude_programs" in + *":$cmd:"*) + ;; + *) + echo "$cmd $rest" + ;; + esac + esac + done <"$1" +} + +category_list () { + echo "$1" | + cut -d' ' -f2- | + tr ' ' '\012' | + grep -v '^$' | + LC_ALL=C sort -u +} + +define_categories () { + echo + echo "/* Command categories */" + bit=0 + echo "$1" | + while read cat + do + echo "#define CAT_$cat (1UL << $bit)" + bit=$(($bit+1)) + done + test "$bit" -gt 32 && die "Urgh.. too many categories?" +} + +define_category_names () { + echo + echo "/* Category names */" + echo "static const char *category_names[] = {" + bit=0 + echo "$1" | + while read cat + do + echo " \"$cat\", /* (1UL << $bit) */" + bit=$(($bit+1)) + done + echo " NULL" + echo "};" +} + +print_command_list () { + echo "static struct cmdname_help command_list[] = {" + + echo "$2" | + while read cmd rest + do + synopsis= + while read line + do + case "$line" in + "$cmd - "*) + synopsis=${line#$cmd - } + break + ;; + esac + done <"$1/Documentation/$cmd.adoc" + + printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis" + printf " | CAT_%s" $rest + echo " }," + done + echo "};" +} + +exclude_programs=: +while test "--exclude-program" = "$1" +do + shift + exclude_programs="$exclude_programs$1:" + shift +done + +if test "$#" -ne 2 +then + die "USAGE: $0 " +fi + +SOURCE_DIR="$1" +OUTPUT="$2" + +{ + commands="$(command_list "$SOURCE_DIR"/command-list.txt)" + categories="$(category_list "$commands")" + + echo "/* Automatically generated by generate-cmdlist.sh */ + struct cmdname_help { + const char *name; + const char *help; + uint32_t category; + }; + " + define_categories "$categories" + echo + define_category_names "$categories" + echo + print_command_list "$SOURCE_DIR" "$commands" +} >"$OUTPUT" diff --git a/tools/generate-configlist.sh b/tools/generate-configlist.sh new file mode 100755 index 0000000000..e28054f9e0 --- /dev/null +++ b/tools/generate-configlist.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +SOURCE_DIR="$1" +OUTPUT="$2" +DEPFILE="$3" + +if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" +then + echo >&2 "USAGE: $0 []" + exit 1 +fi + +print_config_list () { + cat <"$OUTPUT" + +if test -n "$DEPFILE" +then + QUOTED_OUTPUT="$(printf '%s\n' "$OUTPUT" | sed 's,[&/\],\\&,g')" + { + printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \ + "$SOURCE_DIR"/Documentation/config/*.adoc | + sed -e 's/[# ]/\\&/g' -e "s/^/$QUOTED_OUTPUT: /" + printf '%s:\n' "$SOURCE_DIR"/Documentation/*config.adoc \ + "$SOURCE_DIR"/Documentation/config/*.adoc | + sed -e 's/[# ]/\\&/g' + } >"$DEPFILE" +fi diff --git a/tools/generate-hooklist.sh b/tools/generate-hooklist.sh new file mode 100755 index 0000000000..e0cdf26944 --- /dev/null +++ b/tools/generate-hooklist.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Usage: ./generate-hooklist.sh >hook-list.h + +SOURCE_DIR="$1" +OUTPUT="$2" + +if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" +then + echo >&2 "USAGE: $0 " + exit 1 +fi + +{ + +cat <"$OUTPUT" diff --git a/tools/generate-perl.sh b/tools/generate-perl.sh new file mode 100755 index 0000000000..796d835932 --- /dev/null +++ b/tools/generate-perl.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +if test $# -ne 5 +then + echo >&2 "USAGE: $0 " + exit 1 +fi + +GIT_BUILD_OPTIONS="$1" +GIT_VERSION_FILE="$2" +PERL_HEADER="$3" +INPUT="$4" +OUTPUT="$5" + +. "$GIT_BUILD_OPTIONS" +. "$GIT_VERSION_FILE" + +sed -e '1{' \ + -e " /^#!.*perl/!b" \ + -e " s|#!.*perl|#!$PERL_PATH|" \ + -e " r $PERL_HEADER" \ + -e ' G' \ + -e '}' \ + -e "s|@GIT_VERSION@|$GIT_VERSION|g" \ + -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \ + -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \ + -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \ + "$INPUT" >"$OUTPUT" + +case "$INPUT" in +*.perl|*git-contacts) + chmod a+x "$OUTPUT";; +*) + ;; +esac diff --git a/tools/generate-python.sh b/tools/generate-python.sh new file mode 100755 index 0000000000..31ac115689 --- /dev/null +++ b/tools/generate-python.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +if test $# -ne 3 +then + echo >&2 "USAGE: $0 " + exit 1 +fi + +GIT_BUILD_OPTIONS="$1" +INPUT="$2" +OUTPUT="$3" + +. "$GIT_BUILD_OPTIONS" + +sed -e "1s|#!.*python|#!$PYTHON_PATH|" \ + "$INPUT" >"$OUTPUT+" +chmod a+x "$OUTPUT+" +mv "$OUTPUT+" "$OUTPUT" diff --git a/tools/generate-script.sh b/tools/generate-script.sh new file mode 100755 index 0000000000..a149e4f0ba --- /dev/null +++ b/tools/generate-script.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +if test $# -ne 3 +then + echo >&2 "USAGE: $0 " + exit 1 +fi + +INPUT="$1" +OUTPUT="$2" +BUILD_OPTIONS="$3" + +. "$BUILD_OPTIONS" + +sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \ + -e "s|@SHELL_PATH@|$SHELL_PATH|" \ + -e "s|@DIFF@|$DIFF|" \ + -e "s|@LOCALEDIR@|$LOCALEDIR|g" \ + -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \ + -e "$BROKEN_PATH_FIX" \ + -e "s|@GITWEBDIR@|$GITWEBDIR|g" \ + -e "s|@PERL_PATH@|$PERL_PATH|g" \ + -e "s|@PAGER_ENV@|$PAGER_ENV|g" \ + "$INPUT" >"$OUTPUT" + +case "$(basename "$INPUT")" in +git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh) + ;; +*) + chmod a+x "$OUTPUT" + ;; +esac -- cgit v1.3-6-g1900 From daa56fb7897ce8819e5a64f4ec7800b3eef03031 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 19 Mar 2026 06:33:26 +0100 Subject: meson: compile compatibility sources separately In the next commit we're about to introduce a precompiled header for "git-compat-util.h". The consequence of this change is that we'll implicitly include that header for every compilation unit that uses the precompiled headers. This is okay for our "normal" library sources and our builtins. But some of our compatibility sources do not include the header on purpose, and doing so would cause compilation errors. Prepare for this change by splitting out compatibility sources into their static library. Like this, we can selectively enable precompiled headers for the library sources. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 79 +++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 34 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 604fe89d2d..cd00be1c23 100644 --- a/meson.build +++ b/meson.build @@ -271,6 +271,13 @@ version_gen_environment.set('GIT_VERSION', get_option('version')) compiler = meson.get_compiler('c') +compat_sources = [ + 'compat/nonblock.c', + 'compat/obstack.c', + 'compat/open.c', + 'compat/terminal.c', +] + libgit_sources = [ 'abspath.c', 'add-interactive.c', @@ -304,10 +311,6 @@ libgit_sources = [ 'commit.c', 'common-exit.c', 'common-init.c', - 'compat/nonblock.c', - 'compat/obstack.c', - 'compat/open.c', - 'compat/terminal.c', 'compiler-tricks/not-constant.c', 'config.c', 'connect.c', @@ -1163,7 +1166,7 @@ endif if not has_poll_h and not has_sys_poll_h libgit_c_args += '-DNO_POLL' - libgit_sources += 'compat/poll/poll.c' + compat_sources += 'compat/poll/poll.c' libgit_include_directories += 'compat/poll' endif @@ -1179,7 +1182,7 @@ endif # implementation to threat things like drive prefixes specially. if host_machine.system() == 'windows' or not compiler.has_header('libgen.h') libgit_c_args += '-DNO_LIBGEN_H' - libgit_sources += 'compat/basename.c' + compat_sources += 'compat/basename.c' endif if compiler.has_header('paths.h') @@ -1209,7 +1212,7 @@ if host_machine.system() != 'windows' foreach symbol : ['inet_ntop', 'inet_pton', 'hstrerror'] if not compiler.has_function(symbol, dependencies: networking_dependencies) libgit_c_args += '-DNO_' + symbol.to_upper() - libgit_sources += 'compat/' + symbol + '.c' + compat_sources += 'compat/' + symbol + '.c' endif endforeach endif @@ -1251,18 +1254,18 @@ else endif if host_machine.system() == 'darwin' - libgit_sources += 'compat/precompose_utf8.c' + compat_sources += 'compat/precompose_utf8.c' libgit_c_args += '-DPRECOMPOSE_UNICODE' libgit_c_args += '-DPROTECT_HFS_DEFAULT' endif # Configure general compatibility wrappers. if host_machine.system() == 'cygwin' - libgit_sources += [ + compat_sources += [ 'compat/win32/path-utils.c', ] elif host_machine.system() == 'windows' - libgit_sources += [ + compat_sources += [ 'compat/winansi.c', 'compat/win32/dirent.c', 'compat/win32/flush.c', @@ -1289,20 +1292,20 @@ elif host_machine.system() == 'windows' libgit_include_directories += 'compat/win32' if compiler.get_id() == 'msvc' libgit_include_directories += 'compat/vcbuild/include' - libgit_sources += 'compat/msvc.c' + compat_sources += 'compat/msvc.c' else - libgit_sources += 'compat/mingw.c' + compat_sources += 'compat/mingw.c' endif endif if host_machine.system() == 'linux' - libgit_sources += 'compat/linux/procinfo.c' + compat_sources += 'compat/linux/procinfo.c' elif host_machine.system() == 'windows' - libgit_sources += 'compat/win32/trace2_win32_process_info.c' + compat_sources += 'compat/win32/trace2_win32_process_info.c' elif host_machine.system() == 'darwin' - libgit_sources += 'compat/darwin/procinfo.c' + compat_sources += 'compat/darwin/procinfo.c' else - libgit_sources += 'compat/stub/procinfo.c' + compat_sources += 'compat/stub/procinfo.c' endif if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' @@ -1315,13 +1318,13 @@ endif # Configure the simple-ipc subsystem required fro the fsmonitor. if host_machine.system() == 'windows' - libgit_sources += [ + compat_sources += [ 'compat/simple-ipc/ipc-shared.c', 'compat/simple-ipc/ipc-win32.c', ] libgit_c_args += '-DSUPPORTS_SIMPLE_IPC' else - libgit_sources += [ + compat_sources += [ 'compat/simple-ipc/ipc-shared.c', 'compat/simple-ipc/ipc-unix-socket.c', ] @@ -1339,7 +1342,7 @@ if fsmonitor_backend != '' libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND' libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS' - libgit_sources += [ + compat_sources += [ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c', 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c', 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c', @@ -1355,7 +1358,7 @@ if not get_option('b_sanitize').contains('address') and get_option('regex').allo if compiler.get_define('REG_ENHANCED', prefix: '#include ') != '' libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS' - libgit_sources += 'compat/regcomp_enhanced.c' + compat_sources += 'compat/regcomp_enhanced.c' endif elif not get_option('regex').enabled() libgit_c_args += [ @@ -1364,7 +1367,7 @@ elif not get_option('regex').enabled() '-DNO_MBSUPPORT', ] build_options_config.set('NO_REGEX', '1') - libgit_sources += 'compat/regex/regex.c' + compat_sources += 'compat/regex/regex.c' libgit_include_directories += 'compat/regex' else error('Native regex support requested but not found') @@ -1428,7 +1431,7 @@ else if get_option('b_sanitize').contains('address') libgit_c_args += '-DNO_MMAP' - libgit_sources += 'compat/mmap.c' + compat_sources += 'compat/mmap.c' else checkfuncs += { 'mmap': ['mmap.c'] } endif @@ -1438,7 +1441,7 @@ foreach func, impls : checkfuncs if not compiler.has_function(func) libgit_c_args += '-DNO_' + func.to_upper() foreach impl : impls - libgit_sources += 'compat/' + impl + compat_sources += 'compat/' + impl endforeach endif endforeach @@ -1449,13 +1452,13 @@ endif if not compiler.has_function('strdup') libgit_c_args += '-DOVERRIDE_STRDUP' - libgit_sources += 'compat/strdup.c' + compat_sources += 'compat/strdup.c' endif if not compiler.has_function('qsort') libgit_c_args += '-DINTERNAL_QSORT' endif -libgit_sources += 'compat/qsort_s.c' +compat_sources += 'compat/qsort_s.c' if compiler.has_function('getdelim') libgit_c_args += '-DHAVE_GETDELIM' @@ -1511,7 +1514,7 @@ if meson.can_run_host_binaries() and compiler.run(''' } ''', name: 'fread reads directories').returncode() == 0 libgit_c_args += '-DFREAD_READS_DIRECTORIES' - libgit_sources += 'compat/fopen.c' + compat_sources += 'compat/fopen.c' endif if not meson.is_cross_build() and fs.exists('/dev/tty') @@ -1745,14 +1748,22 @@ else endif libgit = declare_dependency( - link_with: static_library('git', - sources: libgit_sources, - c_args: libgit_c_args + [ - '-DGIT_VERSION_H="' + version_def_h.full_path() + '"', - ], - dependencies: libgit_dependencies, - include_directories: libgit_include_directories, - ), + link_with: [ + static_library('compat', + sources: compat_sources, + c_args: libgit_c_args, + dependencies: libgit_dependencies, + include_directories: libgit_include_directories, + ), + static_library('git', + sources: libgit_sources, + c_args: libgit_c_args + [ + '-DGIT_VERSION_H="' + version_def_h.full_path() + '"', + ], + dependencies: libgit_dependencies, + include_directories: libgit_include_directories, + ), + ], compile_args: libgit_c_args, dependencies: libgit_dependencies, include_directories: libgit_include_directories, -- cgit v1.3-6-g1900 From 671df48df895fdf259b48a7f90b70b7c75fc4059 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 19 Mar 2026 06:33:27 +0100 Subject: meson: precompile "git-compat-util.h" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every compilation unit in Git is expected to include "git-compat-util.h" first, either directly or indirectly via "builtin.h". This header papers over differences between platforms so that we can expect the typical POSIX functions to exist. Furthermore, it provides functionality that we end up using everywhere. This header is thus quite heavy as a consequence. Preprocessing it as a standalone unit via `clang -E git-compat-util.h` yields over 23,000 lines of code overall. Naturally, it takes quite some time to compile all of this. Luckily, this is exactly the kind of use case that precompiled headers aim to solve: instead of recompiling it every single time, we compile it once and then link the result into the executable. If include guards are set up properly it means that the file won't need to be reprocessed. Set up such a precompiled header for "git-compat-util.h" and wire it up via Meson. This causes Meson to implicitly include the precompiled header in all compilation units. With GCC and Clang for example this is done via the "-include" statement [1]. This leads to a significant speedup when performing full builds: Benchmark 1: ninja (rev = HEAD~) Time (mean ± σ): 14.467 s ± 0.126 s [User: 248.133 s, System: 31.298 s] Range (min … max): 14.195 s … 14.633 s 10 runs Benchmark 2: ninja (rev = HEAD) Time (mean ± σ): 10.307 s ± 0.111 s [User: 173.290 s, System: 23.998 s] Range (min … max): 10.030 s … 10.433 s 10 runs Summary ninja (rev = HEAD) ran 1.40 ± 0.02 times faster than ninja (rev = HEAD~) [1]: https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 2 ++ tools/precompiled.h | 1 + 2 files changed, 3 insertions(+) create mode 100644 tools/precompiled.h (limited to 'meson.build') diff --git a/meson.build b/meson.build index cd00be1c23..2002f4795e 100644 --- a/meson.build +++ b/meson.build @@ -1760,6 +1760,7 @@ libgit = declare_dependency( c_args: libgit_c_args + [ '-DGIT_VERSION_H="' + version_def_h.full_path() + '"', ], + c_pch: 'tools/precompiled.h', dependencies: libgit_dependencies, include_directories: libgit_include_directories, ), @@ -1820,6 +1821,7 @@ test_dependencies = [ ] git_builtin = executable('git', sources: builtin_sources + 'git.c', + c_pch: 'tools/precompiled.h', dependencies: [libgit_commonmain], install: true, install_dir: git_exec_path, diff --git a/tools/precompiled.h b/tools/precompiled.h new file mode 100644 index 0000000000..b2bec0d2b4 --- /dev/null +++ b/tools/precompiled.h @@ -0,0 +1 @@ +#include "git-compat-util.h" -- cgit v1.3-6-g1900