Modernize the build system
Subsystems (3)
RFC PATCH v3 7/15 Makefile: extract script to generate gitweb.cgi
In reply to Patrick SteinhardtIn order to generate "gitweb.cgi" we have to replace various different placeholders. This is done ad-hoc and is thus not easily reusable across different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at configuration time with the expected options. This script is then used as input for a new "generate-gitweb.sh" script that generates the final "gitweb.cgi" file. While this requires us to repeat the options multiple times, it is in line to how we generate other build options like our GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even though this variable is supposed to be an integer, the source file has the value quoted. The quotes are eventually stripped via sed(1), which replaces "@GITWEB_PROJECT_MAXDEPTH@" with the actual value, which is rather nonsensical. This is made clearer by just dropping the quotes in the source file.
--- gitweb/GITWEB-BUILD-OPTIONS.in | 25 +++++++++++++++ gitweb/Makefile | 58 ++++++++++++++++------------------ gitweb/generate-gitweb.sh | 45 ++++++++++++++++++++++++++ gitweb/gitweb.perl | 2 +- 4 files changed, 99 insertions(+), 31 deletions(-) create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in create mode 100755 gitweb/generate-gitweb.sh
gitweb/GITWEB-BUILD-OPTIONS.in new file +25 -0
@@ -0,0 +1,25 @@ +PERL_PATH=@PERL_PATH@ +JSMIN=@JSMIN@ +CSSMIN=@CSSMIN@ +GIT_VERSION=@GIT_VERSION@ +GIT_BINDIR=@GIT_BINDIR@ +GITWEB_CONFIG=@GITWEB_CONFIG@ +GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@ +GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@ +GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@ +GITWEB_SITENAME=@GITWEB_SITENAME@ +GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@ +GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@ +GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@ +GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@ +GITWEB_BASE_URL=@GITWEB_BASE_URL@ +GITWEB_LIST=@GITWEB_LIST@ +GITWEB_HOMETEXT=@GITWEB_HOMETEXT@ +GITWEB_CSS=@GITWEB_CSS@ +GITWEB_LOGO=@GITWEB_LOGO@ +GITWEB_FAVICON=@GITWEB_FAVICON@ +GITWEB_JS=@GITWEB_JS@ +GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@ +GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@ +GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@ +HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
gitweb/Makefile +28 -30
71 lines not on this page · raw message
gitweb/generate-gitweb.sh new file +45 -0
45 lines not on this page · raw message
gitweb/gitweb.perl +1 -1
@@ -88,7 +88,7 @@ sub evaluate_uri { # fs traversing limit for getting project list # the number is relative to the projectroot -our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@"; +our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@; # string of the home link on top of all pages our $home_link_str = "@GITWEB_HOME_LINK_STR@";
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
RFC PATCH v3 8/15 Makefile: refactor GIT-VERSION-GEN to be reusable
In reply to Patrick SteinhardtOur "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into the current directory, where the expectation is that it should exist in the source directory. But other build systems that support out-of-tree builds may not want to do that to keep the source directory pristine, even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore but so that it instead writes the version to stdout. This makes it easier to compute the same version as our Makefile would without having to write the "GIT-VERSION-FILE".
--- GIT-VERSION-GEN | 12 +----------- Makefile | 3 ++- contrib/buildsystems/CMakeLists.txt | 12 ++++-------- 3 files changed, 7 insertions(+), 20 deletions(-)
GIT-VERSION-GEN +1 -11
@@ -1,6 +1,5 @@ #!/bin/sh -GVF=GIT-VERSION-FILE DEF_VER=v2.47.GIT LF='
@@ -28,13 +27,4 @@ fi VN=$(expr "$VN" : v*'\(.*\)') -if test -r $GVF -then - VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) -else - VC=unset -fi -test "$VN" = "$VC" || { - echo >&2 "GIT_VERSION = $VN" - echo "GIT_VERSION = $VN" >$GVF -} +echo "$VN"
Makefile +2 -1
@@ -592,7 +592,8 @@ include shared.mak # Disable -pedantic compilation. GIT-VERSION-FILE: FORCE - @$(SHELL_PATH) ./GIT-VERSION-GEN + @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+ + @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi -include GIT-VERSION-FILE # Set our default configuration.
contrib/buildsystems/CMakeLists.txt +4 -8
@@ -83,16 +83,12 @@ if(NOT SH_EXE) "On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/") endif() -#Create GIT-VERSION-FILE using GIT-VERSION-GEN -if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE) - message("Generating GIT-VERSION-FILE") - execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -endif() +execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE git_version + OUTPUT_STRIP_TRAILING_WHITESPACE) #Parse GIT-VERSION-FILE to get the version -file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)") -string(REPLACE "GIT_VERSION = " "" git_version ${git_version}) string(FIND ${git_version} "GIT" location) if(location EQUAL -1) string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
RFC PATCH v3 9/15 Makefile: refactor generators to be PWD-independent
In reply to Patrick SteinhardtWe have multiple scripts that generate headers from other data. All of these scripts have the assumption built-in that they are executed in the current source directory, which makes them a bit unwieldy to use during out-of-tree builds. This makes them a bit unwieldy to use. Refactor them to instead take the source directory as well as the output file as arguments.
--- Makefile | 6 ++--- contrib/buildsystems/CMakeLists.txt | 12 +++------ generate-cmdlist.sh | 42 ++++++++++++++++++----------- generate-configlist.sh | 20 ++++++++++---- generate-hooklist.sh | 15 ++++++++++- 5 files changed, 61 insertions(+), 34 deletions(-)
Makefile +3 -3
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X config-list.h: generate-configlist.sh config-list.h: Documentation/*config.txt Documentation/config/*.txt - $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@ + $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@ command-list.h: generate-cmdlist.sh command-list.txt command-list.h: $(wildcard Documentation/git*.txt) $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \ $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \ - command-list.txt >$@ + . $@ hook-list.h: generate-hooklist.sh Documentation/githooks.txt - $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@ + $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@ SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\ $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
contrib/buildsystems/CMakeLists.txt +3 -9
@@ -648,23 +648,17 @@ 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 ${EXCLUSION_PROGS} command-list.txt - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h) 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 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/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 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h) endif() include_directories(${CMAKE_BINARY_DIR})
generate-cmdlist.sh +26 -16
58 lines not on this page · raw message
generate-configlist.sh +15 -5
@@ -1,13 +1,19 @@ #!/bin/sh -echo "/* Automatically generated by generate-configlist.sh */" -echo +SOURCE_DIR="$1" +OUTPUT="$2" + +if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" +then + echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2 + exit 1 +fi print_config_list () { cat <<EOF static const char *config_name_list[] = { EOF - grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | + grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt | sed '/deprecated/d; s/::$//; s/, */\n/g' | sort | sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF EOF } -echo -print_config_list +{ + echo "/* Automatically generated by generate-configlist.sh */" + echo + echo + print_config_list +} >"$OUTPUT"
generate-hooklist.sh +14 -1
@@ -2,6 +2,17 @@ # # 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 "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2 + exit 1 +fi + +{ + cat <<EOF /* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF sed -n \ -e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \ -e 'x' \ - <Documentation/githooks.txt | + <"$SOURCE_DIR"/Documentation/githooks.txt | LC_ALL=C sort cat <<EOF NULL, }; EOF + +} >"$OUTPUT"
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
Re: [RFC PATCH v3 09/15] Makefile: refactor generators to be PWD-independent
Quoted 6 lines · Patrick Steinhardt
We have multiple scripts that generate headers from other data. All of these scripts have the assumption built-in that they are executed in the current source directory, which makes them a bit unwieldy to use during out-of-tree builds. This makes them a bit unwieldy to use. Refactor them to instead take the source directory as well as the output file as arguments.
Duplicate "makes them a bit unwieldy to use".
Quoted 1 line
Signed-off-by Patrick Steinhardt <[email protected]>
RFC PATCH v3 10/15 Makefile: allow "bin-wrappers/" directory to exist
In reply to Patrick SteinhardtThe "bin-wrappers/" directory gets created by our build system and is populated with one script for each of our binaries. There isn't anything inherently wrong with the current layout, but it is somewhat hard to adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists and contains our "wrap-for-bin.sh" script to make things a little bit easier for subsequent steps.
--- .gitignore | 1 - Documentation/CodingGuidelines | 2 +- Makefile | 6 +++--- bin-wrappers/.gitignore | 9 +++++++++ wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0 contrib/buildsystems/CMakeLists.txt | 6 +++--- 6 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 bin-wrappers/.gitignore rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%) mode change 100644 => 100755
.gitignore +0 -1
@@ -12,7 +12,6 @@ /GIT-TEST-SUITES /GIT-USER-AGENT /GIT-VERSION-FILE -/bin-wrappers/ /git /git-add /git-am
Documentation/CodingGuidelines +1 -1
@@ -583,7 +583,7 @@ For C programs: Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb" - ./bin-wrappers/git log` (See `wrap-for-bin.sh`.) + ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.) - The primary data structure that a subsystem 'S' deals with is called `struct S`. Functions that operate on `struct S` are named
Makefile +3 -3
@@ -3198,8 +3198,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $( all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) -bin-wrappers/%: wrap-for-bin.sh - $(call mkdir_p_parent_template) +$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@BUILD_DIR@|$(shell pwd)|' \ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3695,7 +3694,8 @@ clean: profile-clean coverage-clean cocciclean $(RM) $(FUZZ_PROGRAMS) $(RM) $(SP_OBJ) $(RM) $(HCC) - $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) $(test_bindir_programs) $(RM) -r po/build/ $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope* $(RM) -r .dist-tmp-dir .doc-tmp-dir
bin-wrappers/.gitignore new file +9 -0
@@ -0,0 +1,9 @@ +/git +/git-cvsserver +/git-receive-pack +/git-shell +/git-upload-archive +/git-upload-pack +/scalar +/test-fake-ssh +/test-tool
bin-wrappers/wrap-for-bin.sh renamed from wrap-for-bin.sh +0 -0
contrib/buildsystems/CMakeLists.txt +3 -3
@@ -1049,20 +1049,20 @@ set(wrapper_test_scripts foreach(script ${wrapper_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() foreach(script ${wrapper_test_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() -file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) +file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
RFC PATCH v3 11/15 Makefile: simplify building of templates
In reply to Patrick SteinhardtWhen we install Git we also install a set of default templates that both git-init(1) and git-clone(1) populate into our build directories. The way the pristine templates are layed out in our source directory is somewhat weird though: instead of reconstructing the actual directory hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the "branches/" directory, which is supposed to be empty when installing it. And as Git famously doesn't store empty directories at all we have to work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how branches used to be stored in the dark ages. gitrepository-layout(5) lists this directory as "slightly deprecated", which I would claim is a strong understatement. I have never encountered anybody using it today and would be surprised if it even works as expected. So having the "--" hack in place for an item that is basically unused, unmaintained and deprecated doesn't only feel unreasonable, but installing that entry by default may also cause confusion for users that do not know what this is supposed to be in the first place.
Remove this directory from our templates and, now that we do not require the workaround anymore, restructure the templates to form a proper hierarchy. This makes it way easier for build systems to install these templates into place.
We should likely think about removing support for "branch/" altogether, but that is outside of the scope of this patch series.
---
contrib/buildsystems/CMakeLists.txt | 34 ++++++----------
templates/Makefile | 39 ++++++++++++-------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)contrib/buildsystems/CMakeLists.txt +12 -22
@@ -106,8 +106,8 @@ project(git #TODO Enable NLS on windows natively #macros for parsing the Makefile for sources and scripts -macro(parse_makefile_for_sources list_var regex) - file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)") +macro(parse_makefile_for_sources list_var makefile regex) + file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)") string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}}) string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit. string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -665,20 +665,20 @@ include_directories(${CMAKE_BINARY_DIR}) #build #libgit -parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS") +parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS") list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") add_library(libgit ${libgit_SOURCES} ${compat_SOURCES}) #libxdiff -parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS") +parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS") list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") add_library(xdiff STATIC ${libxdiff_SOURCES}) #reftable -parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS") +parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS") list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") add_library(reftable STATIC ${reftable_SOURCES})
@@ -742,7 +742,7 @@ elseif(UNIX) endif() #git -parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS") +parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS") list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -874,24 +874,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content}) -#templates -file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*") -list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "") -list(REMOVE_ITEM templates ".gitignore") -list(REMOVE_ITEM templates "Makefile") -list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds - -list(REMOVE_ITEM templates "branches--") -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches - +#${CMAKE_SOURCE_DIR}/Makefile templates +parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES") +string(REPLACE " " ";" templates ${templates}) #templates have @.*@ replacement so use configure_file instead foreach(tm ${templates}) - string(REPLACE "--" "/" blt_tm ${tm}) - string(REPLACE "this" "" blt_tm ${blt_tm})# for this-- - configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY) + configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY) endforeach() - #translations if(MSGFMT_EXE) file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -965,7 +955,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c) target_link_libraries(test-fake-ssh common-main) #unit-tests -parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS") +parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS") list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/") add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1023,7 +1013,7 @@ if(MSVC) endif() #test-tool -parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS") +parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS") add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c) list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
templates/Makefile +25 -14
@@ -29,24 +29,35 @@ all: boilerplates.made custom # in a file direc--tory--file in the source. They will be # just copied to the destination. -bpsrc = $(filter-out %~,$(wildcard *--*)) -boilerplates.made : $(bpsrc) - $(QUIET)umask 022 && ls *--* 2>/dev/null | \ - while read boilerplate; \ +TEMPLATES = +TEMPLATES += description +TEMPLATES += hooks/applypatch-msg.sample +TEMPLATES += hooks/commit-msg.sample +TEMPLATES += hooks/fsmonitor-watchman.sample +TEMPLATES += hooks/post-update.sample +TEMPLATES += hooks/pre-applypatch.sample +TEMPLATES += hooks/pre-commit.sample +TEMPLATES += hooks/pre-merge-commit.sample +TEMPLATES += hooks/prepare-commit-msg.sample +TEMPLATES += hooks/pre-push.sample +TEMPLATES += hooks/pre-rebase.sample +TEMPLATES += hooks/pre-receive.sample +TEMPLATES += hooks/push-to-checkout.sample +TEMPLATES += hooks/sendemail-validate.sample +TEMPLATES += hooks/update.sample +TEMPLATES += info/exclude + +boilerplates.made: $(TEMPLATES) + $(QUIET)umask 022 && for template in $(TEMPLATES); \ do \ - case "$$boilerplate" in *~) continue ;; esac && \ - dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \ - dir=`expr "$$dst" : '\(.*\)/'` && \ + dir=$$(dirname "$$template") && \ mkdir -p blt/$$dir && \ - case "$$boilerplate" in \ - *--) continue;; \ - esac && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \ - blt/$$dst && \ - if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \ - chmod a+$$rx "blt/$$dst" || exit; \ + -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \ + blt/$$template && \ + if test -x "$$template"; then rx=rx; else rx=r; fi && \ + chmod a+$$rx "blt/$$template" || exit; \ done && \ date >$@
templates/branches-- deleted +0 -1
@@ -1 +0,0 @@ -: this is just to ensure the directory exists.
templates/description renamed from templates/this--description +0 -0
templates/hooks/applypatch-msg.sample renamed from templates/hooks--applypatch-msg.sample +0 -0
templates/hooks/commit-msg.sample renamed from templates/hooks--commit-msg.sample +0 -0
templates/hooks/fsmonitor-watchman.sample renamed from templates/hooks--fsmonitor-watchman.sample +0 -0
templates/hooks/post-update.sample renamed from templates/hooks--post-update.sample +0 -0
templates/hooks/pre-applypatch.sample renamed from templates/hooks--pre-applypatch.sample +0 -0
templates/hooks/pre-commit.sample renamed from templates/hooks--pre-commit.sample +0 -0
templates/hooks/pre-merge-commit.sample renamed from templates/hooks--pre-merge-commit.sample +0 -0
templates/hooks/pre-push.sample renamed from templates/hooks--pre-push.sample +0 -0
templates/hooks/pre-rebase.sample renamed from templates/hooks--pre-rebase.sample +0 -0
templates/hooks/pre-receive.sample renamed from templates/hooks--pre-receive.sample +0 -0
templates/hooks/prepare-commit-msg.sample renamed from templates/hooks--prepare-commit-msg.sample +0 -0
templates/hooks/push-to-checkout.sample renamed from templates/hooks--push-to-checkout.sample +0 -0
templates/hooks/sendemail-validate.sample renamed from templates/hooks--sendemail-validate.sample +0 -0
templates/hooks/update.sample renamed from templates/hooks--update.sample +0 -0
templates/info/exclude renamed from templates/info--exclude +0 -0
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
Re: [RFC PATCH v3 11/15] Makefile: simplify building of templates
Quoted 5 lines · Patrick Steinhardt
When we install Git we also install a set of default templates that both git-init(1) and git-clone(1) populate into our build directories. The way the pristine templates are layed out in our source directory is somewhat weird though: instead of reconstructing the actual directory hierarchy in "templates/", we represent directory separators with "--".
s/layed/laid/
RFC PATCH v3 12/15 t: better support for out-of-tree builds
In reply to Patrick SteinhardtOur in-tree builds used by the Makefile use various different build directories scattered around different locations. The paths to those build directories have to be propagated to our tests such that they can find the contained files. This is done via a mixture of hardcoded paths in our test library and injected variables in our bin-wrappers or "GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For one, we have all paths which are subject to change stored in a small set of central files instead of having the knowledge of build paths in many files. And second, it allows build systems which build files elsewhere to adapt those paths based on their own needs. This is especially nice in the context of build systems that use out-of-tree builds like CMake or Meson.
Remove hardcoded knowledge of build paths from our test library and move it into our bin-wrappers and "GIT-BUILD-OPTIONS".
--- GIT-BUILD-OPTIONS.in | 5 +++++ Makefile | 9 +++++++++ bin-wrappers/wrap-for-bin.sh | 11 ++++++----- contrib/buildsystems/CMakeLists.txt | 8 ++++++++ t/lib-gettext.sh | 4 ++-- t/t7609-mergetool--lib.sh | 2 +- t/test-lib.sh | 6 +++--- 7 files changed, 34 insertions(+), 11 deletions(-)
GIT-BUILD-OPTIONS.in +5 -0
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@ GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@ GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@ +GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@ +GIT_TEST_POPATH=@GIT_TEST_POPATH@ +GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@ +GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@ +GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@ RUNTIME_PREFIX=@RUNTIME_PREFIX@ GITWEBDIR=@GITWEBDIR@ USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
Makefile +9 -0
@@ -3173,6 +3173,11 @@ GIT-BUILD-OPTIONS: FORCE -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \ + -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \ + -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \ + -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \ + -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \ + -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3201,6 +3206,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR $(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@BUILD_DIR@|$(shell pwd)|' \ + -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \ + -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \ + -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \ + -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ chmod +x $@
bin-wrappers/wrap-for-bin.sh +6 -5
@@ -4,21 +4,22 @@ # to run test suite against sandbox, but with only bindir-installed # executables in PATH. The Makefile copies this into various # files in bin-wrappers, substituting -# @BUILD_DIR@ and @PROG@. +# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@. GIT_EXEC_PATH='@BUILD_DIR@' if test -n "$NO_SET_GIT_TEMPLATE_DIR" then unset GIT_TEMPLATE_DIR else - GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt' + GIT_TEMPLATE_DIR='@TEMPLATE_DIR@' export GIT_TEMPLATE_DIR fi -GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" -GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale' +MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@' +GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}" +GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@' PATH='@BUILD_DIR@/bin-wrappers:'"$PATH" -export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR +export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR case "$GIT_DEBUGGER" in '')
contrib/buildsystems/CMakeLists.txt +8 -0
@@ -1054,6 +1054,9 @@ endforeach() file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") +string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}") +string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}") +string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}") string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1139,6 +1142,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}") string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}") string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}") string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
t/lib-gettext.sh +2 -2
@@ -6,8 +6,8 @@ . ./test-lib.sh -GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale" -GIT_PO_PATH="$GIT_BUILD_DIR/po" +GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR" +GIT_PO_PATH="$GIT_TEST_POPATH" export GIT_TEXTDOMAINDIR GIT_PO_PATH if test -n "$GIT_TEST_INSTALLED"
t/t7609-mergetool--lib.sh +1 -1
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'mergetool --tool=vimdiff creates the expected layout' ' - . "$GIT_BUILD_DIR"/mergetools/vimdiff && + . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff && run_unit_tests '
t/test-lib.sh +3 -3
@@ -1478,7 +1478,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes: PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH" fi fi -GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt +GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR" GIT_CONFIG_NOSYSTEM=1 GIT_ATTR_NOSYSTEM=1 GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1494,9 +1494,9 @@ then fi fi -GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib +GITPERLLIB="$GIT_TEST_GITPERLLIB" export GITPERLLIB -test -d "$GIT_BUILD_DIR"/templates/blt || { +test -d "$GIT_TEMPLATE_DIR" || { BAIL_OUT "You haven't built things yet, have you?" }
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
RFC PATCH v3 13/15 t: allow overriding build dir
In reply to Patrick SteinhardtOur "test-lib.sh" assumes that our build directory is the parent directory of "t/". While true when using our Makefile, it's not when using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18), we have introduce support for overriding the GIT_BIULD_DIR by creating the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to the location of the build directory. The intent was to stop modifying "t/test-lib.sh" with the CMake build systems while allowing out-of-tree builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in fact points to the _source_ directory. So while that commit solved part of the problem for out-of-tree builds, CMake still has to write files into the source tree.
Solve the second part of the problem, namely not having to write any data into the source directory at all, by also supporting an environment variable that allows us to point to a different build directory. This allows us to perform properly self-contained out-of-tree builds.
--- t/test-lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
t/test-lib.sh +2 -1
@@ -35,7 +35,7 @@ else # needing to exist. TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1 fi -GIT_BUILD_DIR="${TEST_DIRECTORY%/t}" +GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}" if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -513,6 +513,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e ' PERF_ CURL_VERBOSE TRACE_CURL + BUILD_DIR )); my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env); print join("\n", @vars);
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
Re: [RFC PATCH v3 13/15] t: allow overriding build dir
Quoted 6 lines · Patrick Steinhardt
Our "
test-lib.sh" assumes that our build directory is the parent directory of "t/". While true when using ourMakefile, it's not when using build systems that support out-of-tree builds.In commit
ee9e66e4e7(cmake: avoid editingt/test-lib.sh, 2022-10-18), we have introduce support for overriding theGIT_BIULD_DIRby creating
s/GIT_BIULD_DIR/GIT_BUILD_DIR/
Quoted 14 lines
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to the location of the build directory. The intent was to stop modifying "
t/test-lib.sh" with the CMake build systems while allowing out-of-tree builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in fact points to the _source_ directory. So while that commit solved part of the problem for out-of-tree builds, CMake still has to write files into the source tree.Solve the second part of the problem, namely not having to write any data into the source directory at all, by also supporting an environment variable that allows us to point to a different build directory. This allows us to perform properly self-contained out-of-tree builds.
Signed-off-by Patrick Steinhardt <[email protected]>
RFC PATCH v3 14/15 Documentation: add comparison of build systems
In reply to Patrick SteinhardtWe're contemplating whether to eventually replace our build systems with a build system that is easier to use. Add a comparison of build systems to our technical documentation as a baseline for discussion.
--- Documentation/Makefile | 1 + Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 Documentation/technical/build-systems.txt
Documentation/Makefile +1 -0
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk TECH_DOCS += SubmittingPatches TECH_DOCS += ToolsForGit TECH_DOCS += technical/bitmap-format +TECH_DOCS += technical/build-systems TECH_DOCS += technical/bundle-uri TECH_DOCS += technical/hash-function-transition TECH_DOCS += technical/long-running-process-protocol
Documentation/technical/build-systems.txt new file +224 -0
224 lines not on this page · raw message
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
RFC PATCH v3 15/15 Introduce support for the Meson build system
In reply to Patrick SteinhardtIntroduce support for the Meson build system, a "modern" meta build system that supports many different plaforms, including Linux, macOS, Windows and BSDs. Meson supports different backends, including Ninja, Xcode and Microsoft Visual Studio. Several common IDEs provide an integration with it.
The biggest contender compared to Meson is probably CMake as outlined in our "Documentation/technical/build-systems.txt" file. Based on my own personal experience from working with both build systems extensively I strongly favor Meson over CMake. In my opinion, it feels significantly easier to use with a syntax that feels more like a "real" programming language. The second big reason is that Meson supports Rust natively, which may prove to be important given that the project is likely to pick up Rust as another language eventually.
Using Meson is rather straight-forward. An example:
```
# Meson uses out-of-tree builds. You can set up multiple build
# directories, how you name them is completely up to you.
$ mkdir build
$ cd build
$ meson setup .. -Dprefix=/tmp/git-installation
# Build the project. This also provides several other targets like
e.g. `install` or `test`.
$ ninja
# Meson has been wired up to support execution of our test suites.
# Both our unit tests and our integration tests are supported.
# Running `meson test` without any arguments will execute all tests,
# but the syntax supports globbing to select only some tests.
$ meson test 't-*'
# Execute single test interactively to allow fordebugging.
$ meson test 't0000-*' --interactive --test-args=-ix
```The build instructions have been successfully tested on the following systems, tests are passing:
- Apple macOS 10.15.
- FreeBSD 14.1.
- NixOS 24.11.
- OpenBSD 7.6.
- Ubuntu 24.04.
- Windows 10 with Cygwin.
- Windows 10 with MinGW64, except for t9700, which is also broken with our Makefile.
- Windows 10 with Visual Studio 2022 toolchain, using the Native Tools Command Prompt with meson setup --vsenv. Tests pass, except for t9700.
- Windows 10 with Visual Studio 2022 solution, using the Native Tools Command Prompt with meson setup --backend vs2022. Tests pass, except for t9700.
- Windows 10 with VS Code, using the Meson plug-in.
It is expected that there will still be rough edges in the current version. If this patch lands the expectation is that it will coexist with our other build systems for a while. Like this, distributions can slowly migrate over to Meson and report any findings they have to us such that we can continue to iterate. A potential cutoff date for other build systems may be Git 3.0.
Some notes:
- The installed distribution is structured somewhat differently than how it used to be the case. All of our binaries are installed into $libexec/git-core, while all binaries part of $bindir are now symbolic links pointing to the former. This rule is consistent in itself and thus easier to reason about.
- We do not install dashed binaries into $libexec/git-core anymore. So there won't e.g. be a symlink for git-add(1). These are not required by modern Git and there isn't really much of a usecase for those anymore. By not installing those symlinks we thus start the deprecation of this layout.
- Support for installing documentation has not been wired up yet. This will follow if the project can agree on Meson as build system.
- Documentation does not yet exist. Same here, it will follow if the project can agree on Meson.
- We're targeting a Meson 1.3.0, which has been released relatively recently November 2023. The only feature we use from that version is fs.relative_to(), which we could replace if necessary. If so, we could start to target Meson 1.0.0 and newer, released in December 2022.
- The whole build instructions count around 3000 lines, half of which is listing all of our code and test files. Our Makefiles are around 5000 lines, autoconf adds another 1300 lines. CMake in comparison has only 1200 linescode, but it avoids listing individual files and does not wire up auto-configuration as extensively as the Meson instructions do.
- We bundle a set of subproject wrappers for curl, expat, openssl, pcre2 and zlib. This allows developers to build Git without these dependencies preinstalled, and Meson will fetch and build them automatically. This is especially helpful on Windows.
--- bin-wrappers/meson.build | 28 + contrib/completion/meson.build | 8 + contrib/meson.build | 1 + gitweb/meson.build | 63 ++ meson.build | 1614 ++++++++++++++++++++++++++++ meson_options.txt | 70 ++ perl/FromCPAN/Mail/meson.build | 7 + perl/FromCPAN/meson.build | 9 + perl/Git/LoadCPAN/Mail/meson.build | 7 + perl/Git/LoadCPAN/meson.build | 9 + perl/Git/SVN/Memoize/meson.build | 7 + perl/Git/SVN/meson.build | 20 + perl/Git/meson.build | 18 + perl/meson.build | 12 + po/meson.build | 28 + subprojects/.gitignore | 1 + subprojects/curl.wrap | 13 + subprojects/expat.wrap | 13 + subprojects/openssl.wrap | 15 + subprojects/pcre2.wrap | 16 + subprojects/zlib.wrap | 13 + t/helper/meson.build | 91 ++ t/meson.build | 1103 +++++++++++++++++++ templates/hooks/meson.build | 24 + templates/info/meson.build | 5 + templates/meson.build | 13 + 26 files changed, 3208 insertions(+) create mode 100644 bin-wrappers/meson.build create mode 100644 contrib/completion/meson.build create mode 100644 contrib/meson.build create mode 100644 gitweb/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 perl/FromCPAN/Mail/meson.build create mode 100644 perl/FromCPAN/meson.build create mode 100644 perl/Git/LoadCPAN/Mail/meson.build create mode 100644 perl/Git/LoadCPAN/meson.build create mode 100644 perl/Git/SVN/Memoize/meson.build create mode 100644 perl/Git/SVN/meson.build create mode 100644 perl/Git/meson.build create mode 100644 perl/meson.build create mode 100644 po/meson.build create mode 100644 subprojects/.gitignore create mode 100644 subprojects/curl.wrap create mode 100644 subprojects/expat.wrap create mode 100644 subprojects/openssl.wrap create mode 100644 subprojects/pcre2.wrap create mode 100644 subprojects/zlib.wrap create mode 100644 t/helper/meson.build create mode 100644 t/meson.build create mode 100644 templates/hooks/meson.build create mode 100644 templates/info/meson.build create mode 100644 templates/meson.build
bin-wrappers/meson.build new file +28 -0
@@ -0,0 +1,28 @@ +bin_wrappers_config = configuration_data() +foreach key, value : { + 'BUILD_DIR': meson.project_build_root(), + 'MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools', + 'TEMPLATE_DIR': meson.project_build_root() / 'templates', + 'GIT_TEXTDOMAINDIR': meson.project_build_root() / 'po', + 'GITPERLLIB': meson.project_build_root() / 'perl/lib', +} + # Paths need to be Unix-style without drive prefixes as they get added to the + # PATH variable. And given that drive prefixes contain a colon we'd otherwise + # end up with a broken PATH if we didn't convert them. + if cygpath.found() + value = run_command(cygpath, value, check: true).stdout().strip() + endif + bin_wrappers_config.set(key, value) +endforeach + +foreach executable : bin_wrappers + executable_config = configuration_data() + executable_config.merge_from(bin_wrappers_config) + executable_config.set('PROG', fs.relative_to(executable.full_path(), meson.project_build_root())) + + configure_file( + input: 'wrap-for-bin.sh', + output: fs.stem(executable.full_path()), + configuration: executable_config, + ) +endforeach
contrib/completion/meson.build new file +8 -0
@@ -0,0 +1,8 @@ +foreach script : [ + 'git-completion.bash', + 'git-completion.tcsh', + 'git-completion.zsh', + 'git-prompt.sh' +] + test_dependencies += fs.copyfile(script) +endforeach
contrib/meson.build new file +1 -0
@@ -0,0 +1 @@ +subdir('completion')
gitweb/meson.build new file +63 -0
63 lines not on this page · raw message
meson.build new file +1614 -0
1,614 lines not on this page · raw message
meson_options.txt new file +70 -0
70 lines not on this page · raw message
perl/FromCPAN/Mail/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +test_dependencies += custom_target('Address.pm', + input: 'Address.pm', + output: 'Address.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail', +)
perl/FromCPAN/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +test_dependencies += custom_target('Error.pm', + input: 'Error.pm', + output: 'Error.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/FromCPAN', +) + +subdir('Mail')
perl/Git/LoadCPAN/Mail/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +test_dependencies += custom_target('Address.pm', + input: 'Address.pm', + output: 'Address.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail', +)
perl/Git/LoadCPAN/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +test_dependencies += custom_target('Error.pm', + input: 'Error.pm', + output: 'Error.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN', +) + +subdir('Mail')
perl/Git/SVN/Memoize/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +test_dependencies += custom_target('YAML.pm', + input: 'YAML.pm', + output: 'YAML.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/SVN', +)
perl/Git/SVN/meson.build new file +20 -0
@@ -0,0 +1,20 @@ +foreach source : [ + 'Editor.pm', + 'Fetcher.pm', + 'GlobSpec.pm', + 'Log.pm', + 'Migration.pm', + 'Prompt.pm', + 'Ra.pm', + 'Utils.pm', +] + test_dependencies += custom_target(source, + input: source, + output: source, + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/SVN', + ) +endforeach + +subdir('Memoize')
perl/Git/meson.build new file +18 -0
@@ -0,0 +1,18 @@ +foreach source : [ + 'I18N.pm', + 'IndexInfo.pm', + 'LoadCPAN.pm', + 'Packet.pm', + 'SVN.pm', +] + test_dependencies += custom_target(source, + input: source, + output: source, + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git', + ) +endforeach + +subdir('LoadCPAN') +subdir('SVN')
perl/meson.build new file +12 -0
@@ -0,0 +1,12 @@ +test_dependencies += custom_target('Git.pm', + input: 'Git.pm', + output: 'Git.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5', +) + +subdir('Git') +if get_option('perl_cpan_fallback') + subdir('FromCPAN') +endif
po/meson.build new file +28 -0
@@ -0,0 +1,28 @@ +i18n = import('i18n') + +translations = i18n.gettext('git', + languages: [ + 'bg', + 'ca', + 'de', + 'el', + 'es', + 'fr', + 'id', + 'is', + 'it', + 'ko', + 'pl', + 'pt_PT', + 'ru', + 'sv', + 'tr', + 'uk', + 'vi', + 'zh_CN', + 'zh_TW', + ], + install: true, + install_dir: get_option('datadir'), +) +test_dependencies += translations[0]
subprojects/.gitignore new file +1 -0
@@ -0,0 +1 @@ +/*/
subprojects/curl.wrap new file +13 -0
@@ -0,0 +1,13 @@ +[wrap-file] +directory = curl-8.10.1 +source_url = https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/curl_8.10.1-1/curl-8.10.1.tar.xz +source_filename = curl-8.10.1.tar.xz +source_hash = 73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee +patch_filename = curl_8.10.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/curl_8.10.1-1/get_patch +patch_hash = 707c28f35fc9b0e8d68c0c2800712007612f922a31da9637ce706a2159f3ddd8 +wrapdb_version = 8.10.1-1 + +[provide] +dependency_names = libcurl
subprojects/expat.wrap new file +13 -0
@@ -0,0 +1,13 @@ +[wrap-file] +directory = expat-2.6.3 +source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz +source_filename = expat-2.6.3.tar.bz2 +source_hash = 274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc +patch_filename = expat_2.6.3-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.6.3-1/get_patch +patch_hash = cf017fbe105e31428b2768360bd9be39094df4e948a1e8d1c54b6f7c76460cb1 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.6.3-1/expat-2.6.3.tar.bz2 +wrapdb_version = 2.6.3-1 + +[provide] +expat = expat_dep
subprojects/openssl.wrap new file +15 -0
@@ -0,0 +1,15 @@ +[wrap-file] +directory = openssl-3.0.8 +source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz +source_filename = openssl-3.0.8.tar.gz +source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e +patch_filename = openssl_3.0.8-3_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch +patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz +wrapdb_version = 3.0.8-3 + +[provide] +libcrypto = libcrypto_dep +libssl = libssl_dep +openssl = openssl_dep
subprojects/pcre2.wrap new file +16 -0
@@ -0,0 +1,16 @@ +[wrap-file] +directory = pcre2-10.44 +source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2 +source_filename = pcre2-10.44.tar.bz2 +source_hash = d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96 +patch_filename = pcre2_10.44-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.44-2/get_patch +patch_hash = 4336d422ee9043847e5e10dbbbd01940d4c9e5027f31ccdc33a7898a1ca94009 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.44-2/pcre2-10.44.tar.bz2 +wrapdb_version = 10.44-2 + +[provide] +libpcre2-8 = libpcre2_8 +libpcre2-16 = libpcre2_16 +libpcre2-32 = libpcre2_32 +libpcre2-posix = libpcre2_posix
subprojects/zlib.wrap new file +13 -0
@@ -0,0 +1,13 @@ +[wrap-file] +directory = zlib-1.3.1 +source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-1/zlib-1.3.1.tar.gz +source_filename = zlib-1.3.1.tar.gz +source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 +patch_filename = zlib_1.3.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-1/get_patch +patch_hash = e79b98eb24a75392009cec6f99ca5cdca9881ff20bfa174e8b8926d5c7a47095 +wrapdb_version = 1.3.1-1 + +[provide] +zlib = zlib_dep
t/helper/meson.build new file +91 -0
91 lines not on this page · raw message
t/meson.build new file +1103 -0
937 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.0.72.gef8ce8f3d4.dirty
Part of the diff is not shown here. View the raw message.
Re: [RFC PATCH v3 15/15] Introduce support for the Meson build system
Quoted 5 lines · Patrick Steinhardt
Introduce support for the Meson build system, a "modern" meta build system that supports many different plaforms, including Linux, macOS, Windows and BSDs. Meson supports different backends, including Ninja, Xcode and Microsoft Visual Studio. Several common IDEs provide an integration with it.
s/plaforms/platforms/
Quoted 8 lines
The biggest contender compared to Meson is probably CMake as outlined in our "
Documentation/technical/build-systems.txt" file. Based on my own personal experience from working with both build systems extensively I strongly favor Meson over CMake. In my opinion, it feels significantly easier to use with a syntax that feels more like a "real" programming language. The second big reason is that Meson supports Rust natively, which may prove to be important given that the project is likely to pick up Rust as another language eventually.
s/is likely to/may/
Quoted 2 lines
# Execute single test interactively to allow fordebugging. $ meson test 't0000-*' --interactive --test-args=-ix
s/fordebugging/for debugging/
Quoted 5 lines
- We do not install dashed binaries into
$libexec/git-coreanymore. So there won't e.g. be a symlink for git-add(1). These are not required by modern Git and there isn't really much of a usecase for those anymore. By not installing those symlinks we thus start the deprecation of this layout.
s/usecase/use case/
Quoted 5 lines
- We're targeting a Meson 1.3.0, which has been released relatively recently November 2023. The only feature we use from that version is
fs.relative_to(), which we could replace if necessary. If so, we could start to target Meson 1.0.0 and newer, released in December 2022.
s/targeting a Meson/targeting Meson/
Quoted 8 lines · Patrick Steinhardt
Hi,
this is the third version of my patch series that aims to modernize our build system infrastructure. It refactors our existing build infra to be ready for out-of-tree builds and then wires up Meson.
Changes compared to v2:
Quoted 7 lines
- I have split out semi-related changes like the platform compatibility fixes into separate series. More on that further down below, where I explain the current base.
- I have polished the CMake-related changes I've been doing as prereqs while refactoring our build system. Some of the changes weren't tested before, but now CMake works as expected.
Just curious, does the cmake build system work on Linux now?
(cmake is another system that I don't really know, except in a 'monkey-see monkey-do' kinda way)
Quoted 8 lines
- Fixed up some dependencies in our
Makefile, as I didn't amend them to depend on the new generator scripts.- I have extracted some more scripts to massage our Perl library code, shells cripts and gitweb.cgi such that they can be used by Make, CMake and Meson. This also fixes generation of "gitweb.cgi" on Meson as reported by Ramsay.
I haven't had time to test this yet (I haven't even properly read the patches), but from a quick squint, this looks similar to my attempts to do the same thing the other night (minus the cmake stuff, of course).
However, I didn't notice anything in the commit message about changing the format of the GITWEB-BUILD-OPTIONS file, which already exists before that commit. I did the same, btw, but it seems that file was only used to 'notice' when the configuration changed to enable the re-build of gitweb.cgi. In which case, the change in format (rather than content) was not an issue.
Quoted 10 lines
- I have fixed the cyclic dependency in our
Makefilethat I have introduced with v2.- I have addressed some feedback regarding "build-systems.txt".
- I have made things work with OpenBSD 7.6.
- Things now work on Cygwin and MinGW64 as expected, no more test failures except for t9700, which also fails with our
Makefile.
This caused me some concern for a little while, since I don't recall that the t9700 test has ever failed for me on cygwin. I have the test output files for all versions of git (each rc and rel) from v2.12.0-rc0 (5th Feb 2017) to today (all 143 of them) and none of them show that test failing. (I remove files from that directory on occasion when it takes up too much disk space).
However, you qualify that statement in the commit message to make clear that it works on cygwin, but fails on other windows 'targets'. phew! :)
Quoted 9 lines
- I have improved how we set up the required tooling on Windows such that we detect Git for Windows-provided tools as we do with CMake. Like this, VS Code can now trivially import the Meson project and configure it. Furthermore, generation of the Visual Studio solution is trivial as well. So overall, things work fine now on all the important Windows environments that I'm aware of.
- Several smaller fixes all over the place.
Quoted 7 lines
I've included a range-diff, but it's quite crowded overall.
In general I think that this is in a pretty good shape now. I have tested things on NixOS, macOS 10.15, OpenBSD 7.6, FreeBSD 14.1, Windows 10 with MSVC, VS Code, MinGW and Cygwin, and things are generally smooth and just work. I'm sure there's still going to be weirdnesses on some platforms regardless of that.
I had a very quick attempt on cygwin the other night, and it behaved differently at the 'ninja test' stage. It printed something like '[0/1] all tests' and then seemed to do nothing, except 'python3.9' was hovering up all cycles (well over 75% anyway) with no indication of any progress. This was nothing like the behaviour on Linux (which also looked a bit strange, but at least showed progress on each test as it ran).
I ^C-ed it, since I didn't want to wait 6 hours before it (hopefully) finished running.
Thanks!
ATB,
Ramsay Jones
Quoted 10 lines · Ramsay Jones
I had a very quick attempt on cygwin the other night, and it behaved differently at the 'ninja test' stage. It printed something like '[0/1] all tests' and then seemed to do nothing, except 'python3.9' was hovering up all cycles (well over 75% anyway) with no indication of any progress. This was nothing like the behaviour on Linux (which also looked a bit strange, but at least showed progress on each test as it ran).
I ^C-ed it, since I didn't want to wait 6 hours before it (hopefully) finished running.
Running "ninja test" can be thought of as a convenience target to make all commands available via the Makefile equivalent. What it actually does, though, is first depend on "all" + any explicit test dependencies, and then dispatch to the separate "meson test" tool with some tastefully chosen arguments such as "--no-rebuild" (to prevent rerunning ninja) as well as --print-errorlogs.
Running "meson test" directly is still possible, and maybe required if you want to do things such as --interactive, or running a specific testcase rather than all of them, or --maxfail, or well, all kinds of fiddly and specific fine-tuning. :)
But in particular, I am wondering if maybe your cygwin issue is somehow due to ninja deciding that it really really wanted to buffer all output and wait until it completes before showing anything. It's not supposed to do that, since we wire it up to the "console" pool:
https://ninja-build.org/manual.html#_the_literal_console_literal_pool
The other possibility is that the python installation has decided to buffer itself:
https://docs.python.org/3/using/cmdline.html#cmdoption-u
possibly because due to ninja's juggling of pseudo ttys, the python runtime for "meson test" thinks it is *not* running in a tty. I know that ninja messes around with this in counterintuitive ways in general, but I am not sure exactly how that interacts with the console pool. But regardless of the reason -- if it is happening at the python level, then exporting PYTHONUNBUFFERED=1 may help. It's something I've had to do before for programs other than meson, at least.
Signature · 1 line
Eli Schwartz
Quoted 1 line · Eli Schwartz
On 10/18/24 12:08 PM, Ramsay Jones wrote:
[snip]
Quoted 7 lines
possibly because due to ninja's juggling of pseudo ttys, the python runtime for "meson test" thinks it is *not* running in a tty. I know that ninja messes around with this in counterintuitive ways in general, but I am not sure exactly how that interacts with the console pool. But regardless of the reason -- if it is happening at the python level, then exporting PYTHONUNBUFFERED=1 may help. It's something I've had to do before for programs other than meson, at least.
Unfortunately, the 'PYTHONUNBUFFERED=1' idea didn't work. In fact nothing I have tried on cygwin has worked. For example, if I use meson to run just few tests, like so on Linux:
$ meson test --no-rebuild --print-errorlogs 't000*' 1/9 t0000-basic OK 7.52s 2/9 t0001-init OK 1.88s 3/9 t0002-gitfile OK 0.37s 4/9 t0003-attributes OK 1.35s 5/9 t0004-unwritable OK 0.23s 6/9 t0005-signals OK 0.16s 7/9 t0006-date OK 0.73s 8/9 t0007-git-var OK 0.40s 9/9 t0008-ignores OK 3.09s
Ok: 9 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt $
On cygwin it looks like:
$ meson test --no-rebuild --print-errorlogs 't000*' 1/9 t0002-gitfile OK 12.32s [2-4/9] 🌖 t0003-attributes 12s
Which actually looks nothing like what actually happens! The first line is actually the result of (*maybe*) running all 9 tests, but during that time the line started with '[1-4/9] ...' and they didn't run in sequence but jumped around ending with t0002. Then on the second line, it almost immediately hung, again with python hovering up all the cpu cycles. So I had to kill the task from a second terminal.
Actually, I tell a lie, I did get a single test to work on cygwin:
$ meson test --no-rebuild --print-errorlogs 't0001*' 1/1 t0001-init OK 32.95s
Ok: 1 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt $
Notice that this took much longer, at 32.95s, than (what looked like) all nine tests above at 12.32s. (although via 'make test' t0000-basic.sh alone took 124.13s for v2.47.0!).
Patrick, how do you run the tests on cygwin?
ATB,
Ramsay Jones
Quoted 61 lines · Ramsay Jones
Quoted 1 line · Eli Schwartz
On 10/18/24 12:08 PM, Ramsay Jones wrote:
[snip]
Quoted 7 lines
possibly because due to ninja's juggling of pseudo ttys, the python runtime for "meson test" thinks it is *not* running in a tty. I know that ninja messes around with this in counterintuitive ways in general, but I am not sure exactly how that interacts with the console pool. But regardless of the reason -- if it is happening at the python level, then exporting PYTHONUNBUFFERED=1 may help. It's something I've had to do before for programs other than meson, at least.
Unfortunately, the 'PYTHONUNBUFFERED=1' idea didn't work. In fact nothing I have tried on cygwin has worked. For example, if I use meson to run just few tests, like so on Linux:
$ meson test --no-rebuild --print-errorlogs 't000*' 1/9 t0000-basic OK 7.52s 2/9 t0001-init OK 1.88s 3/9 t0002-gitfile OK 0.37s 4/9 t0003-attributes OK 1.35s 5/9 t0004-unwritable OK 0.23s 6/9 t0005-signals OK 0.16s 7/9 t0006-date OK 0.73s 8/9 t0007-git-var OK 0.40s 9/9 t0008-ignores OK 3.09sOk: 9 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0Full log written to
/home/ramsay/git/build/meson-logs/testlog.txt$On cygwin it looks like:
$ meson test --no-rebuild --print-errorlogs 't000*' 1/9 t0002-gitfile OK 12.32s [2-4/9] 🌖 t0003-attributes 12sWhich actually looks nothing like what actually happens! The first line is actually the result of (*maybe*) running all 9 tests, but during that time the line started with '[1-4/9] ...' and they didn't run in sequence but jumped around ending with t0002. Then on the second line, it almost immediately hung, again with python hovering up all the cpu cycles. So I had to kill the task from a second terminal.
Actually, I tell a lie, I did get a single test to work on cygwin:
$ meson test --no-rebuild --print-errorlogs 't0001*' 1/1 t0001-init OK 32.95sOk: 1 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0
Quoted 8 lines
Full log written to
/home/ramsay/git/build/meson-logs/testlog.txt$Notice that this took much longer, at 32.95s, than (what looked like) all nine tests above at 12.32s. (although via 'make test'
t0000-basic.shalone took 124.13s for v2.47.0!).Patrick, how do you run the tests on cygwin?
I didn't have to do anything special here, so this is quite puzzling. In a fully-updated Cygwin installation:
$ which meson
/usr/bin/meson
$ meson --version
1.3.2
$ python --version
3.9.16
$ mkdir build
$ meson setup ..
... autoconfiguration logs ...
$ meson test 't000*'
ninja: Entering directory `/home/Patrick Steinhardt/git/build'
[582/582] Linking target git-receive-pack.exe
1/9 t0005-signals OK 4.17s
2/9 t0004-unwritable OK 4.58s
3/9 t0002-gitfile OK 6.95s
4/9 t0007-git-var OK 8.15s
5/9 t0006-date OK 15.42s
6/9 t0003-attributes OK 26.84s
7/9 t0001-init OK 29.09s
8/9 t0008-ignores OK 57.17s
9/9 t0000-basic OK 83.82s Ok: 9
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0 Full log written to /home/Patrick Steinhardt/git/build/meson-logs/testlog.txt
This is starting with a fresh repo, I executed git clean -dfx beforehand.
Do any of the versions used maybe differ?
Patrick
Quoted 10 lines · Patrick Steinhardt
Quoted 5 lines · Ramsay Jones
Quoted 1 line · Eli Schwartz
On 10/18/24 12:08 PM, Ramsay Jones wrote:
[snip]
Patrick, how do you run the tests on cygwin?
I didn't have to do anything special here, so this is quite puzzling. In a fully-updated Cygwin installation:
Quoted 10 lines
$ which meson
/usr/bin/meson
$ meson --version
1.3.2
$ python --version
3.9.16
$ mkdir build
$ meson setup ..
... autoconfiguration logs ...
$ meson test 't000*'Hmm, I could have sworn that this caused a complete rebuild for me (even when having just built), hence the '--no-rebuild --print-errorlogs' parameters to meson test. (Oh, maybe that was just 'meson test' - so how do you run *all* tests with meson - rather than 'ninja test').
Quoted 19 lines
ninja: Entering directory `/home/Patrick Steinhardt/git/build' [582/582] Linking target git-receive-pack.exe
1/9 t0005-signals OK 4.17s
2/9 t0004-unwritable OK 4.58s
3/9 t0002-gitfile OK 6.95s
4/9 t0007-git-var OK 8.15s
5/9 t0006-date OK 15.42s
6/9 t0003-attributes OK 26.84s
7/9 t0001-init OK 29.09s
8/9 t0008-ignores OK 57.17s
9/9 t0000-basic OK 83.82sOk: 9
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Quoted 4 lines
Full log written to
/home/PatrickSteinhardt/git/build/meson-logs/testlog.txtThis is starting with a fresh repo, I executed
git clean -dfxbeforehand.
Hmm, I have far to many 'precious' files to use 'git clean'! (perhaps I should clone the repo to get a totally clean slate).
Quoted 2 lines
Do any of the versions used maybe differ?
Ah, yes, I should have noted the versions:
$ uname -a CYGWIN_NT-10.0-19045 satellite 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin $
$ which meson ninja python /usr/bin/meson /usr/bin/ninja /usr/bin/python $
$ meson --version 1.3.2 $
$ ninja --version 1.12.0 $
$ python --version Python 3.9.18 $
So, a slightly newer python - what versions of ninja and the cygwin '.dll' are you using? (the latter is more likely to cause an issue).
BTW, I have been doing:
$ meson setup .. -Dprefix=$HOME
so that it matches the default prefix from the Makefile (not that I have attempted to actually install yet!;) ). Can the default be set in the meson.build file (with command-line override, of course)?
ATB,
Ramsay Jones
Quoted 4 lines · Ramsay Jones
Hmm, I could have sworn that this caused a complete rebuild for me (even when having just built), hence the '--no-rebuild --print-errorlogs' parameters to meson test. (Oh, maybe that was just 'meson test' - so how do you run *all* tests with meson - rather than 'ninja test').
"meson test" without --no-rebuild will first run "ninja" to verify that everything has been built, and build it if it hasn't been. When passing specific test names, it will filter for dependencies of that specific testcase, and only ensure *those* are up to date. Assuming those dependencies are accurate, of course. :D
What do you mean by "complete rebuild"? Do you mean all binaries that were already built and up to date get marked stale and recreated?
Quoted 7 lines
BTW, I have been doing:
$ meson setup .. -Dprefix=$HOMEso that it matches the default prefix from the
Makefile(not that I have attempted to actually install yet!;) ). Can the default be set in the meson.build file (with command-line override, of course)?
project('git', 'c',
meson_version: '>=1.3.0',
# MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
# on MSVC. So we instead fall back to C11 there. default_options: ['c_std=gnu99,c11'],
You can pass any command-line options in as default_options, including prefix. Defaulting to $HOME is somewhat unconventional regardless of whether it's done in a Makefile or a configure.ac or a meson.build or a CMakeLists.txt, but given the Makefile does indeed do that I suppose it's not incredibly bizarre to do it in meson.build as well. :)
Signature · 1 line
Eli Schwartz
Quoted 7 lines · Eli Schwartz
Quoted 4 lines · Ramsay Jones
Hmm, I could have sworn that this caused a complete rebuild for me (even when having just built), hence the '--no-rebuild --print-errorlogs' parameters to meson test. (Oh, maybe that was just 'meson test' - so how do you run *all* tests with meson - rather than 'ninja test').
Quoted 5 lines
"meson test" without --no-rebuild will first run "ninja" to verify that everything has been built, and build it if it hasn't been. When passing specific test names, it will filter for dependencies of that specific testcase, and only ensure *those* are up to date. Assuming those dependencies are accurate, of course. :D
Heh, yes, I just tried it tonight, and it did just as you describe:
$ meson test ninja: Entering directory `/home/ramsay/new-git/build' ninja: no work to do. $
Quoted 2 lines
What do you mean by "complete rebuild"? Do you mean all binaries that were already built and up to date get marked stale and recreated?
My bad, I was a little loose in my language. Whatever it was that I typed (and I obviously can't remember what it was!), resulted in meson going through the configuration step again followed by compilation/linking of all binaries (or at least, that's what it looked like).
Quoted 9 lines
Quoted 7 lines
BTW, I have been doing:
$ meson setup .. -Dprefix=$HOMEso that it matches the default prefix from the
Makefile(not that I have attempted to actually install yet!;) ). Can the default be set in the meson.build file (with command-line override, of course)?
Quoted 5 lines
project('git', 'c',
meson_version: '>=1.3.0',
# MSVC does not support GNU99, and C99 does not define__STDC_VERSION__# on MSVC. So we instead fall back to C11 there. default_options: ['c_std=gnu99,c11'],
Ah yes, this seems to work:
$ git diff
diff --git a/meson.build b/meson.build
index 7c7a59d7fb..23b6f0baa2 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,7 @@ project('git', 'c',
meson_version: '>=1.3.0',
# MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
# on MSVC. So we instead fall back to C11 there.
- default_options: ['c_std=gnu99,c11'],
+ default_options: ['c_std=gnu99,c11', 'prefix=$HOME'],
version: 'v2.47.GIT',
) $
$ meson setup .. --reconfigure
...
User defined options
prefix: /home/ramsay Found ninja-1.12.0 at /usr/bin/ninja
Cleaning... 0 files.
$
Using the command-line to override also works:
$ meson setup .. --reconfigure -Dprefix=/usr/local ...
User defined options
prefix: /usr/local
Found ninja-1.12.0 at /usr/bin/ninja
Cleaning... 0 files.
$
Quoted 5 lines
You can pass any command-line options in as
default_options, including prefix. Defaulting to $HOME is somewhat unconventional regardless of whether it's done in aMakefileor a configure.ac or a meson.build or a CMakeLists.txt, but given theMakefiledoes indeed do that I suppose it's not incredibly bizarre to do it in meson.build as well. :)
I don't have any strong feelings either way, it's just that people are used to doing a 'make install' and having the git build installed in their home directory (including me). But it is not a huge effort to add the '-Dprefix=$HOME', it simply needs to be documented.
I think I need to go away and RTFM at this point and not annoy you (and others) with such noob questions! :)
[For me ATM, meson works fine on Linux, but it simply doesn't work at all on cygwin as far as the tests are concerned (and I haven't tried installing yet). Patrick is not seeing any problems, so I would like to understand why we have such different results.]
Thanks!
ATB,
Ramsay Jones
Quoted 10 lines · Ramsay Jones
Quoted 5 lines
You can pass any command-line options in as
default_options, including prefix. Defaulting to $HOME is somewhat unconventional regardless of whether it's done in aMakefileor a configure.ac or a meson.build or a CMakeLists.txt, but given theMakefiledoes indeed do that I suppose it's not incredibly bizarre to do it in meson.build as well. :)I don't have any strong feelings either way, it's just that people are used to doing a 'make install' and having the git build installed in their home directory (including me). But it is not a huge effort to add the '-Dprefix=$HOME', it simply needs to be documented.
For now I'll leave it as-is, but if people feel strongly about it I don't mind changing the default value.
Quoted 2 lines
I think I need to go away and RTFM at this point and not annoy you (and others) with such noob questions! :)
I find your input to be highly valuable, so thanks for testing things!
Patrick
Quoted 6 lines · Ramsay Jones
Quoted 1 line
Do any of the versions used maybe differ?
Ah, yes, I should have noted the versions:
$ uname -a CYGWIN_NT-10.0-19045 satellite 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin
I'm on basically the same system:
CYGWIN_NT-10.0-19045 DESKTOP-OLQRBOP 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin
Which makes this even weirder.
Quoted 12 lines
$
$ which meson ninja python /usr/bin/meson /usr/bin/ninja /usr/bin/python $$ meson --version 1.3.2 $
Quoted 7 lines
$ ninja --version 1.12.0 $$ python --version Python 3.9.18 $
Let me try to update Cygwin to the latest versions... huh. Why is your Python version newer than mine? I cannot seem to find this version of Python in any of the mirrors.
Oh, wait! I can see that there's a "python3" 3.9.18 available as a testing version. I don't quite understand how this works though, because when I install it I still have Python 3.9.16. Seems like there are two Python packages: "python3", which has the 3.9.18 test version, and then there's "python39", which only has 3.9.16. The first one just seems to be a meta package, so it doesn't contain anything.
So... where did you get Python 3.9.18 from? You mentioned that it also hogs all CPU, so could it be that this is basically a broken Python installation?
Patrick
Quoted 2 lines · Patrick Steinhardt
Quoted 1 line · Ramsay Jones
Quoted 1 line
Do any of the versions used maybe differ?
[snip]
Quoted 10 lines
Oh, wait! I can see that there's a "python3" 3.9.18 available as a testing version. I don't quite understand how this works though, because when I install it I still have Python 3.9.16. Seems like there are two Python packages: "python3", which has the 3.9.18 test version, and then there's "python39", which only has 3.9.16. The first one just seems to be a meta package, so it doesn't contain anything.
So... where did you get Python 3.9.18 from? You mentioned that it also hogs all CPU, so could it be that this is basically a broken Python installation?
Hmm I have no idea how my python installation got messed up (I never try to install TEST packages, but I do just install anything that is in the 'pending' page without even thinking!).
Last night I remembered that when installing something recently on windows it also (without even asking) installed a windows python as well, but that is hidden due to my path ...
$ /cygdrive/c/Users/ramsay/AppData/Local/Programs/Python/Python312/python --version Python 3.12.4 $
My current python packages (which include many obsolete python2 packages) looks like:
$ cygcheck -c python Cygwin Package Information Package Version Status python 3.0.0-1 OK $ cygcheck -c python3 Cygwin Package Information Package Version Status python3 3.9.18-1 OK $ which python python3 /usr/bin/python /usr/bin/python3 $ python --version Python 3.9.18 $ python3 --version Python 3.9.18 $
Go away and wrangle with setup.exe ...
$ python --version Python 3.9.16 $ python3 --version Python 3.9.16 $ which python python3 /usr/bin/python /usr/bin/python3 $ cd git $ mkdir build $ cd build $ meson setup .. -Dprefix=$HOME ... git v2.47.GIT
User defined options
prefix: /home/ramsay
Found ninja-1.12.0 at /usr/bin/ninja
$ ninja [699/699] Linking target t/helper/test-tool.exe $ meson test 't000*' ninja: Entering directory `/home/ramsay/git/build' ninja: no work to do. 1/9 t0002-gitfile OK 10.52s 2/9 t0004-unwritable OK 6.78s 3/9 t0005-signals OK 5.96s 4/9 t0003-attributes OK 54.40s 5/9 t0006-date OK 31.39s 6/9 t0001-init OK 61.68s 7/9 t0007-git-var OK 12.93s 8/9 t0008-ignores FAIL 106.29s exit status 1
Quoted 1 line
Quoted 1 line
Quoted 1 line
PATH='/home/ramsay/git:/usr/bin:/usr/bin:/usr/bin:/usr/bin:/home/ramsay/bin:/usr/bin:/usr/bin:/home/ramsay/bin:/home/ramsay/bin:/usr/local/bin:/usr/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Users/ramsay/AppData/Local/Programs/Python/Python312/Scripts:/cygdrive/c/Users/ramsay/AppData/Local/Programs/Python/Python312:/cygdrive/c/Users/ramsay/AppData/Local/Programs/Python/Launcher:/cygdrive/c/Users/ramsay/AppData/Local/Microsoft/WindowsApps:/usr/lib/lapack' MALLOC_PERTURB_=105 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 GIT_BUILD_DIR=/home/ramsay/git/build
/usr/bin/sht0008-ignores.sh
9/9 t0000-basic OK 193.52s
Ok: 8 Expected Fail: 0 Fail: 1 Unexpected Pass: 0 Skipped: 0 Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt $
So, a big improvement! :)
Having a quick squint at the failure, it '# failed 1 among 397 test(s)' which was 'not ok 391 - correct handling of backslashes', which is the only test marked with a '!CYGWIN' prerequisite! ;) So it seems that I am doing something wrong, which results in the prerequisite not being set.
I haven't debugged that yet, but I wanted to note the above improvement having 'fixed' my python installation. (It doesn't look good for the TEST package! :) ).
Thanks!
ATB,
Ramsay Jones
`
Quoted 6 lines · Ramsay Jones
On 24/10/2024 08:19, Patrick Steinhardt wrote:
Having a quick squint at the failure, it '# failed 1 among 397 test(s)' which was 'not ok 391 - correct handling of backslashes', which is the only test marked with a '!CYGWIN' prerequisite! ;) So it seems that I am doing something wrong, which results in the prerequisite not being set.
The CYGWIN prerequisite is set depending on whether or not uname -s contains "*CYGWIN*". Does your system maybe pick up the wrong uname(1) binary somehow?
Quoted 3 lines
I haven't debugged that yet, but I wanted to note the above improvement having 'fixed' my python installation. (It doesn't look good for the TEST package! :) ).
Great, happy to hear that this is resolved now.
Patrick
Quoted 11 lines · Patrick Steinhardt
Quoted 6 lines · Ramsay Jones
On 24/10/2024 08:19, Patrick Steinhardt wrote:
Having a quick squint at the failure, it '# failed 1 among 397 test(s)' which was 'not ok 391 - correct handling of backslashes', which is the only test marked with a '!CYGWIN' prerequisite! ;) So it seems that I am doing something wrong, which results in the prerequisite not being set.The CYGWIN prerequisite is set depending on whether or not
uname -scontains "*CYGWIN*". Does your system maybe pick up the wrong uname(1) binary somehow?
Yep, I suspected that I knew what the problem was, I just had not looked to see if my hunch was correct yet! :) And indeed:
$ pwd /home/ramsay/git $ ls -l uname* -rw-r--r-- 1 ramsay None 11K Jun 28 2019 uname.c -rwxr-xr-x 1 ramsay None 167K Jun 28 2019 uname.exe* $ ./uname -s Windows $ ./uname -a Windows satellite 10.0 19045() AMD-64 Windows 10 Home $ uname -a CYGWIN_NT-10.0-19045 satellite 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin $
As you can see, many many moons ago (28 Jun 2019 was just the last time it was updated/built - I suspect it was first written in 2006), I had written my own version of uname. If memory serves, it was actually for the 'msys' version, not cygwin! ;)
Anyway, when the test executes my PATH starts:
/home/ramsay/git/build/bin-wrappers:/home/ramsay/git:/usr/bin ...
It is not immediately obvious why '/home/ramsay/git' is in there, but if I move my uname out of the way:
$ mv uname* ../src $ ls -l uname* ls: cannot access 'uname*': No such file or directory $
then everything works:
$ cd build $ meson test 't000*' ninja: Entering directory `/home/ramsay/git/build' ninja: no work to do. 1/9 t0002-gitfile OK 10.28s 2/9 t0004-unwritable OK 6.70s 3/9 t0005-signals OK 6.13s 4/9 t0003-attributes OK 52.56s 5/9 t0006-date OK 30.16s 6/9 t0001-init OK 60.24s 7/9 t0007-git-var OK 12.93s 8/9 t0008-ignores OK 106.42s 9/9 t0000-basic OK 192.99s
Ok: 9 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt $
So, I just need to build the v4 version and test again (at some point I have to do a full (6 hour+) test run on cygwin!).
Thanks!
ATB,
Ramsay Jones
Quoted 41 lines · Ramsay Jones
Quoted 11 lines · Patrick Steinhardt
Quoted 6 lines · Ramsay Jones
On 24/10/2024 08:19, Patrick Steinhardt wrote:
Having a quick squint at the failure, it '# failed 1 among 397 test(s)' which was 'not ok 391 - correct handling of backslashes', which is the only test marked with a '!CYGWIN' prerequisite! ;) So it seems that I am doing something wrong, which results in the prerequisite not being set.The CYGWIN prerequisite is set depending on whether or not
uname -scontains "*CYGWIN*". Does your system maybe pick up the wrong uname(1) binary somehow?Yep, I suspected that I knew what the problem was, I just had not looked to see if my hunch was correct yet! :) And indeed:
$ pwd /home/ramsay/git $ ls -l uname* -rw-r--r-- 1 ramsay None 11K Jun 28 2019 uname.c -rwxr-xr-x 1 ramsay None 167K Jun 28 2019 uname.exe* $ ./uname -s Windows $ ./uname -a Windows satellite 10.0 19045() AMD-64 Windows 10 Home $ uname -a CYGWIN_NT-10.0-19045 satellite 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin $As you can see, many many moons ago (28 Jun 2019 was just the last time it was updated/built - I suspect it was first written in 2006), I had written my own version of uname. If memory serves, it was actually for the 'msys' version, not cygwin! ;)
Anyway, when the test executes my PATH starts:
/home/ramsay/git/build/bin-wrappers:/home/ramsay/git:/usr/bin ...
Quoted 7 lines
It is not immediately obvious why '
/home/ramsay/git' is in there, but if I move my uname out of the way:$ mv uname* ../src $ ls -l uname* ls: cannot access 'uname*': No such file or directory $
Interesting. I guess that find_program() finds some of the required binaries in the Git directory itself, which sounds wrong to me. I'll have a look at this.
Patrick
Quoted 13 lines · Ramsay Jones
Quoted 12 lines · Patrick Steinhardt
Hi,
this is the third version of my patch series that aims to modernize our build system infrastructure. It refactors our existing build infra to be ready for out-of-tree builds and then wires up Meson.
Changes compared to v2:
- I have split out semi-related changes like the platform compatibility fixes into separate series. More on that further down below, where I explain the current base.
Quoted 8 lines
Quoted 3 lines
- I have polished the CMake-related changes I've been doing as prereqs while refactoring our build system. Some of the changes weren't tested before, but now CMake works as expected.
Just curious, does the cmake build system work on Linux now?
(cmake is another system that I don't really know, except in a 'monkey-see monkey-do' kinda way)
To some extent. Some issues have been fixed and/or improved by this series, but we're not fully there for CMake:
- It builds, but the build leaks outside of the build directory into the source tree. In theory we now have all parts together to fix that, as demonstrated by the Meson build support, but I didn't wire this up.
- The tests do not run at all for me, might be I'm holding it wrong. But with the patch that allows us to override the GIT-BUILD-DIR we should be able to get out-of-tree tests running, as well. Again, I didn't wire this up.
- Some things simply haven't been wired up at all, like building "gitweb.cgi". Any gitweb-tests would thus fail.
But in any case, this patch series doesn't regress support for CMake anymore like previous versions did.
Quoted 12 lines
Quoted 7 lines
- Fixed up some dependencies in our
Makefile, as I didn't amend them to depend on the new generator scripts.- I have extracted some more scripts to massage our Perl library code, shells cripts and gitweb.cgi such that they can be used by Make, CMake and Meson. This also fixes generation of "gitweb.cgi" on Meson as reported by Ramsay.
I haven't had time to test this yet (I haven't even properly read the patches), but from a quick squint, this looks similar to my attempts to do the same thing the other night (minus the cmake stuff, of course).
Quoted 5 lines
However, I didn't notice anything in the commit message about changing the format of the GITWEB-BUILD-OPTIONS file, which already exists before that commit. I did the same, btw, but it seems that file was only used to 'notice' when the configuration changed to enable the re-build of gitweb.cgi. In which case, the change in format (rather than content) was not an issue.
Yeah, it's been a bit weird before. It contained sed commands to execute, but also some other relevant build options. Made this whole thing a bit weird to use.
In any case, it works the same way that GIT-BUILD-OPTIONS work now, which I think is a good thing. The plumbing around it is a bit verbose, but other than that I think it's straight-forward.
Quoted 18 lines
Quoted 10 lines
- I have fixed the cyclic dependency in our
Makefilethat I have introduced with v2.- I have addressed some feedback regarding "build-systems.txt".
- I have made things work with OpenBSD 7.6.
- Things now work on Cygwin and MinGW64 as expected, no more test failures except for t9700, which also fails with our
Makefile.This caused me some concern for a little while, since I don't recall that the t9700 test has ever failed for me on cygwin. I have the test output files for all versions of git (each rc and rel) from v2.12.0-rc0 (5th Feb 2017) to today (all 143 of them) and none of them show that test failing. (I remove files from that directory on occasion when it takes up too much disk space).
Quoted 2 lines
However, you qualify that statement in the commit message to make clear that it works on cygwin, but fails on other windows 'targets'. phew! :)
Oh, yeah, that one seems misleading indeed.
Quoted 25 lines
Quoted 9 lines
- I have improved how we set up the required tooling on Windows such that we detect Git for Windows-provided tools as we do with CMake. Like this, VS Code can now trivially import the Meson project and configure it. Furthermore, generation of the Visual Studio solution is trivial as well. So overall, things work fine now on all the important Windows environments that I'm aware of.
- Several smaller fixes all over the place.
Quoted 7 lines
I've included a range-diff, but it's quite crowded overall.
In general I think that this is in a pretty good shape now. I have tested things on NixOS, macOS 10.15, OpenBSD 7.6, FreeBSD 14.1, Windows 10 with MSVC, VS Code, MinGW and Cygwin, and things are generally smooth and just work. I'm sure there's still going to be weirdnesses on some platforms regardless of that.
I had a very quick attempt on cygwin the other night, and it behaved differently at the 'ninja test' stage. It printed something like '[0/1] all tests' and then seemed to do nothing, except 'python3.9' was hovering up all cycles (well over 75% anyway) with no indication of any progress. This was nothing like the behaviour on Linux (which also looked a bit strange, but at least showed progress on each test as it ran).
Quoted 2 lines
I ^C-ed it, since I didn't want to wait 6 hours before it (hopefully) finished running.
Interesting, that's something I didn't experience yet. I'll chime in further down in this thread.
Patrick
Quoted 10 lines · Patrick Steinhardt
This series is based on
15030f9556(The second batch, 2024-10-15) and has the following dependencies:- ps/cmake-clar at
c6d3e52c91(cmake: set up proper dependencies for generated clar headers, 2024-10-15).- ps/upgrade-clar at
f3501edb0e(Makefile: adjust sed command forgenerating "clar-decls.h", 2024-10-14).- ps/platform-compat-fixes at
80ebd91b83(http: fix build error on
Quoted 8 lines
FreeBSD, 2024-10-16).These deps are mostly just there to make tests pass on all platforms, but I wouldn't want folks to go test things and discover breakage that is not caused by Meson itself :) You can also find this version of the patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with keeping this out of "seen" if you prefer to wait for those dependencies to land first.
Of the three, only the last one is marked as "Will merge to 'next'?" in the next integration round[^1]. All three are in 'seen', so this should apply cleanly on top of those.
What is the state of those first two topics? Are they ready to go, or are we expecting a new round for any of them?
Thanks,
Taylor
[^1]: I think I will do another full integration cycle on Tuesday of
next week, but I am not entirely sure yet.
Quoted 20 lines · Taylor Blau
Quoted 10 lines · Patrick Steinhardt
This series is based on
15030f9556(The second batch, 2024-10-15) and has the following dependencies:- ps/cmake-clar at
c6d3e52c91(cmake: set up proper dependencies for generated clar headers, 2024-10-15).- ps/upgrade-clar at
f3501edb0e(Makefile: adjust sed command forgenerating "clar-decls.h", 2024-10-14).- ps/platform-compat-fixes at
80ebd91b83(http: fix build error onQuoted 8 lines
FreeBSD, 2024-10-16).These deps are mostly just there to make tests pass on all platforms, but I wouldn't want folks to go test things and discover breakage that is not caused by Meson itself :) You can also find this version of the patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with keeping this out of "seen" if you prefer to wait for those dependencies to land first.
Quoted 6 lines
Of the three, only the last one is marked as "Will merge to 'next'?" in the next integration round[^1]. All three are in 'seen', so this should apply cleanly on top of those.
What is the state of those first two topics? Are they ready to go, or are we expecting a new round for any of them?
These have been merged into a single topic now and should be ready to go from my point of view. But they still require reviews.
Patrick
Quoted 25 lines · Patrick Steinhardt
Quoted 24 lines · Taylor Blau
Quoted 10 lines · Patrick Steinhardt
This series is based on
15030f9556(The second batch, 2024-10-15) and has the following dependencies:- ps/cmake-clar at
c6d3e52c91(cmake: set up proper dependencies for generated clar headers, 2024-10-15).- ps/upgrade-clar at
f3501edb0e(Makefile: adjust sed command forgenerating "clar-decls.h", 2024-10-14).- ps/platform-compat-fixes at
80ebd91b83(http: fix build error onQuoted 8 lines
FreeBSD, 2024-10-16).These deps are mostly just there to make tests pass on all platforms, but I wouldn't want folks to go test things and discover breakage that is not caused by Meson itself :) You can also find this version of the patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with keeping this out of "seen" if you prefer to wait for those dependencies to land first.
Of the three, only the last one is marked as "Will merge to 'next'?" in the next integration round[^1]. All three are in 'seen', so this should apply cleanly on top of those.
Quoted 5 lines
Quoted 2 lines
What is the state of those first two topics? Are they ready to go, or are we expecting a new round for any of them?
These have been merged into a single topic now and should be ready to go from my point of view. But they still require reviews.
OK, so: ps/platform-compat-fixes is in 'next', and ps/cmake-clar has been folded into ps/upgrade-clar. Have all three have been combined into ps/build?
If so, should this topic be rebuilt on ps/upgrade-clar so that we don't see the same patches twice, perhaps? Or am I still missing something here?
Thanks,
Taylor
Quoted 32 lines · Taylor Blau
Quoted 25 lines · Patrick Steinhardt
Quoted 24 lines · Taylor Blau
Quoted 10 lines · Patrick Steinhardt
This series is based on
15030f9556(The second batch, 2024-10-15) and has the following dependencies:- ps/cmake-clar at
c6d3e52c91(cmake: set up proper dependencies for generated clar headers, 2024-10-15).- ps/upgrade-clar at
f3501edb0e(Makefile: adjust sed command forgenerating "clar-decls.h", 2024-10-14).- ps/platform-compat-fixes at
80ebd91b83(http: fix build error onQuoted 8 lines
FreeBSD, 2024-10-16).These deps are mostly just there to make tests pass on all platforms, but I wouldn't want folks to go test things and discover breakage that is not caused by Meson itself :) You can also find this version of the patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with keeping this out of "seen" if you prefer to wait for those dependencies to land first.
Of the three, only the last one is marked as "Will merge to 'next'?" in the next integration round[^1]. All three are in 'seen', so this should apply cleanly on top of those.
Quoted 5 lines
Quoted 2 lines
What is the state of those first two topics? Are they ready to go, or are we expecting a new round for any of them?
These have been merged into a single topic now and should be ready to go from my point of view. But they still require reviews.
Quoted 7 lines
OK, so: ps/platform-compat-fixes is in 'next', and ps/cmake-clar has been folded into ps/upgrade-clar. Have all three have been combined into ps/build?
If so, should this topic be rebuilt on ps/upgrade-clar so that we don't see the same patches twice, perhaps? Or am I still missing something here?
No, you don't miss anything here, rebuilding this on top of ps/upgrade-clar plus ps/platform-compat-fixes is exactly the right thing to do.
Patrick
Quoted 11 lines · Patrick Steinhardt
This series is based on
15030f9556(The second batch, 2024-10-15) and has the following dependencies:- ps/cmake-clar at
c6d3e52c91(cmake: set up proper dependencies for generated clar headers, 2024-10-15).- ps/upgrade-clar at
f3501edb0e(Makefile: adjust sed command forgenerating "clar-decls.h", 2024-10-14).- ps/platform-compat-fixes at
80ebd91b83(http: fix build error onFreeBSD, 2024-10-16).
While this is still sitting on my review queue, I rebuilt this topic based on the above (extremely helpful) information, but it seems to produce some conflicts when I try to merge it in at the end of 'seen':
--- 8< ---
Makefile +0 -0
@@@ -3932,10 -3859,9 +3886,18 @@@ GIT-TEST-SUITES: FORC fi
$(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) GIT-TEST-SUITES
++<<<<<<< HEAD
+ $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(filter %.c,$^)
++||||||| merged common ancestors
++ $(QUIET_GEN)for suite in $(CLAR_TEST_SUITES); do \
++ sed -ne "s/^\(void test_$${suite}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$$\)/extern \1;/p" $(UNIT_TEST_DIR)/$$suite.c; \
++ done >$@
++=======
+ $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES))
++>>>>>>> ps/build
$(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h
$(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $< >$(UNIT_TEST_DIR)/clar.suite
+$(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite
$(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h
$(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR)
$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(GITLIBS) GIT-LDFLAGS
t/unit-tests/clar/clar.c +0 -0
@@@ -812,9 -801,8 +812,17 @@@ void clar__assert_equal } } } ++<<<<<<< HEAD +#endif /* CLAR_HAVE_WCHAR */ else if (!strcmp("%"PRIuMAX, fmt) || !strcmp("%"PRIxMAX, fmt)) {uintmax_t sz1 =va_arg (args, uintmax_t), sz2 =va_arg (args, uintmax_t); ++||||||| merged common ancestors ++ else if (!strcmp("%"PRIuZ, fmt) || !strcmp("%"PRIxZ, fmt)) { ++ size_t sz1 = va_arg(args, size_t), sz2 = va_arg(args, size_t); ++======= ++ else if (!strcmp("%"PRIuMAX, fmt) || !strcmp("%"PRIxMAX, fmt)) { ++ uintmax_t sz1 = va_arg(args, uintmax_t), sz2 = va_arg(args, uintmax_t); ++>>>>>>> ps/build is_equal = (sz1 == sz2);if (!is_equal) {int offset =p_snprintf (buf,sizeof (buf), fmt, sz1);
t/unit-tests/generate-clar-decls.sh +0 -0
@@@ -1,16 -1,16 +1,36 @@@ ++<<<<<<< HEAD +#!/bin/sh + +if test $# -lt 2 +then + echo "USAGE: $0 <OUTPUT> <SUITE>..." 2>&1 + exit 1 +fi + +OUTPUT="$1" +shift + +for suite in "$@" +do + sed -ne "s/^\(void test_$(basename "${suite%.c}")__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" || + exit 1 +done >"$OUTPUT" ++||||||| merged common ancestors ++======= + #!/bin/sh + + if test $# -lt 2 + then + echo "USAGE: $0 <OUTPUT> <SUITE>..." 2>&1 + exit 1 + fi + + OUTPUT="$1" + shift + + for suite in "$@" + do + sed -ne "s/^\(void test_$suite__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$\)/extern \1;/p" "$suite" || + exit 1 + done >"$OUTPUT" ++>>>>>>> ps/build --- >8 ---
Thanks,
Taylor
Quoted 10 lines · Taylor Blau
Quoted 9 lines · Patrick Steinhardt
This series is based on
15030f9556(The second batch, 2024-10-15) and has the following dependencies:- ps/cmake-clar at
c6d3e52c91(cmake: set up proper dependencies for generated clar headers, 2024-10-15).- ps/upgrade-clar at
f3501edb0e(Makefile: adjust sed command forgenerating "clar-decls.h", 2024-10-14).
Quoted 6 lines
Quoted 2 lines
- ps/platform-compat-fixes at
80ebd91b83(http: fix build error onFreeBSD, 2024-10-16).While this is still sitting on my review queue, I rebuilt this topic based on the above (extremely helpful) information, but it seems to produce some conflicts when I try to merge it in at the end of 'seen':
Huh, interesting. The first two series had conflicts with each other, so I wouldn't be surprised if what you see comes from that. Those two topics have been merged into a single topic now.
I'll send an updated version of this series at the end of this week that also aims to fix conflicts with 'seen'.
Patrick
Quoted 18 lines · Patrick Steinhardt
Quoted 10 lines · Taylor Blau
Quoted 9 lines · Patrick Steinhardt
This series is based on
15030f9556(The second batch, 2024-10-15) and has the following dependencies:- ps/cmake-clar at
c6d3e52c91(cmake: set up proper dependencies for generated clar headers, 2024-10-15).- ps/upgrade-clar at
f3501edb0e(Makefile: adjust sed command forgenerating "clar-decls.h", 2024-10-14).Quoted 6 lines
Quoted 2 lines
- ps/platform-compat-fixes at
80ebd91b83(http: fix build error onFreeBSD, 2024-10-16).While this is still sitting on my review queue, I rebuilt this topic based on the above (extremely helpful) information, but it seems to produce some conflicts when I try to merge it in at the end of 'seen':
Quoted 6 lines
Huh, interesting. The first two series had conflicts with each other, so I wouldn't be surprised if what you see comes from that. Those two topics have been merged into a single topic now.
I'll send an updated version of this series at the end of this week that also aims to fix conflicts with 'seen'.
Great, thanks!
Thanks,
Taylor
v4 cover Modernize the build system
In reply to Patrick SteinhardtHi,
this is the fourth version of my patch series that modernizes our build system. It refactors various parts of it to make it possible to perform out-of-tree builds in theory and then wires up Meson.
Changes compared to v3:
- Various typo fixes.
- Our Makefile now detects unsubstituted build options in the newly- introduced "GIT-BUILD-OPTIONS.in" template.
- I've wired up support for building and installing manpages. This was the last important bit missing to get a fully functioning Git installation. We generate the same set of manpages that our Makefile would and also render a subset of the HTML pages we generate. Not wired up are our technical docs, but doing those shouldn't be all that involved.
Documentation is not built by default, but can be enabled by passing any combination of -Ddocs=html,man.
- I've dropped the target names for custom_target() invocations. Those are auto-derived from the first output anyway, so they only add unnecessary noise.
- The last patch is a compatibility patch for "seen". There are a couple of topics that interact with this series, and I didn't want to make all of them a strict dependency. So I've decided to just create a fixup-style commit that does the necessary changes in order to work with "seen". Like this, you can test without "seen" by simply dropping that last commit, and you can test with "seen" by merging it into this topic.
@Taylor: I didn't really have a better idea than this. There are six additional topics that this branch interacts with, and building the branch with eight dependencies in total didn't feel sensible. Ideally, the topic branch itself shouldn't have the last commit, but once it gets merged into 'seen' we should have it. Let me know in case you have a better idea though.
This topic is built on top of fd3785337b (The third batch, 2024-10-22) with the following two branches merged into it:
- ps/upgrade-clar at 30bf9f0aaa (cmake: set up proper dependencies for generated clar headers, 2024-10-21). This is currently in 'seen'.
- ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
FreeBSD, 2024-10-16). This has been merged to 'next'.
I was pondering a bit whether I should split this topic up even further. I've already evicted other parts out of it such that they can land separately, and landing the Makefile refactorings independently would reduce the overall review load. These steps also make sense even if we don't have Meson, as those are all either simplifications, improvements for CMake or a necessary step towards out-of-tree builds. Let me know your thoughts!
Thanks!
Patrick
Patrick Steinhardt (19):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 28 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 317 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-GEN | 12 +-
Makefile | 209 +--
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 218 ++-
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 36 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +
gitweb/Makefile | 58 +-
gitweb/generate-gitweb.sh | 45 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 63 +
meson.build | 1618 +++++++++++++++++
meson_options.txt | 73 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
.../header_templates/fixed_prefix.template.pl | 2 +-
.../runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 92 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1110 +++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 22 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 24 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 5 +
templates/meson.build | 13 +
unimplemented.sh | 2 +-
wrap-for-bin.sh | 36 -
88 files changed, 4428 insertions(+), 447 deletions(-)
create mode 100755 Documentation/generate-mergetool-list.sh
create mode 100644 Documentation/meson.build
create mode 100644 Documentation/technical/build-systems.txt
create mode 100644 GIT-BUILD-OPTIONS.in
create mode 100644 bin-wrappers/.gitignore
create mode 100644 bin-wrappers/meson.build
create mode 100755 bin-wrappers/wrap-for-bin.sh
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100755 generate-perl.sh
create mode 100755 generate-script.sh
create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in
create mode 100755 gitweb/generate-gitweb.sh
create mode 100644 gitweb/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/.gitignore
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
create mode 100644 templates/hooks/meson.build
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
delete mode 100644 wrap-for-bin.shRange-diff against v3:
1: 800fb080f45 ! 1: 8c481cb9e01 Makefile: use common template for GIT-BUILD-OPTIONS
@@ Makefile: GIT-LDFLAGS: FORCE
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
++ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi2: 1a4a23c66ca = 2: 308dcbe0bd4 Makefile: consistently use @PLACEHOLDER@ to substitute 3: 8261f108968 = 3: 20e77ffc5f5 Makefile: consistently use PERL_PATH 4: 4894179b948 = 4: 50b607a412a Makefile: extract script to massage Perl scripts 5: b40bc302291 = 5: eddafe1cf89 Makefile: use "generate-perl.sh" to massage Perl library 6: c13ce99be3a ! 6: 2cf8cf86218 Makefile: extract script to massage Shell scripts
@@ Makefile: GIT-BUILD-OPTIONS: FORCE
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
- @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
## contrib/buildsystems/CMakeLists.txt ##
@@ contrib/buildsystems/CMakeLists.txt: set(git_shell_scripts
7: ebffd855836 = 7: e8abda661cf Makefile: extract script to generate gitweb.cgi 8: d2cdfad10f5 = 8: 0e682b68e25 Makefile: refactor GIT-VERSION-GEN to be reusable 9: 9be0719ce1b ! 9: 46b7760fbcd Makefile: refactor generators to be PWD-independent
@@ Commit message
We have multiple scripts that generate headers from other data. All of these scripts have the assumption built-in that they are executed in the current source directory, which makes them a bit unwieldy to use during
- out-of-tree builds. This makes them a bit unwieldy to use. Refactor them
- to instead take the source directory as well as the output file as
- arguments.
+ out-of-tree builds.
+
+ Refactor them to instead take the source directory as well as the output
+ file as arguments.
10: 93869e53178 = 10: ec4a9e65ec3 Makefile: allow "bin-wrappers/" directory to exist 11: 1c37d6d1f19 ! 11: b330fd783d4 Makefile: simplify building of templates
@@ Commit message
When we install Git we also install a set of default templates that both git-init(1) and git-clone(1) populate into our build directories. The
- way the pristine templates are layed out in our source directory is
+ way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory hierarchy in "templates/", we represent directory separators with "--".
-: ----------- > 12: fb7231ae4c7 Documentation: allow sourcing generated includes from separate dir -: ----------- > 13: cf1743667e9 Documentation: teach "cmd-list.perl" about out-of-tree builds -: ----------- > 14: 6926a282a80 Documentation: extract script to generate a list of mergetools 12: c45d2df6b8d = 15: ed3affb794c t: better support for out-of-tree builds 13: 542b01515e1 ! 16: 205b038f961 t: allow overriding build dir
@@ Commit message
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
- we have introduce support for overriding the GIT_BIULD_DIR by creating
+ we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to the location of the build directory. The intent was to stop modifying "t/test-lib.sh" with the CMake build systems while allowing out-of-tree
14: bd59e31bb55 = 17: bef26dd67c5 Documentation: add comparison of build systems
15: ac327d98e9c ! 18: 780180568d9 Introduce support for the Meson build system
@@ Commit message
Introduce support for the Meson build system
Introduce support for the Meson build system, a "modern" meta build
- system that supports many different plaforms, including Linux, macOS,
+ system that supports many different platforms, including Linux, macOS,
Windows and BSDs. Meson supports different backends, including Ninja,
Xcode and Microsoft Visual Studio. Several common IDEs provide an
integration with it.
@@ Commit message
strongly favor Meson over CMake. In my opinion, it feels significantly
easier to use with a syntax that feels more like a "real" programming
language. The second big reason is that Meson supports Rust natively,
- which may prove to be important given that the project is likely to pick
- up Rust as another language eventually.
+ which may prove to be important given that the project may pick up Rust
+ as another language eventually.
Using Meson is rather straight-forward. An example:
@@ Commit message
# Running `meson test` without any arguments will execute all tests,
# but the syntax supports globbing to select only some tests.
$ meson test 't-*'
- # Execute single test interactively to allow fordebugging.
+ # Execute single test interactively to allow for debugging.
$ meson test 't0000-*' --interactive --test-args=-ix
```
@@ Commit message
- We do not install dashed binaries into `$libexec/git-core` anymore.
So there won't e.g. be a symlink for git-add(1). These are not
- required by modern Git and there isn't really much of a usecase for
+ required by modern Git and there isn't really much of a use case for
those anymore. By not installing those symlinks we thus start the
deprecation of this layout.
- - Support for installing documentation has not been wired up yet. This
- will follow if the project can agree on Meson as build system.
-
- Documentation does not yet exist. Same here, it will follow if the
project can agree on Meson.
- - We're targeting a Meson 1.3.0, which has been released relatively
+ - We're targeting Meson 1.3.0, which has been released relatively
recently November 2023. The only feature we use from that version is
`fs.relative_to()`, which we could replace if necessary. If so, we
could start to target Meson 1.0.0 and newer, released in December
2022.
- - The whole build instructions count around 3000 lines, half of which
+ - The whole build instructions count around 3300 lines, half of which
is listing all of our code and test files. Our Makefiles are around
5000 lines, autoconf adds another 1300 lines. CMake in comparison
has only 1200 linescode, but it avoids listing individual files and
@@ Commit message
Helped-by: Eli Schwartz <[email protected]>
Signed-off-by: Patrick Steinhardt <[email protected]>
+ ## Documentation/meson.build (new) ##
+@@
++manpages = {
++ # Category 1.
++ 'git-add.txt' : 1,
++ 'git-am.txt' : 1,
++ 'git-annotate.txt' : 1,
++ 'git-apply.txt' : 1,
++ 'git-archimport.txt' : 1,
++ 'git-archive.txt' : 1,
++ 'git-bisect.txt' : 1,
++ 'git-blame.txt' : 1,
++ 'git-branch.txt' : 1,
++ 'git-bugreport.txt' : 1,
++ 'git-bundle.txt' : 1,
++ 'git-cat-file.txt' : 1,
++ 'git-check-attr.txt' : 1,
++ 'git-check-ignore.txt' : 1,
++ 'git-check-mailmap.txt' : 1,
++ 'git-checkout-index.txt' : 1,
++ 'git-checkout.txt' : 1,
++ 'git-check-ref-format.txt' : 1,
++ 'git-cherry-pick.txt' : 1,
++ 'git-cherry.txt' : 1,
++ 'git-citool.txt' : 1,
++ 'git-clean.txt' : 1,
++ 'git-clone.txt' : 1,
++ 'git-column.txt' : 1,
++ 'git-commit-graph.txt' : 1,
++ 'git-commit-tree.txt' : 1,
++ 'git-commit.txt' : 1,
++ 'git-config.txt' : 1,
++ 'git-count-objects.txt' : 1,
++ 'git-credential-cache--daemon.txt' : 1,
++ 'git-credential-cache.txt' : 1,
++ 'git-credential-store.txt' : 1,
++ 'git-credential.txt' : 1,
++ 'git-cvsexportcommit.txt' : 1,
++ 'git-cvsimport.txt' : 1,
++ 'git-cvsserver.txt' : 1,
++ 'git-daemon.txt' : 1,
++ 'git-describe.txt' : 1,
++ 'git-diagnose.txt' : 1,
++ 'git-diff-files.txt' : 1,
++ 'git-diff-index.txt' : 1,
++ 'git-difftool.txt' : 1,
++ 'git-diff-tree.txt' : 1,
++ 'git-diff.txt' : 1,
++ 'git-fast-export.txt' : 1,
++ 'git-fast-import.txt' : 1,
++ 'git-fetch-pack.txt' : 1,
++ 'git-fetch.txt' : 1,
++ 'git-filter-branch.txt' : 1,
++ 'git-fmt-merge-msg.txt' : 1,
++ 'git-for-each-ref.txt' : 1,
++ 'git-for-each-repo.txt' : 1,
++ 'git-format-patch.txt' : 1,
++ 'git-fsck-objects.txt' : 1,
++ 'git-fsck.txt' : 1,
++ 'git-fsmonitor--daemon.txt' : 1,
++ 'git-gc.txt' : 1,
++ 'git-get-tar-commit-id.txt' : 1,
++ 'git-grep.txt' : 1,
++ 'git-gui.txt' : 1,
++ 'git-hash-object.txt' : 1,
++ 'git-help.txt' : 1,
++ 'git-hook.txt' : 1,
++ 'git-http-backend.txt' : 1,
++ 'git-http-fetch.txt' : 1,
++ 'git-http-push.txt' : 1,
++ 'git-imap-send.txt' : 1,
++ 'git-index-pack.txt' : 1,
++ 'git-init-db.txt' : 1,
++ 'git-init.txt' : 1,
++ 'git-instaweb.txt' : 1,
++ 'git-interpret-trailers.txt' : 1,
++ 'git-log.txt' : 1,
++ 'git-ls-files.txt' : 1,
++ 'git-ls-remote.txt' : 1,
++ 'git-ls-tree.txt' : 1,
++ 'git-mailinfo.txt' : 1,
++ 'git-mailsplit.txt' : 1,
++ 'git-maintenance.txt' : 1,
++ 'git-merge-base.txt' : 1,
++ 'git-merge-file.txt' : 1,
++ 'git-merge-index.txt' : 1,
++ 'git-merge-one-file.txt' : 1,
++ 'git-mergetool--lib.txt' : 1,
++ 'git-mergetool.txt' : 1,
++ 'git-merge-tree.txt' : 1,
++ 'git-merge.txt' : 1,
++ 'git-mktag.txt' : 1,
++ 'git-mktree.txt' : 1,
++ 'git-multi-pack-index.txt' : 1,
++ 'git-mv.txt' : 1,
++ 'git-name-rev.txt' : 1,
++ 'git-notes.txt' : 1,
++ 'git-p4.txt' : 1,
++ 'git-pack-objects.txt' : 1,
++ 'git-pack-redundant.txt' : 1,
++ 'git-pack-refs.txt' : 1,
++ 'git-patch-id.txt' : 1,
++ 'git-prune-packed.txt' : 1,
++ 'git-prune.txt' : 1,
++ 'git-pull.txt' : 1,
++ 'git-push.txt' : 1,
++ 'git-quiltimport.txt' : 1,
++ 'git-range-diff.txt' : 1,
++ 'git-read-tree.txt' : 1,
++ 'git-rebase.txt' : 1,
++ 'git-receive-pack.txt' : 1,
++ 'git-reflog.txt' : 1,
++ 'git-refs.txt' : 1,
++ 'git-remote-ext.txt' : 1,
++ 'git-remote-fd.txt' : 1,
++ 'git-remote.txt' : 1,
++ 'git-repack.txt' : 1,
++ 'git-replace.txt' : 1,
++ 'git-replay.txt' : 1,
++ 'git-request-pull.txt' : 1,
++ 'git-rerere.txt' : 1,
++ 'git-reset.txt' : 1,
++ 'git-restore.txt' : 1,
++ 'git-revert.txt' : 1,
++ 'git-rev-list.txt' : 1,
++ 'git-rev-parse.txt' : 1,
++ 'git-rm.txt' : 1,
++ 'git-send-email.txt' : 1,
++ 'git-send-pack.txt' : 1,
++ 'git-shell.txt' : 1,
++ 'git-sh-i18n--envsubst.txt' : 1,
++ 'git-sh-i18n.txt' : 1,
++ 'git-shortlog.txt' : 1,
++ 'git-show-branch.txt' : 1,
++ 'git-show-index.txt' : 1,
++ 'git-show-ref.txt' : 1,
++ 'git-show.txt' : 1,
++ 'git-sh-setup.txt' : 1,
++ 'git-sparse-checkout.txt' : 1,
++ 'git-stage.txt' : 1,
++ 'git-stash.txt' : 1,
++ 'git-status.txt' : 1,
++ 'git-stripspace.txt' : 1,
++ 'git-submodule.txt' : 1,
++ 'git-svn.txt' : 1,
++ 'git-switch.txt' : 1,
++ 'git-symbolic-ref.txt' : 1,
++ 'git-tag.txt' : 1,
++ 'git-unpack-file.txt' : 1,
++ 'git-unpack-objects.txt' : 1,
++ 'git-update-index.txt' : 1,
++ 'git-update-ref.txt' : 1,
++ 'git-update-server-info.txt' : 1,
++ 'git-upload-archive.txt' : 1,
++ 'git-upload-pack.txt' : 1,
++ 'git-var.txt' : 1,
++ 'git-verify-commit.txt' : 1,
++ 'git-verify-pack.txt' : 1,
++ 'git-verify-tag.txt' : 1,
++ 'git-version.txt' : 1,
++ 'git-web--browse.txt' : 1,
++ 'git-whatchanged.txt' : 1,
++ 'git-worktree.txt' : 1,
++ 'git-write-tree.txt' : 1,
++ 'git.txt' : 1,
++ 'gitk.txt' : 1,
++ 'gitweb.txt' : 1,
++ 'scalar.txt' : 1,
++
++ # Category 5.
++ 'gitattributes.txt' : 5,
++ 'gitformat-bundle.txt' : 5,
++ 'gitformat-chunk.txt' : 5,
++ 'gitformat-commit-graph.txt' : 5,
++ 'gitformat-index.txt' : 5,
++ 'gitformat-pack.txt' : 5,
++ 'gitformat-signature.txt' : 5,
++ 'githooks.txt' : 5,
++ 'gitignore.txt' : 5,
++ 'gitmailmap.txt' : 5,
++ 'gitmodules.txt' : 5,
++ 'gitprotocol-capabilities.txt' : 5,
++ 'gitprotocol-common.txt' : 5,
++ 'gitprotocol-http.txt' : 5,
++ 'gitprotocol-pack.txt' : 5,
++ 'gitprotocol-v2.txt' : 5,
++ 'gitrepository-layout.txt' : 5,
++ 'gitweb.conf.txt' : 5,
++
++ # Category 7.
++ 'gitcli.txt' : 7,
++ 'gitcore-tutorial.txt' : 7,
++ 'gitcredentials.txt' : 7,
++ 'gitcvs-migration.txt' : 7,
++ 'gitdiffcore.txt' : 7,
++ 'giteveryday.txt' : 7,
++ 'gitfaq.txt' : 7,
++ 'gitglossary.txt' : 7,
++ 'gitpacking.txt' : 7,
++ 'gitnamespaces.txt' : 7,
++ 'gitremote-helpers.txt' : 7,
++ 'gitrevisions.txt' : 7,
++ 'gitsubmodules.txt' : 7,
++ 'gittutorial-2.txt' : 7,
++ 'gittutorial.txt' : 7,
++ 'gitworkflows.txt' : 7,
++}
++
++asciidoc = find_program('asciidoc')
++git = find_program('git', required: false)
++xmlto = find_program('xmlto')
++
++git_revdate = ''
++if git.found()
++ git_revdate = run_command(git, 'show', '--quiet', '--pretty=%as', check: false).stdout().strip()
++endif
++
++asciidoc_common_options = [
++ asciidoc,
++ '--conf-file=' + meson.current_source_dir() / 'asciidoc.conf',
++ '--attribute=manual=Git Manual',
++ '--attribute=mansource=Git ' + git_version,
++ '--attribute=revdate=' + git_revdate,
++ '--attribute=build_dir=' + meson.current_build_dir(),
++]
++
++cmd_lists = [
++ 'cmds-ancillaryinterrogators.txt',
++ 'cmds-ancillarymanipulators.txt',
++ 'cmds-mainporcelain.txt',
++ 'cmds-plumbinginterrogators.txt',
++ 'cmds-plumbingmanipulators.txt',
++ 'cmds-synchingrepositories.txt',
++ 'cmds-synchelpers.txt',
++ 'cmds-guide.txt',
++ 'cmds-developerinterfaces.txt',
++ 'cmds-userinterfaces.txt',
++ 'cmds-purehelpers.txt',
++ 'cmds-foreignscminterface.txt',
++]
++
++documentation_deps = [ ]
++
++documentation_deps += custom_target(
++ command: [
++ perl,
++ meson.current_source_dir() / 'cmd-list.perl',
++ meson.project_source_root(),
++ meson.current_build_dir(),
++ ] + cmd_lists,
++ output: cmd_lists
++)
++
++foreach mode : [ 'diff', 'merge' ]
++ documentation_deps += custom_target(
++ command: [
++ shell,
++ meson.current_source_dir() / 'generate-mergetool-list.sh',
++ '..',
++ 'diff',
++ '@OUTPUT@'
++ ],
++ env: [
++ 'MERGE_TOOLS_DIR=' + meson.project_source_root() / 'mergetools',
++ 'TOOL_MODE=' + mode,
++ ],
++ output: 'mergetools-' + mode + '.txt',
++ )
++endforeach
++
++foreach manpage, category : manpages
++ if get_option('docs').contains('man')
++ manpage_xml_target = custom_target(
++ command: asciidoc_common_options + [
++ '--backend=docbook',
++ '--doctype=manpage',
++ '--out-file=@OUTPUT@',
++ meson.current_source_dir() / manpage,
++ ],
++ depends: documentation_deps,
++ output: fs.stem(manpage) + '.xml',
++ )
++
++ manpage_path = fs.stem(manpage) + '.' + category.to_string()
++ manpage_target = custom_target(
++ command: [
++ xmlto,
++ '-m',
++ meson.current_source_dir() / 'manpage-normal.xsl',
++ '-m',
++ meson.current_source_dir() / 'manpage-bold-literal.xsl',
++ '--stringparam',
++ 'man.base.url.for.relative.links=' + get_option('prefix') / get_option('mandir'),
++ 'man',
++ manpage_xml_target,
++ '-o',
++ meson.current_build_dir(),
++ ],
++ output: manpage_path,
++ install: true,
++ install_dir: get_option('mandir') / 'man' + category.to_string(),
++ )
++ endif
++
++ if get_option('docs').contains('html') and category == 1
++ custom_target(
++ command: asciidoc_common_options + [
++ '--backend=xhtml11',
++ '--doctype=manpage',
++ '--out-file=@OUTPUT@',
++ meson.current_source_dir() / manpage,
++ ],
++ depends: documentation_deps,
++ output: fs.stem(manpage) + '.html',
++ install: true,
++ install_dir: get_option('datadir') / 'doc/git-doc',
++ )
++ endif
++endforeach
+
## bin-wrappers/meson.build (new) ##
@@
+bin_wrappers_config = configuration_data()
@@ gitweb/meson.build (new)
+ configuration: gitweb_config,
+)
+
-+test_dependencies += custom_target(script,
++test_dependencies += custom_target(
+ input: 'gitweb.perl',
+ output: 'gitweb.cgi',
+ command: [
@@ meson.build (new)
+]
+
+libgit_sources += custom_target(
-+ 'command-list.h',
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
@@ meson.build (new)
+)
+
+libgit_sources += custom_target(
-+ 'config-list.h',
+ output: 'config-list.h',
+ command: [
+ shell,
@@ meson.build (new)
+)
+
+libgit_sources += custom_target(
-+ 'hook-list.h',
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
@@ meson.build (new)
+endif
+
+foreach script : scripts_sh
-+ test_dependencies += custom_target(script,
++ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
@@ meson.build (new)
+ ]
+
+ foreach script : scripts_perl
-+ generated_script = custom_target(script,
++ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
@@ meson.build (new)
+endif
+
+subdir('bin-wrappers')
++if get_option('docs') != []
++ subdir('Documentation')
++endif
## meson_options.txt (new) ##
@@
-+option('default_help_format', type: 'combo', choices: ['man', 'html', 'info'], value: 'man',
-+ description: 'Format of installed documentation.')
+option('default_pager', type: 'string', value: 'less',
+ description: 'Fall-back pager.')
+option('default_editor', type: 'string', value: 'vi',
@@ meson_options.txt (new)
+option('gitweb_site_footer', type: 'string', value: '')
+option('highlight_bin', type: 'string', value: 'highlight')
+
++option('docs', type: 'array', choices: ['man', 'html'], value: [],
++ description: 'Which documenattion formats to build and install.')
++option('default_help_format', type: 'combo', choices: ['man', 'html'], value: 'man',
++ description: 'Default format used when executing git-help(1).')
++
+option('tests', type: 'boolean', value: true,
+ description: 'Enable building tests. This requires Perl, but is separate from the "perl" option such that you can build tests without Perl features enabled.')
+option('test_output_directory', type: 'string',
@@ meson_options.txt (new)
## perl/FromCPAN/Mail/meson.build (new) ##
@@
-+test_dependencies += custom_target('Address.pm',
++test_dependencies += custom_target(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ command: generate_perl_command,
@@ perl/FromCPAN/Mail/meson.build (new)
## perl/FromCPAN/meson.build (new) ##
@@
-+test_dependencies += custom_target('Error.pm',
++test_dependencies += custom_target(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ command: generate_perl_command,
@@ perl/FromCPAN/meson.build (new)
## perl/Git/LoadCPAN/Mail/meson.build (new) ##
@@
-+test_dependencies += custom_target('Address.pm',
++test_dependencies += custom_target(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ command: generate_perl_command,
@@ perl/Git/LoadCPAN/Mail/meson.build (new)
## perl/Git/LoadCPAN/meson.build (new) ##
@@
-+test_dependencies += custom_target('Error.pm',
++test_dependencies += custom_target(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ command: generate_perl_command,
@@ perl/Git/LoadCPAN/meson.build (new)
## perl/Git/SVN/Memoize/meson.build (new) ##
@@
-+test_dependencies += custom_target('YAML.pm',
++test_dependencies += custom_target(
+ input: 'YAML.pm',
+ output: 'YAML.pm',
+ command: generate_perl_command,
@@ perl/Git/SVN/meson.build (new)
+ 'Ra.pm',
+ 'Utils.pm',
+]
-+ test_dependencies += custom_target(source,
++ test_dependencies += custom_target(
+ input: source,
+ output: source,
+ command: generate_perl_command,
@@ perl/Git/meson.build (new)
+ 'Packet.pm',
+ 'SVN.pm',
+]
-+ test_dependencies += custom_target(source,
++ test_dependencies += custom_target(
+ input: source,
+ output: source,
+ command: generate_perl_command,
@@ perl/Git/meson.build (new)
## perl/meson.build (new) ##
@@
-+test_dependencies += custom_target('Git.pm',
++test_dependencies += custom_target(
+ input: 'Git.pm',
+ output: 'Git.pm',
+ command: generate_perl_command,
@@ po/meson.build (new)
+ 'zh_TW',
+ ],
+ install: true,
-+ install_dir: get_option('datadir'),
+)
+test_dependencies += translations[0]
@@ t/meson.build (new)
+ 'unit-tests/unit-test.c',
+]
+
-+clar_decls_h = custom_target('clar_decls_h',
++clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
@@ t/meson.build (new)
+)
+clar_sources += clar_decls_h
+
-+clar_sources += custom_target('clar_suite',
++clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
@@ t/meson.build (new)
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
++ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
@@ t/meson.build (new)
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
++ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh', -: ----------- > 19: 45e2ab4044a meson: fix conflicts with in-flight topics
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 1/19 Makefile: use common template for GIT-BUILD-OPTIONS
The "GIT-BUILD-OPTIONS" file is generated by our build systems to propagate built-in features and paths to our tests. The generation is done ad-hoc, where both our Makefile and the CMake build instructions simply echo a bunch of strings into the file. This makes it very hard to figure out what variables are expected to exist and what format they have, and the written variables can easily get out of sync between build systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue. This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be substituted, alerting us of mismatches. Others don't, but if we forgot to substitute such variables we now have a bogus string that will likely cause our tests to fail, if they have any meaning in the first place.
Backfill values that we didn't yet set in our CMake build instructions. While at it, remove the SUPPORTS_SIMPLE_IPC variable that we only set up in CMake as it isn't used anywhere.
Note that this change requires us to move around the setup of TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing the "GIT-BUILD-OPTIONS" file. This is the only instance I could find where we rely on ordering on variables.
--- GIT-BUILD-OPTIONS.in | 36 +++++++++ Makefile | 109 ++++++++++------------------ contrib/buildsystems/CMakeLists.txt | 58 ++++++++++----- t/test-lib.sh | 13 ++-- 4 files changed, 121 insertions(+), 95 deletions(-) create mode 100644 GIT-BUILD-OPTIONS.in
GIT-BUILD-OPTIONS.in new file +36 -0
@@ -0,0 +1,36 @@ +SHELL_PATH=@SHELL_PATH@ +TEST_SHELL_PATH=@TEST_SHELL_PATH@ +PERL_PATH=@PERL_PATH@ +DIFF=@DIFF@ +PYTHON_PATH=@PYTHON_PATH@ +TAR=@TAR@ +NO_CURL=@NO_CURL@ +NO_ICONV=@NO_ICONV@ +NO_EXPAT=@NO_EXPAT@ +USE_LIBPCRE2=@USE_LIBPCRE2@ +NO_PERL=@NO_PERL@ +NO_PTHREADS=@NO_PTHREADS@ +NO_PYTHON=@NO_PYTHON@ +NO_REGEX=@NO_REGEX@ +NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@ +PAGER_ENV=@PAGER_ENV@ +SANITIZE_LEAK=@SANITIZE_LEAK@ +SANITIZE_ADDRESS=@SANITIZE_ADDRESS@ +X=@X@ +FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@ +FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@ +TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@ +GIT_TEST_OPTS=@GIT_TEST_OPTS@ +GIT_TEST_CMP=@GIT_TEST_CMP@ +GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@ +GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@ +NO_GETTEXT=@NO_GETTEXT@ +GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@ +GIT_PERF_REPO=@GIT_PERF_REPO@ +GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@ +GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@ +GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@ +GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@ +GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@ +GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@ +RUNTIME_PREFIX=@RUNTIME_PREFIX@
Makefile +39 -70
115 lines not on this page · raw message
contrib/buildsystems/CMakeLists.txt +39 -19
66 lines not on this page · raw message
t/test-lib.sh +7 -6
@@ -35,12 +35,6 @@ else # needing to exist. TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1 fi -if test -z "$TEST_OUTPUT_DIRECTORY" -then - # Similarly, override this to store the test-results subdir - # elsewhere - TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY -fi GIT_BUILD_DIR="${TEST_DIRECTORY%/t}" if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then
@@ -100,6 +94,13 @@ fi . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS export PERL_PATH SHELL_PATH +if test -z "$TEST_OUTPUT_DIRECTORY" +then + # Similarly, override this to store the test-results subdir + # elsewhere + TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY +fi + # In t0000, we need to override test directories of nested testcases. In case # the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd # reset this value to instead contain what the developer has specified. We thus
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 2/19 Makefile: consistently use @PLACEHOLDER@ to substitute
In reply to Patrick SteinhardtWe have a bunch of placeholders in our scripts that we replace at build time, for example by using sed(1). These placeholders come in three different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with CMake, which only supports the first syntax in its configure_file() function. To work around that we instead manually replace placeholders via string operations, which is a hassle and removes safeguards that CMake has to verify that we didn't forget to replace any placeholders. Besides that, other build systems like Meson also support the CMake syntax.
Unify our codebase to consistently use the syntax supported by such build systems.
--- Makefile | 44 +++++++++---------- configure.ac | 2 +- contrib/buildsystems/CMakeLists.txt | 34 +++++++------- git-cvsserver.perl | 2 +- git-instaweb.sh | 8 ++-- git-request-pull.sh | 2 +- git-send-email.perl | 2 +- git-sh-i18n.sh | 6 +-- git-sh-setup.sh | 6 +-- git-svn.perl | 2 +- gitk-git/po/vi.po | 2 +- gitweb/Makefile | 44 +++++++++---------- gitweb/gitweb.perl | 44 +++++++++---------- perl/Git/I18N.pm | 6 +-- perl/Git/LoadCPAN.pm | 6 +-- .../header_templates/fixed_prefix.template.pl | 2 +- .../runtime_prefix.template.pl | 8 ++-- unimplemented.sh | 2 +- wrap-for-bin.sh | 18 ++++---- 19 files changed, 120 insertions(+), 120 deletions(-)
Makefile +22 -22
@@ -1555,10 +1555,10 @@ endif ifdef SANE_TOOL_PATH SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH)) -BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|' +BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|' PATH := $(SANE_TOOL_PATH):${PATH} else -BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d' +BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d' endif ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE define cmd_munge_script sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's|@@DIFF@@|$(DIFF_SQ)|' \ - -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \ - -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \ + -e 's|@DIFF@|$(DIFF_SQ)|' \ + -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \ + -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \ -e $(BROKEN_PATH_FIX) \ - -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \ - -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ - -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \ + -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \ + -e 's|@PERL@|$(PERL_PATH_SQ)|g' \ + -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \ [email protected] >$@+ endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE -e ' r GIT-PERL-HEADER' \ -e ' G' \ -e '}' \ - -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ + -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \ $< >$@+ && \ chmod +x $@+ && \ mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile INSTLIBDIR='$(perllibdir_SQ)' && \ INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \ INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \ - sed -e 's=@@PATHSEP@@=$(pathsep)=g' \ - -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \ - -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \ - -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \ - -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \ + sed -e 's=@PATHSEP@=$(pathsep)=g' \ + -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \ + -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \ + -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \ + -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \ $< >$@+ && \ mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh $(QUIET_GEN) \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \ + -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \ unimplemented.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON $(SCRIPT_PYTHON_GEN): % : unimplemented.sh $(QUIET_GEN) \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \ + -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \ unimplemented.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ endif # NO_PYTHON -CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ +CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \ configure.ac >configure.ac+ && \ autoconf -o configure configure.ac+ && \ $(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES $(call mkdir_p_parent_template) $(QUIET_GEN) \ - sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \ - -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \ - -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ + sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \ + -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \ + -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ < $< > $@ perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3225,8 +3225,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR bin-wrappers/%: wrap-for-bin.sh $(call mkdir_p_parent_template) $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@BUILD_DIR@@|$(shell pwd)|' \ - -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ + -e 's|@BUILD_DIR@|$(shell pwd)|' \ + -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ chmod +x $@ # GNU make supports exporting all variables by "export" without parameters.
configure.ac +1 -1
@@ -142,7 +142,7 @@ fi ## Configure body starts here. AC_PREREQ(2.59) -AC_INIT([git], [@@GIT_VERSION@@], [[email protected]]) +AC_INIT([git], [@GIT_VERSION@], [[email protected]]) AC_CONFIG_SRCDIR([git.c])
contrib/buildsystems/CMakeLists.txt +17 -17
@@ -836,14 +836,14 @@ set(git_shell_scripts foreach(script ${git_shell_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME) string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}") - string(REPLACE "@@DIFF@@" "diff" content "${content}") + string(REPLACE "@DIFF@" "diff" content "${content}") string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}") - string(REPLACE "@@NO_CURL@@" "" content "${content}") - string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}") - string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}") - string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}") - string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}") + string(REPLACE "@NO_CURL@" "" content "${content}") + string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}") + string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}") + string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}") + string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl") #create perl header file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header ) -string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}") -string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}") +string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}") +string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}") foreach(script ${git_perl_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}") - string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}") + string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") foreach(pm ${perl_modules}) string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm}) file(STRINGS ${pm} content NEWLINE_CONSUME) - string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}") - string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}") + string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") + string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content}) #test-lib.sh requires perl/build/lib to be the build directory of perl modules endforeach()
@@ -1056,21 +1056,21 @@ set(wrapper_test_scripts foreach(script ${wrapper_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) - string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") - string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}") + string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") + string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() foreach(script ${wrapper_test_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) - string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") - string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") + string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") + string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) -string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") -string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}") +string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") +string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content}) #options for configuring test options
git-cvsserver.perl +1 -1
@@ -26,7 +26,7 @@ use File::Basename; use Getopt::Long qw(:config require_order no_ignore_case); -my $VERSION = '@@GIT_VERSION@@'; +my $VERSION = '@GIT_VERSION@'; my $log = GITCVS::log->new(); my $cfg;
git-instaweb.sh +4 -4
@@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -PERL='@@PERL@@' +PERL='@PERL@' OPTIONS_KEEPDASHDASH= OPTIONS_STUCKLONG= OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf" # if installed, it doesn't need further configuration (module_path) test -z "$httpd" && httpd='lighttpd -f' -# Default is @@GITWEBDIR@@ -test -z "$root" && root='@@GITWEBDIR@@' +# Default is @GITWEBDIR@ +test -z "$root" && root='@GITWEBDIR@' # any untaken local port will do... test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF gitweb_conf() { cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF -#!@@PERL@@ +#!@PERL@ our \$projectroot = "$(dirname "$fqgitdir")"; our \$git_temp = "$fqgitdir/gitweb/tmp"; our \$projects_list = \$projectroot;
git-request-pull.sh +1 -1
@@ -112,7 +112,7 @@ find_matching_ref=' } ' -set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") +set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") remote_sha1=$2 ref=$3
git-send-email.perl +1 -1
@@ -1501,7 +1501,7 @@ sub gen_header { @recipients = unique_email_list(@recipients,@cc,@initial_bcc); @recipients = (map { extract_valid_address_or_die($_) } @recipients); my $date = format_2822_time($time++); - my $gitversion = '@@GIT_VERSION@@'; + my $gitversion = '@GIT_VERSION@'; if ($gitversion =~ m/..GIT_VERSION../) { $gitversion = Git::version(); }
git-sh-i18n.sh +3 -3
@@ -9,7 +9,7 @@ TEXTDOMAIN=git export TEXTDOMAIN if test -z "$GIT_TEXTDOMAINDIR" then - TEXTDOMAINDIR="@@LOCALEDIR@@" + TEXTDOMAINDIR="@LOCALEDIR@" else TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR" fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR # First decide what scheme to use... GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough -if test -n "@@USE_GETTEXT_SCHEME@@" +if test -n "@USE_GETTEXT_SCHEME@" then - GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@" + GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@" elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" then : no probing necessary
git-sh-setup.sh +3 -3
@@ -41,7 +41,7 @@ git_broken_path_fix () { esac } -# @@BROKEN_PATH_FIX@@ +# @BROKEN_PATH_FIX@ # Source git-sh-i18n for gettext support. . "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() { else GIT_PAGER=cat fi - for vardef in @@PAGER_ENV@@ + for vardef in @PAGER_ENV@ do var=${vardef%%=*} eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () { # remove lines from $1 that are not in $2, leaving only common lines. create_virtual_base() { sz0=$(wc -c <"$1") - @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add + @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add sz1=$(wc -c <"$1") # If we do not have enough common material, it is not
git-svn.perl +1 -1
@@ -9,7 +9,7 @@ $_revision $_repository $_q $_authors $_authors_prog %users/; $AUTHOR = 'Eric Wong <[email protected]>'; -$VERSION = '@@GIT_VERSION@@'; +$VERSION = '@GIT_VERSION@'; use Carp qw/croak/; use File::Basename qw/dirname basename/;
gitk-git/po/vi.po +1 -1
@@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: gitk @@GIT_VERSION@@\n" +"Project-Id-Version: gitk @GIT_VERSION@\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-17 14:32+1000\n" "PO-Revision-Date: 2015-09-15 07:33+0700\n"
gitweb/Makefile +22 -22
50 lines not on this page · raw message
gitweb/gitweb.perl +22 -22
116 lines not on this page · raw message
perl/Git/I18N.pm +3 -3
@@ -20,14 +20,14 @@ BEGIN # this "'@@' [...] '@@'" pattern. use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@'; use constant NO_GETTEXT => ( - q[@@NO_GETTEXT@@] ne '' + q[@NO_GETTEXT@] ne '' and - q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR + q[@NO_GETTEXT@] ne NO_GETTEXT_STR ); sub __bootstrap_locale_messages { our $TEXTDOMAIN = 'git'; - our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@'; + our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@'; die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT; require POSIX;
perl/Git/LoadCPAN.pm +3 -3
@@ -31,11 +31,11 @@ =head1 DESCRIPTION # Makefile, and allows for detecting whether the module is loaded from # perl/Git as opposed to perl/build/Git, which is useful for one-off # testing without having Error.pm et al installed. -use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@'; +use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@'; use constant NO_PERL_CPAN_FALLBACKS => ( - q[@@NO_PERL_CPAN_FALLBACKS@@] ne '' + q[@NO_PERL_CPAN_FALLBACKS@] ne '' and - q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR + q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR ); sub import {
perl/header_templates/fixed_prefix.template.pl +1 -1
@@ -1 +1 @@ -use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@')); +use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
perl/header_templates/runtime_prefix.template.pl +4 -4
@@ -3,7 +3,7 @@ # This finds our Git::* libraries relative to the script's runtime path. sub __git_system_path { my ($relpath) = @_; - my $gitexecdir_relative = '@@GITEXECDIR_REL@@'; + my $gitexecdir_relative = '@GITEXECDIR_REL@'; # GIT_EXEC_PATH is supplied by `git` or the test suite. my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path { } BEGIN { - use lib split /@@PATHSEP@@/, + use lib split /@PATHSEP@/, ( $ENV{GITPERLLIB} || do { - my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@'); + my $perllibdir = __git_system_path('@PERLLIBDIR_REL@'); (-e $perllibdir) || die("Invalid system path ($relpath): $path"); $perllibdir; }
@@ -36,7 +36,7 @@ BEGIN # Export the system locale directory to the I18N module. The locale directory # is only installed if NO_GETTEXT is set. - $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@'); + $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@'); } # END RUNTIME_PREFIX generated code.
unimplemented.sh +1 -1
@@ -1,4 +1,4 @@ #!/bin/sh -echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)." +echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)." exit 128
wrap-for-bin.sh +9 -9
@@ -4,33 +4,33 @@ # to run test suite against sandbox, but with only bindir-installed # executables in PATH. The Makefile copies this into various # files in bin-wrappers, substituting -# @@BUILD_DIR@@ and @@PROG@@. +# @BUILD_DIR@ and @PROG@. -GIT_EXEC_PATH='@@BUILD_DIR@@' +GIT_EXEC_PATH='@BUILD_DIR@' if test -n "$NO_SET_GIT_TEMPLATE_DIR" then unset GIT_TEMPLATE_DIR else - GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt' + GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt' export GIT_TEMPLATE_DIR fi -GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" -GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale' -PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH" +GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" +GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale' +PATH='@BUILD_DIR@/bin-wrappers:'"$PATH" export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR case "$GIT_DEBUGGER" in '') - exec "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec "${GIT_EXEC_PATH}/@PROG@" "$@" ;; 1) unset GIT_DEBUGGER - exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@" ;; *) GIT_DEBUGGER_ARGS="$GIT_DEBUGGER" unset GIT_DEBUGGER - exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@" ;; esac
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 3/19 Makefile: consistently use PERL_PATH
In reply to Patrick SteinhardtWhen injecting the Perl path into our scripts we sometimes use '@PERL@' while we othertimes use '@PERL_PATH@'. Refactor the code use the latter consistently, which makes it easier to reuse the same logic for multiple scripts.
--- Makefile | 2 +- contrib/buildsystems/CMakeLists.txt | 2 +- git-instaweb.sh | 4 ++-- git-request-pull.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
Makefile +1 -1
@@ -2553,7 +2553,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \ -e $(BROKEN_PATH_FIX) \ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \ - -e 's|@PERL@|$(PERL_PATH_SQ)|g' \ + -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \ [email protected] >$@+ endef
contrib/buildsystems/CMakeLists.txt +1 -1
@@ -842,7 +842,7 @@ foreach(script ${git_shell_scripts}) string(REPLACE "@NO_CURL@" "" content "${content}") string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}") string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}") - string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}") + string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}") string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach()
git-instaweb.sh +2 -2
@@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -PERL='@PERL@' +PERL='@PERL_PATH@' OPTIONS_KEEPDASHDASH= OPTIONS_STUCKLONG= OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF gitweb_conf() { cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF -#!@PERL@ +#!@PERL_PATH@ our \$projectroot = "$(dirname "$fqgitdir")"; our \$git_temp = "$fqgitdir/gitweb/tmp"; our \$projects_list = \$projectroot;
git-request-pull.sh +1 -1
@@ -112,7 +112,7 @@ find_matching_ref=' } ' -set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") +set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") remote_sha1=$2 ref=$3
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 4/19 Makefile: extract script to massage Perl scripts
In reply to Patrick SteinhardtExtract the script to inject various build-time parameters into our Perl scripts into a standalone script. This is done such that we can reuse it in other build systems.
--- Makefile | 12 ++---------- contrib/buildsystems/CMakeLists.txt | 20 +++++++++++++++----- generate-perl.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 15 deletions(-) create mode 100755 generate-perl.sh
Makefile +2 -10
@@ -2604,16 +2604,8 @@ endif PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir) -$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE - $(QUIET_GEN) \ - sed -e '1{' \ - -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \ - -e ' r GIT-PERL-HEADER' \ - -e ' G' \ - -e '}' \ - -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \ - $< >$@+ && \ - chmod +x $@+ && \ +$(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) GIT-PERL-HEADER "$<" "$@+" && \ mv $@+ $@ PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
contrib/buildsystems/CMakeLists.txt +15 -5
@@ -848,19 +848,29 @@ foreach(script ${git_shell_scripts}) endforeach() #perl scripts -parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl") +parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "") #create perl header file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header ) string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}") string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}") +file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header}) foreach(script ${git_perl_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME) - string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}") - string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}") - file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) + string(REPLACE ".perl" "" perl_gen_path "${script}") + + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path} + COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh + ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS + ${PROJECT_VERSION} + ${CMAKE_BINARY_DIR}/PERL-HEADER + ${CMAKE_SOURCE_DIR}/${script} + ${CMAKE_BINARY_DIR}/${perl_gen_path} + DEPENDS ${CMAKE_SOURCE_DIR}/generate-perl.sh + ${CMAKE_SOURCE_DIR}/${script}) + list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path}) endforeach() +add_custom_target(perl-gen ALL DEPENDS ${perl_gen}) #python script file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
generate-perl.sh new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +if test $# -ne 5 +then + echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION> <PERL_HEADER> <INPUT> <OUTPUT>" >&2 + exit 1 +fi + +GIT_BUILD_OPTIONS="$1" +GIT_VERSION="$2" +PERL_HEADER="$3" +INPUT="$4" +OUTPUT="$5" + +. "$GIT_BUILD_OPTIONS" + +sed -e '1{' \ + -e " s|#!.*perl|#!$PERL_PATH|" \ + -e " r $PERL_HEADER" \ + -e ' G' \ + -e '}' \ + -e "s/@GIT_VERSION@/$GIT_VERSION/g" \ + "$INPUT" >"$OUTPUT" +chmod a+x "$OUTPUT"
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
Re: [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts
Hi Patrick
contrib/buildsystems/CMakeLists.txt foreach(script ${git_shell_scripts}) · line 863
Quoted 3 lines · Patrick Steinhardt
contrib/buildsystems/CMakeLists.txt +2
-0+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path} + COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh
This is missing ${SH_EXE} in order to work with cmd.exe on windows when running the build from Visual Studio. Also do we want to quote the command arguments in case there is a ';' in the path - we seem to be a bit inconsistant in about that in CMakeLists.txt. Also we should add VERBATIM so that special characters in the arguments are quoted when generating the build rules.
Best Wishes
Phillip
Quoted 10 lines
contrib/buildsystems/CMakeLists.txt +9
-0+ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS + ${PROJECT_VERSION} + ${CMAKE_BINARY_DIR}/PERL-HEADER + ${CMAKE_SOURCE_DIR}/${script} + ${CMAKE_BINARY_DIR}/${perl_gen_path} + DEPENDS ${CMAKE_SOURCE_DIR}/generate-perl.sh + ${CMAKE_SOURCE_DIR}/${script}) + list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path}) endforeach() +add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
Re: [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts
Quoted 4 lines · Phillip Wood
Hi Patrick
Quoted 1 line · Patrick Steinhardt
Quoted 9 lines
contrib/buildsystems/CMakeLists.txt foreach(script ${git_shell_scripts}) · line 863
Quoted 2 lines
contrib/buildsystems/CMakeLists.txt +2
-0+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path} + COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.shThis is missing ${SH_EXE} in order to work with cmd.exe on windows when running the build from Visual Studio. Also do we want to quote the command arguments in case there is a ';' in the path - we seem to be a bit inconsistant in about that in CMakeLists.txt. Also we should add VERBATIM so that special characters in the arguments are quoted when generating the build rules.
Indeed, I also had it in my mind to revisit these patches and fix them up based on Dscho's findings in the other thread. Thanks for being proactive and pointing them out!
Patrick
RFC PATCH v4 5/19 Makefile: use "generate-perl.sh" to massage Perl library
In reply to Patrick SteinhardtExtend "generate-perl.sh" such that it knows to also massage the Perl library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
--- GIT-BUILD-OPTIONS.in | 2 ++ Makefile | 10 ++++------ contrib/buildsystems/CMakeLists.txt | 20 ++++++-------------- generate-perl.sh | 14 ++++++++++++-- 4 files changed, 24 insertions(+), 22 deletions(-)
GIT-BUILD-OPTIONS.in +2 -0
@@ -1,6 +1,8 @@ SHELL_PATH=@SHELL_PATH@ TEST_SHELL_PATH=@TEST_SHELL_PATH@ PERL_PATH=@PERL_PATH@ +PERL_LOCALEDIR=@PERL_LOCALEDIR@ +NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@ DIFF=@DIFF@ PYTHON_PATH=@PYTHON_PATH@ TAR=@TAR@
Makefile +4 -6
@@ -3093,13 +3093,9 @@ endif NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS)) endif -perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES +perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES $(call mkdir_p_parent_template) - $(QUIET_GEN) \ - sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \ - -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \ - -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ - < $< > $@ + $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@" perl/build/man/man3/Git.3pm: perl/Git.pm $(call mkdir_p_parent_template)
@@ -3160,6 +3156,8 @@ GIT-BUILD-OPTIONS: FORCE -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \ + -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \ + -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \ -e "s|@DIFF@|\'$(DIFF)\'|" \ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \ -e "s|@TAR@|\'$(TAR)\'|" \
contrib/buildsystems/CMakeLists.txt +6 -14
@@ -849,6 +849,9 @@ endforeach() #perl scripts parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "") +#perl modules +file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") +list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "") #create perl header file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -856,7 +859,7 @@ string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}") string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}") file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header}) -foreach(script ${git_perl_scripts}) +foreach(script ${git_perl_scripts} ${perl_modules}) string(REPLACE ".perl" "" perl_gen_path "${script}") add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
@@ -877,19 +880,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content}) -#perl modules -file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") - -foreach(pm ${perl_modules}) - string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm}) - file(STRINGS ${pm} content NEWLINE_CONSUME) - string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") - string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}") - file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content}) -#test-lib.sh requires perl/build/lib to be the build directory of perl modules -endforeach() - - #templates file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*") list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1131,6 +1121,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_ string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}") string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}") string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}") +string(REPLACE "@PERL_LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}") +string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}") string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}") string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}") string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
generate-perl.sh +12 -2
@@ -17,10 +17,20 @@ OUTPUT="$5" . "$GIT_BUILD_OPTIONS" 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|@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" -chmod a+x "$OUTPUT" + +case "$(basename "$INPUT")" in +*.perl) + chmod a+x "$OUTPUT";; +*) + ;; +esac
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
Hi Patrick
generate-perl.sh OUTPUT="$5" · line 17
Quoted 6 lines · Patrick Steinhardt
generate-perl.sh +0
-0@@ -17,10 +17,20 @@ OUTPUT="$5" . "$GIT_BUILD_OPTIONS"
I need to add
case "$OUTPUT" in
*.pm)
dir="$(dirname $OUTPUT)"
if ! test -d "$dir"
then
mkdir -p "$dir"
fi
;;esac
to create the output directories when building out of tree using CMake on Linux. I'm not sure why it works on Windows without this, or why we don't need to create the leading directories when generating clar-decls.h or clar.suite as CMake seems to do it for us when it initializes the build directory.
Quoted 5 lines
generate-perl.sh +1
-0sed -e '1{' \ + -e " /^#!.*perl/!b" \ -e " s|#!.*perl|#!$PERL_PATH|" \ -e " r $PERL_HEADER" \ -e ' G' \
generate-perl.sh OUTPUT="$5" · line 31
Quoted 10 lines
generate-perl.sh +6
-2-e '}' \ - -e "s/@GIT_VERSION@/$GIT_VERSION/g" \ + -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" -chmod a+x "$OUTPUT" + +case "$(basename "$INPUT")" in
Nit: there's no need to call "basename" here as "*" will match directory separators in a case statement.
Best Wishes
Phillip
Quoted 5 lines
generate-perl.sh +5
-0+*.perl) + chmod a+x "$OUTPUT";; +*) + ;; +esac
Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
Quoted 20 lines · Phillip Wood
Hi Patrick
generate-perl.sh OUTPUT="$5" · line 17
Quoted 6 lines · Patrick Steinhardt
generate-perl.sh +0
-0@@ -17,10 +17,20 @@ OUTPUT="$5" . "$GIT_BUILD_OPTIONS"I need to add
case "$OUTPUT" in
*.pm)dir="$(dirname $OUTPUT)" if ! test -d "$dir" then mkdir -p "$dir" fi ;;
Quoted 7 lines
esac
to create the output directories when building out of tree using CMake on Linux. I'm not sure why it works on Windows without this, or why we don't need to create the leading directories when generating
clar-decls.hor clar.suite as CMake seems to do it for us when it initializes the build directory.
Ah, indeed, I can reproduce this when using Makefiles. I'll solve this via file(MAKE_DIRECTORY).
Patrick
Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
Quoted 9 lines · Patrick Steinhardt
Quoted 9 lines
case "$OUTPUT" in
*.pm)
dir="$(dirname $OUTPUT)"
if ! test -d "$dir"
then
mkdir -p "$dir"
fi
;;
esac
This seems kind of complicated to me. Why not just simply:
case "$OUTPUT" in
(*.pm) mkdir -p "$(dirname $OUTPUT)" ;;
esacThere's no point in testing for existence of the directory before invoking mkdir -p IMO.
Maybe the git environment has some rules about this?
Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
Quoted 13 lines · Paul Smith
Quoted 9 lines · Patrick Steinhardt
Quoted 9 lines
case "$OUTPUT" in
*.pm)
dir="$(dirname $OUTPUT)"
if ! test -d "$dir"
then
mkdir -p "$dir"
fi
;;
esacThis seems kind of complicated to me. Why not just simply:
Quoted 8 lines
case "$OUTPUT" in (*.pm) mkdir -p "$(dirname $OUTPUT)" ;; esacThere's no point in testing for existence of the directory before invoking mkdir -p IMO.
Maybe the git environment has some rules about this?
I won't use either of these. Our Makefile already knows to create the parent directory anyway:
perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@"The issue is rather that CMake didn't know to do the same, so I'm solving this in CMake rather than in the script.
Patrick
RFC PATCH v4 6/19 Makefile: extract script to massage Shell scripts
In reply to Patrick SteinhardtSame as in the preceding commits, extract a script that allows us to unify how we massage shell scripts.
--- GIT-BUILD-OPTIONS.in | 4 ++++ Makefile | 34 +++++++++-------------------- contrib/buildsystems/CMakeLists.txt | 30 +++++++++++++++---------- generate-script.sh | 34 +++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 35 deletions(-) create mode 100755 generate-script.sh
GIT-BUILD-OPTIONS.in +4 -0
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@ GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@ GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@ RUNTIME_PREFIX=@RUNTIME_PREFIX@ +GITWEBDIR=@GITWEBDIR@ +USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@ +LOCALEDIR=@LOCALEDIR@ +BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
Makefile +10 -24
@@ -1555,10 +1555,10 @@ endif ifdef SANE_TOOL_PATH SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH)) -BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|' +BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"| PATH := $(SANE_TOOL_PATH):${PATH} else -BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d' +BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d endif ifeq (,$(HOST_CPU))
@@ -2545,26 +2545,8 @@ GIT-SCRIPT-DEFINES: FORCE echo "$$FLAGS" >$@; \ fi -define cmd_munge_script -sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's|@DIFF@|$(DIFF_SQ)|' \ - -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \ - -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \ - -e $(BROKEN_PATH_FIX) \ - -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \ - -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \ - -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \ - [email protected] >$@+ -endef - -$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES - $(QUIET_GEN)$(cmd_munge_script) && \ - chmod +x $@+ && \ - mv $@+ $@ - -$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES - $(QUIET_GEN)$(cmd_munge_script) && \ +$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES + $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \ mv $@+ $@ git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
@@ -2633,8 +2615,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile perllibdir: @echo '$(perllibdir_SQ)' -git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES - $(QUIET_GEN)$(cmd_munge_script) && \ +git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES + $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \ chmod +x $@+ && \ mv $@+ $@ else # NO_PERL
@@ -3191,6 +3173,10 @@ GIT-BUILD-OPTIONS: FORCE -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \ + -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \ + -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \ + -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \ + -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \ GIT-BUILD-OPTIONS.in >$@+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
contrib/buildsystems/CMakeLists.txt +19 -11
@@ -834,18 +834,22 @@ set(git_shell_scripts ${git_sh_scripts} ${git_shlib_scripts} git-instaweb) foreach(script ${git_shell_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME) - string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}") - string(REPLACE "@DIFF@" "diff" content "${content}") - string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") - string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}") - string(REPLACE "@NO_CURL@" "" content "${content}") - string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}") - string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}") - string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}") - string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}") - file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) + if ("${script}" IN_LIST git_sh_scripts) + string(REPLACE ".sh" "" shell_gen_path "${script}") + else() + set(shell_gen_path "${script}") + endif() + + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${shell_gen_path} + COMMAND ${CMAKE_SOURCE_DIR}/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 + ${CMAKE_SOURCE_DIR}/${script}.sh) + list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path}) endforeach() +add_custom_target(shell-gen ALL DEPENDS ${shell_gen}) #perl scripts parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1156,6 +1160,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}") string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}") string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") +string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}") +string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}") +string(REPLACE "@LOCALEDIR@" "LOCALEDIR" git_build_options "${git_build_options}") +string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}") if(USE_VCPKG) string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") endif()
generate-script.sh new file +34 -0
@@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +if test $# -ne 3 +then + echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2 + 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
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
Re: [RFC PATCH v4 06/19] Makefile: extract script to massage Shell scripts
Hi Patrick
contrib/buildsystems/CMakeLists.txt set(git_shell_scripts · line 844
Quoted 3 lines · Patrick Steinhardt
contrib/buildsystems/CMakeLists.txt +2
-0+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${shell_gen_path} + COMMAND ${CMAKE_SOURCE_DIR}/generate-script.sh
Same comments as the other patch - this need ${SH_EXE} as the command name
contrib/buildsystems/CMakeLists.txt string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio · line 1165
Quoted 7 lines
contrib/buildsystems/CMakeLists.txt +3
-0@@ -1156,6 +1160,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}") string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}") string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") +string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}") +string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}") +string(REPLACE "@LOCALEDIR@" "LOCALEDIR" git_build_options "${git_build_options}")
s/"LOCALEDIR"/"${LOCALEDIR}"/
Best Wishes
Phillip
RFC PATCH v4 7/19 Makefile: extract script to generate gitweb.cgi
In reply to Patrick SteinhardtIn order to generate "gitweb.cgi" we have to replace various different placeholders. This is done ad-hoc and is thus not easily reusable across different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at configuration time with the expected options. This script is then used as input for a new "generate-gitweb.sh" script that generates the final "gitweb.cgi" file. While this requires us to repeat the options multiple times, it is in line to how we generate other build options like our GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even though this variable is supposed to be an integer, the source file has the value quoted. The quotes are eventually stripped via sed(1), which replaces "@GITWEB_PROJECT_MAXDEPTH@" with the actual value, which is rather nonsensical. This is made clearer by just dropping the quotes in the source file.
--- gitweb/GITWEB-BUILD-OPTIONS.in | 25 +++++++++++++++ gitweb/Makefile | 58 ++++++++++++++++------------------ gitweb/generate-gitweb.sh | 45 ++++++++++++++++++++++++++ gitweb/gitweb.perl | 2 +- 4 files changed, 99 insertions(+), 31 deletions(-) create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in create mode 100755 gitweb/generate-gitweb.sh
gitweb/GITWEB-BUILD-OPTIONS.in new file +25 -0
@@ -0,0 +1,25 @@ +PERL_PATH=@PERL_PATH@ +JSMIN=@JSMIN@ +CSSMIN=@CSSMIN@ +GIT_VERSION=@GIT_VERSION@ +GIT_BINDIR=@GIT_BINDIR@ +GITWEB_CONFIG=@GITWEB_CONFIG@ +GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@ +GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@ +GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@ +GITWEB_SITENAME=@GITWEB_SITENAME@ +GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@ +GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@ +GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@ +GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@ +GITWEB_BASE_URL=@GITWEB_BASE_URL@ +GITWEB_LIST=@GITWEB_LIST@ +GITWEB_HOMETEXT=@GITWEB_HOMETEXT@ +GITWEB_CSS=@GITWEB_CSS@ +GITWEB_LOGO=@GITWEB_LOGO@ +GITWEB_FAVICON=@GITWEB_FAVICON@ +GITWEB_JS=@GITWEB_JS@ +GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@ +GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@ +GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@ +HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
gitweb/Makefile +28 -30
71 lines not on this page · raw message
gitweb/generate-gitweb.sh new file +45 -0
45 lines not on this page · raw message
gitweb/gitweb.perl +1 -1
@@ -88,7 +88,7 @@ sub evaluate_uri { # fs traversing limit for getting project list # the number is relative to the projectroot -our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@"; +our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@; # string of the home link on top of all pages our $home_link_str = "@GITWEB_HOME_LINK_STR@";
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 8/19 Makefile: refactor GIT-VERSION-GEN to be reusable
In reply to Patrick SteinhardtOur "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into the current directory, where the expectation is that it should exist in the source directory. But other build systems that support out-of-tree builds may not want to do that to keep the source directory pristine, even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore but so that it instead writes the version to stdout. This makes it easier to compute the same version as our Makefile would without having to write the "GIT-VERSION-FILE".
--- GIT-VERSION-GEN | 12 +----------- Makefile | 3 ++- contrib/buildsystems/CMakeLists.txt | 12 ++++-------- 3 files changed, 7 insertions(+), 20 deletions(-)
GIT-VERSION-GEN +1 -11
@@ -1,6 +1,5 @@ #!/bin/sh -GVF=GIT-VERSION-FILE DEF_VER=v2.47.GIT LF='
@@ -28,13 +27,4 @@ fi VN=$(expr "$VN" : v*'\(.*\)') -if test -r $GVF -then - VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) -else - VC=unset -fi -test "$VN" = "$VC" || { - echo >&2 "GIT_VERSION = $VN" - echo "GIT_VERSION = $VN" >$GVF -} +echo "$VN"
Makefile +2 -1
@@ -592,7 +592,8 @@ include shared.mak # Disable -pedantic compilation. GIT-VERSION-FILE: FORCE - @$(SHELL_PATH) ./GIT-VERSION-GEN + @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+ + @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi -include GIT-VERSION-FILE # Set our default configuration.
contrib/buildsystems/CMakeLists.txt +4 -8
@@ -83,16 +83,12 @@ if(NOT SH_EXE) "On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/") endif() -#Create GIT-VERSION-FILE using GIT-VERSION-GEN -if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE) - message("Generating GIT-VERSION-FILE") - execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -endif() +execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE git_version + OUTPUT_STRIP_TRAILING_WHITESPACE) #Parse GIT-VERSION-FILE to get the version -file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)") -string(REPLACE "GIT_VERSION = " "" git_version ${git_version}) string(FIND ${git_version} "GIT" location) if(location EQUAL -1) string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 9/19 Makefile: refactor generators to be PWD-independent
In reply to Patrick SteinhardtWe have multiple scripts that generate headers from other data. All of these scripts have the assumption built-in that they are executed in the current source directory, which makes them a bit unwieldy to use during out-of-tree builds.
Refactor them to instead take the source directory as well as the output file as arguments.
--- Makefile | 6 ++--- contrib/buildsystems/CMakeLists.txt | 12 +++------ generate-cmdlist.sh | 42 ++++++++++++++++++----------- generate-configlist.sh | 20 ++++++++++---- generate-hooklist.sh | 15 ++++++++++- 5 files changed, 61 insertions(+), 34 deletions(-)
Makefile +3 -3
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X config-list.h: generate-configlist.sh config-list.h: Documentation/*config.txt Documentation/config/*.txt - $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@ + $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@ command-list.h: generate-cmdlist.sh command-list.txt command-list.h: $(wildcard Documentation/git*.txt) $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \ $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \ - command-list.txt >$@ + . $@ hook-list.h: generate-hooklist.sh Documentation/githooks.txt - $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@ + $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@ SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\ $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
contrib/buildsystems/CMakeLists.txt +3 -9
@@ -648,23 +648,17 @@ 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 ${EXCLUSION_PROGS} command-list.txt - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h) 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 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/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 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h) endif() include_directories(${CMAKE_BINARY_DIR})
generate-cmdlist.sh +26 -16
58 lines not on this page · raw message
generate-configlist.sh +15 -5
@@ -1,13 +1,19 @@ #!/bin/sh -echo "/* Automatically generated by generate-configlist.sh */" -echo +SOURCE_DIR="$1" +OUTPUT="$2" + +if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" +then + echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2 + exit 1 +fi print_config_list () { cat <<EOF static const char *config_name_list[] = { EOF - grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | + grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt | sed '/deprecated/d; s/::$//; s/, */\n/g' | sort | sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF EOF } -echo -print_config_list +{ + echo "/* Automatically generated by generate-configlist.sh */" + echo + echo + print_config_list +} >"$OUTPUT"
generate-hooklist.sh +14 -1
@@ -2,6 +2,17 @@ # # 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 "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2 + exit 1 +fi + +{ + cat <<EOF /* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF sed -n \ -e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \ -e 'x' \ - <Documentation/githooks.txt | + <"$SOURCE_DIR"/Documentation/githooks.txt | LC_ALL=C sort cat <<EOF NULL, }; EOF + +} >"$OUTPUT"
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 10/19 Makefile: allow "bin-wrappers/" directory to exist
In reply to Patrick SteinhardtThe "bin-wrappers/" directory gets created by our build system and is populated with one script for each of our binaries. There isn't anything inherently wrong with the current layout, but it is somewhat hard to adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists and contains our "wrap-for-bin.sh" script to make things a little bit easier for subsequent steps.
--- .gitignore | 1 - Documentation/CodingGuidelines | 2 +- Makefile | 6 +++--- bin-wrappers/.gitignore | 9 +++++++++ wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0 contrib/buildsystems/CMakeLists.txt | 6 +++--- 6 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 bin-wrappers/.gitignore rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%) mode change 100644 => 100755
.gitignore +0 -1
@@ -12,7 +12,6 @@ /GIT-TEST-SUITES /GIT-USER-AGENT /GIT-VERSION-FILE -/bin-wrappers/ /git /git-add /git-am
Documentation/CodingGuidelines +1 -1
@@ -583,7 +583,7 @@ For C programs: Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb" - ./bin-wrappers/git log` (See `wrap-for-bin.sh`.) + ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.) - The primary data structure that a subsystem 'S' deals with is called `struct S`. Functions that operate on `struct S` are named
Makefile +3 -3
@@ -3199,8 +3199,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $( all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) -bin-wrappers/%: wrap-for-bin.sh - $(call mkdir_p_parent_template) +$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@BUILD_DIR@|$(shell pwd)|' \ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3696,7 +3695,8 @@ clean: profile-clean coverage-clean cocciclean $(RM) $(FUZZ_PROGRAMS) $(RM) $(SP_OBJ) $(RM) $(HCC) - $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) $(test_bindir_programs) $(RM) -r po/build/ $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope* $(RM) -r .dist-tmp-dir .doc-tmp-dir
bin-wrappers/.gitignore new file +9 -0
@@ -0,0 +1,9 @@ +/git +/git-cvsserver +/git-receive-pack +/git-shell +/git-upload-archive +/git-upload-pack +/scalar +/test-fake-ssh +/test-tool
bin-wrappers/wrap-for-bin.sh renamed from wrap-for-bin.sh +0 -0
contrib/buildsystems/CMakeLists.txt +3 -3
@@ -1049,20 +1049,20 @@ set(wrapper_test_scripts foreach(script ${wrapper_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() foreach(script ${wrapper_test_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() -file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) +file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 11/19 Makefile: simplify building of templates
In reply to Patrick SteinhardtWhen we install Git we also install a set of default templates that both git-init(1) and git-clone(1) populate into our build directories. The way the pristine templates are laid out in our source directory is somewhat weird though: instead of reconstructing the actual directory hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the "branches/" directory, which is supposed to be empty when installing it. And as Git famously doesn't store empty directories at all we have to work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how branches used to be stored in the dark ages. gitrepository-layout(5) lists this directory as "slightly deprecated", which I would claim is a strong understatement. I have never encountered anybody using it today and would be surprised if it even works as expected. So having the "--" hack in place for an item that is basically unused, unmaintained and deprecated doesn't only feel unreasonable, but installing that entry by default may also cause confusion for users that do not know what this is supposed to be in the first place.
Remove this directory from our templates and, now that we do not require the workaround anymore, restructure the templates to form a proper hierarchy. This makes it way easier for build systems to install these templates into place.
We should likely think about removing support for "branch/" altogether, but that is outside of the scope of this patch series.
---
contrib/buildsystems/CMakeLists.txt | 34 ++++++----------
templates/Makefile | 39 ++++++++++++-------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)contrib/buildsystems/CMakeLists.txt +12 -22
@@ -106,8 +106,8 @@ project(git #TODO Enable NLS on windows natively #macros for parsing the Makefile for sources and scripts -macro(parse_makefile_for_sources list_var regex) - file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)") +macro(parse_makefile_for_sources list_var makefile regex) + file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)") string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}}) string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit. string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -665,20 +665,20 @@ include_directories(${CMAKE_BINARY_DIR}) #build #libgit -parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS") +parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS") list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") add_library(libgit ${libgit_SOURCES} ${compat_SOURCES}) #libxdiff -parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS") +parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS") list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") add_library(xdiff STATIC ${libxdiff_SOURCES}) #reftable -parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS") +parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS") list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") add_library(reftable STATIC ${reftable_SOURCES})
@@ -742,7 +742,7 @@ elseif(UNIX) endif() #git -parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS") +parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS") list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -874,24 +874,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content}) -#templates -file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*") -list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "") -list(REMOVE_ITEM templates ".gitignore") -list(REMOVE_ITEM templates "Makefile") -list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds - -list(REMOVE_ITEM templates "branches--") -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches - +#${CMAKE_SOURCE_DIR}/Makefile templates +parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES") +string(REPLACE " " ";" templates ${templates}) #templates have @.*@ replacement so use configure_file instead foreach(tm ${templates}) - string(REPLACE "--" "/" blt_tm ${tm}) - string(REPLACE "this" "" blt_tm ${blt_tm})# for this-- - configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY) + configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY) endforeach() - #translations if(MSGFMT_EXE) file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -965,7 +955,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c) target_link_libraries(test-fake-ssh common-main) #unit-tests -parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS") +parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS") list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/") add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1023,7 +1013,7 @@ if(MSVC) endif() #test-tool -parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS") +parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS") add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c) list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
templates/Makefile +25 -14
@@ -29,24 +29,35 @@ all: boilerplates.made custom # in a file direc--tory--file in the source. They will be # just copied to the destination. -bpsrc = $(filter-out %~,$(wildcard *--*)) -boilerplates.made : $(bpsrc) - $(QUIET)umask 022 && ls *--* 2>/dev/null | \ - while read boilerplate; \ +TEMPLATES = +TEMPLATES += description +TEMPLATES += hooks/applypatch-msg.sample +TEMPLATES += hooks/commit-msg.sample +TEMPLATES += hooks/fsmonitor-watchman.sample +TEMPLATES += hooks/post-update.sample +TEMPLATES += hooks/pre-applypatch.sample +TEMPLATES += hooks/pre-commit.sample +TEMPLATES += hooks/pre-merge-commit.sample +TEMPLATES += hooks/prepare-commit-msg.sample +TEMPLATES += hooks/pre-push.sample +TEMPLATES += hooks/pre-rebase.sample +TEMPLATES += hooks/pre-receive.sample +TEMPLATES += hooks/push-to-checkout.sample +TEMPLATES += hooks/sendemail-validate.sample +TEMPLATES += hooks/update.sample +TEMPLATES += info/exclude + +boilerplates.made: $(TEMPLATES) + $(QUIET)umask 022 && for template in $(TEMPLATES); \ do \ - case "$$boilerplate" in *~) continue ;; esac && \ - dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \ - dir=`expr "$$dst" : '\(.*\)/'` && \ + dir=$$(dirname "$$template") && \ mkdir -p blt/$$dir && \ - case "$$boilerplate" in \ - *--) continue;; \ - esac && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \ - blt/$$dst && \ - if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \ - chmod a+$$rx "blt/$$dst" || exit; \ + -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \ + blt/$$template && \ + if test -x "$$template"; then rx=rx; else rx=r; fi && \ + chmod a+$$rx "blt/$$template" || exit; \ done && \ date >$@
templates/branches-- deleted +0 -1
@@ -1 +0,0 @@ -: this is just to ensure the directory exists.
templates/description renamed from templates/this--description +0 -0
templates/hooks/applypatch-msg.sample renamed from templates/hooks--applypatch-msg.sample +0 -0
templates/hooks/commit-msg.sample renamed from templates/hooks--commit-msg.sample +0 -0
templates/hooks/fsmonitor-watchman.sample renamed from templates/hooks--fsmonitor-watchman.sample +0 -0
templates/hooks/post-update.sample renamed from templates/hooks--post-update.sample +0 -0
templates/hooks/pre-applypatch.sample renamed from templates/hooks--pre-applypatch.sample +0 -0
templates/hooks/pre-commit.sample renamed from templates/hooks--pre-commit.sample +0 -0
templates/hooks/pre-merge-commit.sample renamed from templates/hooks--pre-merge-commit.sample +0 -0
templates/hooks/pre-push.sample renamed from templates/hooks--pre-push.sample +0 -0
templates/hooks/pre-rebase.sample renamed from templates/hooks--pre-rebase.sample +0 -0
templates/hooks/pre-receive.sample renamed from templates/hooks--pre-receive.sample +0 -0
templates/hooks/prepare-commit-msg.sample renamed from templates/hooks--prepare-commit-msg.sample +0 -0
templates/hooks/push-to-checkout.sample renamed from templates/hooks--push-to-checkout.sample +0 -0
templates/hooks/sendemail-validate.sample renamed from templates/hooks--sendemail-validate.sample +0 -0
templates/hooks/update.sample renamed from templates/hooks--update.sample +0 -0
templates/info/exclude renamed from templates/info--exclude +0 -0
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 12/19 Documentation: allow sourcing generated includes from separate dir
In reply to Patrick SteinhardtOur documentation uses "include::" directives to include parts that are either reused across multiple documents or parts that we generate at build time. Unfortunately, top-level includes are only ever resolved relative to the base directory, which is typically the directory of the including document. Most importantly, it is not possible to have either asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory. This is of course a bummer for out-of-tree builds, because here the dynamically-built includes live in the build directory whereas the static includes live in the source directory.
Introduce a build_dir attribute and prepend it to all of our includes for dynamically-built files. This attribute gets set to the build directory and thus converts the include path to an absolute path, which asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl", which tries to figure out included files such our Makefile can set up proper build-time dependencies. This script simply scans through the source files for any lines that match "^include::" and treats the remainder of the line as included file path. But given that those may now contain the "{build_dir}" variable we have to teach the script to replace that attribute with the actual build directory.
--- Documentation/Makefile | 3 ++- Documentation/build-docdep.perl | 2 ++ Documentation/config/diff.txt | 2 +- Documentation/config/merge.txt | 2 +- Documentation/git.txt | 24 ++++++++++++------------ 5 files changed, 18 insertions(+), 15 deletions(-)
Documentation/Makefile +2 -1
@@ -218,6 +218,7 @@ SHELL_PATH ?= $(SHELL) # Shell quote; SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) +ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)' ifdef DEFAULT_PAGER DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER)) ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -283,7 +284,7 @@ docdep_prereqs = \ cmd-list.made $(cmds_txt) doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl - $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR) + $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR) ifneq ($(MAKECMDGOALS),clean) -include doc.dep
Documentation/build-docdep.perl +2 -0
@@ -1,5 +1,6 @@ #!/usr/bin/perl +my ($build_dir) = @ARGV; my %include = (); my %included = ();
@@ -10,6 +11,7 @@ chomp; s/^include::\s*//; s/\[\]//; + s/{build_dir}/${build_dir}/; $include{$text}{$_} = 1; $included{$_} = 1; }
Documentation/config/diff.txt +1 -1
@@ -206,7 +206,7 @@ diff.<driver>.cachetextconv:: Set this option to true to make the diff driver cache the text conversion outputs. See linkgit:gitattributes[5] for details. -include::../mergetools-diff.txt[] +include::{build_dir}/mergetools-diff.txt[] diff.indentHeuristic:: Set this option to `false` to disable the default heuristics
Documentation/config/merge.txt +1 -1
@@ -101,7 +101,7 @@ merge.guitool:: Any other value is treated as a custom merge tool and requires that a corresponding mergetool.<guitool>.cmd variable is defined. -include::../mergetools-merge.txt[] +include::{build_dir}/mergetools-merge.txt[] merge.verbosity:: Controls the amount of output shown by the recursive merge
Documentation/git.txt +12 -12
@@ -245,17 +245,17 @@ ancillary user utilities. Main porcelain commands ~~~~~~~~~~~~~~~~~~~~~~~ -include::cmds-mainporcelain.txt[] +include::{build_dir}/cmds-mainporcelain.txt[] Ancillary Commands ~~~~~~~~~~~~~~~~~~ Manipulators: -include::cmds-ancillarymanipulators.txt[] +include::{build_dir}/cmds-ancillarymanipulators.txt[] Interrogators: -include::cmds-ancillaryinterrogators.txt[] +include::{build_dir}/cmds-ancillaryinterrogators.txt[] Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others These commands are to interact with foreign SCM and with other people via patch over e-mail. -include::cmds-foreignscminterface.txt[] +include::{build_dir}/cmds-foreignscminterface.txt[] Reset, restore and revert ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories. Manipulation commands ~~~~~~~~~~~~~~~~~~~~~ -include::cmds-plumbingmanipulators.txt[] +include::{build_dir}/cmds-plumbingmanipulators.txt[] Interrogation commands ~~~~~~~~~~~~~~~~~~~~~~ -include::cmds-plumbinginterrogators.txt[] +include::{build_dir}/cmds-plumbinginterrogators.txt[] In general, the interrogate commands do not touch the files in the working tree.
@@ -328,12 +328,12 @@ the working tree. Syncing repositories ~~~~~~~~~~~~~~~~~~~~ -include::cmds-synchingrepositories.txt[] +include::{build_dir}/cmds-synchingrepositories.txt[] The following are helper commands used by the above; end users typically do not use them directly. -include::cmds-synchelpers.txt[] +include::{build_dir}/cmds-synchelpers.txt[] Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands These are internal helper commands used by other commands; end users typically do not use them directly. -include::cmds-purehelpers.txt[] +include::{build_dir}/cmds-purehelpers.txt[] Guides ------ The following documentation pages are guides about Git concepts. -include::cmds-guide.txt[] +include::{build_dir}/cmds-guide.txt[] Repository, command and file interfaces ---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which users are expected to interact with directly. See `--user-formats` in linkgit:git-help[1] for more details on the criteria. -include::cmds-userinterfaces.txt[] +include::{build_dir}/cmds-userinterfaces.txt[] File formats, protocols and other developer interfaces ------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and other git developer interfaces. See `--developer-interfaces` in linkgit:git-help[1]. -include::cmds-developerinterfaces.txt[] +include::{build_dir}/cmds-developerinterfaces.txt[] Configuration Mechanism -----------------------
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 13/19 Documentation: teach "cmd-list.perl" about out-of-tree builds
In reply to Patrick SteinhardtThe "cmd-list.perl" script generates a list of commands that can be included into our manpages. The script doesn't know about out-of-tree builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write data into the build directory.
--- Documentation/Makefile | 2 +- Documentation/cmd-list.perl | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-)
Documentation/Makefile +1 -1
@@ -306,7 +306,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \ $(cmds_txt): cmd-list.made cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT) - $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \ + $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \ date >$@ mergetools_txt = mergetools-diff.txt mergetools-merge.txt
Documentation/cmd-list.perl +12 -11
@@ -3,12 +3,13 @@ use File::Compare qw(compare); sub format_one { - my ($out, $nameattr) = @_; + my ($source_dir, $out, $nameattr) = @_; my ($name, $attr) = @$nameattr; + my ($path) = "$source_dir/Documentation/$name.txt"; my ($state, $description); my $mansection; $state = 0; - open I, '<', "$name.txt" or die "No such file $name.txt"; + open I, '<', "$path" or die "No such file $path.txt"; while (<I>) { if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) { $mansection = $1;
@@ -29,7 +30,7 @@ sub format_one { } close I; if (!defined $description) { - die "No description found in $name.txt"; + die "No description found in $path.txt"; } if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) { print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one { } } -my ($input, @categories) = @ARGV; +my ($source_dir, $build_dir, @categories) = @ARGV; -open IN, "<$input"; +open IN, "<$source_dir/command-list.txt"; while (<IN>) { last if /^### command list/; }
@@ -63,17 +64,17 @@ sub format_one { for my $out (@categories) { my ($cat) = $out =~ /^cmds-(.*)\.txt$/; - open O, '>', "$out+" or die "Cannot open output file $out+"; + my ($path) = "$build_dir/$out"; + open O, '>', "$path+" or die "Cannot open output file $out+"; for (@{$cmds{$cat}}) { - format_one(\*O, $_); + format_one($source_dir, \*O, $_); } close O; - if (-f "$out" && compare("$out", "$out+") == 0) { - unlink "$out+"; + if (-f "$path" && compare("$path", "$path+") == 0) { + unlink "$path+"; } else { - print STDERR "$out\n"; - rename "$out+", "$out"; + rename "$path+", "$path"; } }
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 14/19 Documentation: extract script to generate a list of mergetools
In reply to Patrick SteinhardtWe include the list of available mergetools into our manpages. Extract the script that performs this logic such that we can reuse it in other build systems.
While at it, refactor the Makefile targets such that we don't create "mergetools-list.made" anymore. It shouldn't be necessary, as we can instead have other targets depend on "mergetools-{diff,merge}.txt" directly.
--- Documentation/Makefile | 22 ++++++++-------------- Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 14 deletions(-) create mode 100755 Documentation/generate-mergetool-list.sh
Documentation/Makefile +8 -14
@@ -276,11 +276,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),) -include ../GIT-VERSION-FILE endif +mergetools_txt = mergetools-diff.txt mergetools-merge.txt + # # Determine "include::" file references in asciidoc files. # docdep_prereqs = \ - mergetools-list.made $(mergetools_txt) \ + $(mergetools_txt) \ cmd-list.made $(cmds_txt) doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -309,19 +311,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT) $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \ date >$@ -mergetools_txt = mergetools-diff.txt mergetools-merge.txt - -$(mergetools_txt): mergetools-list.made - -mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*) - $(QUIET_GEN) \ - $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \ - . ../git-mergetool--lib.sh && \ - show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \ - $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \ - . ../git-mergetool--lib.sh && \ - show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \ - date >$@ +mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*) +mergetools-diff.txt: + $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@ +mergetools-merge.txt: + $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@ TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
Documentation/generate-mergetool-list.sh new file +17 -0
@@ -0,0 +1,17 @@ +#!/bin/sh + +if test "$#" -ne 3 +then + echo "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>" >&2 + exit 1 +fi + +SOURCE_DIR="$1" +TOOL_MODE="$2" +OUTPUT="$3" +MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools" + +( + . "$SOURCE_DIR"/git-mergetool--lib.sh && + show_tool_names can_$TOOL_MODE +) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 15/19 t: better support for out-of-tree builds
In reply to Patrick SteinhardtOur in-tree builds used by the Makefile use various different build directories scattered around different locations. The paths to those build directories have to be propagated to our tests such that they can find the contained files. This is done via a mixture of hardcoded paths in our test library and injected variables in our bin-wrappers or "GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For one, we have all paths which are subject to change stored in a small set of central files instead of having the knowledge of build paths in many files. And second, it allows build systems which build files elsewhere to adapt those paths based on their own needs. This is especially nice in the context of build systems that use out-of-tree builds like CMake or Meson.
Remove hardcoded knowledge of build paths from our test library and move it into our bin-wrappers and "GIT-BUILD-OPTIONS".
--- GIT-BUILD-OPTIONS.in | 5 +++++ Makefile | 9 +++++++++ bin-wrappers/wrap-for-bin.sh | 11 ++++++----- contrib/buildsystems/CMakeLists.txt | 8 ++++++++ t/lib-gettext.sh | 4 ++-- t/t7609-mergetool--lib.sh | 2 +- t/test-lib.sh | 6 +++--- 7 files changed, 34 insertions(+), 11 deletions(-)
GIT-BUILD-OPTIONS.in +5 -0
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@ GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@ GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@ +GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@ +GIT_TEST_POPATH=@GIT_TEST_POPATH@ +GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@ +GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@ +GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@ RUNTIME_PREFIX=@RUNTIME_PREFIX@ GITWEBDIR=@GITWEBDIR@ USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
Makefile +9 -0
@@ -3173,6 +3173,11 @@ GIT-BUILD-OPTIONS: FORCE -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \ + -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \ + -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \ + -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \ + -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \ + -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3202,6 +3207,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR $(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@BUILD_DIR@|$(shell pwd)|' \ + -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \ + -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \ + -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \ + -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ chmod +x $@
bin-wrappers/wrap-for-bin.sh +6 -5
@@ -4,21 +4,22 @@ # to run test suite against sandbox, but with only bindir-installed # executables in PATH. The Makefile copies this into various # files in bin-wrappers, substituting -# @BUILD_DIR@ and @PROG@. +# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@. GIT_EXEC_PATH='@BUILD_DIR@' if test -n "$NO_SET_GIT_TEMPLATE_DIR" then unset GIT_TEMPLATE_DIR else - GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt' + GIT_TEMPLATE_DIR='@TEMPLATE_DIR@' export GIT_TEMPLATE_DIR fi -GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" -GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale' +MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@' +GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}" +GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@' PATH='@BUILD_DIR@/bin-wrappers:'"$PATH" -export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR +export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR case "$GIT_DEBUGGER" in '')
contrib/buildsystems/CMakeLists.txt +8 -0
@@ -1054,6 +1054,9 @@ endforeach() file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") +string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}") +string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}") +string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}") string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1139,6 +1142,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}") string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}") string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}") string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
t/lib-gettext.sh +2 -2
@@ -6,8 +6,8 @@ . ./test-lib.sh -GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale" -GIT_PO_PATH="$GIT_BUILD_DIR/po" +GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR" +GIT_PO_PATH="$GIT_TEST_POPATH" export GIT_TEXTDOMAINDIR GIT_PO_PATH if test -n "$GIT_TEST_INSTALLED"
t/t7609-mergetool--lib.sh +1 -1
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'mergetool --tool=vimdiff creates the expected layout' ' - . "$GIT_BUILD_DIR"/mergetools/vimdiff && + . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff && run_unit_tests '
t/test-lib.sh +3 -3
@@ -1478,7 +1478,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes: PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH" fi fi -GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt +GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR" GIT_CONFIG_NOSYSTEM=1 GIT_ATTR_NOSYSTEM=1 GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1494,9 +1494,9 @@ then fi fi -GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib +GITPERLLIB="$GIT_TEST_GITPERLLIB" export GITPERLLIB -test -d "$GIT_BUILD_DIR"/templates/blt || { +test -d "$GIT_TEMPLATE_DIR" || { BAIL_OUT "You haven't built things yet, have you?" }
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 16/19 t: allow overriding build dir
In reply to Patrick SteinhardtOur "test-lib.sh" assumes that our build directory is the parent directory of "t/". While true when using our Makefile, it's not when using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18), we have introduce support for overriding the GIT_BUILD_DIR by creating the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to the location of the build directory. The intent was to stop modifying "t/test-lib.sh" with the CMake build systems while allowing out-of-tree builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in fact points to the _source_ directory. So while that commit solved part of the problem for out-of-tree builds, CMake still has to write files into the source tree.
Solve the second part of the problem, namely not having to write any data into the source directory at all, by also supporting an environment variable that allows us to point to a different build directory. This allows us to perform properly self-contained out-of-tree builds.
--- t/test-lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
t/test-lib.sh +2 -1
@@ -35,7 +35,7 @@ else # needing to exist. TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1 fi -GIT_BUILD_DIR="${TEST_DIRECTORY%/t}" +GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}" if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -513,6 +513,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e ' PERF_ CURL_VERBOSE TRACE_CURL + BUILD_DIR )); my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env); print join("\n", @vars);
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 17/19 Documentation: add comparison of build systems
In reply to Patrick SteinhardtWe're contemplating whether to eventually replace our build systems with a build system that is easier to use. Add a comparison of build systems to our technical documentation as a baseline for discussion.
--- Documentation/Makefile | 1 + Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 Documentation/technical/build-systems.txt
Documentation/Makefile +1 -0
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk TECH_DOCS += SubmittingPatches TECH_DOCS += ToolsForGit TECH_DOCS += technical/bitmap-format +TECH_DOCS += technical/build-systems TECH_DOCS += technical/bundle-uri TECH_DOCS += technical/hash-function-transition TECH_DOCS += technical/long-running-process-protocol
Documentation/technical/build-systems.txt new file +224 -0
224 lines not on this page · raw message
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
RFC PATCH v4 18/19 Introduce support for the Meson build system
In reply to Patrick SteinhardtIntroduce support for the Meson build system, a "modern" meta build system that supports many different platforms, including Linux, macOS, Windows and BSDs. Meson supports different backends, including Ninja, Xcode and Microsoft Visual Studio. Several common IDEs provide an integration with it.
The biggest contender compared to Meson is probably CMake as outlined in our "Documentation/technical/build-systems.txt" file. Based on my own personal experience from working with both build systems extensively I strongly favor Meson over CMake. In my opinion, it feels significantly easier to use with a syntax that feels more like a "real" programming language. The second big reason is that Meson supports Rust natively, which may prove to be important given that the project may pick up Rust as another language eventually.
Using Meson is rather straight-forward. An example:
```
# Meson uses out-of-tree builds. You can set up multiple build
# directories, how you name them is completely up to you.
$ mkdir build
$ cd build
$ meson setup .. -Dprefix=/tmp/git-installation
# Build the project. This also provides several other targets like
e.g. `install` or `test`.
$ ninja
# Meson has been wired up to support execution of our test suites.
# Both our unit tests and our integration tests are supported.
# Running `meson test` without any arguments will execute all tests,
# but the syntax supports globbing to select only some tests.
$ meson test 't-*'
# Execute single test interactively to allow for debugging.
$ meson test 't0000-*' --interactive --test-args=-ix
```The build instructions have been successfully tested on the following systems, tests are passing:
- Apple macOS 10.15.
- FreeBSD 14.1.
- NixOS 24.11.
- OpenBSD 7.6.
- Ubuntu 24.04.
- Windows 10 with Cygwin.
- Windows 10 with MinGW64, except for t9700, which is also broken with our Makefile.
- Windows 10 with Visual Studio 2022 toolchain, using the Native Tools Command Prompt with meson setup --vsenv. Tests pass, except for t9700.
- Windows 10 with Visual Studio 2022 solution, using the Native Tools Command Prompt with meson setup --backend vs2022. Tests pass, except for t9700.
- Windows 10 with VS Code, using the Meson plug-in.
It is expected that there will still be rough edges in the current version. If this patch lands the expectation is that it will coexist with our other build systems for a while. Like this, distributions can slowly migrate over to Meson and report any findings they have to us such that we can continue to iterate. A potential cutoff date for other build systems may be Git 3.0.
Some notes:
- The installed distribution is structured somewhat differently than how it used to be the case. All of our binaries are installed into $libexec/git-core, while all binaries part of $bindir are now symbolic links pointing to the former. This rule is consistent in itself and thus easier to reason about.
- We do not install dashed binaries into $libexec/git-core anymore. So there won't e.g. be a symlink for git-add(1). These are not required by modern Git and there isn't really much of a use case for those anymore. By not installing those symlinks we thus start the deprecation of this layout.
- Documentation does not yet exist. Same here, it will follow if the project can agree on Meson.
- We're targeting Meson 1.3.0, which has been released relatively recently November 2023. The only feature we use from that version is fs.relative_to(), which we could replace if necessary. If so, we could start to target Meson 1.0.0 and newer, released in December 2022.
- The whole build instructions count around 3300 lines, half of which is listing all of our code and test files. Our Makefiles are around 5000 lines, autoconf adds another 1300 lines. CMake in comparison has only 1200 linescode, but it avoids listing individual files and does not wire up auto-configuration as extensively as the Meson instructions do.
- We bundle a set of subproject wrappers for curl, expat, openssl, pcre2 and zlib. This allows developers to build Git without these dependencies preinstalled, and Meson will fetch and build them automatically. This is especially helpful on Windows.
--- Documentation/meson.build | 317 ++++++ bin-wrappers/meson.build | 28 + contrib/completion/meson.build | 8 + contrib/meson.build | 1 + gitweb/meson.build | 63 ++ meson.build | 1614 ++++++++++++++++++++++++++++ meson_options.txt | 73 ++ perl/FromCPAN/Mail/meson.build | 7 + perl/FromCPAN/meson.build | 9 + perl/Git/LoadCPAN/Mail/meson.build | 7 + perl/Git/LoadCPAN/meson.build | 9 + perl/Git/SVN/Memoize/meson.build | 7 + perl/Git/SVN/meson.build | 20 + perl/Git/meson.build | 18 + perl/meson.build | 12 + po/meson.build | 27 + subprojects/.gitignore | 1 + subprojects/curl.wrap | 13 + subprojects/expat.wrap | 13 + subprojects/openssl.wrap | 15 + subprojects/pcre2.wrap | 16 + subprojects/zlib.wrap | 13 + t/helper/meson.build | 91 ++ t/meson.build | 1105 +++++++++++++++++++ templates/hooks/meson.build | 24 + templates/info/meson.build | 5 + templates/meson.build | 13 + 27 files changed, 3529 insertions(+) create mode 100644 Documentation/meson.build create mode 100644 bin-wrappers/meson.build create mode 100644 contrib/completion/meson.build create mode 100644 contrib/meson.build create mode 100644 gitweb/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 perl/FromCPAN/Mail/meson.build create mode 100644 perl/FromCPAN/meson.build create mode 100644 perl/Git/LoadCPAN/Mail/meson.build create mode 100644 perl/Git/LoadCPAN/meson.build create mode 100644 perl/Git/SVN/Memoize/meson.build create mode 100644 perl/Git/SVN/meson.build create mode 100644 perl/Git/meson.build create mode 100644 perl/meson.build create mode 100644 po/meson.build create mode 100644 subprojects/.gitignore create mode 100644 subprojects/curl.wrap create mode 100644 subprojects/expat.wrap create mode 100644 subprojects/openssl.wrap create mode 100644 subprojects/pcre2.wrap create mode 100644 subprojects/zlib.wrap create mode 100644 t/helper/meson.build create mode 100644 t/meson.build create mode 100644 templates/hooks/meson.build create mode 100644 templates/info/meson.build create mode 100644 templates/meson.build
Documentation/meson.build new file +317 -0
@@ -0,0 +1,317 @@ +manpages = { + # Category 1. + 'git-add.txt' : 1, + 'git-am.txt' : 1, + 'git-annotate.txt' : 1, + 'git-apply.txt' : 1, + 'git-archimport.txt' : 1, + 'git-archive.txt' : 1, + 'git-bisect.txt' : 1, + 'git-blame.txt' : 1, + 'git-branch.txt' : 1, + 'git-bugreport.txt' : 1, + 'git-bundle.txt' : 1, + 'git-cat-file.txt' : 1, + 'git-check-attr.txt' : 1, + 'git-check-ignore.txt' : 1, + 'git-check-mailmap.txt' : 1, + 'git-checkout-index.txt' : 1, + 'git-checkout.txt' : 1, + 'git-check-ref-format.txt' : 1, + 'git-cherry-pick.txt' : 1, + 'git-cherry.txt' : 1, + 'git-citool.txt' : 1, + 'git-clean.txt' : 1, + 'git-clone.txt' : 1, + 'git-column.txt' : 1, + 'git-commit-graph.txt' : 1, + 'git-commit-tree.txt' : 1, + 'git-commit.txt' : 1, + 'git-config.txt' : 1, + 'git-count-objects.txt' : 1, + 'git-credential-cache--daemon.txt' : 1, + 'git-credential-cache.txt' : 1, + 'git-credential-store.txt' : 1, + 'git-credential.txt' : 1, + 'git-cvsexportcommit.txt' : 1, + 'git-cvsimport.txt' : 1, + 'git-cvsserver.txt' : 1, + 'git-daemon.txt' : 1, + 'git-describe.txt' : 1, + 'git-diagnose.txt' : 1, + 'git-diff-files.txt' : 1, + 'git-diff-index.txt' : 1, + 'git-difftool.txt' : 1, + 'git-diff-tree.txt' : 1, + 'git-diff.txt' : 1, + 'git-fast-export.txt' : 1, + 'git-fast-import.txt' : 1, + 'git-fetch-pack.txt' : 1, + 'git-fetch.txt' : 1, + 'git-filter-branch.txt' : 1, + 'git-fmt-merge-msg.txt' : 1, + 'git-for-each-ref.txt' : 1, + 'git-for-each-repo.txt' : 1, + 'git-format-patch.txt' : 1, + 'git-fsck-objects.txt' : 1, + 'git-fsck.txt' : 1, + 'git-fsmonitor--daemon.txt' : 1, + 'git-gc.txt' : 1, + 'git-get-tar-commit-id.txt' : 1, + 'git-grep.txt' : 1, + 'git-gui.txt' : 1, + 'git-hash-object.txt' : 1, + 'git-help.txt' : 1, + 'git-hook.txt' : 1, + 'git-http-backend.txt' : 1, + 'git-http-fetch.txt' : 1, + 'git-http-push.txt' : 1, + 'git-imap-send.txt' : 1, + 'git-index-pack.txt' : 1, + 'git-init-db.txt' : 1, + 'git-init.txt' : 1, + 'git-instaweb.txt' : 1, + 'git-interpret-trailers.txt' : 1, + 'git-log.txt' : 1, + 'git-ls-files.txt' : 1, + 'git-ls-remote.txt' : 1, + 'git-ls-tree.txt' : 1, + 'git-mailinfo.txt' : 1, + 'git-mailsplit.txt' : 1, + 'git-maintenance.txt' : 1, + 'git-merge-base.txt' : 1, + 'git-merge-file.txt' : 1, + 'git-merge-index.txt' : 1, + 'git-merge-one-file.txt' : 1, + 'git-mergetool--lib.txt' : 1, + 'git-mergetool.txt' : 1, + 'git-merge-tree.txt' : 1, + 'git-merge.txt' : 1, + 'git-mktag.txt' : 1, + 'git-mktree.txt' : 1, + 'git-multi-pack-index.txt' : 1, + 'git-mv.txt' : 1, + 'git-name-rev.txt' : 1, + 'git-notes.txt' : 1, + 'git-p4.txt' : 1, + 'git-pack-objects.txt' : 1, + 'git-pack-redundant.txt' : 1, + 'git-pack-refs.txt' : 1, + 'git-patch-id.txt' : 1, + 'git-prune-packed.txt' : 1, + 'git-prune.txt' : 1, + 'git-pull.txt' : 1, + 'git-push.txt' : 1, + 'git-quiltimport.txt' : 1, + 'git-range-diff.txt' : 1, + 'git-read-tree.txt' : 1, + 'git-rebase.txt' : 1, + 'git-receive-pack.txt' : 1, + 'git-reflog.txt' : 1, + 'git-refs.txt' : 1, + 'git-remote-ext.txt' : 1, + 'git-remote-fd.txt' : 1, + 'git-remote.txt' : 1, + 'git-repack.txt' : 1, + 'git-replace.txt' : 1, + 'git-replay.txt' : 1, + 'git-request-pull.txt' : 1, + 'git-rerere.txt' : 1, + 'git-reset.txt' : 1, + 'git-restore.txt' : 1, + 'git-revert.txt' : 1, + 'git-rev-list.txt' : 1, + 'git-rev-parse.txt' : 1, + 'git-rm.txt' : 1, + 'git-send-email.txt' : 1, + 'git-send-pack.txt' : 1, + 'git-shell.txt' : 1, + 'git-sh-i18n--envsubst.txt' : 1, + 'git-sh-i18n.txt' : 1, + 'git-shortlog.txt' : 1, + 'git-show-branch.txt' : 1, + 'git-show-index.txt' : 1, + 'git-show-ref.txt' : 1, + 'git-show.txt' : 1, + 'git-sh-setup.txt' : 1, + 'git-sparse-checkout.txt' : 1, + 'git-stage.txt' : 1, + 'git-stash.txt' : 1, + 'git-status.txt' : 1, + 'git-stripspace.txt' : 1, + 'git-submodule.txt' : 1, + 'git-svn.txt' : 1, + 'git-switch.txt' : 1, + 'git-symbolic-ref.txt' : 1, + 'git-tag.txt' : 1, + 'git-unpack-file.txt' : 1, + 'git-unpack-objects.txt' : 1, + 'git-update-index.txt' : 1, + 'git-update-ref.txt' : 1, + 'git-update-server-info.txt' : 1, + 'git-upload-archive.txt' : 1, + 'git-upload-pack.txt' : 1, + 'git-var.txt' : 1, + 'git-verify-commit.txt' : 1, + 'git-verify-pack.txt' : 1, + 'git-verify-tag.txt' : 1, + 'git-version.txt' : 1, + 'git-web--browse.txt' : 1, + 'git-whatchanged.txt' : 1, + 'git-worktree.txt' : 1, + 'git-write-tree.txt' : 1, + 'git.txt' : 1, + 'gitk.txt' : 1, + 'gitweb.txt' : 1, + 'scalar.txt' : 1, + + # Category 5. + 'gitattributes.txt' : 5, + 'gitformat-bundle.txt' : 5, + 'gitformat-chunk.txt' : 5, + 'gitformat-commit-graph.txt' : 5, + 'gitformat-index.txt' : 5, + 'gitformat-pack.txt' : 5, + 'gitformat-signature.txt' : 5, + 'githooks.txt' : 5, + 'gitignore.txt' : 5, + 'gitmailmap.txt' : 5, + 'gitmodules.txt' : 5, + 'gitprotocol-capabilities.txt' : 5, + 'gitprotocol-common.txt' : 5, + 'gitprotocol-http.txt' : 5, + 'gitprotocol-pack.txt' : 5, + 'gitprotocol-v2.txt' : 5, + 'gitrepository-layout.txt' : 5, + 'gitweb.conf.txt' : 5, + + # Category 7. + 'gitcli.txt' : 7, + 'gitcore-tutorial.txt' : 7, + 'gitcredentials.txt' : 7, + 'gitcvs-migration.txt' : 7, + 'gitdiffcore.txt' : 7, + 'giteveryday.txt' : 7, + 'gitfaq.txt' : 7, + 'gitglossary.txt' : 7, + 'gitpacking.txt' : 7, + 'gitnamespaces.txt' : 7, + 'gitremote-helpers.txt' : 7, + 'gitrevisions.txt' : 7, + 'gitsubmodules.txt' : 7, + 'gittutorial-2.txt' : 7, + 'gittutorial.txt' : 7, + 'gitworkflows.txt' : 7, +} + +asciidoc = find_program('asciidoc') +git = find_program('git', required: false) +xmlto = find_program('xmlto') + +git_revdate = '' +if git.found() + git_revdate = run_command(git, 'show', '--quiet', '--pretty=%as', check: false).stdout().strip() +endif + +asciidoc_common_options = [ + asciidoc, + '--conf-file=' + meson.current_source_dir() / 'asciidoc.conf', + '--attribute=manual=Git Manual', + '--attribute=mansource=Git ' + git_version, + '--attribute=revdate=' + git_revdate, + '--attribute=build_dir=' + meson.current_build_dir(), +] + +cmd_lists = [ + 'cmds-ancillaryinterrogators.txt', + 'cmds-ancillarymanipulators.txt', + 'cmds-mainporcelain.txt', + 'cmds-plumbinginterrogators.txt', + 'cmds-plumbingmanipulators.txt', + 'cmds-synchingrepositories.txt', + 'cmds-synchelpers.txt', + 'cmds-guide.txt', + 'cmds-developerinterfaces.txt', + 'cmds-userinterfaces.txt', + 'cmds-purehelpers.txt', + 'cmds-foreignscminterface.txt', +] + +documentation_deps = [ ] + +documentation_deps += custom_target( + command: [ + perl, + meson.current_source_dir() / 'cmd-list.perl', + meson.project_source_root(), + meson.current_build_dir(), + ] + cmd_lists, + output: cmd_lists +) + +foreach mode : [ 'diff', 'merge' ] + documentation_deps += custom_target( + command: [ + shell, + meson.current_source_dir() / 'generate-mergetool-list.sh', + '..', + 'diff', + '@OUTPUT@' + ], + env: [ + 'MERGE_TOOLS_DIR=' + meson.project_source_root() / 'mergetools', + 'TOOL_MODE=' + mode, + ], + output: 'mergetools-' + mode + '.txt', + ) +endforeach + +foreach manpage, category : manpages + if get_option('docs').contains('man') + manpage_xml_target = custom_target( + command: asciidoc_common_options + [ + '--backend=docbook', + '--doctype=manpage', + '--out-file=@OUTPUT@', + meson.current_source_dir() / manpage, + ], + depends: documentation_deps, + output: fs.stem(manpage) + '.xml', + ) + + manpage_path = fs.stem(manpage) + '.' + category.to_string() + manpage_target = custom_target( + command: [ + xmlto, + '-m', + meson.current_source_dir() / 'manpage-normal.xsl', + '-m', + meson.current_source_dir() / 'manpage-bold-literal.xsl', + '--stringparam', + 'man.base.url.for.relative.links=' + get_option('prefix') / get_option('mandir'), + 'man', + manpage_xml_target, + '-o', + meson.current_build_dir(), + ], + output: manpage_path, + install: true, + install_dir: get_option('mandir') / 'man' + category.to_string(), + ) + endif + + if get_option('docs').contains('html') and category == 1 + custom_target( + command: asciidoc_common_options + [ + '--backend=xhtml11', + '--doctype=manpage', + '--out-file=@OUTPUT@', + meson.current_source_dir() / manpage, + ], + depends: documentation_deps, + output: fs.stem(manpage) + '.html', + install: true, + install_dir: get_option('datadir') / 'doc/git-doc', + ) + endif +endforeach
bin-wrappers/meson.build new file +28 -0
@@ -0,0 +1,28 @@ +bin_wrappers_config = configuration_data() +foreach key, value : { + 'BUILD_DIR': meson.project_build_root(), + 'MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools', + 'TEMPLATE_DIR': meson.project_build_root() / 'templates', + 'GIT_TEXTDOMAINDIR': meson.project_build_root() / 'po', + 'GITPERLLIB': meson.project_build_root() / 'perl/lib', +} + # Paths need to be Unix-style without drive prefixes as they get added to the + # PATH variable. And given that drive prefixes contain a colon we'd otherwise + # end up with a broken PATH if we didn't convert them. + if cygpath.found() + value = run_command(cygpath, value, check: true).stdout().strip() + endif + bin_wrappers_config.set(key, value) +endforeach + +foreach executable : bin_wrappers + executable_config = configuration_data() + executable_config.merge_from(bin_wrappers_config) + executable_config.set('PROG', fs.relative_to(executable.full_path(), meson.project_build_root())) + + configure_file( + input: 'wrap-for-bin.sh', + output: fs.stem(executable.full_path()), + configuration: executable_config, + ) +endforeach
contrib/completion/meson.build new file +8 -0
@@ -0,0 +1,8 @@ +foreach script : [ + 'git-completion.bash', + 'git-completion.tcsh', + 'git-completion.zsh', + 'git-prompt.sh' +] + test_dependencies += fs.copyfile(script) +endforeach
contrib/meson.build new file +1 -0
@@ -0,0 +1 @@ +subdir('completion')
gitweb/meson.build new file +63 -0
63 lines not on this page · raw message
meson.build new file +1614 -0
1,614 lines not on this page · raw message
meson_options.txt new file +73 -0
73 lines not on this page · raw message
perl/FromCPAN/Mail/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +test_dependencies += custom_target( + input: 'Address.pm', + output: 'Address.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail', +)
perl/FromCPAN/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +test_dependencies += custom_target( + input: 'Error.pm', + output: 'Error.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/FromCPAN', +) + +subdir('Mail')
perl/Git/LoadCPAN/Mail/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +test_dependencies += custom_target( + input: 'Address.pm', + output: 'Address.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail', +)
perl/Git/LoadCPAN/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +test_dependencies += custom_target( + input: 'Error.pm', + output: 'Error.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN', +) + +subdir('Mail')
perl/Git/SVN/Memoize/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +test_dependencies += custom_target( + input: 'YAML.pm', + output: 'YAML.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/SVN', +)
perl/Git/SVN/meson.build new file +20 -0
@@ -0,0 +1,20 @@ +foreach source : [ + 'Editor.pm', + 'Fetcher.pm', + 'GlobSpec.pm', + 'Log.pm', + 'Migration.pm', + 'Prompt.pm', + 'Ra.pm', + 'Utils.pm', +] + test_dependencies += custom_target( + input: source, + output: source, + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/SVN', + ) +endforeach + +subdir('Memoize')
perl/Git/meson.build new file +18 -0
@@ -0,0 +1,18 @@ +foreach source : [ + 'I18N.pm', + 'IndexInfo.pm', + 'LoadCPAN.pm', + 'Packet.pm', + 'SVN.pm', +] + test_dependencies += custom_target( + input: source, + output: source, + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5/Git', + ) +endforeach + +subdir('LoadCPAN') +subdir('SVN')
perl/meson.build new file +12 -0
@@ -0,0 +1,12 @@ +test_dependencies += custom_target( + input: 'Git.pm', + output: 'Git.pm', + command: generate_perl_command, + install: true, + install_dir: get_option('datadir') / 'perl5', +) + +subdir('Git') +if get_option('perl_cpan_fallback') + subdir('FromCPAN') +endif
po/meson.build new file +27 -0
@@ -0,0 +1,27 @@ +i18n = import('i18n') + +translations = i18n.gettext('git', + languages: [ + 'bg', + 'ca', + 'de', + 'el', + 'es', + 'fr', + 'id', + 'is', + 'it', + 'ko', + 'pl', + 'pt_PT', + 'ru', + 'sv', + 'tr', + 'uk', + 'vi', + 'zh_CN', + 'zh_TW', + ], + install: true, +) +test_dependencies += translations[0]
subprojects/.gitignore new file +1 -0
@@ -0,0 +1 @@ +/*/
subprojects/curl.wrap new file +13 -0
@@ -0,0 +1,13 @@ +[wrap-file] +directory = curl-8.10.1 +source_url = https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/curl_8.10.1-1/curl-8.10.1.tar.xz +source_filename = curl-8.10.1.tar.xz +source_hash = 73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee +patch_filename = curl_8.10.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/curl_8.10.1-1/get_patch +patch_hash = 707c28f35fc9b0e8d68c0c2800712007612f922a31da9637ce706a2159f3ddd8 +wrapdb_version = 8.10.1-1 + +[provide] +dependency_names = libcurl
subprojects/expat.wrap new file +13 -0
@@ -0,0 +1,13 @@ +[wrap-file] +directory = expat-2.6.3 +source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz +source_filename = expat-2.6.3.tar.bz2 +source_hash = 274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc +patch_filename = expat_2.6.3-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.6.3-1/get_patch +patch_hash = cf017fbe105e31428b2768360bd9be39094df4e948a1e8d1c54b6f7c76460cb1 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.6.3-1/expat-2.6.3.tar.bz2 +wrapdb_version = 2.6.3-1 + +[provide] +expat = expat_dep
subprojects/openssl.wrap new file +15 -0
@@ -0,0 +1,15 @@ +[wrap-file] +directory = openssl-3.0.8 +source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz +source_filename = openssl-3.0.8.tar.gz +source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e +patch_filename = openssl_3.0.8-3_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch +patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz +wrapdb_version = 3.0.8-3 + +[provide] +libcrypto = libcrypto_dep +libssl = libssl_dep +openssl = openssl_dep
subprojects/pcre2.wrap new file +16 -0
@@ -0,0 +1,16 @@ +[wrap-file] +directory = pcre2-10.44 +source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2 +source_filename = pcre2-10.44.tar.bz2 +source_hash = d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96 +patch_filename = pcre2_10.44-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.44-2/get_patch +patch_hash = 4336d422ee9043847e5e10dbbbd01940d4c9e5027f31ccdc33a7898a1ca94009 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.44-2/pcre2-10.44.tar.bz2 +wrapdb_version = 10.44-2 + +[provide] +libpcre2-8 = libpcre2_8 +libpcre2-16 = libpcre2_16 +libpcre2-32 = libpcre2_32 +libpcre2-posix = libpcre2_posix
subprojects/zlib.wrap new file +13 -0
@@ -0,0 +1,13 @@ +[wrap-file] +directory = zlib-1.3.1 +source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-1/zlib-1.3.1.tar.gz +source_filename = zlib-1.3.1.tar.gz +source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 +patch_filename = zlib_1.3.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-1/get_patch +patch_hash = e79b98eb24a75392009cec6f99ca5cdca9881ff20bfa174e8b8926d5c7a47095 +wrapdb_version = 1.3.1-1 + +[provide] +zlib = zlib_dep
t/helper/meson.build new file +91 -0
91 lines not on this page · raw message
t/meson.build new file +1105 -0
618 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
Part of the diff is not shown here. View the raw message.
RFC PATCH v4 19/19 meson: fix conflicts with in-flight topics
In reply to Patrick SteinhardtAs support for Meson is still in-flight we have to accommodate for conflicts with topics in "seen". The following conflicts are being addressed in this commit:
- ej/cat-file-remote-object-info adds t1017.
- cc/promisor-remote-capability adds t5710.
- ds/path-walk adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- am/git-blame-ignore-revs-by-default adds t8015 and t8016.
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
This is somewhat painful in the current state where Meson is not yet part of the main tree, but we'll have to live with that for the time being.
I've split this commit out into a separate fixup-style commit such that it is possible to test this topic both with and without "seen" merged into it. You can simply revert this commit to test without "seen".
--- meson.build | 4 ++++ t/helper/meson.build | 1 + t/meson.build | 5 +++++ 3 files changed, 10 insertions(+)
meson.build +4 -0
@@ -65,6 +65,8 @@ libgit_sources = [ 'commit-graph.c', 'commit-reach.c', 'commit.c', + 'common-exit.c', + 'common-init.c', 'compat/nonblock.c', 'compat/obstack.c', 'compat/terminal.c',
@@ -177,6 +179,7 @@ libgit_sources = [ 'parse-options.c', 'patch-delta.c', 'patch-ids.c', + 'path-walk.c', 'path.c', 'pathspec.c', 'pkt-line.c',
@@ -217,6 +220,7 @@ libgit_sources = [ 'reftable/reader.c', 'reftable/record.c', 'reftable/stack.c', + 'reftable/system.c', 'reftable/tree.c', 'reftable/writer.c', 'remote.c',
t/helper/meson.build +1 -0
@@ -40,6 +40,7 @@ test_tool_sources = [ 'test-parse-pathspec-file.c', 'test-partial-clone.c', 'test-path-utils.c', + 'test-path-walk.c', 'test-pcre2-config.c', 'test-pkt-line.c', 'test-proc-receive.c',
t/meson.build +5 -0
@@ -167,6 +167,7 @@ integration_tests = [ 't1014-read-tree-confusing.sh', 't1015-read-index-unmerged.sh', 't1016-compatObjectFormat.sh', + 't1017-cat-file-remote-object-info.sh', 't1020-subdirectory.sh', 't1021-rerere-in-workdir.sh', 't1022-read-tree-partial-clone.sh',
@@ -718,6 +719,7 @@ integration_tests = [ 't5703-upload-pack-ref-in-want.sh', 't5704-protocol-violations.sh', 't5705-session-id-in-capabilities.sh', + 't5710-promisor-remote-capability.sh', 't5730-protocol-v2-bundle-uri-file.sh', 't5731-protocol-v2-bundle-uri-git.sh', 't5732-protocol-v2-bundle-uri-http.sh',
@@ -820,6 +822,7 @@ integration_tests = [ 't6500-gc.sh', 't6501-freshen-objects.sh', 't6600-test-reach.sh', + 't6601-path-walk.sh', 't6700-tree-depth.sh', 't7001-mv.sh', 't7002-mv-sparse-checkout.sh',
@@ -946,6 +949,8 @@ integration_tests = [ 't8012-blame-colors.sh', 't8013-blame-ignore-revs.sh', 't8014-blame-ignore-fuzzy.sh', + 't8015-blame-default-ignore-revs.sh', + 't8016-blame-override-ignore-revs.sh', 't9001-send-email.sh', 't9002-column.sh', 't9003-help-autocorrect.sh',
Signature · 1 line
2.47.0.118.gfd3785337b.dirty
Quoted 15 lines · Patrick Steinhardt
- The last patch is a compatibility patch for "seen". There are a couple of topics that interact with this series, and I didn't want to make all of them a strict dependency. So I've decided to just create a fixup-style commit that does the necessary changes in order to work with "seen". Like this, you can test without "seen" by simply dropping that last commit, and you can test with "seen" by merging it into this topic.
@Taylor: I didn't really have a better idea than this. There are six additional topics that this branch interacts with, and building the branch with eight dependencies in total didn't feel sensible. Ideally, the topic branch itself shouldn't have the last commit, but once it gets merged into 'seen' we should have it. Let me know in case you have a better idea though.
Quoted 8 lines
This topic is built on top of
fd3785337b(The third batch, 2024-10-22) with the following two branches merged into it:- ps/upgrade-clar at
30bf9f0aaa(cmake: set up proper dependencies for generated clar headers, 2024-10-21). This is currently in 'seen'.- ps/platform-compat-fixes at
80ebd91b83(http: fix build error onFreeBSD, 2024-10-16). This has been merged to 'next'.
Thanks for all of the helpful information. I changed the base up to "The third batch" and merged in the two branches you mentioned. Everything builds fine at the tip and passes 'make test'.
Quoted 7 lines
I was pondering a bit whether I should split this topic up even further. I've already evicted other parts out of it such that they can land separately, and landing the
Makefilerefactorings independently would reduce the overall review load. These steps also make sense even if we don't have Meson, as those are all either simplifications, improvements for CMake or a necessary step towards out-of-tree builds. Let me know your thoughts!
I think erring on the side of smaller series makes them easier to review, as Stolee and I were talking about in another thread. But if you feel like this topic is receiving sufficient review as-is, then I wouldn't bother changing it.
Thanks,
Taylor
Quoted 5 lines · Patrick Steinhardt
Hi,
this is the fourth version of my patch series that modernizes our build system. It refactors various parts of it to make it possible to perform out-of-tree builds in theory and then wires up Meson.
I was thinking a little bit about this topic last night and wanted to collect my thoughts somewhere.
I think that there are a couple of things that I'm not 100% clear or sold on, which are:
- What is the eventual goal of this series? Do we plan to transition the existing make-driven builds to instead be built with Meson? Will we have both? Something else?
- What is the eventual plan for CMake, which is maintained currently in the contrib directory? Will it be deprecated in favor of Meson? Will we continue to support it?
Let me expand a little on each of those in turn:
== What is the eventual goal?
From reading [PATCH 17/19], it seems the main arguments in favor of using Meson are:
- Ease of use: easy to use, discovering available options is easy. The scripting language is straight-forward to use.
- IDE support: Supports generating build instructions for Xcode and Microsoft Visual Studio, a plugin exists for Visual Studio Code.
- Out-of-tree builds: supported.
- Cross-platform builds: supported.
- Language support:
- C: Supported for GCC, Clang, MSVC and other toolchains.
- Rust: Supported for rustc.
- Test integration: supported. Interactive tests are supported starting with Meson 1.5.0 via the --interactive flag.
I don't think that when reading these any of them stick out to me and compel me to learn a new build system. I understand and am sympathetic to the fact that GNU Make has odd syntax and can be cumbersome. But I don't think that incrementally modifying our Makefile over time is difficult, and it has certainly worked well over the years.
Certainly there is ample support for IDE integration with Make. Out-of-tree builds and cross-platform builds could be supported in theory as you note within the existing build system. Another suggestion you make is that Meson has better native support for Rust, which I agree may be important to consider in the future.
But I don't think that any of those three (out-of-tree builds, cross-compilation, or Rust support) are insurmountable challenges in Make. Certainly there is a lot of inertia there, but I don't think that's a bad thing. Contributors are used to the existing build system, it has worked well for us, works across many platforms and has (IMO) stood the test of time.
I admittedly have a hard time squaring the benefits and goals we have with Meson with the cost of learning a new build system, and/or moving away from Make entirely.
I am entirely open to the possibility that there is something that I am missing here, and that Meson really is a better choice for Git given our current direction. But I think if that's true, then the series needs to explain that more prominently.
== What is the eventual plan for CMake?
From [PATCH 18/19], you write:
Quoted 5 lines
If this patch lands the expectation is that it will coexist with our other build systems for a while. Like this, distributions can slowly migrate over to Meson and report any findings they have to us such that we can continue to iterate. A potential cutoff date for other build systems may be Git 3.0.
I don't view this is a good intermediate state, and is in my view making an existing problem that we have worse. On the "existing problem": I think that landing CMake support in contrib was a mistake. In my view, CMake support should have either been a first-class citizen in Git (such that we don't consider a change "done" until it can be built by CMake), or should have been maintained out-of-tree.
But I think we struck a worst-of-both-worlds balance by landing it in contrib. It's maintained in the tree, so people expect to be able to build the project with it because it comes with a bog-standard clone of git.git.
But despite living in the project's tree, it is not a first-class citizen, and subjectively it seems that we get an awful lot of mail asking why something doesn't build in CMake, etc. (To your credit, I think you have been one of the main people to help with that, often fixing those bugs yourself, which is greatly appreciated).
I don't want to see the project have to pseudo-maintain three build systems. It seems like doing so would be cumbersome, and error-prone. I am already probably guilty of breaking CMake builds when I add a new compilation unit to the project, because of a combination of my lack of familiarity with CMake, and the fact that we don't have a project-wide convention of treating it with the same care as we do the Makefile. I think that having three build systems (even if they only co-existed until Git 3.0) would make that problem worse.
I feel that if we are going to pursue Meson over CMake and/or Make, we should have a clear plan to either get rid of CMake, keep it up-to-date, or something else.
== Conclusion
To step back, I want to say that I appreciate your work on this series and am certainly not opposed[^1] to the idea that we may need to make significant changes to our build infrastructure to support the project's goals.
But I think that what I'm missing currently is a clear picture of what goals we *can't* achieve with the existing build system (or could, but only at significant cost/awkwardness), and why Meson is the right choice to address those gaps.
If the project can agree that pursuing Meson as a replacement for Make, CMake, or both, then I think we would need further clarification on what we want to do with CMake (and more generally how we want to support new efforts to add additional build systems to Git in the future).
Anyway. If I have significantly missed the point here, please feel free to correct me. In the meantime, I think discussing these points would be useful to clarifying the direction of the series.
Thanks,
Taylor
[^1]: Both in my current capacity as interim-maintainer, but also as a
regular contributor to the project, who would (in both cases) be interested in evolving the build system we use in furtherance of project goals.
Quoted 13 lines · Taylor Blau
Quoted 5 lines · Patrick Steinhardt
Hi,
this is the fourth version of my patch series that modernizes our build system. It refactors various parts of it to make it possible to perform out-of-tree builds in theory and then wires up Meson.
I was thinking a little bit about this topic last night and wanted to collect my thoughts somewhere.
I think that there are a couple of things that I'm not 100% clear or sold on, which are:
Quoted 7 lines
- What is the eventual goal of this series? Do we plan to transition the existing make-driven builds to instead be built with Meson? Will we have both? Something else?
- What is the eventual plan for CMake, which is maintained currently in the contrib directory? Will it be deprecated in favor of Meson? Will we continue to support it?
My goal is to end up with a single build system eventually, so yes, we'd at one point in time drop both the Makefile and our CMake build instructions. That would of course not happen over night, but across multiple releases such that devs and packagers can start exercising the new build infra before we remove it.
Quoted 19 lines
Let me expand a little on each of those in turn:
== What is the eventual goal?
From reading [PATCH 17/19], it seems the main arguments in favor of using Meson are:
- Ease of use: easy to use, discovering available options is easy. The scripting language is straight-forward to use.
- IDE support: Supports generating build instructions for Xcode and Microsoft Visual Studio, a plugin exists for Visual Studio Code.
- Out-of-tree builds: supported.
- Cross-platform builds: supported.
- Language support:
- C: Supported for GCC, Clang, MSVC and other toolchains.
- Rust: Supported for rustc.
- Test integration: supported. Interactive tests are supported starting with Meson 1.5.0 via the--interactiveflag.
Quoted 5 lines
I don't think that when reading these any of them stick out to me and compel me to learn a new build system. I understand and am sympathetic to the fact that GNU Make has odd syntax and can be cumbersome. But I don't think that incrementally modifying our
Makefileover time is difficult, and it has certainly worked well over the years.
My main goal isn't necessarily to make things work better for old timers, but _especially_ to make it easier for newcomers. You of course can wire up many missing features with Makefiles, but that only goes so far. What you won't get with them is good cross-platform support, deep integration with IDEs and good discoverability.
Quoted 1 line
Certainly there is ample support for IDE integration with Make.
Not quite. While there is ample support for executing Makefile targets, there isn't really a lot of integration for "advanced" features:
- Auto-configuration.
- Multiple build types.
- Code completion.
- Discovery of the working set of source files.
So the integration that exists for Makefiles is for most of the part extremely shallow.
Also, I'd claim that Makefiles are really only well-integrated on Linux or BSDs. For other systems like Windows it is extremely awkward and you don't really have a nice developer experience there.
There are other factors as well, like auto-detection of the system. Our Makefile only works well for specific platforms that somebody uses on a regular basis, and wiring up a new platform requires manual code in our "config.mak.uname" file. That's somewhat awkward and hard to maintain going forward as every single platform requires its own bits and pieces.
The solution to that problem is autoconfiguration by detecting platform specific bits and pieces. And we _also_ have such a build system in the form of autoconf, but now we're entering territory that is awfully hard to maintain. Most people don't use it at all, the only user seems to really be distros. And they tend to hit many issues with autoconf because we devs don't use that infra in the first place, creating a bit of an awkward situation. Unifying this infrastructure such that devs and packagers use the same build infra is thus another goal of my series.
Quoted 11 lines
Out-of-tree builds and cross-platform builds could be supported in theory as you note within the existing build system. Another suggestion you make is that Meson has better native support for Rust, which I agree may be important to consider in the future.
But I don't think that any of those three (out-of-tree builds, cross-compilation, or Rust support) are insurmountable challenges in Make. Certainly there is a lot of inertia there, but I don't think that's a bad thing. Contributors are used to the existing build system, it has worked well for us, works across many platforms and has (IMO) stood the test of time.
We indeed can wire up all of these features. But the way things are wired up right now is extremely fragile and very manual. I don't disagree with your statement that we old-timers know our way around the build system. But I certainly don't think it is easy to hack on, and that is a problem especially if we want to set up Git for success for the next decade. I want to ensure that the Git project is easily accessible to people.
Quoted 3 lines
I admittedly have a hard time squaring the benefits and goals we have with Meson with the cost of learning a new build system, and/or moving away from Make entirely.
I guess this depends on the exact persona you're optimizing for. There are three main personas involved here:
- Long-time Git contributors. I don't worry about that persona too much. Folks in this category tend to be highly skilled, and they should not have much of an issue with adapting to Meson.
- New contributors. This is a group of people that I think would benefit from Meson. They get integration with their favorite IDE, have easy ways to discover how to tweak build instructions and can use standard invocations for Meson that they might already know from other projects.
- Packagers. This is another group of people that would benefit from my point of view. This is mostly because Meson has certain standards for how to approach problems, and thus the packager would know for how to handle things. They don't have to manually track build options and changes thereof, as these can be easily discovered and because Meson will error out in case invalid options are passed.
Quoted 4 lines
I am entirely open to the possibility that there is something that I am missing here, and that Meson really is a better choice for Git given our current direction. But I think if that's true, then the series needs to explain that more prominently.
Sure, I am happy to update the commit message.
Quoted 37 lines
== What is the eventual plan for CMake?
From [PATCH 18/19], you write:
Quoted 5 lines
If this patch lands the expectation is that it will coexist with our other build systems for a while. Like this, distributions can slowly migrate over to Meson and report any findings they have to us such that we can continue to iterate. A potential cutoff date for other build systems may be Git 3.0.
I don't view this is a good intermediate state, and is in my view making an existing problem that we have worse. On the "existing problem": I think that landing CMake support in contrib was a mistake. In my view, CMake support should have either been a first-class citizen in Git (such that we don't consider a change "done" until it can be built by CMake), or should have been maintained out-of-tree.
But I think we struck a worst-of-both-worlds balance by landing it in contrib. It's maintained in the tree, so people expect to be able to build the project with it because it comes with a bog-standard clone of git.git.
But despite living in the project's tree, it is not a first-class citizen, and subjectively it seems that we get an awful lot of mail asking why something doesn't build in CMake, etc. (To your credit, I think you have been one of the main people to help with that, often fixing those bugs yourself, which is greatly appreciated).
I don't want to see the project have to pseudo-maintain three build systems. It seems like doing so would be cumbersome, and error-prone. I am already probably guilty of breaking CMake builds when I add a new compilation unit to the project, because of a combination of my lack of familiarity with CMake, and the fact that we don't have a project-wide convention of treating it with the same care as we do the
Makefile. I think that having three build systems (even if they only co-existed until Git 3.0) would make that problem worse.
Quoted 3 lines
I feel that if we are going to pursue Meson over CMake and/or Make, we should have a clear plan to either get rid of CMake, keep it up-to-date, or something else.
I fully agree with all you're saying here. Whatever the solution, the new build system should be a proper first-class citizen and should be exercised by our CI systems such that they don't silently break.
I also agree that it's going to be a hassle to maintain three (or three and a half if you count autoconf) build systems. But I don't want to break any users out there by dropping everything but Meson immediately, so I think we just have to accept multiple build systems as an intermediate step. How exactly that would look like is certainly up for debate. My take would be:
1. Adopt the new build system and start exercising it via CI.
2. Drop CMake.
3. Drop autoconf.
4. Drop Makefiles.
This should happen over multiple releases such that every step will pull in additional user groups, which will make the new build system more solid overall. I could see that one step corresponds to one release cycle, but I'm also happy to adapt the pacing as necessary.
Patrick
Quoted 8 lines · Patrick Steinhardt
The solution to that problem is autoconfiguration by detecting platform specific bits and pieces. And we _also_ have such a build system in the form of autoconf, but now we're entering territory that is awfully hard to maintain. Most people don't use it at all, the only user seems to really be distros. And they tend to hit many issues with autoconf because we devs don't use that infra in the first place, creating a bit of an awkward situation. Unifying this infrastructure such that devs and packagers use the same build infra is thus another goal of my series.
As a distro packager (not of git specifically), my understanding was that *no* distros use the autoconf, and that at least some distros say the reason for this is that the autoconf is so unused that it doesn't actually work.
We tried to use the autoconf but failed.
Signature · 1 line
Eli Schwartz
Quoted 11 lines · Eli Schwartz
Quoted 8 lines · Patrick Steinhardt
The solution to that problem is autoconfiguration by detecting platform specific bits and pieces. And we _also_ have such a build system in the form of autoconf, but now we're entering territory that is awfully hard to maintain. Most people don't use it at all, the only user seems to really be distros. And they tend to hit many issues with autoconf because we devs don't use that infra in the first place, creating a bit of an awkward situation. Unifying this infrastructure such that devs and packagers use the same build infra is thus another goal of my series.
Quoted 6 lines
As a distro packager (not of git specifically), my understanding was that *no* distros use the autoconf, and that at least some distros say the reason for this is that the autoconf is so unused that it doesn't actually work.
We tried to use the autoconf but failed.
I thought I saw some distros using autoconf, so it at least isn't _completely_ broken. Let me double check... FreeBSD uses it, but other than that all the others that I've checked use the Makefile directly.
Patrick
Quoted 17 lines · Patrick Steinhardt
Quoted 3 lines
I admittedly have a hard time squaring the benefits and goals we have with Meson with the cost of learning a new build system, and/or moving away from Make entirely.
I guess this depends on the exact persona you're optimizing for. There are three main personas involved here:
- Long-time Git contributors. I don't worry about that persona too much. Folks in this category tend to be highly skilled, and they should not have much of an issue with adapting to Meson.
- New contributors. This is a group of people that I think would benefit from Meson. They get integration with their favorite IDE, have easy ways to discover how to tweak build instructions and can use standard invocations for Meson that they might already know from other projects.
Quoted 6 lines
- Packagers. This is another group of people that would benefit from my point of view. This is mostly because Meson has certain standards for how to approach problems, and thus the packager would know for how to handle things. They don't have to manually track build options and changes thereof, as these can be easily discovered and because Meson will error out in case invalid options are passed.
I appreciate your thoughtful response to my concerns here. Please feel free to correct me if I am wrong, but I think the bulk of your argument is captured fairly well by these three points, so I want to focus my response here.
Responding in turn, I think my feeling is something like:
- Long-time Git contributors are going to be the ones who will most frequently use the new build system. I am definitely sympathetic to getting too comfortable with our existing tools, but so far in your response I have not seen a compelling reason to switch the project to use Meson.
What I really want to say here is that I don't think we should be over-correcting on things that we are all comfortable with when they are indeed not the optimal solution.
We can and should challenge those assumptions. But I think what I see here is us challenging the assumption that 'make' is not the right tool for the project, and (at least personally) not seeing that it isn't.
- New contributors are a group that we should be optimizing for, I certainly agree with you there. But I think there are a couple of points that your response glosses over:
* New contributors should be telling us what build system they prefer, not the other way around. If we are going to switch to using a new build system to better accommodate new contributors, it should be because either (a) they have told us what doesn't work with 'make', or (b) we have a bulk of evidence that new contributors cannot easily build the project.
* New contributors do not interact with build system internals nearly as much as more experienced contributors. I would imagine that the vast majority of those interactions are simply running "make" or "make test".
You mention a handful of other niceties that Meson provides, like language server support, but I am not sure that I agree those are (a) the responsibility of the build system to provide, or (b) that those needs aren't already well met by the vast number of existing tools and IDE integrations that can work with ctags.
- Packagers are something that I admittedly have less exposure to than the other groups listed here, but I think my feeling there is similar. While they are more likely to exercise far more parts of the build system, I think we should also only be switching to a new build system if there is evidence of significant, unmet needs by packagers, which I have not seen.
Quoted 19 lines
Quoted 3 lines
I feel that if we are going to pursue Meson over CMake and/or Make, we should have a clear plan to either get rid of CMake, keep it up-to-date, or something else.
I fully agree with all you're saying here. Whatever the solution, the new build system should be a proper first-class citizen and should be exercised by our CI systems such that they don't silently break.
I also agree that it's going to be a hassle to maintain three (or three and a half if you count autoconf) build systems. But I don't want to break any users out there by dropping everything but Meson immediately, so I think we just have to accept multiple build systems as an intermediate step. How exactly that would look like is certainly up for debate. My take would be:
1. Adopt the new build system and start exercising it via CI.
2. Drop CMake.
Quoted 8 lines
3. Drop autoconf.
4. Drop Makefiles.
This should happen over multiple releases such that every step will pull in additional user groups, which will make the new build system more solid overall. I could see that one step corresponds to one release cycle, but I'm also happy to adapt the pacing as necessary.
I have a hard time imagining the project ever dropping its Makefile entirely, if for no other reason that make is available nearly everywhere that we want to build Git, and the Makefile is the product of nearly two decades of work to make it compile anywhere.
If our tree really is going to have a Makefile in it forever, then I think adding Meson (even if we remove CMake support) has many of the same challenges as the state we're in today "supporting" Make and CMake in parallel.
Thanks,
Taylor
Quoted 5 lines · Taylor Blau
Quoted 4 lines · Patrick Steinhardt
Quoted 3 lines
I admittedly have a hard time squaring the benefits and goals we have with Meson with the cost of learning a new build system, and/or moving away from Make entirely.
Quoted 8 lines
Quoted 8 lines
I guess this depends on the exact persona you're optimizing for. There are three main personas involved here:
- New contributors. This is a group of people that I think would benefit from Meson. They get integration with their favorite IDE, have easy ways to discover how to tweak build instructions and can use standard invocations for Meson that they might already know from other projects.
As someone that was once a New Contributor, my perception is that new contributors are more likely to be familiar with CMake due to its longer history and wider general popularity.
CMake has standard invocations and IDE integration so this isn't really a Meson-specific feature.
That said, if we mean, "Linux/Unix-savvy New Contributors," then I can understand why Meson might be a favorite, and perhaps this might be the crowd we are looking to target (in the same vein of the original argument for why Git uses C instead of C++).
The remainder of my reply assumes that we are targetting a general audience (in other words, including Windows users).
Disclaimer ~ I don't use Windows so I'm making some broad assumptions and generalizations about that userbase.
Quoted 7 lines
Quoted 6 lines · Patrick Steinhardt
- Packagers. This is another group of people that would benefit from my point of view. This is mostly because Meson has certain standards for how to approach problems, and thus the packager would know for how to handle things. They don't have to manually track build options and changes thereof, as these can be easily discovered and because Meson will error out in case invalid options are passed.
CMake's option() variables and its GNUInstallDirs module pretty much handles all of the standardization that packagers are looking for on this front, so this argument doesn't push the needle towards Meson over CMake from my perspective.
Quoted 6 lines
Taylor Blau wrote:
I appreciate your thoughtful response to my concerns here. Please feel free to correct me if I am wrong, but I think the bulk of your argument is captured fairly well by these three points, so I want to focus my response here.
Quoted 7 lines
Responding in turn, I think my feeling is something like:
- Long-time Git contributors are going to be the ones who will most frequently use the new build system. I am definitely sympathetic to getting too comfortable with our existing tools, but so far in your response I have not seen a compelling reason to switch the project to use Meson.
Likewise, I have not seen a compelling reason to not focus the effort on CMake instead. In other words, why not enhance the current status quo (Make + CMake) instead of trying to replace it?
Quoted 10 lines
- New contributors are a group that we should be optimizing for, I certainly agree with you there. But I think there are a couple of points that your response glosses over:
* New contributors should be telling us what build system they prefer, not the other way around. If we are going to switch to using a new build system to better accommodate new contributors, it should be because either (a) they have told us what doesn't work with 'make', or (b) we have a bulk of evidence that new contributors cannot easily build the project.
As someone that was once a New Contributor, I would be more comfortable with CMake (over Meson) because it's widespread and because it has less dependencies.
Quoted 11 lines
* New contributors do not interact with build system internals nearly as much as more experienced contributors. I would imagine that the vast majority of those interactions are simply running "make" or "make test".
You mention a handful of other niceties that Meson provides, like language server support, but I am not sure that I agree those are (a) the responsibility of the build system to provide, or (b) that those needs aren't already well met by the vast number of existing tools and IDE integrations that can work with ctags.
CMake has all of these same bells and whistles, and it's already present in git.git. LSP support just means being able to generate a compile_commands.json file, and the current CMake setup already does that.
The one thing that no one has mentioned is dependencies.
CMake has less dependencies. Python is arguably a liability in the build system arena, and Meson requires it.
Furthermore, if you must have your fast Ninja builds then CMake supports that too, but, critically, it's optional. If you don't have Ninja then you can use CMake's Makefile generator. Meson, OTOH, requires Ninja. CMake seems like a more pragmatic option in that regard.
Sorry for derailing this thread to share my Meson vs. CMake opinion, but if the main con that the Meson website has to say about CMake is, "The scripting language is cumbersome to work with. Some simple things are more complicated than necessary." [1] then my general feeling is that it's not a very strong reason for Git's needs.
[1] https://mesonbuild.com/Comparisons.html#cmake
Quoted 6 lines
- Packagers are something that I admittedly have less exposure to than the other groups listed here, but I think my feeling there is similar. While they are more likely to exercise far more parts of the build system, I think we should also only be switching to a new build system if there is evidence of significant, unmet needs by packagers, which I have not seen.
I concur with that. As someone that deals with packaging I strongly prefer tools that have minimal dependencies, just like Git. Meson brings along extra requirements (namely Python, as I mentioned before) whereas CMake requires just a C++ compiler and Make.
On that front, Git's Make-only setup is pretty wonderful from a packager's perspective because all you need is Make, so I don't think we would ever want to ditch the Makefiles, and that's okay.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I feel that if we are going to pursue Meson over CMake and/or Make, we should have a clear plan to either get rid of CMake, keep it up-to-date, or something else.
We should also have a strong reason to transition to Meson over the "something else" option of improving the CMake integration instead of trying to replace it.
Quoted 15 lines
Quoted 15 lines
I fully agree with all you're saying here. Whatever the solution, the new build system should be a proper first-class citizen and should be exercised by our CI systems such that they don't silently break.
I also agree that it's going to be a hassle to maintain three (or three and a half if you count autoconf) build systems. But I don't want to break any users out there by dropping everything but Meson immediately, so I think we just have to accept multiple build systems as an intermediate step. How exactly that would look like is certainly up for debate. My take would be:
1. Adopt the new build system and start exercising it via CI.
2. Drop CMake.
Quoted 8 lines
Quoted 8 lines
3. Drop autoconf.
4. Drop Makefiles.
This should happen over multiple releases such that every step will pull in additional user groups, which will make the new build system more solid overall. I could see that one step corresponds to one release cycle, but I'm also happy to adapt the pacing as necessary.
My take would be:
1. Enhance CMake
2. Drop Autoconf
3. Profit?
This would not need to happen over multiple releases. There'd just be one minor or major release where (2) would happen once (1) has reached some substantial level of maturity, and that'd be it.
Arguably, we could even do (2) before (1) and it'd be fine.
Quoted 9 lines
I have a hard time imagining the project ever dropping its
Makefileentirely, if for no other reason that make is available nearly everywhere that we want to build Git, and theMakefileis the product of nearly two decades of work to make it compile anywhere.If our tree really is going to have a
Makefilein it forever, then I think adding Meson (even if we remove CMake support) has many of the same challenges as the state we're in today "supporting" Make and CMake in parallel.
I agree, and from my outsider perspective it seems like a simpler answer would be to double-down on CMake rather than having to adopt another system and do the whole deprecation dance.
My perception is that any benefits we would get from supporting Meson would also be present with CMake, but with less effort.
That's just my opinion, though. Perhaps there are strong reasons for why Meson is a better tool for the purposes of attracting New Contributors and improving our day-to-day usage, but the benefits are not immediately obvious to me at least.
Signature · 1 line
David
Quoted 8 lines · David Aguilar
Quoted 7 lines
Quoted 6 lines · Patrick Steinhardt
- Packagers. This is another group of people that would benefit from my point of view. This is mostly because Meson has certain standards for how to approach problems, and thus the packager would know for how to handle things. They don't have to manually track build options and changes thereof, as these can be easily discovered and because Meson will error out in case invalid options are passed.
Quoted 4 lines
CMake's
option()variables and its GNUInstallDirs module pretty much handles all of the standardization that packagers are looking for on this front, so this argument doesn't push the needle towards Meson over CMake from my perspective.
The specific points brought by Patrick, which I guess you are disputing, are that meson options are "easily discovered" and "will error out in case invalid options are passed".
Obviously biased as a Meson maintainer, but
No. Absolutely not. CMake's option() variables are deeply, frustratingly bad as a user experience, for one simple reason. They are turing-complete and you cannot know they exist until you have successfully configured cmake at least once. Even then, the only way to find out about them is to execute a cmake subcommand that prints "cache variables" rather than "options", since options are just cache variables marked with an explanation.
In comparison, GNU autotools rigorously defined the standard GNU interface to configuring a build. In a freshly extracted copy of the source code, run
./configure --help
It lists various options, split up by section e.g.
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, make install' will install all the files in /usr/local/bin', /usr/local/lib' etc. You can specify an installation prefix other than /usr/local' using --prefix', for instance --prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
It has additional sections for "optional features" / "optional packages", and lists "Some influential environment variables" as well. You do *not* need to successfully configure before seeing this help text, and the same options always exist every time you run it.
Meson does something similar: in a freshly extracted source tree, run "meson configure". It has some cool tricks, such as opening into a pager if possible, and having table-formatted, colored output to make it easy to distinguish between the option name, its default and allowed values, and the description.
Meson splits the options table between core, base, compiler-specific, directory standards, and project-specific options. All the options that come from the project itself are further available in a single meson_options.txt" / "meson.options" file at the root of the project, you don't have to inspect thousands of lines of code to see where option() might have been invoked, or figure out whether it was transitively defined by including a module installed by a different project to /usr/share/ECM/modules/ (???) that includes a third module from /usr/share/cmake/Modules/ without which the option simply does not exist at all.
CMake thus fails on both points raised by Patrick:
- cmake options *cannot* be easily discovered, and many people (myself included) would argue that they cannot be discovered at all, whether easily or otherwise
- since cmake options are, in fact, just cache variables, it logically cannot be an error to define options that don't exist. You are quite free to define any cache variables you want, whether they exist or not, and cmake is entirely unconcerned with your doing so. Define a "NOT_AN_OPTION" variable that doesn't exist? ok, no effect -- no part of the build attempts to dereference ${NOT_AN_OPTION} so it is simply ignored.
...
GNUInstallDirs is... workable, sort of, but is also a tremendous footgun as you have to manually set it up and most people do not. Being able to work around the bad defaults is better than nothing, sure. No one is forcing any given project to use the bad defaults. But I'd hardly call that a ringing endorsement.
Quoted 3 lines
As someone that was once a New Contributor, I would be more comfortable with CMake (over Meson) because it's widespread and because it has less dependencies.
I just took a look at cmake's dependencies on my Gentoo system. It appears to have a whole lot of them.
RDEPEND="
>=app-arch/libarchive-3.3.3:=
app-crypt/rhash:0=
>=dev-libs/expat-2.0.1
>=dev-libs/jsoncpp-1.9.2-r2:0=
>=dev-libs/libuv-1.10.0:=
>=net-misc/curl-7.21.5[ssl]
sys-libs/zlib
virtual/pkgconfig
dap? ( dev-cpp/cppdap )
gui? (
!qt6? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
qt6? ( dev-qt/qtbase:6[gui,widgets] )
)
ncurses? ( sys-libs/ncurses:= )"
It also is written in C++.
meson is written in python, so it depends on that. And of course on ninja (for unix systems). It has no other dependencies, period, end of story.
Although like cmake, it depends on my system on virtual/pkgconfig -- for both packages, that pkgconfig dependency is a convenience since software has a habit of using build system functions such as "pkg_check_modules" (cmake) or "dependency" (meson) with almost universal regularity, so it's easier than having tens of thousands of packages all depend on virtual/pkgconfig.
cmake is easily installed from their website as a prebuilt binary with all dependencies bundled inside, I suppose. So that is "less dependencies"? But meson releases a prebuilt binary redistributable as a Windows MSI as well -- and on Linux, python is usually preinstalled. There's no *demand* for a prebuilt binary redistributable for Linux. If there was, we already have the packaging scripts to make one, and it's how I test the operation of the Windows MSI.
By the way, Python 3.6 to 3.10 use C89 "with several select C99 features". There are people who consider CMake's C++ requirement an insurmountably steep obstacle, e.g. that is why OpenSSL refuses to use any build system other than their own custom one written in Perl.
Quoted 4 lines
The one thing that no one has mentioned is dependencies.
CMake has less dependencies. Python is arguably a liability in the build system arena, and Meson requires it.
Please explain more about this. I don't really understand what you mean by "a liability", nor how it is "more dependencies" than cmake.
Quoted 5 lines
Furthermore, if you must have your fast Ninja builds then CMake supports that too, but, critically, it's optional. If you don't have Ninja then you can use CMake's
Makefilegenerator. Meson, OTOH, requires Ninja. CMake seems like a more pragmatic option in that regard.
Quoted 7 lines
Sorry for derailing this thread to share my Meson vs. CMake opinion, but if the main con that the Meson website has to say about CMake is, "The scripting language is cumbersome to work with. Some simple things are more complicated than necessary." [1] then my general feeling is that it's not a very strong reason for Git's needs.
Those are "some pros and cons", not all pros and cons, and it may surprise you to hear that that page is not well maintained because a) no one is strongly motivated to do so, b) no one feels passionately about making an anti-cmake rant part of the core documentation.
That page was written once in 2014 and essentially never touched since, though tree-wide formatting tweaks were made and the documentation switched hosting and git imported into the main git repository in 2017.
Quoted 4 lines
I concur with that. As someone that deals with packaging I strongly prefer tools that have minimal dependencies, just like Git. Meson brings along extra requirements (namely Python, as I mentioned before) whereas CMake requires just a C++ compiler and Make.
... wait, so is this or isn't this about the dependencies for building and installing cmake, rather than merely running it?
CMake depends on projects that build with cmake, by the way. This is the hell dimension of distro packaging.
(It also depends on jsoncpp which builds with meson, incidentally.)
Signature · 1 line
Eli Schwartz
Quoted 27 lines · David Aguilar
Quoted 5 lines · Taylor Blau
Quoted 4 lines · Patrick Steinhardt
Quoted 3 lines
I admittedly have a hard time squaring the benefits and goals we have with Meson with the cost of learning a new build system, and/or moving away from Make entirely.
Quoted 8 lines
Quoted 8 lines
I guess this depends on the exact persona you're optimizing for. There are three main personas involved here:
- New contributors. This is a group of people that I think would benefit from Meson. They get integration with their favorite IDE, have easy ways to discover how to tweak build instructions and can use standard invocations for Meson that they might already know from other projects.
As someone that was once a New Contributor, my perception is that new contributors are more likely to be familiar with CMake due to its longer history and wider general popularity.
CMake has standard invocations and IDE integration so this isn't really a Meson-specific feature.
That said, if we mean, "Linux/Unix-savvy New Contributors," then I can understand why Meson might be a favorite, and perhaps this might be the crowd we are looking to target (in the same vein of the original argument for why Git uses C instead of C++).
Quoted 5 lines
The remainder of my reply assumes that we are targetting a general audience (in other words, including Windows users).
Disclaimer ~ I don't use Windows so I'm making some broad assumptions and generalizations about that userbase.
My goal is to not only make things easier to use for Linux users, but also for users on other platforms like Windows while also catering to the typical developer of Git and making the solution for them as tasty as possible.
I agree that CMake is a tad easier to use and set up on Windows, mostly because it is directly integrated into MSVC. But I also think that CMake is a harder sell towards the power users because it is comparatively hard to maintain due to its somewhat arcane syntax, implicit variables and things like this.
So I'm basically trying to find a good middle ground where all of the respective target audiences get benefit:
- For Unix devs I think that Meson is easier to maintain and use compared to CMake. We also get nice features like out-of-source builds, good integration with the test suite and easy integration with IDEs.
- For Windows devs we have an officially supported way to build Meson from MSVC and co. Also, subprojects allow us to have as easy story for how to build Git without preinstalled dependencies, which is not currently possible with CMake to the best of my knowledge.
- For packagers I think that Meson provides better discoverability of options than CMake.
So Meson may not be the perfect solution for everyone of these target audiences, and better solutions may exist to cater specific needs. But it provides a net benefit for every single one of these audiences from my point of view. And when taking the benefits for all target audiences combined I think that Meson provides the bigger win compared to CMake.
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines · Patrick Steinhardt
- Packagers. This is another group of people that would benefit from my point of view. This is mostly because Meson has certain standards for how to approach problems, and thus the packager would know for how to handle things. They don't have to manually track build options and changes thereof, as these can be easily discovered and because Meson will error out in case invalid options are passed.
Quoted 4 lines
CMake's
option()variables and its GNUInstallDirs module pretty much handles all of the standardization that packagers are looking for on this front, so this argument doesn't push the needle towards Meson over CMake from my perspective.
I think that discoverability of Meson is way better. Here you can simply say meson configure and it provides you a nice list of all options that are available. For CMake it always used to be a big pain.
Quoted 14 lines
Quoted 6 lines
Taylor Blau wrote:
I appreciate your thoughtful response to my concerns here. Please feel free to correct me if I am wrong, but I think the bulk of your argument is captured fairly well by these three points, so I want to focus my response here.Quoted 7 lines
Responding in turn, I think my feeling is something like:
- Long-time Git contributors are going to be the ones who will most frequently use the new build system. I am definitely sympathetic to getting too comfortable with our existing tools, but so far in your response I have not seen a compelling reason to switch the project to use Meson.
Quoted 3 lines
Likewise, I have not seen a compelling reason to not focus the effort on CMake instead. In other words, why not enhance the current status quo (Make + CMake) instead of trying to replace it?
As mentioned above, I mostly think that Meson makes for a more compelling overall package. That being said, if we eventually come to the conclusion that we as a community want CMake instead of Meson, then I am willing to go there.
Quoted 17 lines
Quoted 11 lines
* New contributors do not interact with build system internals nearly as much as more experienced contributors. I would imagine that the vast majority of those interactions are simply running "make" or "make test".
You mention a handful of other niceties that Meson provides, like language server support, but I am not sure that I agree those are (a) the responsibility of the build system to provide, or (b) that those needs aren't already well met by the vast number of existing tools and IDE integrations that can work with ctags.
CMake has all of these same bells and whistles, and it's already present in git.git. LSP support just means being able to generate a compile_commands.json file, and the current CMake setup already does that.
Quoted 4 lines
The one thing that no one has mentioned is dependencies.
CMake has less dependencies. Python is arguably a liability in the build system arena, and Meson requires it.
Eli has menitoned [muon](https://muon.build/), which is a drop-in replacement for Meson written in plain C99. I don't know whether it is currently able to compile the Git project, but if this is going to be a concern for people I can try to make sure that it does.
Quoted 10 lines
Furthermore, if you must have your fast Ninja builds then CMake supports that too, but, critically, it's optional. If you don't have Ninja then you can use CMake's
Makefilegenerator. Meson, OTOH, requires Ninja. CMake seems like a more pragmatic option in that regard.Sorry for derailing this thread to share my Meson vs. CMake opinion, but if the main con that the Meson website has to say about CMake is, "The scripting language is cumbersome to work with. Some simple things are more complicated than necessary." [1] then my general feeling is that it's not a very strong reason for Git's needs.
No need to be sorry at all, the whole thread is marked as an RFC exactly so that people can provide their opinions.
Quoted 30 lines
Quoted 15 lines
Quoted 15 lines
I fully agree with all you're saying here. Whatever the solution, the new build system should be a proper first-class citizen and should be exercised by our CI systems such that they don't silently break.
I also agree that it's going to be a hassle to maintain three (or three and a half if you count autoconf) build systems. But I don't want to break any users out there by dropping everything but Meson immediately, so I think we just have to accept multiple build systems as an intermediate step. How exactly that would look like is certainly up for debate. My take would be:
1. Adopt the new build system and start exercising it via CI.
2. Drop CMake.
Quoted 8 lines
Quoted 8 lines
3. Drop autoconf.
4. Drop Makefiles.
This should happen over multiple releases such that every step will pull in additional user groups, which will make the new build system more solid overall. I could see that one step corresponds to one release cycle, but I'm also happy to adapt the pacing as necessary.
My take would be:
1. Enhance CMake
2. Drop Autoconf
3. Profit?
Quoted 5 lines
This would not need to happen over multiple releases. There'd just be one minor or major release where (2) would happen once (1) has reached some substantial level of maturity, and that'd be it.
Arguably, we could even do (2) before (1) and it'd be fine.
I'd honestly be sad if we go down the CMake route, mostly because I think that it is an inferior build system compared to Meson. I have worked with it extensively in the context of libgit2 and always found it to be a pain due to its esoteric syntax, the use of so many implicit variables, platform CMake policies, and there being so many ways to do the same thing and, where the easiest solution is typically the wrong one to pick.
That being said, I'm trying to be as pragmatic is possible: my main goal is to have a modern build system that is easier to use. So while I think that Meson fits better into that role, the next-best thing would be CMake from my point of view.
So I'll continue to champion Meson, but if the project as a whole agrees to take up CMake as another official build system then I'll adapt and make that happen.
Quoted 10 lines
Quoted 9 lines
I have a hard time imagining the project ever dropping its
Makefileentirely, if for no other reason that make is available nearly everywhere that we want to build Git, and theMakefileis the product of nearly two decades of work to make it compile anywhere.If our tree really is going to have a
Makefilein it forever, then I think adding Meson (even if we remove CMake support) has many of the same challenges as the state we're in today "supporting" Make and CMake in parallel.
Quoted 6 lines
I agree, and from my outsider perspective it seems like a simpler answer would be to double-down on CMake rather than having to adopt another system and do the whole deprecation dance.
My perception is that any benefits we would get from supporting Meson would also be present with CMake, but with less effort.
I doubt the "less effort" part. The Meson build instructions are way more complete compared to the CMake build instructions by now -- many things that work with Meson don't work with CMake. So we would have to invest significant resources to polish CMake.
Quoted 4 lines
That's just my opinion, though. Perhaps there are strong reasons for why Meson is a better tool for the purposes of attracting New Contributors and improving our day-to-day usage, but the benefits are not immediately obvious to me at least.
Thanks for your input, highly appreciated!
Patrick
Quoted 10 lines · Patrick Steinhardt
Quoted 4 lines · David Aguilar
The one thing that no one has mentioned is dependencies.
CMake has less dependencies. Python is arguably a liability in the build system arena, and Meson requires it.
Eli has menitoned [muon](https://muon.build/), which is a drop-in replacement for Meson written in plain C99. I don't know whether it is currently able to compile the Git project, but if this is going to be a concern for people I can try to make sure that it does.
I was wondering whether I should say something, because I don't really feel the criticism was on-target to begin with. But...
I am delighted to be able to confirm, that muon works quite well here.
It did require two small tweaks for not yet implemented features in muon, that meson had and which this patch series depends on:
the iconv special dependency, which I provided a patch for:
https://git.sr.ht/~lattis/muon/commit/75d33f6b6d482344d969e4ad6ce1527353f91cce
using fallback from gnu99 to c11 for the sake of MSVC, which I reported and got the muon developer to implement:
https://git.sr.ht/~lattis/muon/commit/a70e9687f3bfb8b9c21baf9acdfe84f97a42b11f
(Note the commit author dates by the way. I had the same general thought about whether muon could satisfy git users such as, frankly, ones more interesting to me than "python has too many dependencies". Such as perhaps HPE NonStop users, and I tried muon out a month ago. Yes -- even though I am a *meson* maintainer, I consider this a useful alternative to have. Meson's FAQ includes discussion about whether it makes sense to require Python, and notes that we specifically avoided providing any "provide your own python extensions" functionality because it would prevent being able to ever rewrite in another not-python language. We also document muon as an alternative in our FAQ.)
With these two small changes, muon compiles git successfully, and passes all tests but one:
running tests for project 'git'
1030/1030 f:1 s:0 j:1 [===========================================================================================================================================================================================] finished 1030 tests, 0 expected fail, 1 fail, 0 skipped
fail 9.32s t5324-split-commit-graph
stdout: 'ok 1 - setup repo
ok 2 - tweak umask for modebit tests
ok 3 - create commits and write commit-graph
ok 4 - check normal git operations: graph exists
ok 5 - add more commits, and write a new base graph
ok 6 - fork and fail to base a chain on a commit-graph file
ok 7 - add three more commits, write a tip graph
ok 8 - check normal git operations: split commit-graph: merge 3 vs 2
ok 9 - add one commit, write a tip graph
ok 10 - check normal git operations: three-layer commit-graph: commit 11
vs 6
ok 11 - add one commit, write a merged graph
ok 12 - check normal git operations: merged commit-graph: commit 12 vs 6
ok 13 - create fork and chain across alternate
ok 14 - check normal git operations: alternate: commit 13 vs 6
ok 15 - test merge stragety constants
ok 16 - remove commit-graph-chain file after flattening
ok 17 - verify hashes along chain, even in shallow
ok 18 - verify notices chain slice which is bogus (base)
ok 19 - verify notices chain slice which is bogus (tip)
ok 20 - verify --shallow does not check base contents
ok 21 - warn on base graph chunk incorrect
ok 22 - verify after commit-graph-chain corruption (base)
ok 23 - verify after commit-graph-chain corruption (tip)
ok 24 - verify notices too-short chain file
ok 25 - verify across alternates
ok 26 - reader bounds-checks base-graph chunk
ok 27 - add octopus merge
ok 28 - check normal git operations: graph exists
ok 29 - split across alternate where alternate is not split
ok 30 - --split=no-merge always writes an incremental
ok 31 - --split=replace replaces the chain
not ok 32 - handles file descriptor exhaustion
#
# git init ulimit &&
# (
# cd ulimit &&
# for i in $(test_seq 64)
# do
# test_commit $i &&
# run_with_limited_open_files test_might_fail git commit-graph write \
# --split=no-merge --reachable || return 1
# done
# )
#
ok 33 - split commit-graph respects core.sharedrepository 0666
ok 34 - split commit-graph respects core.sharedrepository 0600
ok 35 - --split=replace with partial Bloom data
ok 36 - prevent regression for duplicate commits across layers
ok 37 - setup repo for mixed generation commit-graph-chain
ok 38 - do not write generation data chunk if not present on existing tip
ok 39 - do not write generation data chunk if the topmost remaining
layer does not have generation data chunk
ok 40 - write generation data chunk if topmost remaining layer has
generation data chunk
ok 41 - write generation data chunk when commit-graph chain is replaced
ok 42 - temporary graph layer is discarded upon failure
# failed 1 among 42 test(s) 1..42 '
Signature · 1 line
Eli Schwartz
Quoted 42 lines · Eli Schwartz
Quoted 10 lines · Patrick Steinhardt
Quoted 4 lines · David Aguilar
The one thing that no one has mentioned is dependencies.
CMake has less dependencies. Python is arguably a liability in the build system arena, and Meson requires it.
Eli has menitoned [muon](https://muon.build/), which is a drop-in replacement for Meson written in plain C99. I don't know whether it is currently able to compile the Git project, but if this is going to be a concern for people I can try to make sure that it does.
I was wondering whether I should say something, because I don't really feel the criticism was on-target to begin with. But...
I am delighted to be able to confirm, that muon works quite well here.
It did require two small tweaks for not yet implemented features in muon, that meson had and which this patch series depends on:
the iconv special dependency, which I provided a patch for:
https://git.sr.ht/~lattis/muon/commit/75d33f6b6d482344d969e4ad6ce1527353f91cce
using fallback from gnu99 to c11 for the sake of MSVC, which I reported and got the muon developer to implement:
https://git.sr.ht/~lattis/muon/commit/a70e9687f3bfb8b9c21baf9acdfe84f97a42b11f
(Note the commit author dates by the way. I had the same general thought about whether muon could satisfy git users such as, frankly, ones more interesting to me than "python has too many dependencies". Such as perhaps HPE NonStop users, and I tried muon out a month ago. Yes -- even though I am a *meson* maintainer, I consider this a useful alternative to have. Meson's FAQ includes discussion about whether it makes sense to require Python, and notes that we specifically avoided providing any "provide your own python extensions" functionality because it would prevent being able to ever rewrite in another not-python language. We also document muon as an alternative in our FAQ.)
Quoted 2 lines
With these two small changes, muon compiles git successfully, and passes all tests but one:
Thanks, I'll have a look at the test failure.
Patrick
Quoted 43 lines · Patrick Steinhardt
Quoted 42 lines · Eli Schwartz
Quoted 10 lines · Patrick Steinhardt
Quoted 4 lines · David Aguilar
The one thing that no one has mentioned is dependencies.
CMake has less dependencies. Python is arguably a liability in the build system arena, and Meson requires it.
Eli has menitoned [muon](https://muon.build/), which is a drop-in replacement for Meson written in plain C99. I don't know whether it is currently able to compile the Git project, but if this is going to be a concern for people I can try to make sure that it does.
I was wondering whether I should say something, because I don't really feel the criticism was on-target to begin with. But...
I am delighted to be able to confirm, that muon works quite well here.
It did require two small tweaks for not yet implemented features in muon, that meson had and which this patch series depends on:
the iconv special dependency, which I provided a patch for:
https://git.sr.ht/~lattis/muon/commit/75d33f6b6d482344d969e4ad6ce1527353f91cce
using fallback from gnu99 to c11 for the sake of MSVC, which I reported and got the muon developer to implement:
https://git.sr.ht/~lattis/muon/commit/a70e9687f3bfb8b9c21baf9acdfe84f97a42b11f
(Note the commit author dates by the way. I had the same general thought about whether muon could satisfy git users such as, frankly, ones more interesting to me than "python has too many dependencies". Such as perhaps HPE NonStop users, and I tried muon out a month ago. Yes -- even though I am a *meson* maintainer, I consider this a useful alternative to have. Meson's FAQ includes discussion about whether it makes sense to require Python, and notes that we specifically avoided providing any "provide your own python extensions" functionality because it would prevent being able to ever rewrite in another not-python language. We also document muon as an alternative in our FAQ.)
Quoted 4 lines
Quoted 2 lines
With these two small changes, muon compiles git successfully, and passes all tests but one:
Thanks, I'll have a look at the test failure.
I couldn't reproduce the test failures on my system reliably. I did notice that some of the tests are quite flaky, and that seems mostly to be attributed to file descriptor exhaustion. These problems go away when running muon test -j1.
So maybe there is an issue to how file descriptor are allocated? That's just a guess though.
Patrick
Quoted 29 lines · Patrick Steinhardt
Quoted 3 lines · David Aguilar
That said, if we mean, "Linux/Unix-savvy New Contributors," then I can understand why Meson might be a favorite, and perhaps this might be the crowd we are looking to target [...]
My goal is to not only make things easier to use for Linux users, but also for users on other platforms like Windows while also catering to the typical developer of Git and making the solution for them as tasty as possible.
I agree that CMake is a tad easier to use and set up on Windows, mostly because it is directly integrated into MSVC. But I also think that CMake is a harder sell towards the power users because it is comparatively hard to maintain due to its somewhat arcane syntax, implicit variables and things like this.
So I'm basically trying to find a good middle ground where all of the respective target audiences get benefit:
- For Unix devs I think that Meson is easier to maintain and use compared to CMake. We also get nice features like out-of-source builds, good integration with the test suite and easy integration with IDEs.
- For Windows devs we have an officially supported way to build Meson from MSVC and co. Also, subprojects allow us to have as easy story for how to build Git without preinstalled dependencies, which is not currently possible with CMake to the best of my knowledge.
Quoted 8 lines
- For packagers I think that Meson provides better discoverability of options than CMake.
So Meson may not be the perfect solution for everyone of these target audiences, and better solutions may exist to cater specific needs. But it provides a net benefit for every single one of these audiences from my point of view. And when taking the benefits for all target audiences combined I think that Meson provides the bigger win compared to CMake.
Thanks for clarifying. Not that it matters, but you've convinced me. Constructive criticism follows below in the hope that it can help you further harden the arguments for Meson.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines · Patrick Steinhardt
- Packagers. This is another group of people that would benefit from my point of view. This is mostly because Meson has certain standards for how to approach problems, and thus the packager would know for how to handle things. They don't have to manually track build options and changes thereof, as these can be easily discovered and because Meson will error out in case invalid options are passed.
Quoted 8 lines
Quoted 4 lines
CMake's
option()variables and its GNUInstallDirs module pretty much handles all of the standardization that packagers are looking for on this front, so this argument doesn't push the needle towards Meson over CMake from my perspective.I think that discoverability of Meson is way better. Here you can simply say
meson configureand it provides you a nice list of all options that are available. For CMake it always used to be a big pain.
The pain of discovering options with CMake is true in the general case.
A specific project can enforce conventions so that all option()s are specified at the top of the main build script or a designated file specifically for options. That would trivially make the options easily discoverable in that there's only a single place to look, but that's nowhere near the rigor that Meson enforces.
Following a sensible convention is why I didn't originally vibe with the argument that option()s are insufficient, but that would merely be one project's conventions and is by no means a universal practice.
Elsewhere in this thread it was also mentioned that unknown options are blindly accepted by CMake. That's actually not true.
While it's not as rigorous as Meson because it doesn't error out by default, CMake does issue a warning when you specify variables/options that are not used by the project. IIRC this warning can be made into an error by using the "cmake -Werror=dev" option, but I appreciate Meson taking the stricter route as it results in better overall usability.
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Taylor Blau wrote:
I appreciate your thoughtful response to my concerns here. Please feel free to correct me if I am wrong, but I think the bulk of your argument is captured fairly well by these three points, so I want to focus my response here.Responding in turn, I think my feeling is something like:
- Long-time Git contributors are going to be the ones who will most frequently use the new build system. I am definitely sympathetic to getting too comfortable with our existing tools, but so far in your response I have not seen a compelling reason to switch the project to use Meson.
Quoted 8 lines
Quoted 3 lines
Likewise, I have not seen a compelling reason to not focus the effort on CMake instead. In other words, why not enhance the current status quo (Make + CMake) instead of trying to replace it?
As mentioned above, I mostly think that Meson makes for a more compelling overall package. That being said, if we eventually come to the conclusion that we as a community want CMake instead of Meson, then I am willing to go there.
I hope that's not where things land because the separation of configuration vs. build steps does provide a benefit in day-to-day use (specifically, faster incremental builds) due to the clean separation of the configuration and build steps.
It seems like it would be nice if the Meson build were eventually hooked up so that we can continue typing "make prefix=... install" (perhaps through an opt-in "enable meson" variable) and the Makefile would handle driving Meson + Ninja, but that's probably an untenable feature given the complexity of the current Makefile.
If the Makefile were completely replaced one day then that would be a nice to have, but it would probably be a bad crutch because the natural tendency would be to shadow all of Meson's options behind Makefile knobs. Encouraging users to just run meson directly seems like a better overall situation. Bisecting is the only reason why something like that might seem appealing, but I probably wouldn't push for it myself and maybe there's a better way to handle that when we cross that bridge.
Quoted 19 lines
Quoted 19 lines
Quoted 11 lines
* New contributors do not interact with build system internals nearly as much as more experienced contributors. I would imagine that the vast majority of those interactions are simply running "make" or "make test".
You mention a handful of other niceties that Meson provides, like language server support, but I am not sure that I agree those are (a) the responsibility of the build system to provide, or (b) that those needs aren't already well met by the vast number of existing tools and IDE integrations that can work with ctags.
CMake has all of these same bells and whistles, and it's already present in git.git. LSP support just means being able to generate a compile_commands.json file, and the current CMake setup already does that.
The one thing that no one has mentioned is dependencies.
Quoted 7 lines
Quoted 2 lines
CMake has less dependencies. Python is arguably a liability in the build system arena, and Meson requires it.
Eli has menitoned [muon](https://muon.build/), which is a drop-in replacement for Meson written in plain C99. I don't know whether it is currently able to compile the Git project, but if this is going to be a concern for people I can try to make sure that it does.
Thanks both for confirming that muon is a viable alternative.
Elsewhere in this thread packaging metadata for CMake was shared arguing that CMake also has many dependencies. A subtle nuance there is that those are all either optional dependencies (e.g. Qt for the GUI parts) or they are dependencies that can be optionally supplied.
You can build CMake without those dependencies installed and CMake's vendored versions will be statically linked instead. So, from the perspective of wanting to go from 0 to 100 with just gcc/g++ installed, CMake has less dependencies. This might be slightly disingenuous because CMake vendors its dependencies and distros have to opt-in so that they can supply their own versions, but the main takeaway is that GCC is all you need and that's what I meant by, "less dependencies."
This is a moot point for most users, though, and it's even moreso moot if muon compatibility can be maintained.
As to why I consider Python a liability ~ this is more of a concern for Meson and it doesn't really matter for end users, but Python has a proven track record of making breaking changes.
If you're building everything from scratch with new versions of compilers and tools then the C++ project is the one that's going to build just fine a decade from now with little to minimal effort. Python doesn't have that track record.
Even though CMake is written in C++ (which is unacceptable for some projects), this is subjectively one advantage that CMake seems to have. This is a moot point, though, and perhaps Python will eventually reach this same level of respect for not introducing breaking changes.
Furthermore, I suspect that most contributors are simply going to "apt install meson" or "brew install meson" so it's not really that much of an issue in practice for the majority of users/contributors.
Quoted 8 lines
I'd honestly be sad if we go down the CMake route, mostly because I think that it is an inferior build system compared to Meson. I have worked with it extensively in the context of libgit2 and always found it to be a pain due to its esoteric syntax, the use of so many implicit variables, platform CMake policies, and there being so many ways to do the same thing and, where the easiest solution is typically the wrong one to pick.
Quoted 8 lines
That being said, I'm trying to be as pragmatic is possible: my main goal is to have a modern build system that is easier to use. So while I think that Meson fits better into that role, the next-best thing would be CMake from my point of view.
So I'll continue to champion Meson, but if the project as a whole agrees to take up CMake as another official build system then I'll adapt and make that happen.
I agree with you. Meson looks to be a technically better option. I kinda wonder how many folks are actually using the contrib/ CMakeLists.txt, and whether this effort would be helped by retiring it sooner rather than later?
Would it be worth adding a canary to the CMake build that forces it to fail to build unless "cmake -D ENABLE_DEPRECATED_BUILD=ON" option is specified?
It could error out with a message telling users to reach out to the list alongside the hint to specify the option if they just want to get a working build.
On a rather low-powered machine here are some timings:
$ make clean
$ time make -j
181.36s user 15.35s system 99% cpu 3:17.33 total $ ninja -C build clean
$ time ninja -C build
11.23s user 4.67s system 47% cpu 33.605 total34s vs 3m17s ~ nice! That's also surprising.
That large of a difference is not explained by the extra probes done by the Makefile; a no-op incremental build is 0.5s for Make and 0.02s for Meson so the Makefile probes seem to only account for at most 0.5s.
Is the Meson build simply building much less, and that's why it's currently so much faster?
Or.. is it because I have "sccache" installed and Meson automatically uses it? "ninja -C build -v" confirms that it's using sccache and "make V=1" does not, so maybe that's why.
How do we disable the sccache usage?
"meson configure build" doesn't seem to list anything related to caching, but it is really nice seeing all of the other options in one place.
Improvement in build time seems like it could be something that sways long-time contributors towards Meson. It is pretty nice that it automatically picked up sccache in my $PATH and automatically gave me those speedups.
Quoted 1 line
Thanks for your input, highly appreciated!
Thanks. I don't want to be the CMake champion, so here are a few helpful/surprising details about the Meson build to help make it better.
(1) I first built w/out having "curl-config" installed. I was surprised to find that "ninja -C build install" ended up installing "bin/curl" and "bin/curl-config" into the prefix.
Is there a way to have the install step only install Git without bringing along these other non-Git bits?
(2) There seems to be a difference in how symlinks and hardlinks are handled in the install step.
Running "make prefix=$PWD/dist install" ends up with real files in dist/bin/ (hardlinks) whereas with Meson all of the files in the bin/ directory are symlinks into ../libexec/.
(3) Not all of the same files seems to be getting installed.
I don't see bin/gitk or bin/git-cvsserver when building with Meson.
The share/git-core/templates/ directory is missing completely.
git-gui and its related files are missing. Perhaps this is intentional/todo at this stage and hasn't been added yet.
Meson installs bin/git-http-backend (symlinked to libexec) but in the original Makefile this file only exists in libexec/.
The contents of libexec/git-core/ seems to be missing dozens of files compared to the Makefile build.
share/perl5/ has a bunch of extra git-{cvsserver,send-email,svn,...} scripts so perhaps this is where some of those files went? The Makefile places these files in the libexec/ area instead of in the share/perl5/ area.
The Makefile does not install share/gitweb/static/js/. Instead, it seems to mash everything together into a single share/gitweb/static/gitweb.js file which Meson does not install. Meson installs separate files in the share/gitweb/static/js/ area. Was that intentional, or is that just another todo?
cheers,
Signature · 1 line
David
Quoted 39 lines · David Aguilar
Quoted 29 lines · Patrick Steinhardt
Quoted 3 lines · David Aguilar
That said, if we mean, "Linux/Unix-savvy New Contributors," then I can understand why Meson might be a favorite, and perhaps this might be the crowd we are looking to target [...]
My goal is to not only make things easier to use for Linux users, but also for users on other platforms like Windows while also catering to the typical developer of Git and making the solution for them as tasty as possible.
I agree that CMake is a tad easier to use and set up on Windows, mostly because it is directly integrated into MSVC. But I also think that CMake is a harder sell towards the power users because it is comparatively hard to maintain due to its somewhat arcane syntax, implicit variables and things like this.
So I'm basically trying to find a good middle ground where all of the respective target audiences get benefit:
- For Unix devs I think that Meson is easier to maintain and use compared to CMake. We also get nice features like out-of-source builds, good integration with the test suite and easy integration with IDEs.
- For Windows devs we have an officially supported way to build Meson from MSVC and co. Also, subprojects allow us to have as easy story for how to build Git without preinstalled dependencies, which is not currently possible with CMake to the best of my knowledge.
Quoted 8 lines
- For packagers I think that Meson provides better discoverability of options than CMake.
So Meson may not be the perfect solution for everyone of these target audiences, and better solutions may exist to cater specific needs. But it provides a net benefit for every single one of these audiences from my point of view. And when taking the benefits for all target audiences combined I think that Meson provides the bigger win compared to CMake.
Quoted 3 lines
Thanks for clarifying. Not that it matters, but you've convinced me. Constructive criticism follows below in the hope that it can help you further harden the arguments for Meson.
Very happy to hear!
Quoted 29 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines · Patrick Steinhardt
- Packagers. This is another group of people that would benefit from my point of view. This is mostly because Meson has certain standards for how to approach problems, and thus the packager would know for how to handle things. They don't have to manually track build options and changes thereof, as these can be easily discovered and because Meson will error out in case invalid options are passed.
Quoted 8 lines
Quoted 4 lines
CMake's
option()variables and its GNUInstallDirs module pretty much handles all of the standardization that packagers are looking for on this front, so this argument doesn't push the needle towards Meson over CMake from my perspective.I think that discoverability of Meson is way better. Here you can simply say
meson configureand it provides you a nice list of all options that are available. For CMake it always used to be a big pain.The pain of discovering options with CMake is true in the general case.
A specific project can enforce conventions so that all option()s are specified at the top of the main build script or a designated file specifically for options. That would trivially make the options easily discoverable in that there's only a single place to look, but that's nowhere near the rigor that Meson enforces.
Following a sensible convention is why I didn't originally vibe with the argument that option()s are insufficient, but that would merely be one project's conventions and is by no means a universal practice.
Quoted 8 lines
Elsewhere in this thread it was also mentioned that unknown options are blindly accepted by CMake. That's actually not true.
While it's not as rigorous as Meson because it doesn't error out by default, CMake does issue a warning when you specify variables/options that are not used by the project. IIRC this warning can be made into an error by using the "cmake -Werror=dev" option, but I appreciate Meson taking the stricter route as it results in better overall usability.
Ah, fair enough, I remember seeing these warnings myself. As you say, I also prefer being as strict as possible, as otherwise it is so easy to miss the fact that a build option has been mistyped, removed or renamed. The warning helps the dev if they pay attention, but especially in automated systems I'd expect it to go unnoticed quite often.
Quoted 34 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Taylor Blau wrote:
I appreciate your thoughtful response to my concerns here. Please feel free to correct me if I am wrong, but I think the bulk of your argument is captured fairly well by these three points, so I want to focus my response here.Responding in turn, I think my feeling is something like:
- Long-time Git contributors are going to be the ones who will most frequently use the new build system. I am definitely sympathetic to getting too comfortable with our existing tools, but so far in your response I have not seen a compelling reason to switch the project to use Meson.
Quoted 8 lines
Quoted 3 lines
Likewise, I have not seen a compelling reason to not focus the effort on CMake instead. In other words, why not enhance the current status quo (Make + CMake) instead of trying to replace it?
As mentioned above, I mostly think that Meson makes for a more compelling overall package. That being said, if we eventually come to the conclusion that we as a community want CMake instead of Meson, then I am willing to go there.
I hope that's not where things land because the separation of configuration vs. build steps does provide a benefit in day-to-day use (specifically, faster incremental builds) due to the clean separation of the configuration and build steps.
It seems like it would be nice if the Meson build were eventually hooked up so that we can continue typing "make prefix=... install" (perhaps through an opt-in "enable meson" variable) and the
Makefilewould handle driving Meson + Ninja, but that's probably an untenable feature given the complexity of the currentMakefile.
Quoted 8 lines
If the
Makefilewere completely replaced one day then that would be a nice to have, but it would probably be a bad crutch because the natural tendency would be to shadow all of Meson's options behindMakefileknobs. Encouraging users to just run meson directly seems like a better overall situation. Bisecting is the only reason why something like that might seem appealing, but I probably wouldn't push for it myself and maybe there's a better way to handle that when we cross that bridge.
In theory it is of course possible to have a thin wrapper around Meson, but as you say it'd likely be a bit more on the painful side to write. One could be pragmatic and only map the most commonly used options and otherwise let the autodetection of features do its thing, which could be good enough for bisectability.
On the other hand I don't see that our Makefile would go away anytime soon. I would eventually want to remove it so that we have a single build system, only, but I'd think that the timeline here would rather be a year or two before we do so. So maybe that reduces the need for such a mechanism.
Quoted 42 lines
Quoted 19 lines
Quoted 19 lines
Quoted 11 lines
* New contributors do not interact with build system internals nearly as much as more experienced contributors. I would imagine that the vast majority of those interactions are simply running "make" or "make test".
You mention a handful of other niceties that Meson provides, like language server support, but I am not sure that I agree those are (a) the responsibility of the build system to provide, or (b) that those needs aren't already well met by the vast number of existing tools and IDE integrations that can work with ctags.
CMake has all of these same bells and whistles, and it's already present in git.git. LSP support just means being able to generate a compile_commands.json file, and the current CMake setup already does that.
The one thing that no one has mentioned is dependencies.
Quoted 7 lines
Quoted 2 lines
CMake has less dependencies. Python is arguably a liability in the build system arena, and Meson requires it.
Eli has menitoned [muon](https://muon.build/), which is a drop-in replacement for Meson written in plain C99. I don't know whether it is currently able to compile the Git project, but if this is going to be a concern for people I can try to make sure that it does.
Thanks both for confirming that muon is a viable alternative.
Elsewhere in this thread packaging metadata for CMake was shared arguing that CMake also has many dependencies. A subtle nuance there is that those are all either optional dependencies (e.g. Qt for the GUI parts) or they are dependencies that can be optionally supplied.
You can build CMake without those dependencies installed and CMake's vendored versions will be statically linked instead. So, from the perspective of wanting to go from 0 to 100 with just gcc/g++ installed, CMake has less dependencies. This might be slightly disingenuous because CMake vendors its dependencies and distros have to opt-in so that they can supply their own versions, but the main takeaway is that GCC is all you need and that's what I meant by, "less dependencies."
Quoted 2 lines
This is a moot point for most users, though, and it's even moreso moot if muon compatibility can be maintained.
Fair. I don't really expect anybody to use the combination of muon/sumo for everyday work, mostly because the usability is not quite up to par with Meson/Ninja. But there are two use cases that I deem important:
- Esoteric platforms that may not have Python available. I don't know whether there actually are any relevant ones, but with muon/sumo it is possible to support these.
- Bootstrappability, which I think is rather critical for a project like Git that is at the core of the whole software ecosystem. Depending only on a C99 compiler and a shell is a huge win here.
A bit of an anecdota, but CMake itself for example struggles with this quite heavily because it has dependencies that use CMake themselves. So it is nice that there is a clear path for bootstrapping with Meson and thus Git.
Quoted 9 lines
As to why I consider Python a liability ~ this is more of a concern for Meson and it doesn't really matter for end users, but Python has a proven track record of making breaking changes.
If you're building everything from scratch with new versions of compilers and tools then the C++ project is the one that's going to build just fine a decade from now with little to minimal effort. Python doesn't have that track record.
Quoted 8 lines
Even though CMake is written in C++ (which is unacceptable for some projects), this is subjectively one advantage that CMake seems to have. This is a moot point, though, and perhaps Python will eventually reach this same level of respect for not introducing breaking changes.
Furthermore, I suspect that most contributors are simply going to "apt install meson" or "brew install meson" so it's not really that much of an issue in practice for the majority of users/contributors.
Agreed.
Quoted 22 lines
Quoted 8 lines
I'd honestly be sad if we go down the CMake route, mostly because I think that it is an inferior build system compared to Meson. I have worked with it extensively in the context of libgit2 and always found it to be a pain due to its esoteric syntax, the use of so many implicit variables, platform CMake policies, and there being so many ways to do the same thing and, where the easiest solution is typically the wrong one to pick.
Quoted 8 lines
That being said, I'm trying to be as pragmatic is possible: my main goal is to have a modern build system that is easier to use. So while I think that Meson fits better into that role, the next-best thing would be CMake from my point of view.
So I'll continue to champion Meson, but if the project as a whole agrees to take up CMake as another official build system then I'll adapt and make that happen.
I agree with you. Meson looks to be a technically better option. I kinda wonder how many folks are actually using the contrib/ CMakeLists.txt, and whether this effort would be helped by retiring it sooner rather than later?
Quoted 7 lines
Would it be worth adding a canary to the CMake build that forces it to fail to build unless "cmake -D ENABLE_DEPRECATED_BUILD=ON" option is specified?
It could error out with a message telling users to reach out to the list alongside the hint to specify the option if they just want to get a working build.
I think it's still a bit too early to think about the actual deprecation road -- before removing things I want to connect with any stakeholders that use the old system and figure out whether I've got everything covered that they need. I know that Johannes for example uses CMake extensively, so I will make sure to connect with him before proposing its removal.
I've also shifted my thinking a bit: instead of removing CMake as a first step I'd like to remove the autoconf code. It is known to be broken in many situations and there is only a very small set of users out there. So replacing that with Meson would be a good first target from my point of view.
In any case I don't want to negatively surprise anybody, so I am of course very happy to discuss the roadmap here and will work with anybody who has needs that I haven't addressed yet.
Quoted 11 lines
On a rather low-powered machine here are some timings:
$ make clean $ time make -j 181.36s user 15.35s system 99% cpu 3:17.33 total$ ninja -C build clean $ time ninja -C build 11.23s user 4.67s system 47% cpu 33.605 total34s vs 3m17s ~ nice! That's also surprising.
Awesome!
Quoted 7 lines
That large of a difference is not explained by the extra probes done by the
Makefile; a no-op incremental build is 0.5s for Make and 0.02s for Meson so theMakefileprobes seem to only account for at most 0.5s.Is the Meson build simply building much less, and that's why it's currently so much faster?
We don't build documentation by default and don't have gitk wired up, but other than that the builds should be mostly equivalent.
Quoted 8 lines
Or.. is it because I have "sccache" installed and Meson automatically uses it? "ninja -C build -v" confirms that it's using sccache and "make V=1" does not, so maybe that's why.
How do we disable the sccache usage?
"meson configure build" doesn't seem to list anything related to caching, but it is really nice seeing all of the other options in one place.
Yes, Meson knows to pick up sccache and ccache automatically. [1] mentions that you can disable this by setting the compiler explicitly via the CC environment variable.
[1]: https://mesonbuild.com/Feature-autodetection.html#ccache
Quoted 4 lines
Improvement in build time seems like it could be something that sways long-time contributors towards Meson. It is pretty nice that it automatically picked up sccache in my $PATH and automatically gave me those speedups.
True.
Quoted 6 lines
Quoted 1 line
Thanks for your input, highly appreciated!
Thanks. I don't want to be the CMake champion, so here are a few helpful/surprising details about the Meson build to help make it better.
Quoted 6 lines
(1) I first built w/out having "curl-config" installed. I was surprised to find that "ninja -C build install" ended up installing "bin/curl" and "bin/curl-config" into the prefix.
Is there a way to have the install step only install Git without bringing along these other non-Git bits?
It definitely shouldn't install curl and curl-config, I'll have a look at that. But other than that Meson is currently set up such that it will automatically fall back to the subprojects in case certain dependencies cannot be found. This can be disabled via meson setup --wrap-mode nofallback.
Quoted 6 lines
(2) There seems to be a difference in how symlinks and hardlinks are handled in the install step.
Running "make prefix=$PWD/dist install" ends up with real files in dist/bin/ (hardlinks) whereas with Meson all of the files in the bin/ directory are symlinks into ../libexec/.
Yup, that's documented as part of the commit message that introduces Meson as one of the main differences.
Quoted 20 lines
(3) Not all of the same files seems to be getting installed.
I don't see bin/gitk or bin/git-cvsserver when building with Meson.
The share/git-core/templates/ directory is missing completely.
git-gui and its related files are missing. Perhaps this is intentional/todo at this stage and hasn't been added yet.
Meson installs bin/git-http-backend (symlinked to libexec) but in the original
Makefilethis file only exists in libexec/.The contents of libexec/git-core/ seems to be missing dozens of files compared to the
Makefilebuild.share/perl5/ has a bunch of extra git-{cvsserver,send-email,svn,...} scripts so perhaps this is where some of those files went? The
Makefileplaces these files in the libexec/ area instead of in the share/perl5/ area.
Quoted 5 lines
The
Makefiledoes not install share/gitweb/static/js/. Instead, it seems to mash everything together into a single share/gitweb/static/gitweb.js file which Meson does not install. Meson installs separate files in the share/gitweb/static/js/ area. Was that intentional, or is that just another todo?
gitk and git-gui aren't currently wired up. All the other ones I'll have a look at.
Thanks a lot for your feedback!
Patrick
Quoted 3 lines · Patrick Steinhardt
Fair. I don't really expect anybody to use the combination of muon/sumo for everyday work, mostly because the usability is not quite up to par with Meson/Ninja. But there are two use cases that I deem important:
(samu :P)
Quoted 4 lines
- Esoteric platforms that may not have Python available. I don't know whether there actually are any relevant ones, but with muon/sumo it is possible to support these.
Quoted 8 lines
- Bootstrappability, which I think is rather critical for a project like Git that is at the core of the whole software ecosystem. Depending only on a C99 compiler and a shell is a huge win here.
A bit of an anecdota, but CMake itself for example struggles with this quite heavily because it has dependencies that use CMake themselves. So it is nice that there is a clear path for bootstrapping with Meson and thus Git.
Yeah, the cmake bootstrap route tends to be an issue for Linux distros because we want to use system packages for those dependencies, and while it's possible to build a bootstrap seed cmake binary using their shellscript and use it to build a "real" cmake, that doesn't really help you install cmake's dependencies. There are some tricks you can do like for example on Gentoo, bootstrap the OS with http2 support in curl toggled off, so you can build without nghttp2 / no cmake, then use that to build cmake, then rebuild curl. It requires manual intervention but then you can reuse the existing cmake binary.
There's generally no path for building cmake with bundled dependencies, as that would conflict with the desired end state of distributing cmake linked to system packages.
Quoted 8 lines
Quoted 8 lines
Thanks. I don't want to be the CMake champion, so here are a few helpful/surprising details about the Meson build to help make it better.
(1) I first built w/out having "curl-config" installed. I was surprised to find that "ninja -C build install" ended up installing "bin/curl" and "bin/curl-config" into the prefix.
Quoted 8 lines
Quoted 2 lines
Is there a way to have the install step only install Git without bringing along these other non-Git bits?
It definitely shouldn't install curl and curl-config, I'll have a look at that. But other than that Meson is currently set up such that it will automatically fall back to the subprojects in case certain dependencies cannot be found. This can be disabled via
meson setup --wrap-mode nofallback.
https://github.com/mesonbuild/wrapdb/tree/master/subprojects/packagefiles/curl
could be updated to handle the case where meson.is_subproject() returns "true", by not installing tooling.
Alternatively, meson install --skip-subprojects can avoid installing *any* files from subprojects, on the theory that subprojects exist solely to provide static libraries linked into the real project.
(In theory, one could have a subproject where arbitrary data files from a subproject dependency are crucial at runtime. I think the gnome ecosystem does this, hence using GLib / Gtk as a subproject "needs" to install the subproject too -- but curl definitely doesn't have this issue...)
Signature · 1 line
Eli Schwartz
Quoted 6 lines · Eli Schwartz
Quoted 3 lines · Patrick Steinhardt
Fair. I don't really expect anybody to use the combination of muon/sumo for everyday work, mostly because the usability is not quite up to par with Meson/Ninja. But there are two use cases that I deem important:
(samu :P)
Heh. Just double checked that I got it correct in the docs, but seems like I did.
Quoted 26 lines
Quoted 8 lines
Quoted 8 lines
Thanks. I don't want to be the CMake champion, so here are a few helpful/surprising details about the Meson build to help make it better.
(1) I first built w/out having "curl-config" installed. I was surprised to find that "ninja -C build install" ended up installing "bin/curl" and "bin/curl-config" into the prefix.
Quoted 8 lines
Quoted 2 lines
Is there a way to have the install step only install Git without bringing along these other non-Git bits?
It definitely shouldn't install curl and curl-config, I'll have a look at that. But other than that Meson is currently set up such that it will automatically fall back to the subprojects in case certain dependencies cannot be found. This can be disabled via
meson setup --wrap-mode nofallback.https://github.com/mesonbuild/wrapdb/tree/master/subprojects/packagefiles/curl
could be updated to handle the case where
meson.is_subproject()returns "true", by not installing tooling.Alternatively, meson install --skip-subprojects can avoid installing *any* files from subprojects, on the theory that subprojects exist solely to provide static libraries linked into the real project.
Quoted 5 lines
(In theory, one could have a subproject where arbitrary data files from a subproject dependency are crucial at runtime. I think the gnome ecosystem does this, hence using GLib / Gtk as a subproject "needs" to install the subproject too -- but curl definitely doesn't have this issue...)
Yeah. --skip-subprojects is one way to do this, but that of course requires the user to know about it. It would be nice if one could wire this up in "meson.build" directly, e.g. by passing a install: false flag to dependency(). We don't want to install any of the subprojects as we build all of them statically and link them into the final binaries.
Patrick
Quoted 9 lines · Patrick Steinhardt
Quoted 6 lines
(2) There seems to be a difference in how symlinks and hardlinks are handled in the install step.
Running "make prefix=$PWD/dist install" ends up with real files in dist/bin/ (hardlinks) whereas with Meson all of the files in the bin/ directory are symlinks into ../libexec/.
Yup, that's documented as part of the commit message that introduces Meson as one of the main differences.
Is there a way to disable that? These symbolic-links pretending to be installed files are quite annoying---when the target file is lost, the links become useless.
Quoted 3 lines · Junio C Hamano
Is there a way to disable that? These symbolic-links pretending to be installed files are quite annoying---when the target file is lost, the links become useless.
INSTALL_SYMLINKS=1 in the existing Makefile is of course the one true way... (and really, why would you expect the target file to be lost for any reason).
That being said, it doesn't appear the patch series implements any of the other multiplicity of choice in what kind of filesystem object gets used for multiple copies of the same file. No hardlink or copy support has been rigged up.
(Meson doesn't have a builtin function for performing hardlinks, by the way. I don't really think I've seen people desire to do this outside of one project being discussed right here right now. hardlinks are mainly good at fooling people who look at them into not understanding the association between the two, and at breaking across multiple filesystems. It's definitely impossible to get it right automatically, and asking users to make an informed choice here is just not something that projects other than git seem to find valuable, for whatever reason. So basically, it's fairly understandable that meson hasn't previously added hardlink support.)
Signature · 1 line
Eli Schwartz
Quoted 14 lines · Eli Schwartz
Quoted 3 lines · Junio C Hamano
Is there a way to disable that? These symbolic-links pretending to be installed files are quite annoying---when the target file is lost, the links become useless.
INSTALL_SYMLINKS=1 in the existing
Makefileis of course the one true way... (and really, why would you expect the target file to be lost for any reason).That being said, it doesn't appear the patch series implements any of the other multiplicity of choice in what kind of filesystem object gets used for multiple copies of the same file. No hardlink or copy support has been rigged up.
Quoted 10 lines
(Meson doesn't have a builtin function for performing hardlinks, by the way. I don't really think I've seen people desire to do this outside of one project being discussed right here right now. hardlinks are mainly good at fooling people who look at them into not understanding the association between the two, and at breaking across multiple filesystems. It's definitely impossible to get it right automatically, and asking users to make an informed choice here is just not something that projects other than git seem to find valuable, for whatever reason. So basically, it's fairly understandable that meson hasn't previously added hardlink support.)
Yeah, for now we exclusively use symlinks for this and I didn't wire up an alternative. This was mostly to keep things simple while still ending up with a fully functional Git distribution. I also couldn't think of a scenario where symlinks would be an issue -- Meson also supports them on Windows, so that would not be an issue.
If this is a requirement I can adapt though. While Meson does not support hardlinks natively, we can of of course manually wire up them if required.
Patrick
Quoted 3 lines · Patrick Steinhardt
If this is a requirement I can adapt though. While Meson does not support hardlinks natively, we can of of course manually wire up them if required.
Nah, there must be bigger fish to fry in the new build system integration, and I have a feeling that by the time we are done, we may have lost the largest need for hardlinks.
I have a feeling that in _some_ future, we may not be installing "git-add" and friends for the built-in commands anywhere on disk, which is historically the primary thing we use hardlinks for to conserve both disk space and inodes.
Thanks.
Quoted 9 lines · David Aguilar
As to why I consider Python a liability ~ this is more of a concern for Meson and it doesn't really matter for end users, but Python has a proven track record of making breaking changes.
If you're building everything from scratch with new versions of compilers and tools then the C++ project is the one that's going to build just fine a decade from now with little to minimal effort. Python doesn't have that track record.
Quoted 8 lines
Even though CMake is written in C++ (which is unacceptable for some projects), this is subjectively one advantage that CMake seems to have. This is a moot point, though, and perhaps Python will eventually reach this same level of respect for not introducing breaking changes.
Furthermore, I suspect that most contributors are simply going to "apt install meson" or "brew install meson" so it's not really that much of an issue in practice for the majority of users/contributors.
For what it's worth, meson is aware that python breaking changes are a potential issue. Although the general python ecosystem is fairly lax about this -- on *all* points across:
- cpython itself being backwards incompatible
- projects making breaking changes in a micro release
- projects deciding to only support the latest, or 2 most recent, versions of cpython
meson pedantically avoids non-standard-library dependencies both for bootstrappability and for points 2 & 3.
Regarding point 1, meson can't do a lot other than adapt. But the latest version of meson will always support *all* non-EOL versions of python, we do prerelease testing of cpython betas, and we do not drop support even for EOL versions of cpython unless, having carefully evaluated the benefits and negatives, we decide that the advantages of relying on a new version outweigh the downside of preventing people on older systems with older cpython from upgrading meson.
Currently that means we still support 7 different versions of cpython, including 2 versions that are EOL (and 4 versions that built with c89, before the migration to c11).
Of course, as you say it's a bit of a moot point given that muon exists. But I just wanted to clarify that meson does take this concern seriously and we try to do everything we can to make that work -- even when some meson maintainers are unhappy and feel that being unable to depend on unpredictable third-party modules cramps their style.
We know that we are core FOSS infrastructure, and are used by other core FOSS infrastructure projects such as init systems (both systemd and openrc), graphics stacks (mesa, libdrm, both xorg and wayland), desktops (gnome has an official directive to use meson), and a variety of freedesktop projects, many of which need to keep building on LTS versions of Debian oldoldstable (not a typo) and oftentimes on even more surprising platforms.
And in some cases we've been a bit influential in getting cpython to revert breaking changes :) e.g. python 3.13 reverted the removal of the importlib.resources "Functional API".
Signature · 1 line
Eli Schwartz
Quoted 5 lines · David Aguilar
Quoted 1 line · Patrick Steinhardt
On Sat, Nov 09, 2024 at 04:58:56AM -0800, David Aguilar wrote:
(3) Not all of the same files seems to be getting installed.
I don't see bin/gitk or bin/git-cvsserver when building with Meson.
gitk is intentionally committed. git-cvsserver is fixed now.
Quoted 1 line
The share/git-core/templates/ directory is missing completely.
Fixed.
Quoted 2 lines
git-gui and its related files are missing. Perhaps this is intentional/todo at this stage and hasn't been added yet.
Yup, this is intentionally omitted for now.
Quoted 2 lines
Meson installs bin/git-http-backend (symlinked to libexec) but in the original
Makefilethis file only exists in libexec/.
Huh, true. On my system (NixOS) it's also installed in 'bin/', but when using the Makefile it indeed only ends up in 'libexec/'. Fixed now.
Quoted 2 lines
The contents of libexec/git-core/ seems to be missing dozens of files compared to the
Makefilebuild.
This is intentional, as I'm dropping the dashed builitins. Git does not need these nowadays and resolves them internally anyway.
Quoted 4 lines
share/perl5/ has a bunch of extra git-{cvsserver,send-email,svn,...} scripts so perhaps this is where some of those files went? The
Makefileplaces these files in the libexec/ area instead of in the share/perl5/ area.
Fixed.
Quoted 5 lines
The
Makefiledoes not install share/gitweb/static/js/. Instead, it seems to mash everything together into a single share/gitweb/static/gitweb.js file which Meson does not install. Meson installs separate files in the share/gitweb/static/js/ area. Was that intentional, or is that just another todo?
No, this was unintentional, fixed now. What is missing in this context is wiring up jsmin and cssmin, but I'll leave that as a todo for now.
Will send a new version later today with these fixes.
Patrick
Quoted 30 lines · Taylor Blau
Quoted 17 lines · Patrick Steinhardt
Quoted 3 lines
I admittedly have a hard time squaring the benefits and goals we have with Meson with the cost of learning a new build system, and/or moving away from Make entirely.
I guess this depends on the exact persona you're optimizing for. There are three main personas involved here:
- Long-time Git contributors. I don't worry about that persona too much. Folks in this category tend to be highly skilled, and they should not have much of an issue with adapting to Meson.
- New contributors. This is a group of people that I think would benefit from Meson. They get integration with their favorite IDE, have easy ways to discover how to tweak build instructions and can use standard invocations for Meson that they might already know from other projects.
Quoted 6 lines
- Packagers. This is another group of people that would benefit from my point of view. This is mostly because Meson has certain standards for how to approach problems, and thus the packager would know for how to handle things. They don't have to manually track build options and changes thereof, as these can be easily discovered and because Meson will error out in case invalid options are passed.
I appreciate your thoughtful response to my concerns here. Please feel free to correct me if I am wrong, but I think the bulk of your argument is captured fairly well by these three points, so I want to focus my response here.
Quoted 7 lines
Responding in turn, I think my feeling is something like:
- Long-time Git contributors are going to be the ones who will most frequently use the new build system. I am definitely sympathetic to getting too comfortable with our existing tools, but so far in your response I have not seen a compelling reason to switch the project to use Meson.
Yes, that's certainly true. And while I think we should optimize more for newcomers as stated, I still think that Meson is very much preferable over Makefiles for long-time contributors, as well. The transition period may take some time, but in the end it just feels superior to Make from my poin of view.
Out of curiosity: did you try the Meson build? I personally have to say that I already prefer working with it because the workflow with it is so much nicer. It has nicer output, is faster, has out-of-tree builds, makes it easier to configure and test execution feels way nicer compared to my previous workflow with make.
This is all subjective of course.
Quoted 8 lines
What I really want to say here is that I don't think we should be over-correcting on things that we are all comfortable with when they are indeed not the optimal solution.
We can and should challenge those assumptions. But I think what I see here is us challenging the assumption that 'make' is not the right tool for the project, and (at least personally) not seeing that it isn't.
As said, Makefiles have some problems that aren't really solveable from my perspective. And I think part of the problem in this context is that the typical developer working on Git is very much centered around Unix. The experience on non-Unix systems is kind of a pain though as there is no proper integration with anything.
And that's not only true for non-Unix-like platforms, but basically for anyone who isn't comfortable working from the command line. Integration of the project into an IDE with our Makefile is hard to pull off. While many editors can of course trivially execute the Makefile for you, setting things up such that it is _properly_ integrated into the IDE is hard.
Overall, I don't think we old time contributors lose anything by using Meson instead of Makefiles, quite on the contrary we get speedier builds and nicer integration. We'd have to adapt eventually, but I don't see that as a huge barrier.
Quoted 10 lines
- New contributors are a group that we should be optimizing for, I certainly agree with you there. But I think there are a couple of points that your response glosses over:
* New contributors should be telling us what build system they prefer, not the other way around. If we are going to switch to using a new build system to better accommodate new contributors, it should be because either (a) they have told us what doesn't work with 'make', or (b) we have a bulk of evidence that new contributors cannot easily build the project.
That's basically why the whole patch series is marked as an RFC: to get feedback from people and ask them for their opinion.
Quoted 4 lines
* New contributors do not interact with build system internals nearly as much as more experienced contributors. I would imagine that the vast majority of those interactions are simply running "make" or "make test".
Agreed.
I assume that what they are after is a streamlined process for how to compile and test the project. The build system should be providing good feedback for missing dependencies, for existing build options and how to use them. These are all things that Meson provides by default, and our Makefile doesn't.
Quoted 6 lines
You mention a handful of other niceties that Meson provides, like language server support, but I am not sure that I agree those are (a) the responsibility of the build system to provide, or (b) that those needs aren't already well met by the vast number of existing tools and IDE integrations that can work with ctags.
From my own experience the integration with other IDEs isn't great at all in Makefile-based projects. I don't use IDEs though, so I am probably not the best resource to judge.
Quoted 6 lines
- Packagers are something that I admittedly have less exposure to than the other groups listed here, but I think my feeling there is similar. While they are more likely to exercise far more parts of the build system, I think we should also only be switching to a new build system if there is evidence of significant, unmet needs by packagers, which I have not seen.
We have repeatedly gotten feedback that our autoconf-based build is basically broken and does not work well. After all, that's what spawned the whole discussion around a more modern build system that is able to properly auto-detect what the host system provides.
Quoted 33 lines
Quoted 19 lines
Quoted 3 lines
I feel that if we are going to pursue Meson over CMake and/or Make, we should have a clear plan to either get rid of CMake, keep it up-to-date, or something else.
I fully agree with all you're saying here. Whatever the solution, the new build system should be a proper first-class citizen and should be exercised by our CI systems such that they don't silently break.
I also agree that it's going to be a hassle to maintain three (or three and a half if you count autoconf) build systems. But I don't want to break any users out there by dropping everything but Meson immediately, so I think we just have to accept multiple build systems as an intermediate step. How exactly that would look like is certainly up for debate. My take would be:
1. Adopt the new build system and start exercising it via CI.
2. Drop CMake.
Quoted 8 lines
3. Drop autoconf.
4. Drop Makefiles.
This should happen over multiple releases such that every step will pull in additional user groups, which will make the new build system more solid overall. I could see that one step corresponds to one release cycle, but I'm also happy to adapt the pacing as necessary.
I have a hard time imagining the project ever dropping its
Makefileentirely, if for no other reason that make is available nearly everywhere that we want to build Git, and theMakefileis the product of nearly two decades of work to make it compile anywhere.
Quoted 4 lines
If our tree really is going to have a
Makefilein it forever, then I think adding Meson (even if we remove CMake support) has many of the same challenges as the state we're in today "supporting" Make and CMake in parallel.
If our stance is that we cannot ever drop our Makefile because it has grown for such a long time, but maintaing two official build systems at the same time is not an option either, then our hands are tied. So I don't think is a reasonable approach overall.
Yes, transitions like this will cause some pain, but I think that it is relatively easy to avoid most of the pain by having a proper plan for how to do the transition. The biggest pain will be that we have to maintain multiple build systems and keep them in sync for some time, but that also has a couple of advantages:
- We can iteratively evolve the replacement build system over time until it is ready to fully replace the old one.
- We don't have to screw anyone over by having a hard cutoff date.
- We can decide that the replacement build system is insufficient and discard it.
- Users of the build system can experiment with both build systems.
Patrick
Quoted 11 lines · Patrick Steinhardt
Quoted 5 lines
- Long-time Git contributors are going to be the ones who will most frequently use the new build system. I am definitely sympathetic to getting too comfortable with our existing tools, but so far in your response I have not seen a compelling reason to switch the project to use Meson.
Yes, that's certainly true. And while I think we should optimize more for newcomers as stated, I still think that Meson is very much preferable over Makefiles for long-time contributors, as well. The transition period may take some time, but in the end it just feels superior to Make from my poin of view.
The number one thing I care about as a developer is that the build is _reliable_. Right now, if I move forwards and backwards in history and type "make" I will almost[1] always get a correct result based on the current tree, with the minimal required amount of building. This is important for bisecting.
When I have worked on other projects, especially those that use autotools, I quite frequently run into cases where building from a dirty state cause bizarre problems that go away with a "git clean && ./configure && make". But then bisection is _much_ slower because we're building from scratch (not to mention that autoconf itself is horrifically slow).
How does the meson build do here? I don't have any reason to think it would be bad, but I am nervous of any change.
[1] I say "almost" because there are one or two spots in our history where you can run into link errors jumping over them. But for a 20-year project that's not too bad, and they happen infrequently enough that I don't worry about it.
Quoted 5 lines
Out of curiosity: did you try the Meson build? I personally have to say that I already prefer working with it because the workflow with it is so much nicer. It has nicer output, is faster, has out-of-tree builds, makes it easier to configure and test execution feels way nicer compared to my previous workflow with make.
I hadn't tried it. I did now, checking out origin/ps/build^ (to drop the "seen" resolution topic), but it didn't work:
$ meson setup build [...] Program msgfmt found: NO po/meson.build:3: WARNING: Gettext not found, all translation (po) targets will be ignored.
po/meson.build:3:20: ERROR: Can not assign void to variable.
I guess the assignment of "translations" there needs to be made conditional?
-Peff
Quoted 13 lines · Jeff King
The number one thing I care about as a developer is that the build is _reliable_. Right now, if I move forwards and backwards in history and type "make" I will almost[1] always get a correct result based on the current tree, with the minimal required amount of building. This is important for bisecting.
When I have worked on other projects, especially those that use autotools, I quite frequently run into cases where building from a dirty state cause bizarre problems that go away with a "git clean && ./configure && make". But then bisection is _much_ slower because we're building from scratch (not to mention that autoconf itself is horrifically slow).
Quoted 2 lines
How does the meson build do here? I don't have any reason to think it would be bad, but I am nervous of any change.
This is something that has bothered me about autoconf as well. Meson is much more reliable about:
- forcing a buildsystem reconfigure on any changes to the buildsystem files
- due to using ninja, forcing any object files to be rebuilt on e.g. any changes to compiler flags, since the *entire* compiler command line is part of the key that determines staleness
- keeping your existing objects between buildsystem reconfigures, if the resulting reconfigure didn't change the compiler command line for that specific object file
Quoted 14 lines
Quoted 5 lines
Out of curiosity: did you try the Meson build? I personally have to say that I already prefer working with it because the workflow with it is so much nicer. It has nicer output, is faster, has out-of-tree builds, makes it easier to configure and test execution feels way nicer compared to my previous workflow with make.
I hadn't tried it. I did now, checking out origin/ps/build^ (to drop the "seen" resolution topic), but it didn't work:
$ meson setup build [...] Program msgfmt found: NO po/meson.build:3: WARNING: Gettext not found, all translation (po) targets will be ignored.
Quoted 4 lines
po/meson.build:3:20: ERROR: Can not assign void to variable.
I guess the assignment of "translations" there needs to be made conditional?
Yeah, this is an interesting quirk. Many projects would tend to figure that translation (po) targets are "optional" because if you don't have msgfmt installed then you can just install the project without any translations and then non-English speakers will be inconvenienced but at least the entire project isn't completely un-buildable. So meson automatically disables the target and logs a warning, but then this project *also* wants to depend on the translations for the testsuite.
So this should be taken into account. Do the tests actually need translations, though?
Signature · 1 line
Eli Schwartz
Quoted 22 lines · Eli Schwartz
Quoted 8 lines
I hadn't tried it. I did now, checking out origin/ps/build^ (to drop the "seen" resolution topic), but it didn't work:
$ meson setup build [...] Program msgfmt found: NO po/meson.build:3: WARNING: Gettext not found, all translation (po) targets will be ignored.Quoted 4 lines
po/meson.build:3:20: ERROR: Can not assign void to variable.
I guess the assignment of "translations" there needs to be made conditional?
Yeah, this is an interesting quirk. Many projects would tend to figure that translation (po) targets are "optional" because if you don't have msgfmt installed then you can just install the project without any translations and then non-English speakers will be inconvenienced but at least the entire project isn't completely un-buildable. So meson automatically disables the target and logs a warning, but then this project *also* wants to depend on the translations for the testsuite.
Quoted 2 lines
So this should be taken into account. Do the tests actually need translations, though?
No, they don't. I don't have msgfmt on my system at all, and always build with NO_GETTEXT.
-Peff
Quoted 2 lines · Jeff King
No, they don't. I don't have msgfmt on my system at all, and always build with
NO_GETTEXT.
Well, even systems without msgfmt installed may have the gettext() family of symbols available. On various systems, it may even be built into their libc.
So, detecting and handling this case sensibly out of the box would be good, which I guess means checking for find_program('msgfmt') inside of po/meson.build
That being said, the meson way to handle NO_GETTEXT is to use the build option
meson setup builddir -Dgettext=disabled
That option is a "feature option", which means by default its value is auto, not disabled, and it will check for an available libintl / libc gettext().
The po/ directory is only processed if libintl / libc gettext() is found. Passing -Dgettext=disabled means that it will be forcibly overridden to "not found". Meson will log this configuration message:
Dependency intl skipped: feature gettext disabled
Signature · 1 line
Eli Schwartz
Quoted 11 lines · Eli Schwartz
Quoted 2 lines · Jeff King
No, they don't. I don't have msgfmt on my system at all, and always build with
NO_GETTEXT.Well, even systems without msgfmt installed may have the
gettext()family of symbols available. On various systems, it may even be built into their libc.So, detecting and handling this case sensibly out of the box would be good, which I guess means checking for
find_program('msgfmt')inside of po/meson.build
Yes, this is a glibc system where gettext() is in the libc. I agree the fault is in po/meson.build which is not ready to handle the null return from import('i18n'). So it is not handling the case where gettext() is available but msgfmt is not.
Mostly I was responding to your original question, though, which is: do the tests need translations. They definitely do not, as I do not generally build Git with gettext support at all. So if there is a dependency there, it seems wrong.
Quoted 4 lines
That being said, the meson way to handle
NO_GETTEXTis to use the build optionmeson setup builddir -Dgettext=disabled
Yes, that does get "meson setup" to complete for me. That gives me two other questions:
- how would I know this option exists? I think you mentioned elsewhere in the thread the ability to ask about which options exist, but I couldn't find anything via "meson -h", etc.
- is there a way to put configuration like this in a file, similar to our current config.mak?
-Peff
Quoted 6 lines · Jeff King
Yes, that does get "meson setup" to complete for me. That gives me two other questions:
- how would I know this option exists? I think you mentioned elsewhere in the thread the ability to ask about which options exist, but I couldn't find anything via "meson -h", etc.
meson -h lists:
configure Change project options
Which could perhaps be reworded as it allows you to both view and change them.
If you install meson via a linux distribution package, it probably has nice integration with our manpage. If you install it with pip install meson then not so much...
$ man meson
The configure command
meson configure provides a way to configure a Meson project from the command line. Its usage is simple:
meson configure [ build directory ] [ options to set ]
If build directory is omitted, the current directory is used instead.
If no parameters are set, meson configure will print the value of all build options to the console.
To set values, use the -D command line argument like this.
meson configure -Dopt1=value1 -Dopt2=value2
Quoted 2 lines
- is there a way to put configuration like this in a file, similar to our current config.mak?
https://mesonbuild.com/Machine-files.html
machine files (passed via --cross-file or --native-file) allow you to define your toolchain, e.g. set up persistent CFLAGS and CC that you can store as a configuration file, check into git, share with people, etc.
You can also store configuration options in them:
[project options]
gettext = 'disabled'default_editor = 'vim'
[built-in options]c_std = 'gnu17'b_lto = trueb_sanitize = 'address,undefined'
Signature · 1 line
Eli Schwartz
Quoted 5 lines · Eli Schwartz
Quoted 3 lines
- how would I know this option exists? I think you mentioned elsewhere in the thread the ability to ask about which options exist, but I couldn't find anything via "meson -h", etc.
Quoted 8 lines
meson -h lists:
configure Change project options
Which could perhaps be reworded as it allows you to both view and change them.
Ah. I saw that, but I tried:
$ meson configure build Meson configurator encountered an error:
ERROR: Directory /home/peff/compile/git/build is neither a Meson build directory nor a project source directory.
which seemed like a chicken-and-egg (I cannot configure a build directory until I "setup", but I cannot "setup" until I figure out the configuration options that work).
But it seems:
$ meson configure .
gives me a list, albeit with a warning about using the source directory. It looks like just "meson configure" does the same, but somehow I didn't try that. ;)
Quoted 8 lines
Quoted 2 lines
- is there a way to put configuration like this in a file, similar to our current config.mak?
https://mesonbuild.com/Machine-files.html
machine files (passed via --cross-file or --native-file) allow you to define your toolchain, e.g. set up persistent CFLAGS and CC that you can store as a configuration file, check into git, share with people, etc.
Thanks. And sorry, I am being a bit more lazy than usual about going out and reading documentation on my own[1].
My usual workflow is to symlink config.mak to my custom file (which of course I maintain in another Git repo). And then "make" just does the right thing, even if I'm moving around through history, bisecting, etc.
I think the meson equivalent is that I would "meson setup build --native-file /path/to/my/config.mak" once, which would copy all of the values in to that environment. And then starting ninja from that "build" directory would presumably work throughout history. My config.mak does have some runtime logic, though (e.g., when bisecting old commits it relaxes the compiler options). It sounds like that would need to re-run meson, and not work at the ninja level.
I'm also not clear on how to alternatively build with different optimization levels, or with different sanitizers. Right now that is:
# normal build and test some script make && cd t && ./t0000-basic.sh -v -i
# now with sanitizer make SANITIZE=address && cd t && ./t0000-basic.sh -v -i
If I understand correctly, the workflow here is either to have two separate build directories, or to "meson configure" between the two. And AFAICT the tests _have_ to be run via "meson test" now, if we want them to find the Git built in the separate directories.
-Peff
[1] I think my gut feeling is that these are questions that Patrick should be answering if he wants to sell the project on moving away from make. I know we can't expect to be spoon-fed all parts of a transition, but I am starting from the point of view of: I am perfectly happy with make, why do you want me to switch?
Another thing I am observing about this is that "meson" is not really just replacing "make". It is also replacing autoconf to some degree in probing various things (like gettext). But that is not something I (or most developers) were using at all. So it is not just transitioning to a different piece of software, but also changing the fundamental approach. Though I imagine with the right --native-file options, I could disable all of the probing entirely.
Quoted 5 lines · Jeff King
[1] I think my gut feeling is that these are questions that Patrick should be answering if he wants to sell the project on moving away from make. I know we can't expect to be spoon-fed all parts of a transition, but I am starting from the point of view of: I am perfectly happy with make, why do you want me to switch?
Yeah, that is a very fair thing to say.
Even if you personally (or I for that matter) were not 100% happy with make, it is important for somebody who has sufficiently gained respect in the project to play devil's advocate to say it, and I am glad you did.
Quoted 8 lines · Junio C Hamano
Quoted 5 lines · Jeff King
[1] I think my gut feeling is that these are questions that Patrick should be answering if he wants to sell the project on moving away from make. I know we can't expect to be spoon-fed all parts of a transition, but I am starting from the point of view of: I am perfectly happy with make, why do you want me to switch?
Quoted 6 lines
Yeah, that is a very fair thing to say.
Even if you personally (or I for that matter) were not 100% happy with make, it is important for somebody who has sufficiently gained respect in the project to play devil's advocate to say it, and I am glad you did.
Yup, I agree with you a 100%.
I was first focussing on getting everything set up and then get some early signals as to whether this is a direction that we can go into in the first place, and because of that I didn't yet provide any docs. But based on your feedback I guess I should focus on exactly that as my next step. So I'll include docs in the next reroll that demonstrate everyday workflows in Git and how to do these with Meson.
Thanks!
Patrick
Quoted 7 lines · Jeff King
I think the meson equivalent is that I would "meson setup build --native-file /path/to/my/config.mak" once, which would copy all of the values in to that environment. And then starting ninja from that "build" directory would presumably work throughout history. My config.mak does have some runtime logic, though (e.g., when bisecting old commits it relaxes the compiler options). It sounds like that would need to re-run meson, and not work at the ninja level.
Well, at least to change compiler options and relax them it would need to re-run meson once.
Quoted 6 lines
I'm also not clear on how to alternatively build with different optimization levels, or with different sanitizers. Right now that is:
# normal build and test some script make && cd t && ./t0000-basic.sh -v -i
Quoted 7 lines
# now with sanitizer make SANITIZE=address && cd t && ./t0000-basic.sh -v -iIf I understand correctly, the workflow here is either to have two separate build directories, or to "meson configure" between the two. And AFAICT the tests _have_ to be run via "meson test" now, if we want them to find the Git built in the separate directories.
Yes, and yes. Well, kind of.
meson test t0000-basic
# supports globbing and passing args meson test t0000* --test-args="-v -i"
GIT_BUILD_DIR=$PWD/../build ./t0000-basic.sh -v -i
are all functional. The introduction of meson doesn't change how the tests actually work, but it does introduce an environment variable pointing to the built git program(s) in some location other than "the parent directory of t/ itself", and meson test sets that variable then runs ./tXXXX-testname.sh itself. So you could continue to run it directly.
Quoted 6 lines
[1] I think my gut feeling is that these are questions that Patrick should be answering if he wants to sell the project on moving away from make. I know we can't expect to be spoon-fed all parts of a transition, but I am starting from the point of view of: I am perfectly happy with make, why do you want me to switch?
Quoted 7 lines
Another thing I am observing about this is that "meson" is not really just replacing "make". It is also replacing autoconf to some degree in probing various things (like gettext). But that is not something I (or most developers) were using at all. So it is not just transitioning to a different piece of software, but also changing the fundamental approach. Though I imagine with the right --native-file options, I could disable all of the probing entirely.
I would say that technically you were already probing various things. It is simply that the Makefile performed all those probes each time you ran make, e.g.
ifndef CURL_LDFLAGS
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG)
--libs))$(CURL_LDFLAGS)
endif
ran curl-config --libs every time, which is very much a probe.
Other things like NEEDS_LIBICONV were not a probe, but did require the user to know it was necessary... possibly since conditionally checking for -liconv -lintl in a Makefile is difficult to do automatically. :)
Really, the main difference in my view is that probing is moved to an explicit step rather than happening "under the hood" as part of executing make. And that's a definite difference, since make is a single step and meson setup build && ninja -C build/ is two steps.
Signature · 1 line
Eli Schwartz
Quoted 12 lines · Taylor Blau
== Conclusion
To step back, I want to say that I appreciate your work on this series and am certainly not opposed[^1] to the idea that we may need to make significant changes to our build infrastructure to support the project's goals.
But I think that what I'm missing currently is a clear picture of what goals we *can't* achieve with the existing build system (or could, but only at significant cost/awkwardness), and why Meson is the right choice to address those gaps.
Quoted 4 lines
If the project can agree that pursuing Meson as a replacement for Make, CMake, or both, then I think we would need further clarification on what we want to do with CMake (and more generally how we want to support new efforts to add additional build systems to Git in the future).
One extremely big distinction is that Make is not a configuration system, and cannot be, and git has many configuration options that are currently underserved to the point of nonexistence. This causes a *lot* of trouble to people attempting to build git as it's not often clear how to do so other than by building a stock no-options build.
When you do try it, you frequently end up with broken option passing resulting in an inconsistent git installation where some parts of the code are built with one option, and other parts of the code are built with its inverse, and neither of them are the third set of options that you had finally settled on. This also affects distro maintainers.
The configure.ac tries to solve this problem and fails because it appears no one bothers to maintain it. The CMake files try to solve this problem but only for Windows (?). Possibly the reason people struggle with both is because both feel quite painful to use -- the initial premise of this patch series is, after all, "I the submitter believe this build system is nicer than the other option".
Signature · 1 line
Eli Schwartz
Quoted 5 lines · Patrick Steinhardt
Hi,
this is the fourth version of my patch series that modernizes our build system. It refactors various parts of it to make it possible to perform out-of-tree builds in theory and then wires up Meson.
As Promised, I have tested this version on Linux and Cygwin (not full test on patches 1-18). When built on top of fd3785337b (The third batch) with the two branches merged (as indicated below) Linux (build+test) and cygwin (just build) work as expected.
Quoted 14 lines
Changes compared to v3:
- Various typo fixes.
- Our
Makefilenow detects unsubstituted build options in the newly- introduced "GIT-BUILD-OPTIONS.in" template.- I've wired up support for building and installing manpages. This was the last important bit missing to get a fully functioning Git installation. We generate the same set of manpages that our
Makefilewould and also render a subset of the HTML pages we generate. Not wired up are our technical docs, but doing those shouldn't be all that involved.
Quoted 2 lines
Documentation is not built by default, but can be enabled by passing any combination of
-Ddocs=html,man.
I haven't tried this (yet).
Quoted 11 lines
- I've dropped the target names for
custom_target()invocations. Those are auto-derived from the first output anyway, so they only add unnecessary noise.- The last patch is a compatibility patch for "seen". There are a couple of topics that interact with this series, and I didn't want to make all of them a strict dependency. So I've decided to just create a fixup-style commit that does the necessary changes in order to work with "seen". Like this, you can test without "seen" by simply dropping that last commit, and you can test with "seen" by merging it into this topic.
I couldn't try this patch because (at the time) the 'seen' branch didn't build. :(
Quoted 7 lines
@Taylor: I didn't really have a better idea than this. There are six additional topics that this branch interacts with, and building the branch with eight dependencies in total didn't feel sensible. Ideally, the topic branch itself shouldn't have the last commit, but once it gets merged into 'seen' we should have it. Let me know in case you have a better idea though.
Quoted 8 lines
This topic is built on top of
fd3785337b(The third batch, 2024-10-22) with the following two branches merged into it:- ps/upgrade-clar at
30bf9f0aaa(cmake: set up proper dependencies for generated clar headers, 2024-10-21). This is currently in 'seen'.- ps/platform-compat-fixes at
80ebd91b83(http: fix build error onFreeBSD, 2024-10-16). This has been merged to 'next'.
As indicated above, this worked just fine.
Now that 'seen' builds again [92855bf61d ("Merge branch 'ps/build' into seen", 2024-10-27)], I tested meson on Linux and Cygwin (build and *full* test this time).
On Linux, the result looks like:
$ tail meson-logs/testlog.txt Summary of Failures:
117/1035 t1017-cat-file-remote-object-info FAIL 0.01s exit status 2
Ok: 1034 Expected Fail: 0 Fail: 1 Unexpected Pass: 0 Skipped: 0 Timeout: 0
$
It looks like a branch has been removed from 'seen'. :) (ie the t1017* test file does not exist).
On cygwin, the result looks like:
$ tail -11 meson-logs/testlog.txt Summary of Failures:
23/1035 t-reftable-stack TIMEOUT 30.26s killed by signal 15 SIGTERM 114/1035 t1017-cat-file-remote-object-info FAIL 0.13s exit status 127
Ok: 1033 Expected Fail: 0 Fail: 1 Unexpected Pass: 0 Skipped: 0 Timeout: 1
$
The t-reftable-stack unit test took just over 75s on the v2.27.0 test run. I haven't looked into it yet, but plenty of other tests run for longer than the 30s, so I don't know why that test seems to be different.
Also, it is worth noting that the test ran for 2hr50min. Usually I have to wait 6hr approx. for 'make test' to finish because I don't like to use any '-j' parameters (You can't do anything else on the machine while it is cooking the cpu!). :)
Thanks!
ATB,
Ramsay Jones
Quoted 5 lines · Ramsay Jones
Quoted 2 lines · Patrick Steinhardt
Hi,
Quoted 8 lines
Quoted 3 lines
this is the fourth version of my patch series that modernizes our build system. It refactors various parts of it to make it possible to perform out-of-tree builds in theory and then wires up Meson.
As Promised, I have tested this version on Linux and Cygwin (not full test on patches 1-18). When built on top of
fd3785337b(The third batch) with the two branches merged (as indicated below) Linux (build+test) and cygwin (just build) work as expected.
Thanks!
Quoted 12 lines
Quoted 11 lines
- I've dropped the target names for
custom_target()invocations. Those are auto-derived from the first output anyway, so they only add unnecessary noise.- The last patch is a compatibility patch for "seen". There are a couple of topics that interact with this series, and I didn't want to make all of them a strict dependency. So I've decided to just create a fixup-style commit that does the necessary changes in order to work with "seen". Like this, you can test without "seen" by simply dropping that last commit, and you can test with "seen" by merging it into this topic.
Quoted 2 lines
I couldn't try this patch because (at the time) the 'seen' branch didn't build. :(
Okay. I'll adapt the next version accordingly.
Quoted 14 lines
On cygwin, the result looks like:
$ tail -11 meson-logs/testlog.txt Summary of Failures:23/1035 t-reftable-stack TIMEOUT 30.26s killed by signal 15 SIGTERM 114/1035 t1017-cat-file-remote-object-info FAIL 0.13s exit status 127Ok: 1033 Expected Fail: 0 Fail: 1 Unexpected Pass: 0 Skipped: 0 Timeout: 1
Quoted 5 lines
$
The t-reftable-stack unit test took just over 75s on the v2.27.0 test run. I haven't looked into it yet, but plenty of other tests run for longer than the 30s, so I don't know why that test seems to be different.
Meson has a default timeout of 30 seconds for tests. I only removed that timeout for our shell scripts, but didn't for the unit tests. I'll fix that in the next version.
Quoted 4 lines
Also, it is worth noting that the test ran for 2hr50min. Usually I have to wait 6hr approx. for 'make test' to finish because I don't like to use any '-j' parameters (You can't do anything else on the machine while it is cooking the cpu!). :)
You probably know, but you can of course also pick the number of CPU cores to run tests on with Meson: meson test -j1.
Patrick
v5 cover Modernize the build system
In reply to Patrick SteinhardtHi,
this is the fourth version of my patch series that modernizes our build system. It refactors various parts of it to make it possible to perform out-of-tree builds in theory and then wires up Meson.
Changes compared to v4:
- Improve our CMake build instructions tot use SH_EXE to execute scripts.
- Create Perl build directories in our CMake build instructions.
- Remove superfluous use of basename(1).
- Remove timeout for unit tests in Meson.
Thanks!
Patrick
Patrick Steinhardt (19):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 28 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 317 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-GEN | 12 +-
Makefile | 209 +--
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 230 ++-
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 36 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +
gitweb/Makefile | 58 +-
gitweb/generate-gitweb.sh | 45 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 63 +
meson.build | 1618 +++++++++++++++++
meson_options.txt | 73 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
.../header_templates/fixed_prefix.template.pl | 2 +-
.../runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 92 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1111 +++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 22 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 24 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 5 +
templates/meson.build | 13 +
unimplemented.sh | 2 +-
wrap-for-bin.sh | 36 -
88 files changed, 4441 insertions(+), 447 deletions(-)
create mode 100755 Documentation/generate-mergetool-list.sh
create mode 100644 Documentation/meson.build
create mode 100644 Documentation/technical/build-systems.txt
create mode 100644 GIT-BUILD-OPTIONS.in
create mode 100644 bin-wrappers/.gitignore
create mode 100644 bin-wrappers/meson.build
create mode 100755 bin-wrappers/wrap-for-bin.sh
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100755 generate-perl.sh
create mode 100755 generate-script.sh
create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in
create mode 100755 gitweb/generate-gitweb.sh
create mode 100644 gitweb/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/.gitignore
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
create mode 100644 templates/hooks/meson.build
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
delete mode 100644 wrap-for-bin.shRange-diff against v4:
1: 8c481cb9e01 = 1: 8c481cb9e01 Makefile: use common template for GIT-BUILD-OPTIONS
2: 308dcbe0bd4 = 2: 308dcbe0bd4 Makefile: consistently use @PLACEHOLDER@ to substitute
3: 20e77ffc5f5 = 3: 20e77ffc5f5 Makefile: consistently use PERL_PATH
4: 50b607a412a ! 4: 44297298476 Makefile: extract script to massage Perl scripts
@@ contrib/buildsystems/CMakeLists.txt: foreach(script ${git_shell_scripts})
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
-+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
-+ COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh
-+ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
-+ ${PROJECT_VERSION}
-+ ${CMAKE_BINARY_DIR}/PERL-HEADER
-+ ${CMAKE_SOURCE_DIR}/${script}
-+ ${CMAKE_BINARY_DIR}/${perl_gen_path}
-+ DEPENDS ${CMAKE_SOURCE_DIR}/generate-perl.sh
-+ ${CMAKE_SOURCE_DIR}/${script})
++ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
++ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
++ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
++ "${PROJECT_VERSION}"
++ "${CMAKE_BINARY_DIR}/PERL-HEADER"
++ "${CMAKE_SOURCE_DIR}/${script}"
++ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
++ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
++ "${CMAKE_SOURCE_DIR}/${script}"
++ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
5: eddafe1cf89 ! 5: 87dc74adfd4 Makefile: use "generate-perl.sh" to massage Perl library
@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@PATHSEP@" ":" perl_header
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
++ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
++ 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"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ contrib/buildsystems/CMakeLists.txt: file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
@@ generate-perl.sh: OUTPUT="$5"
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
-+case "$(basename "$INPUT")" in
++case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
6: 2cf8cf86218 ! 6: 180655bbab8 Makefile: extract script to massage Shell scripts
@@ contrib/buildsystems/CMakeLists.txt: set(git_shell_scripts
+ set(shell_gen_path "${script}")
+ endif()
+
-+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${shell_gen_path}
-+ COMMAND ${CMAKE_SOURCE_DIR}/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
-+ ${CMAKE_SOURCE_DIR}/${script}.sh)
++ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
++ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/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"
++ "${CMAKE_SOURCE_DIR}/${script}.sh"
++ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" ""
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
-+string(REPLACE "@LOCALEDIR@" "LOCALEDIR" git_build_options "${git_build_options}")
++string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
7: e8abda661cf = 7: 07d5a9c2957 Makefile: extract script to generate gitweb.cgi
8: 0e682b68e25 ! 8: 065d03468f0 Makefile: refactor GIT-VERSION-GEN to be reusable
@@ contrib/buildsystems/CMakeLists.txt: if(NOT SH_EXE)
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-+execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
-+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
++execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
++ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE git_version
+ OUTPUT_STRIP_TRAILING_WHITESPACE) 9: 46b7760fbcd ! 9: 817d58cbaf9 Makefile: refactor generators to be PWD-independent
@@ contrib/buildsystems/CMakeLists.txt: set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
-+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h)
++ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
++ ${EXCLUSION_PROGS}
++ "${CMAKE_SOURCE_DIR}"
++ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
@@ contrib/buildsystems/CMakeLists.txt: set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
-+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config-list.h)
++ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
++ "${CMAKE_SOURCE_DIR}"
++ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
@@ contrib/buildsystems/CMakeLists.txt: set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
-+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h)
++ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
++ "${CMAKE_SOURCE_DIR}"
++ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
10: ec4a9e65ec3 = 10: 33c9c322853 Makefile: allow "bin-wrappers/" directory to exist
11: b330fd783d4 = 11: a193157a2d8 Makefile: simplify building of templates
12: fb7231ae4c7 = 12: 46667dc608c Documentation: allow sourcing generated includes from separate dir
13: cf1743667e9 = 13: 7079149d6a1 Documentation: teach "cmd-list.perl" about out-of-tree builds
14: 6926a282a80 = 14: 4ef7262aa04 Documentation: extract script to generate a list of mergetools
15: ed3affb794c = 15: 565c3d149f6 t: better support for out-of-tree builds
16: 205b038f961 = 16: 8ebb9184043 t: allow overriding build dir
17: bef26dd67c5 = 17: a39f9a4547b Documentation: add comparison of build systems
18: 780180568d9 ! 18: de2239fbfcd Introduce support for the Meson build system @@ t/meson.build (new)
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
++ timeout: 0,
+ )
+endforeach
+
19: 45e2ab4044a = 19: 0be293e8bff meson: fix conflicts with in-flight topics
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 1/19 Makefile: use common template for GIT-BUILD-OPTIONS
The "GIT-BUILD-OPTIONS" file is generated by our build systems to propagate built-in features and paths to our tests. The generation is done ad-hoc, where both our Makefile and the CMake build instructions simply echo a bunch of strings into the file. This makes it very hard to figure out what variables are expected to exist and what format they have, and the written variables can easily get out of sync between build systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue. This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be substituted, alerting us of mismatches. Others don't, but if we forgot to substitute such variables we now have a bogus string that will likely cause our tests to fail, if they have any meaning in the first place.
Backfill values that we didn't yet set in our CMake build instructions. While at it, remove the SUPPORTS_SIMPLE_IPC variable that we only set up in CMake as it isn't used anywhere.
Note that this change requires us to move around the setup of TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing the "GIT-BUILD-OPTIONS" file. This is the only instance I could find where we rely on ordering on variables.
--- GIT-BUILD-OPTIONS.in | 36 +++++++++ Makefile | 109 ++++++++++------------------ contrib/buildsystems/CMakeLists.txt | 58 ++++++++++----- t/test-lib.sh | 13 ++-- 4 files changed, 121 insertions(+), 95 deletions(-) create mode 100644 GIT-BUILD-OPTIONS.in
GIT-BUILD-OPTIONS.in new file +36 -0
@@ -0,0 +1,36 @@ +SHELL_PATH=@SHELL_PATH@ +TEST_SHELL_PATH=@TEST_SHELL_PATH@ +PERL_PATH=@PERL_PATH@ +DIFF=@DIFF@ +PYTHON_PATH=@PYTHON_PATH@ +TAR=@TAR@ +NO_CURL=@NO_CURL@ +NO_ICONV=@NO_ICONV@ +NO_EXPAT=@NO_EXPAT@ +USE_LIBPCRE2=@USE_LIBPCRE2@ +NO_PERL=@NO_PERL@ +NO_PTHREADS=@NO_PTHREADS@ +NO_PYTHON=@NO_PYTHON@ +NO_REGEX=@NO_REGEX@ +NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@ +PAGER_ENV=@PAGER_ENV@ +SANITIZE_LEAK=@SANITIZE_LEAK@ +SANITIZE_ADDRESS=@SANITIZE_ADDRESS@ +X=@X@ +FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@ +FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@ +TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@ +GIT_TEST_OPTS=@GIT_TEST_OPTS@ +GIT_TEST_CMP=@GIT_TEST_CMP@ +GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@ +GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@ +NO_GETTEXT=@NO_GETTEXT@ +GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@ +GIT_PERF_REPO=@GIT_PERF_REPO@ +GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@ +GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@ +GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@ +GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@ +GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@ +GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@ +RUNTIME_PREFIX=@RUNTIME_PREFIX@
Makefile +39 -70
115 lines not on this page · raw message
contrib/buildsystems/CMakeLists.txt +39 -19
66 lines not on this page · raw message
t/test-lib.sh +7 -6
@@ -35,12 +35,6 @@ else # needing to exist. TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1 fi -if test -z "$TEST_OUTPUT_DIRECTORY" -then - # Similarly, override this to store the test-results subdir - # elsewhere - TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY -fi GIT_BUILD_DIR="${TEST_DIRECTORY%/t}" if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then
@@ -100,6 +94,13 @@ fi . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS export PERL_PATH SHELL_PATH +if test -z "$TEST_OUTPUT_DIRECTORY" +then + # Similarly, override this to store the test-results subdir + # elsewhere + TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY +fi + # In t0000, we need to override test directories of nested testcases. In case # the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd # reset this value to instead contain what the developer has specified. We thus
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 2/19 Makefile: consistently use @PLACEHOLDER@ to substitute
In reply to Patrick SteinhardtWe have a bunch of placeholders in our scripts that we replace at build time, for example by using sed(1). These placeholders come in three different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with CMake, which only supports the first syntax in its configure_file() function. To work around that we instead manually replace placeholders via string operations, which is a hassle and removes safeguards that CMake has to verify that we didn't forget to replace any placeholders. Besides that, other build systems like Meson also support the CMake syntax.
Unify our codebase to consistently use the syntax supported by such build systems.
--- Makefile | 44 +++++++++---------- configure.ac | 2 +- contrib/buildsystems/CMakeLists.txt | 34 +++++++------- git-cvsserver.perl | 2 +- git-instaweb.sh | 8 ++-- git-request-pull.sh | 2 +- git-send-email.perl | 2 +- git-sh-i18n.sh | 6 +-- git-sh-setup.sh | 6 +-- git-svn.perl | 2 +- gitk-git/po/vi.po | 2 +- gitweb/Makefile | 44 +++++++++---------- gitweb/gitweb.perl | 44 +++++++++---------- perl/Git/I18N.pm | 6 +-- perl/Git/LoadCPAN.pm | 6 +-- .../header_templates/fixed_prefix.template.pl | 2 +- .../runtime_prefix.template.pl | 8 ++-- unimplemented.sh | 2 +- wrap-for-bin.sh | 18 ++++---- 19 files changed, 120 insertions(+), 120 deletions(-)
Makefile +22 -22
@@ -1555,10 +1555,10 @@ endif ifdef SANE_TOOL_PATH SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH)) -BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|' +BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|' PATH := $(SANE_TOOL_PATH):${PATH} else -BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d' +BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d' endif ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE define cmd_munge_script sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's|@@DIFF@@|$(DIFF_SQ)|' \ - -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \ - -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \ + -e 's|@DIFF@|$(DIFF_SQ)|' \ + -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \ + -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \ -e $(BROKEN_PATH_FIX) \ - -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \ - -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ - -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \ + -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \ + -e 's|@PERL@|$(PERL_PATH_SQ)|g' \ + -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \ [email protected] >$@+ endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE -e ' r GIT-PERL-HEADER' \ -e ' G' \ -e '}' \ - -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ + -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \ $< >$@+ && \ chmod +x $@+ && \ mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile INSTLIBDIR='$(perllibdir_SQ)' && \ INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \ INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \ - sed -e 's=@@PATHSEP@@=$(pathsep)=g' \ - -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \ - -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \ - -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \ - -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \ + sed -e 's=@PATHSEP@=$(pathsep)=g' \ + -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \ + -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \ + -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \ + -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \ $< >$@+ && \ mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh $(QUIET_GEN) \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \ + -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \ unimplemented.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON $(SCRIPT_PYTHON_GEN): % : unimplemented.sh $(QUIET_GEN) \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \ + -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \ unimplemented.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ endif # NO_PYTHON -CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ +CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \ configure.ac >configure.ac+ && \ autoconf -o configure configure.ac+ && \ $(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES $(call mkdir_p_parent_template) $(QUIET_GEN) \ - sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \ - -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \ - -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ + sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \ + -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \ + -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ < $< > $@ perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3225,8 +3225,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR bin-wrappers/%: wrap-for-bin.sh $(call mkdir_p_parent_template) $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@BUILD_DIR@@|$(shell pwd)|' \ - -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ + -e 's|@BUILD_DIR@|$(shell pwd)|' \ + -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ chmod +x $@ # GNU make supports exporting all variables by "export" without parameters.
configure.ac +1 -1
@@ -142,7 +142,7 @@ fi ## Configure body starts here. AC_PREREQ(2.59) -AC_INIT([git], [@@GIT_VERSION@@], [[email protected]]) +AC_INIT([git], [@GIT_VERSION@], [[email protected]]) AC_CONFIG_SRCDIR([git.c])
contrib/buildsystems/CMakeLists.txt +17 -17
@@ -836,14 +836,14 @@ set(git_shell_scripts foreach(script ${git_shell_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME) string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}") - string(REPLACE "@@DIFF@@" "diff" content "${content}") + string(REPLACE "@DIFF@" "diff" content "${content}") string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}") - string(REPLACE "@@NO_CURL@@" "" content "${content}") - string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}") - string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}") - string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}") - string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}") + string(REPLACE "@NO_CURL@" "" content "${content}") + string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}") + string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}") + string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}") + string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl") #create perl header file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header ) -string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}") -string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}") +string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}") +string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}") foreach(script ${git_perl_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}") - string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}") + string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") foreach(pm ${perl_modules}) string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm}) file(STRINGS ${pm} content NEWLINE_CONSUME) - string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}") - string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}") + string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") + string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content}) #test-lib.sh requires perl/build/lib to be the build directory of perl modules endforeach()
@@ -1056,21 +1056,21 @@ set(wrapper_test_scripts foreach(script ${wrapper_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) - string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") - string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}") + string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") + string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() foreach(script ${wrapper_test_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) - string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") - string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") + string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") + string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) -string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") -string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}") +string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") +string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content}) #options for configuring test options
git-cvsserver.perl +1 -1
@@ -26,7 +26,7 @@ use File::Basename; use Getopt::Long qw(:config require_order no_ignore_case); -my $VERSION = '@@GIT_VERSION@@'; +my $VERSION = '@GIT_VERSION@'; my $log = GITCVS::log->new(); my $cfg;
git-instaweb.sh +4 -4
@@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -PERL='@@PERL@@' +PERL='@PERL@' OPTIONS_KEEPDASHDASH= OPTIONS_STUCKLONG= OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf" # if installed, it doesn't need further configuration (module_path) test -z "$httpd" && httpd='lighttpd -f' -# Default is @@GITWEBDIR@@ -test -z "$root" && root='@@GITWEBDIR@@' +# Default is @GITWEBDIR@ +test -z "$root" && root='@GITWEBDIR@' # any untaken local port will do... test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF gitweb_conf() { cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF -#!@@PERL@@ +#!@PERL@ our \$projectroot = "$(dirname "$fqgitdir")"; our \$git_temp = "$fqgitdir/gitweb/tmp"; our \$projects_list = \$projectroot;
git-request-pull.sh +1 -1
@@ -112,7 +112,7 @@ find_matching_ref=' } ' -set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") +set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") remote_sha1=$2 ref=$3
git-send-email.perl +1 -1
@@ -1501,7 +1501,7 @@ sub gen_header { @recipients = unique_email_list(@recipients,@cc,@initial_bcc); @recipients = (map { extract_valid_address_or_die($_) } @recipients); my $date = format_2822_time($time++); - my $gitversion = '@@GIT_VERSION@@'; + my $gitversion = '@GIT_VERSION@'; if ($gitversion =~ m/..GIT_VERSION../) { $gitversion = Git::version(); }
git-sh-i18n.sh +3 -3
@@ -9,7 +9,7 @@ TEXTDOMAIN=git export TEXTDOMAIN if test -z "$GIT_TEXTDOMAINDIR" then - TEXTDOMAINDIR="@@LOCALEDIR@@" + TEXTDOMAINDIR="@LOCALEDIR@" else TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR" fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR # First decide what scheme to use... GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough -if test -n "@@USE_GETTEXT_SCHEME@@" +if test -n "@USE_GETTEXT_SCHEME@" then - GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@" + GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@" elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" then : no probing necessary
git-sh-setup.sh +3 -3
@@ -41,7 +41,7 @@ git_broken_path_fix () { esac } -# @@BROKEN_PATH_FIX@@ +# @BROKEN_PATH_FIX@ # Source git-sh-i18n for gettext support. . "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() { else GIT_PAGER=cat fi - for vardef in @@PAGER_ENV@@ + for vardef in @PAGER_ENV@ do var=${vardef%%=*} eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () { # remove lines from $1 that are not in $2, leaving only common lines. create_virtual_base() { sz0=$(wc -c <"$1") - @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add + @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add sz1=$(wc -c <"$1") # If we do not have enough common material, it is not
git-svn.perl +1 -1
@@ -9,7 +9,7 @@ $_revision $_repository $_q $_authors $_authors_prog %users/; $AUTHOR = 'Eric Wong <[email protected]>'; -$VERSION = '@@GIT_VERSION@@'; +$VERSION = '@GIT_VERSION@'; use Carp qw/croak/; use File::Basename qw/dirname basename/;
gitk-git/po/vi.po +1 -1
@@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: gitk @@GIT_VERSION@@\n" +"Project-Id-Version: gitk @GIT_VERSION@\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-17 14:32+1000\n" "PO-Revision-Date: 2015-09-15 07:33+0700\n"
gitweb/Makefile +22 -22
50 lines not on this page · raw message
gitweb/gitweb.perl +22 -22
116 lines not on this page · raw message
perl/Git/I18N.pm +3 -3
@@ -20,14 +20,14 @@ BEGIN # this "'@@' [...] '@@'" pattern. use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@'; use constant NO_GETTEXT => ( - q[@@NO_GETTEXT@@] ne '' + q[@NO_GETTEXT@] ne '' and - q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR + q[@NO_GETTEXT@] ne NO_GETTEXT_STR ); sub __bootstrap_locale_messages { our $TEXTDOMAIN = 'git'; - our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@'; + our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@'; die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT; require POSIX;
perl/Git/LoadCPAN.pm +3 -3
@@ -31,11 +31,11 @@ =head1 DESCRIPTION # Makefile, and allows for detecting whether the module is loaded from # perl/Git as opposed to perl/build/Git, which is useful for one-off # testing without having Error.pm et al installed. -use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@'; +use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@'; use constant NO_PERL_CPAN_FALLBACKS => ( - q[@@NO_PERL_CPAN_FALLBACKS@@] ne '' + q[@NO_PERL_CPAN_FALLBACKS@] ne '' and - q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR + q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR ); sub import {
perl/header_templates/fixed_prefix.template.pl +1 -1
@@ -1 +1 @@ -use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@')); +use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
perl/header_templates/runtime_prefix.template.pl +4 -4
@@ -3,7 +3,7 @@ # This finds our Git::* libraries relative to the script's runtime path. sub __git_system_path { my ($relpath) = @_; - my $gitexecdir_relative = '@@GITEXECDIR_REL@@'; + my $gitexecdir_relative = '@GITEXECDIR_REL@'; # GIT_EXEC_PATH is supplied by `git` or the test suite. my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path { } BEGIN { - use lib split /@@PATHSEP@@/, + use lib split /@PATHSEP@/, ( $ENV{GITPERLLIB} || do { - my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@'); + my $perllibdir = __git_system_path('@PERLLIBDIR_REL@'); (-e $perllibdir) || die("Invalid system path ($relpath): $path"); $perllibdir; }
@@ -36,7 +36,7 @@ BEGIN # Export the system locale directory to the I18N module. The locale directory # is only installed if NO_GETTEXT is set. - $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@'); + $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@'); } # END RUNTIME_PREFIX generated code.
unimplemented.sh +1 -1
@@ -1,4 +1,4 @@ #!/bin/sh -echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)." +echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)." exit 128
wrap-for-bin.sh +9 -9
@@ -4,33 +4,33 @@ # to run test suite against sandbox, but with only bindir-installed # executables in PATH. The Makefile copies this into various # files in bin-wrappers, substituting -# @@BUILD_DIR@@ and @@PROG@@. +# @BUILD_DIR@ and @PROG@. -GIT_EXEC_PATH='@@BUILD_DIR@@' +GIT_EXEC_PATH='@BUILD_DIR@' if test -n "$NO_SET_GIT_TEMPLATE_DIR" then unset GIT_TEMPLATE_DIR else - GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt' + GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt' export GIT_TEMPLATE_DIR fi -GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" -GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale' -PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH" +GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" +GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale' +PATH='@BUILD_DIR@/bin-wrappers:'"$PATH" export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR case "$GIT_DEBUGGER" in '') - exec "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec "${GIT_EXEC_PATH}/@PROG@" "$@" ;; 1) unset GIT_DEBUGGER - exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@" ;; *) GIT_DEBUGGER_ARGS="$GIT_DEBUGGER" unset GIT_DEBUGGER - exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@" ;; esac
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 3/19 Makefile: consistently use PERL_PATH
In reply to Patrick SteinhardtWhen injecting the Perl path into our scripts we sometimes use '@PERL@' while we othertimes use '@PERL_PATH@'. Refactor the code use the latter consistently, which makes it easier to reuse the same logic for multiple scripts.
--- Makefile | 2 +- contrib/buildsystems/CMakeLists.txt | 2 +- git-instaweb.sh | 4 ++-- git-request-pull.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
Makefile +1 -1
@@ -2553,7 +2553,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \ -e $(BROKEN_PATH_FIX) \ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \ - -e 's|@PERL@|$(PERL_PATH_SQ)|g' \ + -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \ [email protected] >$@+ endef
contrib/buildsystems/CMakeLists.txt +1 -1
@@ -842,7 +842,7 @@ foreach(script ${git_shell_scripts}) string(REPLACE "@NO_CURL@" "" content "${content}") string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}") string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}") - string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}") + string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}") string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach()
git-instaweb.sh +2 -2
@@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -PERL='@PERL@' +PERL='@PERL_PATH@' OPTIONS_KEEPDASHDASH= OPTIONS_STUCKLONG= OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF gitweb_conf() { cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF -#!@PERL@ +#!@PERL_PATH@ our \$projectroot = "$(dirname "$fqgitdir")"; our \$git_temp = "$fqgitdir/gitweb/tmp"; our \$projects_list = \$projectroot;
git-request-pull.sh +1 -1
@@ -112,7 +112,7 @@ find_matching_ref=' } ' -set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") +set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") remote_sha1=$2 ref=$3
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 4/19 Makefile: extract script to massage Perl scripts
In reply to Patrick SteinhardtExtract the script to inject various build-time parameters into our Perl scripts into a standalone script. This is done such that we can reuse it in other build systems.
--- Makefile | 12 ++---------- contrib/buildsystems/CMakeLists.txt | 21 ++++++++++++++++----- generate-perl.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 15 deletions(-) create mode 100755 generate-perl.sh
Makefile +2 -10
@@ -2604,16 +2604,8 @@ endif PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir) -$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE - $(QUIET_GEN) \ - sed -e '1{' \ - -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \ - -e ' r GIT-PERL-HEADER' \ - -e ' G' \ - -e '}' \ - -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \ - $< >$@+ && \ - chmod +x $@+ && \ +$(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) GIT-PERL-HEADER "$<" "$@+" && \ mv $@+ $@ PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
contrib/buildsystems/CMakeLists.txt +16 -5
@@ -848,19 +848,30 @@ foreach(script ${git_shell_scripts}) endforeach() #perl scripts -parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl") +parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "") #create perl header file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header ) string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}") string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}") +file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header}) foreach(script ${git_perl_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME) - string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}") - string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}") - file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) + string(REPLACE ".perl" "" perl_gen_path "${script}") + + add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}" + COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh" + "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS" + "${PROJECT_VERSION}" + "${CMAKE_BINARY_DIR}/PERL-HEADER" + "${CMAKE_SOURCE_DIR}/${script}" + "${CMAKE_BINARY_DIR}/${perl_gen_path}" + DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh" + "${CMAKE_SOURCE_DIR}/${script}" + VERBATIM) + list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path}) endforeach() +add_custom_target(perl-gen ALL DEPENDS ${perl_gen}) #python script file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
generate-perl.sh new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +if test $# -ne 5 +then + echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION> <PERL_HEADER> <INPUT> <OUTPUT>" >&2 + exit 1 +fi + +GIT_BUILD_OPTIONS="$1" +GIT_VERSION="$2" +PERL_HEADER="$3" +INPUT="$4" +OUTPUT="$5" + +. "$GIT_BUILD_OPTIONS" + +sed -e '1{' \ + -e " s|#!.*perl|#!$PERL_PATH|" \ + -e " r $PERL_HEADER" \ + -e ' G' \ + -e '}' \ + -e "s/@GIT_VERSION@/$GIT_VERSION/g" \ + "$INPUT" >"$OUTPUT" +chmod a+x "$OUTPUT"
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 5/19 Makefile: use "generate-perl.sh" to massage Perl library
In reply to Patrick SteinhardtExtend "generate-perl.sh" such that it knows to also massage the Perl library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
--- GIT-BUILD-OPTIONS.in | 2 ++ Makefile | 10 ++++------ contrib/buildsystems/CMakeLists.txt | 23 +++++++++-------------- generate-perl.sh | 14 ++++++++++++-- 4 files changed, 27 insertions(+), 22 deletions(-)
GIT-BUILD-OPTIONS.in +2 -0
@@ -1,6 +1,8 @@ SHELL_PATH=@SHELL_PATH@ TEST_SHELL_PATH=@TEST_SHELL_PATH@ PERL_PATH=@PERL_PATH@ +PERL_LOCALEDIR=@PERL_LOCALEDIR@ +NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@ DIFF=@DIFF@ PYTHON_PATH=@PYTHON_PATH@ TAR=@TAR@
Makefile +4 -6
@@ -3093,13 +3093,9 @@ endif NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS)) endif -perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES +perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES $(call mkdir_p_parent_template) - $(QUIET_GEN) \ - sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \ - -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \ - -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ - < $< > $@ + $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@" perl/build/man/man3/Git.3pm: perl/Git.pm $(call mkdir_p_parent_template)
@@ -3160,6 +3156,8 @@ GIT-BUILD-OPTIONS: FORCE -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \ + -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \ + -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \ -e "s|@DIFF@|\'$(DIFF)\'|" \ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \ -e "s|@TAR@|\'$(TAR)\'|" \
contrib/buildsystems/CMakeLists.txt +9 -14
@@ -849,6 +849,9 @@ endforeach() #perl scripts parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "") +#perl modules +file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") +list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "") #create perl header file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -856,9 +859,12 @@ string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}") string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}") file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header}) -foreach(script ${git_perl_scripts}) +foreach(script ${git_perl_scripts} ${perl_modules}) string(REPLACE ".perl" "" perl_gen_path "${script}") + get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY) + 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" "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ -878,19 +884,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content}) -#perl modules -file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") - -foreach(pm ${perl_modules}) - string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm}) - file(STRINGS ${pm} content NEWLINE_CONSUME) - string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") - string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}") - file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content}) -#test-lib.sh requires perl/build/lib to be the build directory of perl modules -endforeach() - - #templates file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*") list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1132,6 +1125,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_ string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}") string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}") string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}") +string(REPLACE "@PERL_LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}") +string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}") string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}") string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}") string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
generate-perl.sh +12 -2
@@ -17,10 +17,20 @@ OUTPUT="$5" . "$GIT_BUILD_OPTIONS" 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|@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" -chmod a+x "$OUTPUT" + +case "$INPUT" in +*.perl) + chmod a+x "$OUTPUT";; +*) + ;; +esac
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 6/19 Makefile: extract script to massage Shell scripts
In reply to Patrick SteinhardtSame as in the preceding commits, extract a script that allows us to unify how we massage shell scripts.
--- GIT-BUILD-OPTIONS.in | 4 ++++ Makefile | 34 +++++++++-------------------- contrib/buildsystems/CMakeLists.txt | 31 ++++++++++++++++---------- generate-script.sh | 34 +++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 35 deletions(-) create mode 100755 generate-script.sh
GIT-BUILD-OPTIONS.in +4 -0
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@ GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@ GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@ RUNTIME_PREFIX=@RUNTIME_PREFIX@ +GITWEBDIR=@GITWEBDIR@ +USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@ +LOCALEDIR=@LOCALEDIR@ +BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
Makefile +10 -24
@@ -1555,10 +1555,10 @@ endif ifdef SANE_TOOL_PATH SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH)) -BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|' +BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"| PATH := $(SANE_TOOL_PATH):${PATH} else -BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d' +BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d endif ifeq (,$(HOST_CPU))
@@ -2545,26 +2545,8 @@ GIT-SCRIPT-DEFINES: FORCE echo "$$FLAGS" >$@; \ fi -define cmd_munge_script -sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's|@DIFF@|$(DIFF_SQ)|' \ - -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \ - -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \ - -e $(BROKEN_PATH_FIX) \ - -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \ - -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \ - -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \ - [email protected] >$@+ -endef - -$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES - $(QUIET_GEN)$(cmd_munge_script) && \ - chmod +x $@+ && \ - mv $@+ $@ - -$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES - $(QUIET_GEN)$(cmd_munge_script) && \ +$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES + $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \ mv $@+ $@ git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
@@ -2633,8 +2615,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile perllibdir: @echo '$(perllibdir_SQ)' -git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES - $(QUIET_GEN)$(cmd_munge_script) && \ +git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES + $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \ chmod +x $@+ && \ mv $@+ $@ else # NO_PERL
@@ -3191,6 +3173,10 @@ GIT-BUILD-OPTIONS: FORCE -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \ + -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \ + -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \ + -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \ + -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \ GIT-BUILD-OPTIONS.in >$@+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
contrib/buildsystems/CMakeLists.txt +20 -11
@@ -834,18 +834,23 @@ set(git_shell_scripts ${git_sh_scripts} ${git_shlib_scripts} git-instaweb) foreach(script ${git_shell_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME) - string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}") - string(REPLACE "@DIFF@" "diff" content "${content}") - string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") - string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}") - string(REPLACE "@NO_CURL@" "" content "${content}") - string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}") - string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}") - string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}") - string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}") - file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) + if ("${script}" IN_LIST git_sh_scripts) + string(REPLACE ".sh" "" shell_gen_path "${script}") + else() + set(shell_gen_path "${script}") + endif() + + add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}" + COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/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" + "${CMAKE_SOURCE_DIR}/${script}.sh" + VERBATIM) + list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path}) endforeach() +add_custom_target(shell-gen ALL DEPENDS ${shell_gen}) #perl scripts parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1160,6 +1165,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}") string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}") string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") +string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}") +string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}") +string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}") +string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}") if(USE_VCPKG) string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") endif()
generate-script.sh new file +34 -0
@@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +if test $# -ne 3 +then + echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2 + 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
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 7/19 Makefile: extract script to generate gitweb.cgi
In reply to Patrick SteinhardtIn order to generate "gitweb.cgi" we have to replace various different placeholders. This is done ad-hoc and is thus not easily reusable across different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at configuration time with the expected options. This script is then used as input for a new "generate-gitweb.sh" script that generates the final "gitweb.cgi" file. While this requires us to repeat the options multiple times, it is in line to how we generate other build options like our GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even though this variable is supposed to be an integer, the source file has the value quoted. The quotes are eventually stripped via sed(1), which replaces "@GITWEB_PROJECT_MAXDEPTH@" with the actual value, which is rather nonsensical. This is made clearer by just dropping the quotes in the source file.
--- gitweb/GITWEB-BUILD-OPTIONS.in | 25 +++++++++++++++ gitweb/Makefile | 58 ++++++++++++++++------------------ gitweb/generate-gitweb.sh | 45 ++++++++++++++++++++++++++ gitweb/gitweb.perl | 2 +- 4 files changed, 99 insertions(+), 31 deletions(-) create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in create mode 100755 gitweb/generate-gitweb.sh
gitweb/GITWEB-BUILD-OPTIONS.in new file +25 -0
@@ -0,0 +1,25 @@ +PERL_PATH=@PERL_PATH@ +JSMIN=@JSMIN@ +CSSMIN=@CSSMIN@ +GIT_VERSION=@GIT_VERSION@ +GIT_BINDIR=@GIT_BINDIR@ +GITWEB_CONFIG=@GITWEB_CONFIG@ +GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@ +GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@ +GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@ +GITWEB_SITENAME=@GITWEB_SITENAME@ +GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@ +GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@ +GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@ +GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@ +GITWEB_BASE_URL=@GITWEB_BASE_URL@ +GITWEB_LIST=@GITWEB_LIST@ +GITWEB_HOMETEXT=@GITWEB_HOMETEXT@ +GITWEB_CSS=@GITWEB_CSS@ +GITWEB_LOGO=@GITWEB_LOGO@ +GITWEB_FAVICON=@GITWEB_FAVICON@ +GITWEB_JS=@GITWEB_JS@ +GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@ +GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@ +GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@ +HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
gitweb/Makefile +28 -30
71 lines not on this page · raw message
gitweb/generate-gitweb.sh new file +45 -0
45 lines not on this page · raw message
gitweb/gitweb.perl +1 -1
@@ -88,7 +88,7 @@ sub evaluate_uri { # fs traversing limit for getting project list # the number is relative to the projectroot -our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@"; +our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@; # string of the home link on top of all pages our $home_link_str = "@GITWEB_HOME_LINK_STR@";
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 8/19 Makefile: refactor GIT-VERSION-GEN to be reusable
In reply to Patrick SteinhardtOur "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into the current directory, where the expectation is that it should exist in the source directory. But other build systems that support out-of-tree builds may not want to do that to keep the source directory pristine, even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore but so that it instead writes the version to stdout. This makes it easier to compute the same version as our Makefile would without having to write the "GIT-VERSION-FILE".
--- GIT-VERSION-GEN | 12 +----------- Makefile | 3 ++- contrib/buildsystems/CMakeLists.txt | 12 ++++-------- 3 files changed, 7 insertions(+), 20 deletions(-)
GIT-VERSION-GEN +1 -11
@@ -1,6 +1,5 @@ #!/bin/sh -GVF=GIT-VERSION-FILE DEF_VER=v2.47.GIT LF='
@@ -28,13 +27,4 @@ fi VN=$(expr "$VN" : v*'\(.*\)') -if test -r $GVF -then - VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) -else - VC=unset -fi -test "$VN" = "$VC" || { - echo >&2 "GIT_VERSION = $VN" - echo "GIT_VERSION = $VN" >$GVF -} +echo "$VN"
Makefile +2 -1
@@ -592,7 +592,8 @@ include shared.mak # Disable -pedantic compilation. GIT-VERSION-FILE: FORCE - @$(SHELL_PATH) ./GIT-VERSION-GEN + @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+ + @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi -include GIT-VERSION-FILE # Set our default configuration.
contrib/buildsystems/CMakeLists.txt +4 -8
@@ -83,16 +83,12 @@ if(NOT SH_EXE) "On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/") endif() -#Create GIT-VERSION-FILE using GIT-VERSION-GEN -if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE) - message("Generating GIT-VERSION-FILE") - execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -endif() +execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN" + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE git_version + OUTPUT_STRIP_TRAILING_WHITESPACE) #Parse GIT-VERSION-FILE to get the version -file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)") -string(REPLACE "GIT_VERSION = " "" git_version ${git_version}) string(FIND ${git_version} "GIT" location) if(location EQUAL -1) string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 9/19 Makefile: refactor generators to be PWD-independent
In reply to Patrick SteinhardtWe have multiple scripts that generate headers from other data. All of these scripts have the assumption built-in that they are executed in the current source directory, which makes them a bit unwieldy to use during out-of-tree builds.
Refactor them to instead take the source directory as well as the output file as arguments.
--- Makefile | 6 ++--- contrib/buildsystems/CMakeLists.txt | 19 ++++++------- generate-cmdlist.sh | 42 ++++++++++++++++++----------- generate-configlist.sh | 20 ++++++++++---- generate-hooklist.sh | 15 ++++++++++- 5 files changed, 68 insertions(+), 34 deletions(-)
Makefile +3 -3
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X config-list.h: generate-configlist.sh config-list.h: Documentation/*config.txt Documentation/config/*.txt - $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@ + $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@ command-list.h: generate-cmdlist.sh command-list.txt command-list.h: $(wildcard Documentation/git*.txt) $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \ $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \ - command-list.txt >$@ + . $@ hook-list.h: generate-hooklist.sh Documentation/githooks.txt - $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@ + $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@ SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\ $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
contrib/buildsystems/CMakeLists.txt +10 -9
@@ -648,23 +648,24 @@ 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 ${EXCLUSION_PROGS} command-list.txt - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h) + execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh" + ${EXCLUSION_PROGS} + "${CMAKE_SOURCE_DIR}" + "${CMAKE_BINARY_DIR}/command-list.h") 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 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h) + execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/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 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h) + execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh + "${CMAKE_SOURCE_DIR}" + "${CMAKE_BINARY_DIR}/hook-list.h") endif() include_directories(${CMAKE_BINARY_DIR})
generate-cmdlist.sh +26 -16
58 lines not on this page · raw message
generate-configlist.sh +15 -5
@@ -1,13 +1,19 @@ #!/bin/sh -echo "/* Automatically generated by generate-configlist.sh */" -echo +SOURCE_DIR="$1" +OUTPUT="$2" + +if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" +then + echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2 + exit 1 +fi print_config_list () { cat <<EOF static const char *config_name_list[] = { EOF - grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | + grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt | sed '/deprecated/d; s/::$//; s/, */\n/g' | sort | sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF EOF } -echo -print_config_list +{ + echo "/* Automatically generated by generate-configlist.sh */" + echo + echo + print_config_list +} >"$OUTPUT"
generate-hooklist.sh +14 -1
@@ -2,6 +2,17 @@ # # 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 "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2 + exit 1 +fi + +{ + cat <<EOF /* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF sed -n \ -e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \ -e 'x' \ - <Documentation/githooks.txt | + <"$SOURCE_DIR"/Documentation/githooks.txt | LC_ALL=C sort cat <<EOF NULL, }; EOF + +} >"$OUTPUT"
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty
RFC PATCH v5 10/19 Makefile: allow "bin-wrappers/" directory to exist
In reply to Patrick SteinhardtThe "bin-wrappers/" directory gets created by our build system and is populated with one script for each of our binaries. There isn't anything inherently wrong with the current layout, but it is somewhat hard to adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists and contains our "wrap-for-bin.sh" script to make things a little bit easier for subsequent steps.
--- .gitignore | 1 - Documentation/CodingGuidelines | 2 +- Makefile | 6 +++--- bin-wrappers/.gitignore | 9 +++++++++ wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0 contrib/buildsystems/CMakeLists.txt | 6 +++--- 6 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 bin-wrappers/.gitignore rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%) mode change 100644 => 100755
.gitignore +0 -1
@@ -12,7 +12,6 @@ /GIT-TEST-SUITES /GIT-USER-AGENT /GIT-VERSION-FILE -/bin-wrappers/ /git /git-add /git-am
Documentation/CodingGuidelines +1 -1
@@ -583,7 +583,7 @@ For C programs: Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb" - ./bin-wrappers/git log` (See `wrap-for-bin.sh`.) + ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.) - The primary data structure that a subsystem 'S' deals with is called `struct S`. Functions that operate on `struct S` are named
Makefile +3 -3
@@ -3199,8 +3199,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $( all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) -bin-wrappers/%: wrap-for-bin.sh - $(call mkdir_p_parent_template) +$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@BUILD_DIR@|$(shell pwd)|' \ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3696,7 +3695,8 @@ clean: profile-clean coverage-clean cocciclean $(RM) $(FUZZ_PROGRAMS) $(RM) $(SP_OBJ) $(RM) $(HCC) - $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) $(test_bindir_programs) $(RM) -r po/build/ $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope* $(RM) -r .dist-tmp-dir .doc-tmp-dir
bin-wrappers/.gitignore new file +9 -0
@@ -0,0 +1,9 @@ +/git +/git-cvsserver +/git-receive-pack +/git-shell +/git-upload-archive +/git-upload-pack +/scalar +/test-fake-ssh +/test-tool
bin-wrappers/wrap-for-bin.sh renamed from wrap-for-bin.sh +0 -0
contrib/buildsystems/CMakeLists.txt +3 -3
@@ -1061,20 +1061,20 @@ set(wrapper_test_scripts foreach(script ${wrapper_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() foreach(script ${wrapper_test_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() -file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) +file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
Signature · 1 line
2.47.0.229.g8f8d6eee53.dirty