Merge branch 'ps/build' into seen

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
  ...
This commit is contained in:
Junio C Hamano 2024-11-22 16:55:53 +09:00
commit 54d32b0364
98 changed files with 4920 additions and 500 deletions

3
.gitignore vendored
View File

@ -12,7 +12,6 @@
/GIT-TEST-SUITES /GIT-TEST-SUITES
/GIT-USER-AGENT /GIT-USER-AGENT
/GIT-VERSION-FILE /GIT-VERSION-FILE
/bin-wrappers/
/git /git
/git-add /git-add
/git-am /git-am
@ -195,9 +194,11 @@
/config-list.h /config-list.h
/command-list.h /command-list.h
/hook-list.h /hook-list.h
/version-def.h
*.tar.gz *.tar.gz
*.dsc *.dsc
*.deb *.deb
/git.rc
/git.spec /git.spec
*.exe *.exe
*.[aos] *.[aos]

View File

@ -15,3 +15,5 @@ tmp-doc-diff/
GIT-ASCIIDOCFLAGS GIT-ASCIIDOCFLAGS
/.build/ /.build/
/GIT-EXCLUDED-PROGRAMS /GIT-EXCLUDED-PROGRAMS
/asciidoc.conf
/asciidoctor-extensions.rb

View File

@ -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=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb" 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 - The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named `struct S`. Functions that operate on `struct S` are named

View File

@ -1,6 +1,8 @@
# Import tree-wide shared Makefile behavior and libraries # Import tree-wide shared Makefile behavior and libraries
include ../shared.mak include ../shared.mak
.PHONY: FORCE
# Guard against environment variables # Guard against environment variables
MAN1_TXT = MAN1_TXT =
MAN5_TXT = MAN5_TXT =
@ -111,6 +113,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format TECH_DOCS += technical/bitmap-format
TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol TECH_DOCS += technical/long-running-process-protocol
@ -148,16 +151,12 @@ man5dir = $(mandir)/man5
man7dir = $(mandir)/man7 man7dir = $(mandir)/man7
# DESTDIR = # DESTDIR =
GIT_DATE := $(shell git show --quiet --pretty='%as')
ASCIIDOC = asciidoc ASCIIDOC = asciidoc
ASCIIDOC_EXTRA = ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11 ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf ASCIIDOC_CONF = -f asciidoc.conf
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \ ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
-amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
-arevdate='$(GIT_DATE)'
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML) TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK) TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@ -210,6 +209,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
DBLATEX_COMMON = DBLATEX_COMMON =
XMLTO_EXTRA += --skip-validation XMLTO_EXTRA += --skip-validation
XMLTO_EXTRA += -x manpage.xsl 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 endif
ASCIIDOC_DEPS += docinfo.html ASCIIDOC_DEPS += docinfo.html
@ -218,6 +225,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote; # Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER)) DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)' ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@ -275,15 +283,17 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE -include ../GIT-VERSION-FILE
endif endif
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
# #
# Determine "include::" file references in asciidoc files. # Determine "include::" file references in asciidoc files.
# #
docdep_prereqs = \ docdep_prereqs = \
mergetools-list.made $(mergetools_txt) \ $(mergetools_txt) \
cmd-list.made $(cmds_txt) cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl 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) ifneq ($(MAKECMDGOALS),clean)
-include doc.dep -include doc.dep
@ -305,22 +315,14 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made $(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT) 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 >$@ date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
mergetools-diff.txt:
$(mergetools_txt): mergetools-list.made $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
mergetools-merge.txt:
mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*) $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
$(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 >$@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK)) TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
@ -364,7 +366,7 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS) %.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $< $(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 $@ $< $(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
technical/api-index.txt: technical/api-index-skel.txt \ technical/api-index.txt: technical/api-index-skel.txt \
@ -373,7 +375,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../ technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \ $(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
asciidoc.conf GIT-ASCIIDOCFLAGS $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
SubmittingPatches.txt: SubmittingPatches SubmittingPatches.txt: SubmittingPatches

View File

@ -21,6 +21,9 @@ tilde=&#126;
apostrophe=&#39; apostrophe=&#39;
backtick=&#96; backtick=&#96;
litdd=&#45;&#45; litdd=&#45;&#45;
manmanual='Git Manual'
mansource='Git @GIT_VERSION@'
revdate='@GIT_DATE@'
ifdef::backend-docbook[] ifdef::backend-docbook[]
[linkgit-inlinemacro] [linkgit-inlinemacro]

View File

@ -29,13 +29,9 @@ module Git
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
def process document, output def process document, output
if document.basebackend? 'docbook' if document.basebackend? 'docbook'
mansource = document.attributes['mansource']
manversion = document.attributes['manversion']
manmanual = document.attributes['manmanual']
new_tags = "" \ new_tags = "" \
"<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \ "<refmiscinfo class=\"source\">@GIT_VERSION@</refmiscinfo>\n" \
"<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \ "<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
"<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>") output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end end
output output

View File

@ -1,5 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
my ($build_dir) = @ARGV;
my %include = (); my %include = ();
my %included = (); my %included = ();
@ -10,6 +11,7 @@ for my $text (<*.txt>) {
chomp; chomp;
s/^include::\s*//; s/^include::\s*//;
s/\[\]//; s/\[\]//;
s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1; $include{$text}{$_} = 1;
$included{$_} = 1; $included{$_} = 1;
} }

View File

@ -3,12 +3,13 @@
use File::Compare qw(compare); use File::Compare qw(compare);
sub format_one { sub format_one {
my ($out, $nameattr) = @_; my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr; my ($name, $attr) = @$nameattr;
my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description); my ($state, $description);
my $mansection; my $mansection;
$state = 0; $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>) { while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) { if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1; $mansection = $1;
@ -29,7 +30,7 @@ sub format_one {
} }
close I; close I;
if (!defined $description) { if (!defined $description) {
die "No description found in $name.txt"; die "No description found in $path.txt";
} }
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) { if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t"; 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>) { while (<IN>) {
last if /^### command list/; last if /^### command list/;
} }
@ -63,17 +64,17 @@ close IN;
for my $out (@categories) { for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/; 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}}) { for (@{$cmds{$cat}}) {
format_one(\*O, $_); format_one($source_dir, \*O, $_);
} }
close O; close O;
if (-f "$out" && compare("$out", "$out+") == 0) { if (-f "$path" && compare("$path", "$path+") == 0) {
unlink "$out+"; unlink "$path+";
} }
else { else {
print STDERR "$out\n"; rename "$path+", "$path";
rename "$out+", "$out";
} }
} }

View File

@ -218,7 +218,7 @@ endif::git-diff[]
Set this option to `true` to make the diff driver cache the text Set this option to `true` to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details. conversion outputs. See linkgit:gitattributes[5] for details.
include::../mergetools-diff.txt[] include::{build_dir}/mergetools-diff.txt[]
`diff.indentHeuristic`:: `diff.indentHeuristic`::
Set this option to `false` to disable the default heuristics Set this option to `false` to disable the default heuristics

View File

@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined. corresponding mergetool.<guitool>.cmd variable is defined.
include::../mergetools-merge.txt[] include::{build_dir}/mergetools-merge.txt[]
merge.verbosity:: merge.verbosity::
Controls the amount of output shown by the recursive merge Controls the amount of output shown by the recursive merge

View File

@ -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"

View File

@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
include::cmds-mainporcelain.txt[] include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands Ancillary Commands
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Manipulators: Manipulators:
include::cmds-ancillarymanipulators.txt[] include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators: Interrogators:
include::cmds-ancillaryinterrogators.txt[] include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others Interacting with Others
@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other These commands are to interact with foreign SCM and with other
people via patch over e-mail. people via patch over e-mail.
include::cmds-foreignscminterface.txt[] include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
@ -313,13 +313,13 @@ repositories.
Manipulation commands Manipulation commands
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
include::cmds-plumbingmanipulators.txt[] include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
include::cmds-plumbinginterrogators.txt[] include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in In general, the interrogate commands do not touch the files in
the working tree. the working tree.
@ -328,12 +328,12 @@ the working tree.
Syncing repositories Syncing repositories
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
include::cmds-synchingrepositories.txt[] include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users The following are helper commands used by the above; end users
typically do not use them directly. typically do not use them directly.
include::cmds-synchelpers.txt[] include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands Internal helper commands
@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end These are internal helper commands used by other commands; end
users typically do not use them directly. users typically do not use them directly.
include::cmds-purehelpers.txt[] include::{build_dir}/cmds-purehelpers.txt[]
Guides Guides
------ ------
The following documentation pages are guides about Git concepts. The following documentation pages are guides about Git concepts.
include::cmds-guide.txt[] include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces 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 users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria. 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 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 other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1]. linkgit:git-help[1].
include::cmds-developerinterfaces.txt[] include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism Configuration Mechanism
----------------------- -----------------------

324
Documentation/meson.build Normal file
View File

@ -0,0 +1,324 @@
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')
asciidoc_conf = custom_target(
command: [
shell,
meson.project_source_root() / 'GIT-VERSION-GEN',
meson.project_source_root(),
'@INPUT@',
'@OUTPUT@',
],
input: meson.current_source_dir() / 'asciidoc.conf.in',
output: 'asciidoc.conf',
depends: [git_version_file],
)
asciidoc_common_options = [
asciidoc,
'--conf-file=' + asciidoc_conf.full_path(),
'--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 = [
asciidoc_conf,
]
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

View File

@ -0,0 +1,224 @@
= Build Systems
The build system is the primary way for both developers and system integrators
to interact with the Git project. As such, being easy to use and extend for
those who are not directly developing Git itself is just as important as other
requirements we have on any potential build system.
This document outlines the different requirements that we have for the build
system and then compares available build systems using these criteria.
== Requirements
The following subsections present a list of requirements that we have for any
potential build system. Sections are sorted by decreasing priority.
=== Platform support
The build system must have support for all of our platforms that we continually
test against as outlined by our platform support policy. These platforms are:
- Linux
- Windows
- macOS
Furthermore, the build system should have support for the following platforms
that generally have somebody running test pipelines against regularly:
- AIX
- FreeBSD
- NetBSD
- NonStop
- OpenBSD
The platforms which must be supported by the tool should be aligned with our
[platform support policy](platform-support.txt).
=== Auto-detection of supported features
The build system must support auto-detection of features which are or aren't
available on the current platform. Platform maintainers should not be required
to manually configure the complete build.
Auto-detection of the following items is considered to be important:
- Check for the existence of headers.
- Check for the existence of libraries.
- Check for the existence of exectuables.
- Check for the runtime behavior of specific functions.
- Check for specific link order requirements when multiple libraries are
involved.
=== Ease of use
The build system should be both easy to use and easy to extend. While this is
naturally a subjective metric it is likely not controversial to say that some
build systems are considerably harder to use than others.
=== IDE support
The build system should integrate with well-known IDEs. Well-known IDEs include:
- Microsoft Visual Studio
- Visual Studio Code
- Xcode
There are four levels of support:
- Native integration into the IDE.
- Integration into the IDE via a plugin.
- Integration into the IDE via generating a project description with the build
system.
- No integration.
Native integration is preferable, but integration via either a plugin or by
generating a project description via the build system are considered feasible
alternatives.
Another important distinction is the level of integration. There are two
features that one generally wants to have:
- Integration of build targets.
- Automatic setup of features like code completion with detected build
dependencies.
The first bullet point is the bare minimum, but is not sufficient to be
considered proper integration.
=== Out-of-tree builds
The build system should support out-of-tree builds. Out-of-tree builds allow a
developer to configure multiple different build directories with different
configuration, e.g. one "debug" build and one "release" build.
=== Cross-platform builds
The build system should support cross-platform builds, e.g. building for arm on
an x86-64 host.
=== Language support
The following languages and toolchains are of relevance and should be supported
by the build system:
- C: the primary compiled language used by Git, must be supported. Relevant
toolchains are GCC, Clang and MSVC.
- Rust: candidate as a second compiled lanugage, should be supported. Relevant
toolchains is the LLVM-based rustc.
Built-in support for the respective languages is preferred over support that
needs to be wired up manually to avoid unnecessary complexity. Native support
includes the following features:
- Compiling objects.
- Dependency tracking.
- Detection of available features.
- Discovery of relevant toolchains.
- Linking libraries and executables.
- Templating placeholders in scripts.
=== Test integration
It should be possible to integrate tests into the build system such that it is
possible to build and test Git within the build system. Features which are nice
to have:
- Track build-time dependencies for respective tests. Unit tests have
different requirements than integration tests.
- Allow filtering of which tests to run.
- Allow running tests such that utilities like `test_pause` or `debug` work.
== Comparison
The following list of build systems are considered:
- GNU Make
- autoconf
- CMake
- Meson
=== GNU Make
- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
- Auto-detection: no built-in support for auto-detection of features.
- Ease of use: easy to use, but discovering available options is hard. Makefile
rules can quickly get out of hand once reaching a certain scope.
- IDE support: execution of Makefile targets is supported by many IDEs
- Out-of-tree builds: supported in theory, not wired up in practice.
- Cross-platform builds: supported in theory, not wired up in practice.
- Language support:
- C: Limited built-in support, many parts need to be wired up manually.
- Rust: No built-in support, needs to be wired up manually.
- Test integration: partially supported, many parts need to be wired up
manually.
=== autoconf
- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
- Auto-detection: supported.
- Ease of use: easy to use, discovering available options is comparatively
easy. The autoconf syntax is prohibitively hard to extend though due to its
complex set of interacting files and the hard-to-understand M4 language.
- IDE support: no integration into IDEs at generation time. The generated
Makefiles have the same level of support as GNU Make.
- Out-of-tree builds: supported in theory, not wired up in practice.
- Cross-platform builds: supported.
- Language support:
- C: Limited built-in support, many parts need to be wired up manually.
- Rust: No built-in support, needs to be wired up manually.
- Test integration: partially supported, many parts need to be wired up
manually.
=== CMake
- Platform support: not as extensive as GNU Make or autoconf, but all major
platforms are supported.
- AIX
- Cygwin
- FreeBSD
- Linux
- OpenBSD
- Solaris
- Windows
- macOS
- Ease of use: easy to use, discovering available options is not always
trivial. The scripting language used by CMake is somewhat cumbersome to use,
but extending CMake build instructions is doable.
- IDE support: natively integrated into Microsoft Visual Studio. Can generate
project descriptions for Xcode. An extension is available for Visual Studio
Code. Many other IDEs have plugins for CMake.
- Out-of-tree builds: supported.
- Cross-platform builds: supported.
- Language support:
- C: Supported for GCC, Clang, MSVC and other toolchains.
- Rust: No built-in support, needs to be wired up manually.
- Test integration: supported, even though test dependencies are a bit
cumbersome to use via "test fixtures". Interactive test runs are not
supported.
=== Meson
- Platform: not as extensive as GNU Make or autoconf, but all major platforms
and some smaller ones are supported.
- AIX
- Cygwin
- DragonflyBSD
- FreeBSD
- Haiku
- Linux
- NetBSD
- OpenBSD
- Solaris
- Windows
- macOS
- 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.

47
GIT-BUILD-OPTIONS.in Normal file
View File

@ -0,0 +1,47 @@
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@
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@
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@
LOCALEDIR=@LOCALEDIR@
BROKEN_PATH_FIX=@BROKEN_PATH_FIX@

1
GIT-VERSION-FILE.in Normal file
View File

@ -0,0 +1 @@
GIT_VERSION=@GIT_VERSION@

View File

@ -1,23 +1,41 @@
#!/bin/sh #!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT DEF_VER=v2.47.GIT
LF=' LF='
' '
if test "$#" -ne 3
then
echo "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>" >&2
exit 1
fi
SOURCE_DIR="$1"
INPUT="$2"
OUTPUT="$3"
if ! test -f "$INPUT"
then
echo "Input is not a file: $INPUT" >&2
exit 1
fi
GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
export GIT_CEILING_DIRECTORIES
# First see if there is a version file (included in release tarballs), # First see if there is a version file (included in release tarballs),
# then try git-describe, then default. # then try git-describe, then default.
if test -f version if test -f "$SOURCE_DIR"/version
then then
VN=$(cat version) || VN="$DEF_VER" VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
elif { test -d "${GIT_DIR:-.git}" || test -f .git; } && elif { test -d "$SOURCE_DIR/.git" || test -d "${GIT_DIR:-.git}" || test -f "$SOURCE_DIR"/.git; } &&
VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) && VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in case "$VN" in
*$LF*) (exit 1) ;; *$LF*) (exit 1) ;;
v[0-9]*) v[0-9]*)
git update-index -q --refresh git -C "$SOURCE_DIR" update-index -q --refresh
test -z "$(git diff-index --name-only HEAD --)" || test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;; VN="$VN-dirty" ;;
esac esac
then then
@ -26,15 +44,31 @@ else
VN="$DEF_VER" VN="$DEF_VER"
fi fi
VN=$(expr "$VN" : v*'\(.*\)') GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as')
if test -r $GVF GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
if test -z "$GIT_USER_AGENT"
then then
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) GIT_USER_AGENT=git/$GIT_VERSION
else fi
VC=unset
read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
EOF
sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_DATE@|$GIT_DATE|" \
-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
-e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
"$INPUT" >"$OUTPUT"+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
then
mv "$OUTPUT"+ "$OUTPUT"
else
rm "$OUTPUT"+
fi fi
test "$VN" = "$VC" || {
echo >&2 "GIT_VERSION = $VN"
echo "GIT_VERSION = $VN" >$GVF
}

239
Makefile
View File

@ -595,7 +595,10 @@ include shared.mak
# Disable -pedantic compilation. # Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN @OLD=$$(cat $@ 2>/dev/null || :) && \
$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" GIT-VERSION-FILE.in $@ && \
NEW=$$(cat $@ 2>/dev/null || :) && \
if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
-include GIT-VERSION-FILE -include GIT-VERSION-FILE
# Set our default configuration. # Set our default configuration.
@ -1566,10 +1569,10 @@ endif
ifdef SANE_TOOL_PATH ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(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} PATH := $(SANE_TOOL_PATH):${PATH}
else else
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d' BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif endif
ifeq (,$(HOST_CPU)) ifeq (,$(HOST_CPU))
@ -2526,13 +2529,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \ pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)' -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
version.sp version.s version.o: EXTRA_CPPFLAGS = \ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
'-DGIT_VERSION="$(GIT_VERSION)"' \ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
'-DGIT_BUILT_FROM_COMMIT="$(shell \ version.sp version.s version.o: version-def.h
GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
git rev-parse -q --verify HEAD 2>/dev/null)"'
$(BUILT_INS): git$X $(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \ $(QUIET_BUILT_IN)$(RM) $@ && \
@ -2543,17 +2544,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt 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: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt) command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \ $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \ $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
command-list.txt >$@ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.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):\ SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\ $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
@ -2566,33 +2567,16 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \ echo "$$FLAGS" >$@; \
fi fi
define cmd_munge_script $(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
-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@@|$(PERL_PATH_SQ)|g' \
-e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
chmod +x $@+ && \
mv $@+ $@ mv $@+ $@
$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
$(QUIET_GEN)$(cmd_munge_script) && \ $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
mv $@+ $@ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
git.res: git.rc GIT-VERSION-FILE GIT-PREFIX git.res: git.rc GIT-PREFIX
$(QUIET_RC)$(RC) \ $(QUIET_RC)$(RC) -i $< -o $@
$(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
$(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
-DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
# This makes sure we depend on the NO_PERL setting itself. # This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
@ -2625,16 +2609,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir) PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE $(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
$(QUIET_GEN) \ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
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 $@+ && \
mv $@+ $@ mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES)) PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
@ -2650,11 +2626,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \ INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \ INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \ INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
sed -e 's=@@PATHSEP@@=$(pathsep)=g' \ sed -e 's=@PATHSEP@=$(pathsep)=g' \
-e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
-e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
-e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
-e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \ $< >$@+ && \
mv $@+ $@ mv $@+ $@
@ -2662,15 +2638,15 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir: perllibdir:
@echo '$(perllibdir_SQ)' @echo '$(perllibdir_SQ)'
git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \ chmod +x $@+ && \
mv $@+ $@ mv $@+ $@
else # NO_PERL else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \ $(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ 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 >$@+ && \ unimplemented.sh >$@+ && \
chmod +x $@+ && \ chmod +x $@+ && \
mv $@+ $@ mv $@+ $@
@ -2691,13 +2667,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh $(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \ $(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ 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 >$@+ && \ unimplemented.sh >$@+ && \
chmod +x $@+ && \ chmod +x $@+ && \
mv $@+ $@ mv $@+ $@
endif # NO_PYTHON 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+ && \ configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \ autoconf -o configure configure.ac+ && \
$(RM) configure.ac+ $(RM) configure.ac+
@ -3124,13 +3100,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS)) NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template) $(call mkdir_p_parent_template)
$(QUIET_GEN) \ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
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 perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template) $(call mkdir_p_parent_template)
@ -3183,80 +3155,66 @@ GIT-LDFLAGS: FORCE
echo "$$FLAGS" >GIT-LDFLAGS; \ echo "$$FLAGS" >GIT-LDFLAGS; \
fi fi
ifdef RUNTIME_PREFIX
RUNTIME_PREFIX_OPTION = true
else
RUNTIME_PREFIX_OPTION = false
endif
# We need to apply sq twice, once to protect from the shell # We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it # that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo". # and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE GIT-BUILD-OPTIONS: FORCE
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+ @sed \
@echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
@echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+ -e "s|@DIFF@|\'$(DIFF)\'|" \
@echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
@echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+ -e "s|@TAR@|\'$(TAR)\'|" \
@echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
@echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
@echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
@echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
@echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
@echo X=\'$(X)\' >>$@+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
ifdef FSMONITOR_DAEMON_BACKEND -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
@echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
endif -e "s|@X@|\'$(X)\'|" \
ifdef FSMONITOR_OS_SETTINGS -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
@echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
endif -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
ifdef TEST_OUTPUT_DIRECTORY -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
endif -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
ifdef GIT_TEST_OPTS -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
@echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
endif -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
ifdef GIT_TEST_CMP -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
endif -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
endif -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
ifdef GIT_TEST_UTF8_LOCALE -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
@echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
endif -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
@echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
ifdef GIT_PERF_REPEAT_COUNT -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
@echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
endif -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
ifdef GIT_PERF_REPO -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
@echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
endif -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
ifdef GIT_PERF_LARGE_REPO -e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
@echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+ GIT-BUILD-OPTIONS.in >$@+
endif @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
ifdef GIT_PERF_MAKE_OPTS
@echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
endif
ifdef GIT_PERF_MAKE_COMMAND
@echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
endif
ifdef GIT_INTEROP_MAKE_OPTS
@echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
endif
ifdef GIT_TEST_INDEX_VERSION
@echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
endif
ifdef GIT_TEST_PERL_FATAL_WARNINGS
@echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
endif
ifdef RUNTIME_PREFIX
@echo RUNTIME_PREFIX=\'true\' >>$@+
else
@echo RUNTIME_PREFIX=\'false\' >>$@+
endif
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
@ -3276,11 +3234,14 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
bin-wrappers/%: wrap-for-bin.sh $(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \ -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|@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 $@ chmod +x $@
# GNU make supports exporting all variables by "export" without parameters. # GNU make supports exporting all variables by "export" without parameters.
@ -3773,7 +3734,9 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS) $(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ) $(RM) $(SP_OBJ)
$(RM) $(HCC) $(RM) $(HCC)
$(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json $(RM) version-def.h
$(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
$(RM) $(test_bindir_programs)
$(RM) -r po/build/ $(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope* $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir $(RM) -r .dist-tmp-dir .doc-tmp-dir

9
bin-wrappers/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
/git
/git-cvsserver
/git-receive-pack
/git-shell
/git-upload-archive
/git-upload-pack
/scalar
/test-fake-ssh
/test-tool

28
bin-wrappers/meson.build Normal file
View File

@ -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

37
bin-wrappers/wrap-for-bin.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
# wrap-for-bin.sh: Template for git executable wrapper scripts
# 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@, @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='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac

View File

@ -6,7 +6,7 @@
. ${0%/*}/lib.sh . ${0%/*}/lib.sh
filter_log () { filter_log () {
sed -e '/^GIT_VERSION = /d' \ sed -e '/^GIT_VERSION=/d' \
-e "/constant Gem::ConfigMap is deprecated/d" \ -e "/constant Gem::ConfigMap is deprecated/d" \
-e '/^ \* new asciidoc flags$/d' \ -e '/^ \* new asciidoc flags$/d' \
-e '/stripped namespace before processing/d' \ -e '/stripped namespace before processing/d' \

View File

@ -142,7 +142,7 @@ fi
## Configure body starts here. ## Configure body starts here.
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org]) AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c]) AC_CONFIG_SRCDIR([git.c])

View File

@ -83,23 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/") "On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif() endif()
#Create GIT-VERSION-FILE using GIT-VERSION-GEN message("Generating Git version")
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE) execute_process(COMMAND ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
message("Generating GIT-VERSION-FILE") "${CMAKE_SOURCE_DIR}"
execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN "${CMAKE_SOURCE_DIR}/contrib/buildsystems/git-version.in"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) "${CMAKE_BINARY_DIR}/git-version")
endif() file(STRINGS "${CMAKE_BINARY_DIR}/git-version" git_version)
#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})
else()
string(REGEX MATCH "[0-9]*\\.[0-9]*" git_version ${git_version})
string(APPEND git_version ".0") #for building from a snapshot
endif()
project(git project(git
VERSION ${git_version} VERSION ${git_version}
@ -110,8 +99,8 @@ project(git
#TODO Enable NLS on windows natively #TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts #macros for parsing the Makefile for sources and scripts
macro(parse_makefile_for_sources list_var regex) macro(parse_makefile_for_sources list_var makefile regex)
file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)") file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}}) string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit. 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 string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@ -240,10 +229,7 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
GIT_HTML_PATH="share/doc/git-doc" GIT_HTML_PATH="share/doc/git-doc"
DEFAULT_HELP_FORMAT="html" DEFAULT_HELP_FORMAT="html"
DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates" DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates"
GIT_VERSION="${PROJECT_VERSION}.GIT" BINDIR="bin")
GIT_USER_AGENT="git/${PROJECT_VERSION}.GIT"
BINDIR="bin"
GIT_BUILT_FROM_COMMIT="")
if(WIN32) if(WIN32)
set(FALLBACK_RUNTIME_PREFIX /mingw64) set(FALLBACK_RUNTIME_PREFIX /mingw64)
@ -652,60 +638,79 @@ 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) if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty) list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h") message("Generating command-list.h")
execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ${EXCLUSION_PROGS}
OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h) "${CMAKE_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/command-list.h")
endif() endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h) if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h") message("Generating config-list.h")
execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}"
OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h) "${CMAKE_BINARY_DIR}/config-list.h")
endif() endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h) if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h") message("Generating hook-list.h")
execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}"
OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h) "${CMAKE_BINARY_DIR}/hook-list.h")
endif() endif()
include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_BINARY_DIR})
#build #build
#libgit #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 libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/") list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/version-def.h"
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
"${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/version-def.h.in"
"${CMAKE_BINARY_DIR}/version-def.h"
DEPENDS "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
"${CMAKE_SOURCE_DIR}/version-def.h.in"
VERBATIM)
list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES}) add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff #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}/") list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES}) add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable #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}/") list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES}) add_library(reftable STATIC ${reftable_SOURCES})
if(WIN32) if(WIN32)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.rc
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
"${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/git.rc.in"
"${CMAKE_BINARY_DIR}/git.rc"
DEPENDS "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
"${CMAKE_SOURCE_DIR}/git.rc.in"
VERBATIM)
if(NOT MSVC)#use windres when compiling with gcc and clang if(NOT MSVC)#use windres when compiling with gcc and clang
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR} COMMAND ${WINDRES_EXE} -O coff -i ${CMAKE_BINARY_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
-DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\"" DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
-i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM) VERBATIM)
else()#MSVC use rc else()#MSVC use rc
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
COMMAND ${CMAKE_RC_COMPILER} /d MAJOR=${PROJECT_VERSION_MAJOR} /d MINOR=${PROJECT_VERSION_MINOR} COMMAND ${CMAKE_RC_COMPILER} /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_BINARY_DIR}/git.rc
/d MICRO=${PROJECT_VERSION_PATCH} /d PATCHLEVEL=0 /d GIT_VERSION="${PROJECT_VERSION}.GIT" DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
/fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_SOURCE_DIR}/git.rc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM) VERBATIM)
endif() endif()
@ -752,7 +757,7 @@ elseif(UNIX)
endif() endif()
#git #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}/") list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES}) add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@ -834,70 +839,80 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb) ${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts}) foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME) if ("${script}" IN_LIST git_sh_scripts)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}") string(REPLACE ".sh" "" shell_gen_path "${script}")
string(REPLACE "@@DIFF@@" "diff" content "${content}") else()
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") set(shell_gen_path "${script}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}") endif()
string(REPLACE "@@NO_CURL@@" "" content "${content}")
string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}") add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}") COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}") "${CMAKE_SOURCE_DIR}/${script}.sh"
string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}") "${CMAKE_BINARY_DIR}/${shell_gen_path}"
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) "${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() endforeach()
add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts #perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl") 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 #create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl 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 "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" 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}) add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME) COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}") "${CMAKE_SOURCE_DIR}"
string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}") "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
DEPENDS ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
"${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
VERBATIM)
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"
"${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
"${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}"
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
"${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
VERBATIM)
list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach() endforeach()
add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script #python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME) file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}") string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content}) file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
#perl modules #${CMAKE_SOURCE_DIR}/Makefile templates
file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
string(REPLACE " " ";" templates ${templates})
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/" "")
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
#templates have @.*@ replacement so use configure_file instead #templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates}) foreach(tm ${templates})
string(REPLACE "--" "/" blt_tm ${tm}) configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
endforeach() endforeach()
#translations #translations
if(MSGFMT_EXE) if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po") file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@ -971,7 +986,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main) target_link_libraries(test-fake-ssh common-main)
#unit-tests #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/") list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES}) add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@ -1037,7 +1052,7 @@ if(MSVC)
endif() endif()
#test-tool #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) 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/") list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
@ -1063,22 +1078,25 @@ set(wrapper_test_scripts
foreach(script ${wrapper_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 "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}") string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach() endforeach()
foreach(script ${wrapper_test_scripts}) 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 "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach() 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 "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@@PROG@@" "git-cvsserver" 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}) file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options #options for configuring test options
@ -1125,27 +1143,58 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1) set(NO_PYTHON 1)
endif() endif()
file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n") file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n") string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n") string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n") string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n") string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n") string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n") string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n") string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n") string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n") string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n") string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n") string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n") string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n") string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n") string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n") string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n") string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n") string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
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}")
string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG) if(USE_VCPKG)
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif() endif()
file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree #Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE) get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)

View File

@ -0,0 +1 @@
@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@

View File

@ -0,0 +1,8 @@
foreach script : [
'git-completion.bash',
'git-completion.tcsh',
'git-completion.zsh',
'git-prompt.sh'
]
test_dependencies += fs.copyfile(script)
endforeach

1
contrib/meson.build Normal file
View File

@ -0,0 +1 @@
subdir('completion')

View File

@ -64,7 +64,7 @@ define_category_names () {
print_command_list () { print_command_list () {
echo "static struct cmdname_help command_list[] = {" echo "static struct cmdname_help command_list[] = {"
echo "$1" | echo "$2" |
while read cmd rest while read cmd rest
do do
synopsis= synopsis=
@ -76,7 +76,7 @@ print_command_list () {
break break
;; ;;
esac esac
done <"Documentation/$cmd.txt" done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis" printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest printf " | CAT_%s" $rest
@ -93,18 +93,28 @@ do
shift shift
done done
commands="$(command_list "$1")" if test "$#" -ne 2
categories="$(category_list "$commands")" then
die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
fi
echo "/* Automatically generated by generate-cmdlist.sh */ SOURCE_DIR="$1"
struct cmdname_help { OUTPUT="$2"
const char *name;
const char *help; {
uint32_t category; commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
}; categories="$(category_list "$commands")"
"
define_categories "$categories" echo "/* Automatically generated by generate-cmdlist.sh */
echo struct cmdname_help {
define_category_names "$categories" const char *name;
echo const char *help;
print_command_list "$commands" uint32_t category;
};
"
define_categories "$categories"
echo
define_category_names "$categories"
echo
print_command_list "$SOURCE_DIR" "$commands"
} >"$OUTPUT"

View File

@ -1,13 +1,19 @@
#!/bin/sh #!/bin/sh
echo "/* Automatically generated by generate-configlist.sh */" SOURCE_DIR="$1"
echo 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 () { print_config_list () {
cat <<EOF cat <<EOF
static const char *config_name_list[] = { static const char *config_name_list[] = {
EOF 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' | sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort | sort |
sed 's/^.*$/ "&",/' sed 's/^.*$/ "&",/'
@ -17,5 +23,9 @@ EOF
EOF EOF
} }
echo {
print_config_list echo "/* Automatically generated by generate-configlist.sh */"
echo
echo
print_config_list
} >"$OUTPUT"

View File

@ -2,6 +2,17 @@
# #
# Usage: ./generate-hooklist.sh >hook-list.h # 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 cat <<EOF
/* Automatically generated by generate-hooklist.sh */ /* Automatically generated by generate-hooklist.sh */
@ -11,10 +22,12 @@ EOF
sed -n \ sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \ -e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \ -e 'x' \
<Documentation/githooks.txt | <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort LC_ALL=C sort
cat <<EOF cat <<EOF
NULL, NULL,
}; };
EOF EOF
} >"$OUTPUT"

37
generate-perl.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
set -e
if test $# -ne 5
then
echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
exit 1
fi
GIT_BUILD_OPTIONS="$1"
GIT_VERSION_FILE="$2"
PERL_HEADER="$3"
INPUT="$4"
OUTPUT="$5"
. "$GIT_BUILD_OPTIONS"
. "$GIT_VERSION_FILE"
sed -e '1{' \
-e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
-e "s|@GIT_VERSION@|$GIT_VERSION|g" \
-e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
-e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
-e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
case "$INPUT" in
*.perl)
chmod a+x "$OUTPUT";;
*)
;;
esac

34
generate-script.sh Executable file
View File

@ -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

View File

@ -26,7 +26,7 @@ use File::Path qw/rmtree/;
use File::Basename; use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case); use Getopt::Long qw(:config require_order no_ignore_case);
my $VERSION = '@@GIT_VERSION@@'; my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new(); my $log = GITCVS::log->new();
my $cfg; my $cfg;

View File

@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong # Copyright (c) 2006 Eric Wong
# #
PERL='@@PERL@@' PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH= OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG= OPTIONS_STUCKLONG=
OPTIONS_SPEC="\ OPTIONS_SPEC="\
@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path) # if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f' test -z "$httpd" && httpd='lighttpd -f'
# Default is @@GITWEBDIR@@ # Default is @GITWEBDIR@
test -z "$root" && root='@@GITWEBDIR@@' test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do... # any untaken local port will do...
test -z "$port" && port=1234 test -z "$port" && port=1234
@ -716,7 +716,7 @@ EOF
gitweb_conf() { gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
#!@@PERL@@ #!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")"; our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp"; our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot; our \$projects_list = \$projectroot;

View File

@ -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 remote_sha1=$2
ref=$3 ref=$3

View File

@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc); @recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients); @recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++); my $date = format_2822_time($time++);
my $gitversion = '@@GIT_VERSION@@'; my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) { if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version(); $gitversion = Git::version();
} }

View File

@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR" if test -z "$GIT_TEXTDOMAINDIR"
then then
TEXTDOMAINDIR="@@LOCALEDIR@@" TEXTDOMAINDIR="@LOCALEDIR@"
else else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR" TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi fi
@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use... # First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
if test -n "@@USE_GETTEXT_SCHEME@@" if test -n "@USE_GETTEXT_SCHEME@"
then 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" elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then then
: no probing necessary : no probing necessary

View File

@ -41,7 +41,7 @@ git_broken_path_fix () {
esac esac
} }
# @@BROKEN_PATH_FIX@@ # @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support. # Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n" . "$(git --exec-path)/git-sh-i18n"
@ -154,7 +154,7 @@ git_pager() {
else else
GIT_PAGER=cat GIT_PAGER=cat
fi fi
for vardef in @@PAGER_ENV@@ for vardef in @PAGER_ENV@
do do
var=${vardef%%=*} var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var" 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. # remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() { create_virtual_base() {
sz0=$(wc -c <"$1") 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") sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not # If we do not have enough common material, it is not

View File

@ -9,7 +9,7 @@ use vars qw/ $AUTHOR $VERSION
$_revision $_repository $_revision $_repository
$_q $_authors $_authors_prog %users/; $_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>'; $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
$VERSION = '@@GIT_VERSION@@'; $VERSION = '@GIT_VERSION@';
use Carp qw/croak/; use Carp qw/croak/;
use File::Basename qw/dirname basename/; use File::Basename qw/dirname basename/;

View File

@ -1,6 +1,6 @@
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION MAJOR,MINOR,MICRO,PATCHLEVEL FILEVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
PRODUCTVERSION MAJOR,MINOR,MICRO,PATCHLEVEL PRODUCTVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
@ -11,7 +11,7 @@ BEGIN
VALUE "InternalName", "git\0" VALUE "InternalName", "git\0"
VALUE "OriginalFilename", "git.exe\0" VALUE "OriginalFilename", "git.exe\0"
VALUE "ProductName", "Git\0" VALUE "ProductName", "Git\0"
VALUE "ProductVersion", GIT_VERSION "\0" VALUE "ProductVersion", "@GIT_VERSION@\0"
END END
END END

View File

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitk @@GIT_VERSION@@\n" "Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n" "POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n" "PO-Revision-Date: 2015-09-15 07:33+0700\n"

View File

@ -0,0 +1,24 @@
PERL_PATH=@PERL_PATH@
JSMIN=@JSMIN@
CSSMIN=@CSSMIN@
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@

View File

@ -77,48 +77,48 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
-e 's|++GIT_BINDIR++|$(bindir)|g' \
-e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
-e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
-e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
-e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
-e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
-e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
-e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
-e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
-e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
-e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
-e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
-e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
-e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
-e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
-e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
-e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
-e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
-e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
-e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE .PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
@rm -f $@+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
@echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+ -e 's|@JSMIN@|$(JSMIN)|' \
-e 's|@CSSMIN@|$(CSSMIN)|' \
-e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
-e 's|@GIT_BINDIR@|$(bindir)|' \
-e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
-e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
-e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
-e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
-e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
-e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
-e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
-e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
-e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
-e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
-e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
-e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
-e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
-e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
-e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
-e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
-e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
-e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
-e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
-e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@ @cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS $(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
$(MAK_DIR_GITWEB)gitweb.cgi: GIT-VERSION-FILE
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl $(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
$(GITWEB_REPLACE) $< >$@+ && \
chmod +x $@+ && \
mv $@+ $@ mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(MAK_DIR_GITWEB)generate-gitweb-js.sh
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES)) $(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
$(QUIET_GEN)$(RM) $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
cat $^ >$@+ && \ $(MAK_DIR_GITWEB)generate-gitweb-js.sh $@+ $^ && \
mv $@+ $@ mv $@+ $@
### Installation rules ### Installation rules

47
gitweb/generate-gitweb-cgi.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/sh
set -e
if test $# -ne 4
then
echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>" >&2
exit 1
fi
GITWEB_BUILD_OPTIONS="$1"
GIT_VERSION_FILE="$2"
INPUT="$3"
OUTPUT="$4"
. "$GITWEB_BUILD_OPTIONS"
. "$GIT_VERSION_FILE"
sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
-e "s|@PERL_PATH@|$PERL_PATH|" \
-e "s|@JSMIN@|$JSMIN|" \
-e "s|@CSSMIN@|$CSSMIN|" \
-e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
-e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
-e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
-e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
-e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
-e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
-e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
-e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
-e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
-e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
-e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
-e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
-e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
-e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
-e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
-e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
-e "s|@GITWEB_JS@|$GITWEB_JS|" \
-e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
-e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
-e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
-e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
"$INPUT" >"$OUTPUT"
chmod a+x "$OUTPUT"

12
gitweb/generate-gitweb-js.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
if test "$#" -lt 2
then
echo "USAGE: $0 <OUTPUT> <INPUT>..." >&2
exit 1
fi
OUTPUT="$1"
shift
cat "$@" >"$OUTPUT"

View File

@ -35,7 +35,7 @@ BEGIN {
CGI->compile() if $ENV{'MOD_PERL'}; CGI->compile() if $ENV{'MOD_PERL'};
} }
our $version = "++GIT_VERSION++"; our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link); our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri { sub evaluate_uri {
@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use # core git executable to use
# this can just be "git" if your webserver has a sensible PATH # this can just be "git" if your webserver has a sensible PATH
our $GIT = "++GIT_BINDIR++/git"; our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path # absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm"; #our $projectroot = "/pub/scm";
our $projectroot = "++GITWEB_PROJECTROOT++"; our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list # fs traversing limit for getting project list
# the number is relative to the projectroot # 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 # string of the home link on top of all pages
our $home_link_str = "++GITWEB_HOME_LINK_STR++"; our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link # extra breadcrumbs preceding the home link
our @extra_breadcrumbs = (); our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles # name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks # replace this with something more descriptive for clearer bookmarks
our $site_name = "++GITWEB_SITENAME++" our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git"; || ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page # html snippet to include in the <head> section of each page
our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++"; our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page # filename of html text to include at top of each page
our $site_header = "++GITWEB_SITE_HEADER++"; our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page # html text to include at home page
our $home_text = "++GITWEB_HOMETEXT++"; our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page # filename of html text to include at bottom of each page
our $site_footer = "++GITWEB_SITE_FOOTER++"; our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets # URI of stylesheets
our @stylesheets = ("++GITWEB_CSS++"); our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG. # URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef; our $stylesheet = undef;
# URI of GIT logo (72x27 size) # URI of GIT logo (72x27 size)
our $logo = "++GITWEB_LOGO++"; our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type # URI of GIT favicon, assumed to be image/png type
our $favicon = "++GITWEB_FAVICON++"; our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb) # URI of gitweb.js (JavaScript code for gitweb)
our $javascript = "++GITWEB_JS++"; our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link # URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/"; #our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@ -128,7 +128,7 @@ our $logo_url = "https://git-scm.com/";
our $logo_label = "git homepage"; our $logo_label = "git homepage";
# source of projects list # source of projects list
our $projects_list = "++GITWEB_LIST++"; our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column # the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25; our $projects_list_description_width = 25;
@ -147,7 +147,7 @@ our $default_projects_order = "project";
# show repository only if this file exists # show repository only if this file exists
# (only effective if this variable evaluates to true) # (only effective if this variable evaluates to true)
our $export_ok = "++GITWEB_EXPORT_OK++"; our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page # don't generate age column on the projects list page
our $omit_age_column = 0; our $omit_age_column = 0;
@ -161,11 +161,11 @@ our $omit_owner=0;
our $export_auth_hook = undef; our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page # only allow viewing of repositories also shown on the overview page
our $strict_export = "++GITWEB_STRICT_EXPORT++"; our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from, # list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project" # i.e. full URL is "$git_base_url/$project"
our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++"); our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob # default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain'; our $default_blob_plain_mimetype = 'text/plain';
@ -200,7 +200,7 @@ our $prevent_xss = 0;
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output). # http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH. # Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight] # [Default: highlight]
our $highlight_bin = "++HIGHLIGHT_BIN++"; our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving # information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = ( our %known_snapshot_formats = (
@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON); our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config { sub evaluate_gitweb_config {
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++"; our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++"; our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++"; our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice. # Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so # Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so

79
gitweb/meson.build Normal file
View File

@ -0,0 +1,79 @@
gitweb_config = configuration_data()
gitweb_config.set_quoted('PERL_PATH', perl.full_path())
gitweb_config.set_quoted('CSSMIN', '')
gitweb_config.set_quoted('JSMIN', '')
gitweb_config.set_quoted('GIT_BINDIR', get_option('prefix') / get_option('bindir'))
gitweb_config.set_quoted('GITWEB_CONFIG', get_option('gitweb_config'))
gitweb_config.set_quoted('GITWEB_CONFIG_SYSTEM', get_option('gitweb_config_system'))
gitweb_config.set_quoted('GITWEB_CONFIG_COMMON', get_option('gitweb_config_common'))
gitweb_config.set_quoted('GITWEB_HOME_LINK_STR', get_option('gitweb_home_link_str'))
gitweb_config.set_quoted('GITWEB_SITENAME', get_option('gitweb_sitename'))
gitweb_config.set_quoted('GITWEB_PROJECTROOT', get_option('gitweb_projectroot'))
gitweb_config.set_quoted('GITWEB_PROJECT_MAXDEPTH', get_option('gitweb_project_maxdepth'))
gitweb_config.set_quoted('GITWEB_EXPORT_OK', get_option('gitweb_export_ok'))
gitweb_config.set_quoted('GITWEB_STRICT_EXPORT', get_option('gitweb_strict_export'))
gitweb_config.set_quoted('GITWEB_BASE_URL', get_option('gitweb_base_url'))
gitweb_config.set_quoted('GITWEB_LIST', get_option('gitweb_list'))
gitweb_config.set_quoted('GITWEB_HOMETEXT', get_option('gitweb_hometext'))
gitweb_config.set_quoted('GITWEB_CSS', get_option('gitweb_css'))
gitweb_config.set_quoted('GITWEB_LOGO', get_option('gitweb_logo'))
gitweb_config.set_quoted('GITWEB_FAVICON', get_option('gitweb_favicon'))
gitweb_config.set_quoted('GITWEB_JS', get_option('gitweb_js'))
gitweb_config.set_quoted('GITWEB_SITE_HTML_HEAD_STRING', get_option('gitweb_site_html_head_string'))
gitweb_config.set_quoted('GITWEB_SITE_HEADER', get_option('gitweb_site_header'))
gitweb_config.set_quoted('GITWEB_SITE_FOOTER', get_option('gitweb_site_footer'))
gitweb_config.set_quoted('HIGHLIGHT_BIN', get_option('highlight_bin'))
configure_file(
input: 'GITWEB-BUILD-OPTIONS.in',
output: 'GITWEB-BUILD-OPTIONS',
configuration: gitweb_config,
)
test_dependencies += custom_target(
input: 'gitweb.perl',
output: 'gitweb.cgi',
command: [
shell,
meson.current_source_dir() / 'generate-gitweb-cgi.sh',
meson.current_build_dir() / 'GITWEB-BUILD-OPTIONS',
git_version_file.full_path(),
'@INPUT@',
'@OUTPUT@',
],
install: true,
install_dir: get_option('datadir') / 'gitweb',
depends: [git_version_file],
)
javascript_files = [
meson.current_source_dir() / 'static/js/adjust-timezone.js',
meson.current_source_dir() / 'static/js/blame_incremental.js',
meson.current_source_dir() / 'static/js/javascript-detection.js',
meson.current_source_dir() / 'static/js/lib/common-lib.js',
meson.current_source_dir() / 'static/js/lib/cookies.js',
meson.current_source_dir() / 'static/js/lib/datetime.js',
]
test_dependencies += custom_target(
input: javascript_files,
output: 'gitweb.js',
command: [
shell,
meson.current_source_dir() / 'generate-gitweb-js.sh',
'@OUTPUT@',
] + javascript_files,
install: true,
install_dir: get_option('datadir') / 'gitweb/static',
)
foreach asset : [
'static/git-favicon.png',
'static/git-logo.png',
'static/gitweb.css',
]
fs.copyfile(asset,
install: true,
install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
)
endforeach

1894
meson.build Normal file

File diff suppressed because it is too large Load Diff

81
meson_options.txt Normal file
View File

@ -0,0 +1,81 @@
# Configuration for how Git behaves at runtime.
option('default_pager', type: 'string', value: 'less',
description: 'Fall-back pager.')
option('default_editor', type: 'string', value: 'vi',
description: 'Fall-back editor.')
option('gitconfig', type: 'string', value: '/etc/gitconfig',
description: 'Path to the global git configuration file.')
option('gitattributes', type: 'string', value: '/etc/gitattributes',
description: 'Path to the global git attributes file.')
option('pager_environment', type: 'string', value: 'LESS=FRX LV=-c',
description: 'Environment used when spawning the pager')
option('perl_cpan_fallback', type: 'boolean', value: true,
description: 'Install bundled copies of CPAN modules that serve as a fallback in case the modules are not available on the system.')
option('runtime_prefix', type: 'boolean', value: false,
description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')
option('sane_tool_path', type: 'string', value: '',
description: 'A colon-separated list of paths to prepend to PATH if your tools in /usr/bin are broken.')
# Features supported by Git.
option('curl', type: 'feature', value: 'enabled',
description: 'Build helpers used to access remotes with the HTTP transport.')
option('expat', type: 'feature', value: 'enabled',
description: 'Build helpers used to push to remotes with the HTTP transport.')
option('gettext', type: 'feature', value: 'auto',
description: 'Build translation files.')
option('iconv', type: 'feature', value: 'auto',
description: 'Support reencoding strings with different encodings.')
option('pcre2', type: 'feature', value: 'enabled',
description: 'Support Perl-compatible regular expressions in e.g. git-grep(1).')
option('perl', type: 'feature', value: 'auto',
description: 'Build tools written in Perl.')
option('python', type: 'feature', value: 'auto',
description: 'Build tools written in Python.')
option('regex', type: 'feature', value: 'auto',
description: 'Use the system-provided regex library instead of the bundled one.')
# Backends.
option('https_backend', type: 'combo', value: 'auto', choices: ['auto', 'openssl', 'CommonCrypto', 'none'],
description: 'The HTTPS backend to use when connecting to remotes.')
option('sha1_backend', type: 'combo', choices: ['openssl', 'block', 'sha1dc', 'common-crypto'], value: 'sha1dc',
description: 'The backend used for hashing objects with the SHA1 object format')
option('sha256_backend', type: 'combo', choices: ['openssl', 'nettle', 'gcrypt', 'block'], value: 'block',
description: 'The backend used for hashing objects with the SHA256 object format')
# Build tweaks.
option('macos_use_homebrew_gettext', type: 'boolean', value: true,
description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
# gitweb configuration.
option('gitweb_config', type: 'string', value: 'gitweb_config.perl')
option('gitweb_config_system', type: 'string', value: '/etc/gitweb.conf')
option('gitweb_config_common', type: 'string', value: '/etc/gitweb-common.conf')
option('gitweb_home_link_str', type: 'string', value: 'projects')
option('gitweb_sitename', type: 'string', value: '')
option('gitweb_projectroot', type: 'string', value: '/pub/git')
option('gitweb_project_maxdepth', type: 'string', value: '2007')
option('gitweb_export_ok', type: 'string', value: '')
option('gitweb_strict_export', type: 'string', value: '')
option('gitweb_base_url', type: 'string', value: '')
option('gitweb_list', type: 'string', value: '')
option('gitweb_hometext', type: 'string', value: 'indextext.html')
option('gitweb_css', type: 'string', value: 'static/gitweb.css')
option('gitweb_logo', type: 'string', value: 'static/git-logo.png')
option('gitweb_favicon', type: 'string', value: 'static/git-favicon.png')
option('gitweb_js', type: 'string', value: 'static/gitweb.js')
option('gitweb_site_html_head_string', type: 'string', value: '')
option('gitweb_site_header', type: 'string', value: '')
option('gitweb_site_footer', type: 'string', value: '')
option('highlight_bin', type: 'string', value: 'highlight')
# Documentation.
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).')
# Testing.
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',
description: 'Path to the directory used to store test outputs')

View File

@ -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',
)

View File

@ -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')

View File

@ -20,14 +20,14 @@ our @EXPORT_OK = @EXPORT;
# this "'@@' [...] '@@'" pattern. # this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@'; use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => ( use constant NO_GETTEXT => (
q[@@NO_GETTEXT@@] ne '' q[@NO_GETTEXT@] ne ''
and and
q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR q[@NO_GETTEXT@] ne NO_GETTEXT_STR
); );
sub __bootstrap_locale_messages { sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git'; our $TEXTDOMAIN = 'git';
our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@'; our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT; die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX; require POSIX;

View File

@ -31,11 +31,11 @@ C<git.git> repository. Use it for anything else at your peril!
# Makefile, and allows for detecting whether the module is loaded from # 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 # perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed. # 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 => ( use constant NO_PERL_CPAN_FALLBACKS => (
q[@@NO_PERL_CPAN_FALLBACKS@@] ne '' q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and 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 { sub import {

View File

@ -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',
)

View File

@ -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')

View File

@ -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',
)

20
perl/Git/SVN/meson.build Normal file
View File

@ -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')

18
perl/Git/meson.build Normal file
View File

@ -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')

View File

@ -1 +1 @@
use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@')); use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));

View File

@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path. # This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path { sub __git_system_path {
my ($relpath) = @_; my ($relpath) = @_;
my $gitexecdir_relative = '@@GITEXECDIR_REL@@'; my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite. # GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path; my $exec_path;
@ -24,11 +24,11 @@ sub __git_system_path {
} }
BEGIN { BEGIN {
use lib split /@@PATHSEP@@/, use lib split /@PATHSEP@/,
( (
$ENV{GITPERLLIB} || $ENV{GITPERLLIB} ||
do { do {
my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@'); my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path"); (-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir; $perllibdir;
} }
@ -36,7 +36,7 @@ BEGIN {
# Export the system locale directory to the I18N module. The locale directory # Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set. # 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. # END RUNTIME_PREFIX generated code.

12
perl/meson.build Normal file
View File

@ -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

27
po/meson.build Normal file
View File

@ -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]

1
subprojects/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/*/

13
subprojects/curl.wrap Normal file
View File

@ -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

13
subprojects/expat.wrap Normal file
View File

@ -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

15
subprojects/openssl.wrap Normal file
View File

@ -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

16
subprojects/pcre2.wrap Normal file
View File

@ -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

13
subprojects/zlib.wrap Normal file
View File

@ -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

93
t/helper/meson.build Normal file
View File

@ -0,0 +1,93 @@
test_tool_sources = [
'../unit-tests/test-lib.c',
'test-advise.c',
'test-bitmap.c',
'test-bloom.c',
'test-bundle-uri.c',
'test-cache-tree.c',
'test-chmtime.c',
'test-config.c',
'test-crontab.c',
'test-csprng.c',
'test-date.c',
'test-delete-gpgsig.c',
'test-delta.c',
'test-dir-iterator.c',
'test-drop-caches.c',
'test-dump-cache-tree.c',
'test-dump-fsmonitor.c',
'test-dump-split-index.c',
'test-dump-untracked-cache.c',
'test-env-helper.c',
'test-example-tap.c',
'test-find-pack.c',
'test-fsmonitor-client.c',
'test-genrandom.c',
'test-genzeros.c',
'test-getcwd.c',
'test-hash-speed.c',
'test-hash.c',
'test-hashmap.c',
'test-hexdump.c',
'test-json-writer.c',
'test-lazy-init-name-hash.c',
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
'test-name-hash.c',
'test-online-cpus.c',
'test-pack-mtimes.c',
'test-parse-options.c',
'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',
'test-progress.c',
'test-reach.c',
'test-read-cache.c',
'test-read-graph.c',
'test-read-midx.c',
'test-ref-store.c',
'test-reftable.c',
'test-regex.c',
'test-repository.c',
'test-revision-walking.c',
'test-rot13-filter.c',
'test-run-command.c',
'test-scrap-cache-tree.c',
'test-serve-v2.c',
'test-sha1.c',
'test-sha256.c',
'test-sigchain.c',
'test-simple-ipc.c',
'test-string-list.c',
'test-submodule-config.c',
'test-submodule-nested-repo-config.c',
'test-submodule.c',
'test-subprocess.c',
'test-tool.c',
'test-trace2.c',
'test-truncate.c',
'test-userdiff.c',
'test-wildmatch.c',
'test-windows-named-pipe.c',
'test-write-cache.c',
'test-xml-encode.c',
]
test_tool = executable('test-tool',
sources: test_tool_sources,
dependencies: [libgit, common_main],
)
bin_wrappers += test_tool
test_dependencies += test_tool
test_fake_ssh = executable('test-fake-ssh',
sources: 'test-fake-ssh.c',
dependencies: [libgit, common_main],
)
bin_wrappers += test_fake_ssh
test_dependencies += test_fake_ssh

View File

@ -6,8 +6,8 @@
. ./test-lib.sh . ./test-lib.sh
GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale" GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
GIT_PO_PATH="$GIT_BUILD_DIR/po" GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED" if test -n "$GIT_TEST_INSTALLED"

1107
t/meson.build Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ Testing basic merge tools options'
. ./test-lib.sh . ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' ' test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
. "$GIT_BUILD_DIR"/mergetools/vimdiff && . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests run_unit_tests
' '

View File

@ -35,13 +35,7 @@ else
# needing to exist. # needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1 TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi fi
if test -z "$TEST_OUTPUT_DIRECTORY" GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
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" if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2 echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@ -92,6 +86,15 @@ export LSAN_OPTIONS
prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
export UBSAN_OPTIONS export UBSAN_OPTIONS
# The TEST_OUTPUT_DIRECTORY will be overwritten via GIT-BUILD-OPTIONS. So in
# case the caller has manually set up this variable via the environment we must
# make sure to not overwrite that value, and thus we save it into
# TEST_OUTPUT_DIRECTORY_OVERRIDE here.
if test -n "$TEST_OUTPUT_DIRECTORY" && test -z "$TEST_OUTPUT_DIRECTORY_OVERRIDE"
then
TEST_OUTPUT_DIRECTORY_OVERRIDE=$TEST_OUTPUT_DIRECTORY
fi
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
then then
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).' echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@ -100,6 +103,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH 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 # 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 # 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 # reset this value to instead contain what the developer has specified. We thus
@ -512,6 +522,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_ PERF_
CURL_VERBOSE CURL_VERBOSE
TRACE_CURL TRACE_CURL
BUILD_DIR
)); ));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env); my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars); print join("\n", @vars);
@ -1409,7 +1420,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH" PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi fi
fi fi
GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1 GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.." GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@ -1475,9 +1486,9 @@ then
fi fi
fi fi
GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib GITPERLLIB="$GIT_TEST_GITPERLLIB"
export 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?" BAIL_OUT "You haven't built things yet, have you?"
} }

View File

@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be # in a file direc--tory--file in the source. They will be
# just copied to the destination. # just copied to the destination.
bpsrc = $(filter-out %~,$(wildcard *--*)) TEMPLATES =
boilerplates.made : $(bpsrc) TEMPLATES += description
$(QUIET)umask 022 && ls *--* 2>/dev/null | \ TEMPLATES += hooks/applypatch-msg.sample
while read boilerplate; \ 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 \ do \
case "$$boilerplate" in *~) continue ;; esac && \ dir=$$(dirname "$$template") && \
dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
dir=`expr "$$dst" : '\(.*\)/'` && \
mkdir -p blt/$$dir && \ mkdir -p blt/$$dir && \
case "$$boilerplate" in \
*--) continue;; \
esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
blt/$$dst && \ blt/$$template && \
if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \ if test -x "$$template"; then rx=rx; else rx=r; fi && \
chmod a+$$rx "blt/$$dst" || exit; \ chmod a+$$rx "blt/$$template" || exit; \
done && \ done && \
date >$@ date >$@

View File

@ -1 +0,0 @@
: this is just to ensure the directory exists.

View File

@ -0,0 +1,26 @@
hooks = [
'applypatch-msg.sample',
'commit-msg.sample',
'fsmonitor-watchman.sample',
'post-update.sample',
'pre-applypatch.sample',
'pre-commit.sample',
'pre-merge-commit.sample',
'prepare-commit-msg.sample',
'pre-push.sample',
'pre-rebase.sample',
'pre-receive.sample',
'push-to-checkout.sample',
'sendemail-validate.sample',
'update.sample',
]
foreach hook : hooks
configure_file(
input: hook,
output: hook,
configuration: template_config,
install: true,
install_dir: get_option('datadir') / 'git-core/templates',
)
endforeach

View File

@ -0,0 +1,7 @@
configure_file(
input: 'exclude',
output: 'exclude',
configuration: template_config,
install: true,
install_dir: get_option('datadir') / 'git-core/templates',
)

15
templates/meson.build Normal file
View File

@ -0,0 +1,15 @@
template_config = configuration_data()
template_config.set('PERL_PATH', perl.found() ? fs.as_posix(perl.full_path()) : '')
template_config.set('SHELL_PATH', fs.as_posix(shell.full_path()))
template_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
configure_file(
input: 'description',
output: 'description',
configuration: template_config,
install: true,
install_dir: get_option('datadir') / 'git-core/templates',
)
subdir('hooks')
subdir('info')

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/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 exit 128

8
version-def.h.in Normal file
View File

@ -0,0 +1,8 @@
#ifndef VERSION_DEF_H
#define VERSION_DEF_H
#define GIT_VERSION "@GIT_VERSION@"
#define GIT_BUILT_FROM_COMMIT "@GIT_BUILT_FROM_COMMIT@"
#define GIT_USER_AGENT "@GIT_USER_AGENT@"
#endif /* VERSION_DEF_H */

View File

@ -1,5 +1,6 @@
#include "git-compat-util.h" #include "git-compat-util.h"
#include "version.h" #include "version.h"
#include "version-def.h"
#include "strbuf.h" #include "strbuf.h"
const char git_version_string[] = GIT_VERSION; const char git_version_string[] = GIT_VERSION;

View File

@ -1,36 +0,0 @@
#!/bin/sh
# wrap-for-bin.sh: Template for git executable wrapper scripts
# 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@@.
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'
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"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
;;
1)
unset GIT_DEBUGGER
exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
;;
esac