Skip to content

Commit 29e5596

Browse files
committed
Merge branch 'ps/build'
Build procedure update plus introduction of Meson based builds. * ps/build: (24 commits) 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: write absolute program path into bin-wrappers Makefile: allow "bin-wrappers/" directory to exist Makefile: refactor generators to be PWD-independent Makefile: extract script to generate gitweb.js Makefile: extract script to generate gitweb.cgi Makefile: extract script to massage Python scripts 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: generate doc versions via GIT-VERSION-GEN Makefile: generate "git.rc" via GIT-VERSION-GEN ...
2 parents ededd0d + 904339e commit 29e5596

File tree

98 files changed

+4995
-511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4995
-511
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/GIT-TEST-SUITES
1313
/GIT-USER-AGENT
1414
/GIT-VERSION-FILE
15-
/bin-wrappers/
1615
/git
1716
/git-add
1817
/git-am
@@ -195,9 +194,11 @@
195194
/config-list.h
196195
/command-list.h
197196
/hook-list.h
197+
/version-def.h
198198
*.tar.gz
199199
*.dsc
200200
*.deb
201+
/git.rc
201202
/git.spec
202203
*.exe
203204
*.[aos]

Documentation/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ tmp-doc-diff/
1515
GIT-ASCIIDOCFLAGS
1616
/.build/
1717
/GIT-EXCLUDED-PROGRAMS
18+
/asciidoc.conf
19+
/asciidoctor-extensions.rb

Documentation/CodingGuidelines

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ For C programs:
583583
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
584584
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
585585
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
586-
./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
586+
./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
587587

588588
- The primary data structure that a subsystem 'S' deals with is called
589589
`struct S`. Functions that operate on `struct S` are named

Documentation/Makefile

+28-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Import tree-wide shared Makefile behavior and libraries
22
include ../shared.mak
33

4+
.PHONY: FORCE
5+
46
# Guard against environment variables
57
MAN1_TXT =
68
MAN5_TXT =
@@ -111,6 +113,7 @@ TECH_DOCS += MyFirstObjectWalk
111113
TECH_DOCS += SubmittingPatches
112114
TECH_DOCS += ToolsForGit
113115
TECH_DOCS += technical/bitmap-format
116+
TECH_DOCS += technical/build-systems
114117
TECH_DOCS += technical/bundle-uri
115118
TECH_DOCS += technical/hash-function-transition
116119
TECH_DOCS += technical/long-running-process-protocol
@@ -148,16 +151,12 @@ man5dir = $(mandir)/man5
148151
man7dir = $(mandir)/man7
149152
# DESTDIR =
150153

151-
GIT_DATE := $(shell git show --quiet --pretty='%as')
152-
153154
ASCIIDOC = asciidoc
154155
ASCIIDOC_EXTRA =
155156
ASCIIDOC_HTML = xhtml11
156157
ASCIIDOC_DOCBOOK = docbook
157158
ASCIIDOC_CONF = -f asciidoc.conf
158-
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
159-
-amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
160-
-arevdate='$(GIT_DATE)'
159+
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
161160
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
162161
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
163162
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -210,6 +209,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
210209
DBLATEX_COMMON =
211210
XMLTO_EXTRA += --skip-validation
212211
XMLTO_EXTRA += -x manpage.xsl
212+
213+
asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
214+
$(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
215+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
216+
else
217+
asciidoc.conf: asciidoc.conf.in FORCE
218+
$(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
219+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
213220
endif
214221

215222
ASCIIDOC_DEPS += docinfo.html
@@ -218,6 +225,7 @@ SHELL_PATH ?= $(SHELL)
218225
# Shell quote;
219226
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
220227

228+
ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
221229
ifdef DEFAULT_PAGER
222230
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
223231
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -275,15 +283,17 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
275283
-include ../GIT-VERSION-FILE
276284
endif
277285

286+
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
287+
278288
#
279289
# Determine "include::" file references in asciidoc files.
280290
#
281291
docdep_prereqs = \
282-
mergetools-list.made $(mergetools_txt) \
292+
$(mergetools_txt) \
283293
cmd-list.made $(cmds_txt)
284294

285295
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
286-
$(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
296+
$(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
287297

288298
ifneq ($(MAKECMDGOALS),clean)
289299
-include doc.dep
@@ -305,22 +315,14 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
305315
$(cmds_txt): cmd-list.made
306316

307317
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
308-
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
318+
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
309319
date >$@
310320

311-
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
312-
313-
$(mergetools_txt): mergetools-list.made
314-
315-
mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
316-
$(QUIET_GEN) \
317-
$(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
318-
. ../git-mergetool--lib.sh && \
319-
show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
320-
$(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
321-
. ../git-mergetool--lib.sh && \
322-
show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
323-
date >$@
321+
mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
322+
mergetools-diff.txt:
323+
$(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
324+
mergetools-merge.txt:
325+
$(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
324326

325327
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
326328

@@ -341,6 +343,7 @@ clean:
341343
$(RM) SubmittingPatches.txt
342344
$(RM) $(cmds_txt) $(mergetools_txt) *.made
343345
$(RM) GIT-ASCIIDOCFLAGS
346+
$(RM) asciidoc.conf asciidoctor-extensions.rb
344347

345348
docinfo.html: docinfo-html.in
346349
$(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ -364,7 +367,7 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
364367
%.xml : %.txt $(ASCIIDOC_DEPS)
365368
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
366369

367-
user-manual.xml: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
370+
user-manual.xml: user-manual.txt user-manual.conf $(ASCIIDOC_DEPS)
368371
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
369372

370373
technical/api-index.txt: technical/api-index-skel.txt \
@@ -373,7 +376,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
373376

374377
technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
375378
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
376-
asciidoc.conf GIT-ASCIIDOCFLAGS
379+
$(ASCIIDOC_DEPS)
377380
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
378381

379382
SubmittingPatches.txt: SubmittingPatches
@@ -416,13 +419,13 @@ $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
416419
howto-index.txt: howto-index.sh $(HOWTO_TXT)
417420
$(QUIET_GEN)'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(HOWTO_TXT)) >$@
418421

419-
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
422+
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt $(ASCIIDOC_DEPS)
420423
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
421424

422425
WEBDOC_DEST = /pub/software/scm/git/docs
423426

424427
howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
425-
$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt GIT-ASCIIDOCFLAGS
428+
$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt $(ASCIIDOC_DEPS)
426429
$(QUIET_ASCIIDOC) \
427430
sed -e '1,/^$$/d' $< | \
428431
$(TXT_TO_HTML) - >$@

Documentation/asciidoc.conf Documentation/asciidoc.conf.in

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ tilde=&#126;
2121
apostrophe=&#39;
2222
backtick=&#96;
2323
litdd=&#45;&#45;
24+
manmanual='Git Manual'
25+
mansource='Git @GIT_VERSION@'
26+
revdate='@GIT_DATE@'
2427

2528
ifdef::backend-docbook[]
2629
[linkgit-inlinemacro]

Documentation/asciidoctor-extensions.rb Documentation/asciidoctor-extensions.rb.in

+2-6
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@ def process(parent, target, attrs)
2929
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
3030
def process document, output
3131
if document.basebackend? 'docbook'
32-
mansource = document.attributes['mansource']
33-
manversion = document.attributes['manversion']
34-
manmanual = document.attributes['manmanual']
3532
new_tags = "" \
36-
"<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \
37-
"<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \
38-
"<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
33+
"<refmiscinfo class=\"source\">@GIT_VERSION@</refmiscinfo>\n" \
34+
"<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
3935
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
4036
end
4137
output

Documentation/build-docdep.perl

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/perl
22

3+
my ($build_dir) = @ARGV;
34
my %include = ();
45
my %included = ();
56

@@ -10,6 +11,7 @@
1011
chomp;
1112
s/^include::\s*//;
1213
s/\[\]//;
14+
s/{build_dir}/${build_dir}/;
1315
$include{$text}{$_} = 1;
1416
$included{$_} = 1;
1517
}

Documentation/cmd-list.perl

+12-11
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
use File::Compare qw(compare);
44

55
sub format_one {
6-
my ($out, $nameattr) = @_;
6+
my ($source_dir, $out, $nameattr) = @_;
77
my ($name, $attr) = @$nameattr;
8+
my ($path) = "$source_dir/Documentation/$name.txt";
89
my ($state, $description);
910
my $mansection;
1011
$state = 0;
11-
open I, '<', "$name.txt" or die "No such file $name.txt";
12+
open I, '<', "$path" or die "No such file $path.txt";
1213
while (<I>) {
1314
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
1415
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
2930
}
3031
close I;
3132
if (!defined $description) {
32-
die "No description found in $name.txt";
33+
die "No description found in $path.txt";
3334
}
3435
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
3536
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
4344
}
4445
}
4546

46-
my ($input, @categories) = @ARGV;
47+
my ($source_dir, $build_dir, @categories) = @ARGV;
4748

48-
open IN, "<$input";
49+
open IN, "<$source_dir/command-list.txt";
4950
while (<IN>) {
5051
last if /^### command list/;
5152
}
@@ -63,17 +64,17 @@ sub format_one {
6364

6465
for my $out (@categories) {
6566
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
66-
open O, '>', "$out+" or die "Cannot open output file $out+";
67+
my ($path) = "$build_dir/$out";
68+
open O, '>', "$path+" or die "Cannot open output file $out+";
6769
for (@{$cmds{$cat}}) {
68-
format_one(\*O, $_);
70+
format_one($source_dir, \*O, $_);
6971
}
7072
close O;
7173

72-
if (-f "$out" && compare("$out", "$out+") == 0) {
73-
unlink "$out+";
74+
if (-f "$path" && compare("$path", "$path+") == 0) {
75+
unlink "$path+";
7476
}
7577
else {
76-
print STDERR "$out\n";
77-
rename "$out+", "$out";
78+
rename "$path+", "$path";
7879
}
7980
}

Documentation/config/diff.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ endif::git-diff[]
218218
Set this option to `true` to make the diff driver cache the text
219219
conversion outputs. See linkgit:gitattributes[5] for details.
220220

221-
include::../mergetools-diff.txt[]
221+
include::{build_dir}/mergetools-diff.txt[]
222222

223223
`diff.indentHeuristic`::
224224
Set this option to `false` to disable the default heuristics

Documentation/config/merge.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ merge.guitool::
101101
Any other value is treated as a custom merge tool and requires that a
102102
corresponding mergetool.<guitool>.cmd variable is defined.
103103

104-
include::../mergetools-merge.txt[]
104+
include::{build_dir}/mergetools-merge.txt[]
105105

106106
merge.verbosity::
107107
Controls the amount of output shown by the recursive merge
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
if test "$#" -ne 3
4+
then
5+
echo >&2 "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>"
6+
exit 1
7+
fi
8+
9+
SOURCE_DIR="$1"
10+
TOOL_MODE="$2"
11+
OUTPUT="$3"
12+
MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
13+
14+
(
15+
. "$SOURCE_DIR"/git-mergetool--lib.sh &&
16+
show_tool_names can_$TOOL_MODE
17+
) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"

0 commit comments

Comments
 (0)