Skip to content

Commit

Permalink
Merge branch 'ps/build' into seen
Browse files Browse the repository at this point in the history
Build procedure update plus introduction of Mason based builds

* ps/build:
  meson: fix conflicts with in-flight topics
  Introduce support for the Meson build system
  Documentation: add comparison of build systems
  t: allow overriding build dir
  t: better support for out-of-tree builds
  Documentation: extract script to generate a list of mergetools
  Documentation: teach "cmd-list.perl" about out-of-tree builds
  Documentation: allow sourcing generated includes from separate dir
  Makefile: simplify building of templates
  Makefile: allow "bin-wrappers/" directory to exist
  Makefile: refactor generators to be PWD-independent
  Makefile: refactor GIT-VERSION-GEN to be reusable
  Makefile: extract script to generate gitweb.cgi
  Makefile: extract script to massage Shell scripts
  Makefile: use "generate-perl.sh" to massage Perl library
  Makefile: extract script to massage Perl scripts
  Makefile: consistently use PERL_PATH
  Makefile: consistently use @Placeholder@ to substitute
  Makefile: use common template for GIT-BUILD-OPTIONS
  • Loading branch information
ttaylorr committed Oct 30, 2024
2 parents 4ed90a2 + 7afbcb6 commit e46ea97
Show file tree
Hide file tree
Showing 88 changed files with 4,428 additions and 447 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
/bin-wrappers/
/git
/git-add
/git-am
Expand Down
2 changes: 1 addition & 1 deletion Documentation/CodingGuidelines
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 12 additions & 16 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -218,6 +219,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)'
Expand Down Expand Up @@ -275,15 +277,17 @@ 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
$(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
Expand All @@ -305,22 +309,14 @@ 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

$(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))

Expand Down
2 changes: 2 additions & 0 deletions Documentation/build-docdep.perl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/perl

my ($build_dir) = @ARGV;
my %include = ();
my %included = ();

Expand All @@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
Expand Down
23 changes: 12 additions & 11 deletions Documentation/cmd-list.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand All @@ -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/;
}
Expand All @@ -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";
}
}
2 changes: 1 addition & 1 deletion Documentation/config/diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Documentation/config/merge.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions Documentation/generate-mergetool-list.sh
Original file line number Diff line number Diff line change
@@ -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"
24 changes: 12 additions & 12 deletions Documentation/git.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
---------------------------------------
Expand All @@ -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
------------------------------------------------------
Expand All @@ -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
-----------------------
Expand Down
Loading

0 comments on commit e46ea97

Please sign in to comment.