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

Getting there.

* ps/build: (25 commits)
  fixup! Makefile: propagate Git version via generated header
  fixup! Makefile: generate doc versions via GIT-VERSION-GEN
  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: extract script to generate gitweb.js
  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: generate doc versions via GIT-VERSION-GEN
  ...
  • Loading branch information
gitster committed Nov 22, 2024
2 parents e4cdf95 + 9541929 commit 54d32b0
Show file tree
Hide file tree
Showing 98 changed files with 4,919 additions and 499 deletions.
3 changes: 2 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 Expand Up @@ -195,9 +194,11 @@
/config-list.h
/command-list.h
/hook-list.h
/version-def.h
*.tar.gz
*.dsc
*.deb
/git.rc
/git.spec
*.exe
*.[aos]
Expand Down
2 changes: 2 additions & 0 deletions Documentation/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ tmp-doc-diff/
GIT-ASCIIDOCFLAGS
/.build/
/GIT-EXCLUDED-PROGRAMS
/asciidoc.conf
/asciidoctor-extensions.rb
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
48 changes: 25 additions & 23 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak

.PHONY: FORCE

# Guard against environment variables
MAN1_TXT =
MAN5_TXT =
Expand Down Expand Up @@ -111,6 +113,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 @@ -148,16 +151,12 @@ man5dir = $(mandir)/man5
man7dir = $(mandir)/man7
# DESTDIR =

GIT_DATE := $(shell git show --quiet --pretty='%as')

ASCIIDOC = asciidoc
ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
-amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
-arevdate='$(GIT_DATE)'
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
Expand Down Expand Up @@ -210,6 +209,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
DBLATEX_COMMON =
XMLTO_EXTRA += --skip-validation
XMLTO_EXTRA += -x manpage.xsl

asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
$(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
else
asciidoc.conf: asciidoc.conf.in FORCE
$(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
endif

ASCIIDOC_DEPS += docinfo.html
Expand All @@ -218,6 +225,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 +283,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 +315,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 Expand Up @@ -364,7 +366,7 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<

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

technical/api-index.txt: technical/api-index-skel.txt \
Expand All @@ -373,7 +375,7 @@ technical/api-index.txt: technical/api-index-skel.txt \

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

SubmittingPatches.txt: SubmittingPatches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ tilde=&#126;
apostrophe=&#39;
backtick=&#96;
litdd=&#45;&#45;
manmanual='Git Manual'
mansource='Git @GIT_VERSION@'
revdate='@GIT_DATE@'

ifdef::backend-docbook[]
[linkgit-inlinemacro]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ def process(parent, target, attrs)
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
def process document, output
if document.basebackend? 'docbook'
mansource = document.attributes['mansource']
manversion = document.attributes['manversion']
manmanual = document.attributes['manmanual']
new_tags = "" \
"<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \
"<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \
"<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
"<refmiscinfo class=\"source\">@GIT_VERSION@</refmiscinfo>\n" \
"<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end
output
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 @@ -218,7 +218,7 @@ endif::git-diff[]
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 54d32b0

Please sign in to comment.