2005-12-01 21:26:41 +01:00
|
|
|
# The default target of this Makefile is...
|
2007-01-10 21:24:54 +01:00
|
|
|
all::
|
2005-12-01 21:26:41 +01:00
|
|
|
|
2007-03-06 08:09:14 +01:00
|
|
|
# Define V=1 to have a more verbose compile.
|
2007-03-06 07:35:01 +01:00
|
|
|
#
|
2009-06-06 01:36:15 +02:00
|
|
|
# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
|
|
|
|
#
|
|
|
|
# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
|
|
|
|
# to PATH if your tools in /usr/bin are broken.
|
|
|
|
#
|
2010-05-14 11:31:42 +02:00
|
|
|
# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
|
|
|
|
# system headers do not define a socklen_t type.
|
|
|
|
#
|
2010-05-14 11:31:43 +02:00
|
|
|
# Define INLINE to a suitable substitute (such as '__inline' or '') if git
|
|
|
|
# fails to compile with errors about undefined inline functions or similar.
|
|
|
|
#
|
2014-09-13 16:20:22 +02:00
|
|
|
# Define SNPRINTF_RETURNS_BOGUS if you are on a system which snprintf()
|
2008-03-05 16:46:13 +01:00
|
|
|
# or vsnprintf() return -1 instead of number of characters which would
|
|
|
|
# have been written to the final string if enough space had been available.
|
|
|
|
#
|
2014-09-13 16:20:22 +02:00
|
|
|
# Define FREAD_READS_DIRECTORIES if you are on a system which succeeds
|
2017-06-14 07:30:18 +02:00
|
|
|
# when attempting to read from an fopen'ed directory (or even to fopen
|
|
|
|
# it at all).
|
2008-02-09 03:32:47 +01:00
|
|
|
#
|
2006-03-01 00:07:20 +01:00
|
|
|
# Define NO_OPENSSL environment variable if you do not have OpenSSL.
|
2005-05-23 00:08:15 +02:00
|
|
|
#
|
2017-05-20 23:42:04 +02:00
|
|
|
# Define USE_LIBPCRE if you have and want to use libpcre. Various
|
|
|
|
# commands such as log and grep offer runtime options to use
|
|
|
|
# Perl-compatible regular expressions instead of standard or extended
|
|
|
|
# POSIX regular expressions.
|
2011-05-09 23:52:05 +02:00
|
|
|
#
|
2018-03-11 14:26:09 +01:00
|
|
|
# USE_LIBPCRE is a synonym for USE_LIBPCRE2, define USE_LIBPCRE1
|
|
|
|
# instead if you'd like to use the legacy version 1 of the PCRE
|
|
|
|
# library. Support for version 1 will likely be removed in some future
|
|
|
|
# release of Git, as upstream has all but abandoned it.
|
grep: add support for PCRE v2
Add support for v2 of the PCRE API. This is a new major version of
PCRE that came out in early 2015[1].
The regular expression syntax is the same, but while the API is
similar, pretty much every function is either renamed or takes
different arguments. Thus using it via entirely new functions makes
sense, as opposed to trying to e.g. have one compile_pcre_pattern()
that would call either PCRE v1 or v2 functions.
Git can now be compiled with either USE_LIBPCRE1=YesPlease or
USE_LIBPCRE2=YesPlease, with USE_LIBPCRE=YesPlease currently being a
synonym for the former. Providing both is a compile-time error.
With earlier patches to enable JIT for PCRE v1 the performance of the
release versions of both libraries is almost exactly the same, with
PCRE v2 being around 1% slower.
However after I reported this to the pcre-dev mailing list[2] I got a
lot of help with the API use from Zoltán Herczeg, he subsequently
optimized some of the JIT functionality in v2 of the library.
Running the p7820-grep-engines.sh performance test against the latest
Subversion trunk of both, with both them and git compiled as -O3, and
the test run against linux.git, gives the following results. Just the
/perl/ tests shown:
$ GIT_PERF_REPEAT_COUNT=30 GIT_PERF_LARGE_REPO=~/g/linux GIT_PERF_MAKE_COMMAND='grep -q LIBPCRE2 Makefile && make -j8 USE_LIBPCRE2=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre2/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre2/inst/lib || make -j8 USE_LIBPCRE=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre/inst/lib' ./run HEAD~5 HEAD~ HEAD p7820-grep-engines.sh
[...]
Test HEAD~5 HEAD~ HEAD
-----------------------------------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.31(1.10+0.48) 0.21(0.35+0.56) -32.3% 0.21(0.34+0.55) -32.3%
7820.7: perl grep '^how to' 0.56(2.70+0.40) 0.24(0.64+0.52) -57.1% 0.20(0.28+0.60) -64.3%
7820.11: perl grep '[how] to' 0.56(2.66+0.38) 0.29(0.95+0.45) -48.2% 0.23(0.45+0.54) -58.9%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 1.02(5.77+0.42) 0.31(1.02+0.54) -69.6% 0.23(0.50+0.54) -77.5%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.38(1.57+0.42) 0.27(0.85+0.46) -28.9% 0.21(0.33+0.57) -44.7%
See commit ("perf: add a comparison test of grep regex engines",
2017-04-19) for details on the machine the above test run was executed
on.
Here HEAD~2 is git with PCRE v1 without JIT, HEAD~ is PCRE v1 with
JIT, and HEAD is PCRE v2 (also with JIT). See previous commits of mine
mentioning p7820-grep-engines.sh for more details on the test setup.
For ease of readability, a different run just of HEAD~ (PCRE v1 with
JIT v.s. PCRE v2), again with just the /perl/ tests shown:
[...]
Test HEAD~ HEAD
----------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.21(0.42+0.52) 0.21(0.31+0.58) +0.0%
7820.7: perl grep '^how to' 0.25(0.65+0.50) 0.20(0.31+0.57) -20.0%
7820.11: perl grep '[how] to' 0.30(0.90+0.50) 0.23(0.46+0.53) -23.3%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 0.30(1.19+0.38) 0.23(0.51+0.51) -23.3%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.27(0.84+0.48) 0.21(0.34+0.57) -22.2%
I.e. the two are either neck-to-neck, but PCRE v2 usually pulls ahead,
when it does it's around 20% faster.
A brief note on thread safety: As noted in pcre2api(3) & pcre2jit(3)
the compiled pattern can be shared between threads, but not some of
the JIT context, however the grep threading support does all pattern &
JIT compilation in separate threads, so this code doesn't need to
concern itself with thread safety.
See commit 63e7e9d8b6 ("git-grep: Learn PCRE", 2011-05-09) for the
initial addition of PCRE v1. This change follows some of the same
patterns it did (and which were discussed on list at the time),
e.g. mocking up types with typedef instead of ifdef-ing them out when
USE_LIBPCRE2 isn't defined. This adds some trivial memory use to the
program, but makes the code look nicer.
1. https://lists.exim.org/lurker/message/20150105.162835.0666407a.en.html
2. https://lists.exim.org/lurker/thread/20170419.172322.833ee099.en.html
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:56 +02:00
|
|
|
#
|
2019-08-25 20:22:22 +02:00
|
|
|
# When using USE_LIBPCRE1, define NO_LIBPCRE1_JIT if you want to
|
|
|
|
# disable JIT even if supported by your library.
|
grep: un-break building with PCRE >= 8.32 without --enable-jit
Amend my change earlier in this series ("grep: add support for the
PCRE v1 JIT API", 2017-04-11) to un-break the build on PCRE v1
versions later than 8.31 compiled without --enable-jit.
As explained in that change and a later compatibility change in this
series ("grep: un-break building with PCRE < 8.32", 2017-05-10) the
pcre_jit_exec() function is a faster path to execute the JIT.
Unfortunately there's no compatibility stub for that function compiled
into the library if pcre_config(PCRE_CONFIG_JIT, &ret) would return 0,
and no macro that can be used to check for it, so the only portable
option to support builds without --enable-jit is via a new
NO_LIBPCRE1_JIT=UnfortunatelyYes Makefile option[1].
Another option would be to make the JIT opt-in via
USE_LIBPCRE1_JIT=YesPlease, after all it's not a default option of
PCRE v1.
I think it makes more sense to make it opt-out since even though it's
not a default option, most packagers of PCRE seem to turn it on by
default, with the notable exception of the MinGW package.
Make the MinGW platform work by default by changing the build defaults
to turn on NO_LIBPCRE1_JIT=UnfortunatelyYes. It is the only platform
that turns on USE_LIBPCRE=YesPlease by default, see commit
df5218b4c3 ("config.mak.uname: support MSys2", 2016-01-13) for that
change.
1. "How do I support pcre1 JIT on all
versions?" (https://lists.exim.org/lurker/thread/20170601.103148.10253788.en.html)
2. https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-pcre/PKGBUILD
(referenced from "Re: PCRE v2 compile error, was Re: What's cooking
in git.git (May 2017, #01; Mon, 1)";
<alpine.DEB.2.20.1705021756530.3480@virtualbox>)
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:55 +02:00
|
|
|
#
|
grep: add support for PCRE v2
Add support for v2 of the PCRE API. This is a new major version of
PCRE that came out in early 2015[1].
The regular expression syntax is the same, but while the API is
similar, pretty much every function is either renamed or takes
different arguments. Thus using it via entirely new functions makes
sense, as opposed to trying to e.g. have one compile_pcre_pattern()
that would call either PCRE v1 or v2 functions.
Git can now be compiled with either USE_LIBPCRE1=YesPlease or
USE_LIBPCRE2=YesPlease, with USE_LIBPCRE=YesPlease currently being a
synonym for the former. Providing both is a compile-time error.
With earlier patches to enable JIT for PCRE v1 the performance of the
release versions of both libraries is almost exactly the same, with
PCRE v2 being around 1% slower.
However after I reported this to the pcre-dev mailing list[2] I got a
lot of help with the API use from Zoltán Herczeg, he subsequently
optimized some of the JIT functionality in v2 of the library.
Running the p7820-grep-engines.sh performance test against the latest
Subversion trunk of both, with both them and git compiled as -O3, and
the test run against linux.git, gives the following results. Just the
/perl/ tests shown:
$ GIT_PERF_REPEAT_COUNT=30 GIT_PERF_LARGE_REPO=~/g/linux GIT_PERF_MAKE_COMMAND='grep -q LIBPCRE2 Makefile && make -j8 USE_LIBPCRE2=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre2/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre2/inst/lib || make -j8 USE_LIBPCRE=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre/inst/lib' ./run HEAD~5 HEAD~ HEAD p7820-grep-engines.sh
[...]
Test HEAD~5 HEAD~ HEAD
-----------------------------------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.31(1.10+0.48) 0.21(0.35+0.56) -32.3% 0.21(0.34+0.55) -32.3%
7820.7: perl grep '^how to' 0.56(2.70+0.40) 0.24(0.64+0.52) -57.1% 0.20(0.28+0.60) -64.3%
7820.11: perl grep '[how] to' 0.56(2.66+0.38) 0.29(0.95+0.45) -48.2% 0.23(0.45+0.54) -58.9%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 1.02(5.77+0.42) 0.31(1.02+0.54) -69.6% 0.23(0.50+0.54) -77.5%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.38(1.57+0.42) 0.27(0.85+0.46) -28.9% 0.21(0.33+0.57) -44.7%
See commit ("perf: add a comparison test of grep regex engines",
2017-04-19) for details on the machine the above test run was executed
on.
Here HEAD~2 is git with PCRE v1 without JIT, HEAD~ is PCRE v1 with
JIT, and HEAD is PCRE v2 (also with JIT). See previous commits of mine
mentioning p7820-grep-engines.sh for more details on the test setup.
For ease of readability, a different run just of HEAD~ (PCRE v1 with
JIT v.s. PCRE v2), again with just the /perl/ tests shown:
[...]
Test HEAD~ HEAD
----------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.21(0.42+0.52) 0.21(0.31+0.58) +0.0%
7820.7: perl grep '^how to' 0.25(0.65+0.50) 0.20(0.31+0.57) -20.0%
7820.11: perl grep '[how] to' 0.30(0.90+0.50) 0.23(0.46+0.53) -23.3%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 0.30(1.19+0.38) 0.23(0.51+0.51) -23.3%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.27(0.84+0.48) 0.21(0.34+0.57) -22.2%
I.e. the two are either neck-to-neck, but PCRE v2 usually pulls ahead,
when it does it's around 20% faster.
A brief note on thread safety: As noted in pcre2api(3) & pcre2jit(3)
the compiled pattern can be shared between threads, but not some of
the JIT context, however the grep threading support does all pattern &
JIT compilation in separate threads, so this code doesn't need to
concern itself with thread safety.
See commit 63e7e9d8b6 ("git-grep: Learn PCRE", 2011-05-09) for the
initial addition of PCRE v1. This change follows some of the same
patterns it did (and which were discussed on list at the time),
e.g. mocking up types with typedef instead of ifdef-ing them out when
USE_LIBPCRE2 isn't defined. This adds some trivial memory use to the
program, but makes the code look nicer.
1. https://lists.exim.org/lurker/message/20150105.162835.0666407a.en.html
2. https://lists.exim.org/lurker/thread/20170419.172322.833ee099.en.html
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:56 +02:00
|
|
|
# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are
|
|
|
|
# in /foo/bar/include and /foo/bar/lib directories. Which version of
|
|
|
|
# PCRE this points to determined by the USE_LIBPCRE1 and USE_LIBPCRE2
|
|
|
|
# variables.
|
2011-05-09 23:52:05 +02:00
|
|
|
#
|
Portable alloca for Git
In the next patch we'll have to use alloca() for performance reasons,
but since alloca is non-standardized and is not portable, let's have a
trick with compatibility wrappers:
1. at configure time, determine, do we have working alloca() through
alloca.h, and define
#define HAVE_ALLOCA_H
if yes.
2. in code
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
# define xalloca(size) (alloca(size))
# define xalloca_free(p) do {} while(0)
#else
# define xalloca(size) (xmalloc(size))
# define xalloca_free(p) (free(p))
#endif
and use it like
func() {
p = xalloca(size);
...
xalloca_free(p);
}
This way, for systems, where alloca is available, we'll have optimal
on-stack allocations with fast executions. On the other hand, on
systems, where alloca is not available, this gracefully fallbacks to
xmalloc/free.
Both autoconf and config.mak.uname configurations were updated. For
autoconf, we are not bothering considering cases, when no alloca.h is
available, but alloca() works some other way - its simply alloca.h is
available and works or not, everything else is deep legacy.
For config.mak.uname, I've tried to make my almost-sure guess for where
alloca() is available, but since I only have access to Linux it is the
only change I can be sure about myself, with relevant to other changed
systems people Cc'ed.
NOTE
SunOS and Windows had explicit -DHAVE_ALLOCA_H in their configurations.
I've changed that to now-common HAVE_ALLOCA_H=YesPlease which should be
correct.
Cc: Brandon Casey <drafnel@gmail.com>
Cc: Marius Storm-Olsen <mstormo@gmail.com>
Cc: Johannes Sixt <j6t@kdbg.org>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Gerrit Pape <pape@smarden.org>
Cc: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Thomas Schwinge <thomas@codesourcery.com> (GNU Hurd changes)
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-27 15:22:50 +01:00
|
|
|
# Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
|
|
|
|
#
|
2011-08-03 14:07:57 +02:00
|
|
|
# Define NO_CURL if you do not have libcurl installed. git-http-fetch and
|
2005-11-02 20:19:24 +01:00
|
|
|
# git-http-push are not built, and you cannot use http:// and https://
|
2011-08-03 14:07:57 +02:00
|
|
|
# transports (neither smart nor dumb).
|
2005-07-31 02:14:23 +02:00
|
|
|
#
|
2005-09-19 16:11:19 +02:00
|
|
|
# Define CURLDIR=/foo/bar if your curl header and library files are in
|
2014-04-30 19:58:10 +02:00
|
|
|
# /foo/bar/include and /foo/bar/lib directories.
|
2005-09-19 16:11:19 +02:00
|
|
|
#
|
2015-10-21 19:10:46 +02:00
|
|
|
# Define CURL_CONFIG to curl's configuration program that prints information
|
|
|
|
# about the library (e.g., its version number). The default is 'curl-config'.
|
|
|
|
#
|
2018-11-03 06:12:11 +01:00
|
|
|
# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl,
|
|
|
|
# if you do not want to rely on the libraries provided by CURL_CONFIG. The
|
|
|
|
# default value is a result of `curl-config --libs`. An example value for
|
|
|
|
# CURL_LDFLAGS is as follows:
|
|
|
|
#
|
|
|
|
# CURL_LDFLAGS=-lcurl
|
|
|
|
#
|
2005-11-02 20:19:24 +01:00
|
|
|
# Define NO_EXPAT if you do not have expat installed. git-http-push is
|
2011-08-03 14:07:57 +02:00
|
|
|
# not built, and you cannot push using http:// and https:// transports (dumb).
|
2005-11-02 20:19:24 +01:00
|
|
|
#
|
2009-01-28 21:43:57 +01:00
|
|
|
# Define EXPATDIR=/foo/bar if your expat header and library files are in
|
|
|
|
# /foo/bar/include and /foo/bar/lib directories.
|
|
|
|
#
|
2013-02-11 23:03:45 +01:00
|
|
|
# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
|
|
|
|
# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
|
|
|
|
#
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
# Define NO_GETTEXT if you don't want Git output to be translated.
|
|
|
|
# A translated Git requires GNU libintl or another gettext implementation,
|
|
|
|
# plus libintl-perl at runtime.
|
|
|
|
#
|
2012-01-23 23:04:29 +01:00
|
|
|
# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
|
|
|
|
# the installed gettext translation of the shell scripts output.
|
|
|
|
#
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
|
|
|
|
# trust the langinfo.h's nl_langinfo(CODESET) function to return the
|
|
|
|
# current character set. GNU and Solaris have a nl_langinfo(CODESET),
|
|
|
|
# FreeBSD can use either, but MinGW and some others need to use
|
|
|
|
# libcharset.h's locale_charset() instead.
|
|
|
|
#
|
2014-03-11 23:37:33 +01:00
|
|
|
# Define CHARSET_LIB to the library you need to link with in order to
|
2012-02-12 17:23:36 +01:00
|
|
|
# use locale_charset() function. On some platforms this needs to set to
|
2014-03-11 23:37:33 +01:00
|
|
|
# -lcharset, on others to -liconv .
|
2012-02-12 17:23:36 +01:00
|
|
|
#
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
|
|
|
|
# need -lintl when linking.
|
|
|
|
#
|
|
|
|
# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
|
|
|
|
# doesn't support GNU extensions like --check and --statistics
|
|
|
|
#
|
2010-04-13 11:07:13 +02:00
|
|
|
# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
|
|
|
|
# it specifies.
|
|
|
|
#
|
2006-01-20 02:13:57 +01:00
|
|
|
# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
|
2010-04-02 00:43:54 +02:00
|
|
|
# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
|
2006-01-20 02:13:57 +01:00
|
|
|
#
|
2012-12-14 20:57:01 +01:00
|
|
|
# Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp.
|
|
|
|
#
|
2005-09-19 03:30:50 +02:00
|
|
|
# Define NO_STRCASESTR if you don't have strcasestr.
|
|
|
|
#
|
2007-09-07 00:32:54 +02:00
|
|
|
# Define NO_MEMMEM if you don't have memmem.
|
|
|
|
#
|
2012-12-18 23:03:55 +01:00
|
|
|
# Define NO_GETPAGESIZE if you don't have getpagesize.
|
|
|
|
#
|
2006-06-24 16:01:25 +02:00
|
|
|
# Define NO_STRLCPY if you don't have strlcpy.
|
|
|
|
#
|
2011-11-02 16:46:22 +01:00
|
|
|
# Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
|
|
|
|
# C library. If your compiler also does not support long long or does not have
|
2007-02-20 01:22:56 +01:00
|
|
|
# strtoull, define NO_STRTOULL.
|
|
|
|
#
|
2005-12-03 00:08:28 +01:00
|
|
|
# Define NO_SETENV if you don't have setenv in the C library.
|
|
|
|
#
|
2008-01-18 02:03:51 +01:00
|
|
|
# Define NO_UNSETENV if you don't have unsetenv in the C library.
|
|
|
|
#
|
2007-10-20 22:03:49 +02:00
|
|
|
# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
|
|
|
|
#
|
2012-09-08 19:01:31 +02:00
|
|
|
# Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
|
|
|
|
#
|
2011-05-19 13:37:55 +02:00
|
|
|
# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
|
|
|
|
# in the C library.
|
|
|
|
#
|
2009-05-31 10:35:51 +02:00
|
|
|
# Define NO_LIBGEN_H if you don't have libgen.h.
|
|
|
|
#
|
2009-07-10 19:10:45 +02:00
|
|
|
# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
|
|
|
|
#
|
2008-01-24 19:34:46 +01:00
|
|
|
# Define NO_SYS_SELECT_H if you don't have sys/select.h.
|
|
|
|
#
|
2006-05-02 09:40:24 +02:00
|
|
|
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
|
|
|
|
# Enable it on Windows. By default, symrefs are still used.
|
2005-11-15 06:59:50 +01:00
|
|
|
#
|
2006-07-09 11:44:58 +02:00
|
|
|
# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
|
2006-07-06 09:14:16 +02:00
|
|
|
# tests. These tests take up a significant amount of the total test time
|
|
|
|
# but are not needed unless you plan to talk to SVN repos.
|
|
|
|
#
|
2006-07-24 06:28:28 +02:00
|
|
|
# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
|
|
|
|
# installed in /sw, but don't want GIT to link against any libraries
|
|
|
|
# installed there. If defined you may specify your own (or Fink's)
|
|
|
|
# include directories and library directories by defining CFLAGS
|
|
|
|
# and LDFLAGS appropriately.
|
|
|
|
#
|
|
|
|
# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
|
|
|
|
# have DarwinPorts installed in /opt/local, but don't want GIT to
|
|
|
|
# link against any libraries installed there. If defined you may
|
|
|
|
# specify your own (or DarwinPort's) include directories and
|
|
|
|
# library directories by defining CFLAGS and LDFLAGS appropriately.
|
|
|
|
#
|
2013-05-19 12:23:34 +02:00
|
|
|
# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
|
|
|
|
# and do not want to use Apple's CommonCrypto library. This allows you
|
|
|
|
# to provide your own OpenSSL library, for example from MacPorts.
|
|
|
|
#
|
2012-07-23 08:29:14 +02:00
|
|
|
# Define BLK_SHA1 environment variable to make use of the bundled
|
|
|
|
# optimized C SHA1 routine.
|
2009-08-06 01:13:20 +02:00
|
|
|
#
|
2005-07-29 17:48:26 +02:00
|
|
|
# Define PPC_SHA1 environment variable when running make to make use of
|
|
|
|
# a bundled SHA1 routine optimized for PowerPC.
|
2005-09-07 21:22:56 +02:00
|
|
|
#
|
2017-03-16 23:09:12 +01:00
|
|
|
# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
|
|
|
|
# algorithm. This is slower, but may detect attempted collision attacks.
|
|
|
|
# Takes priority over other *_SHA1 knobs.
|
|
|
|
#
|
2017-08-15 14:04:17 +02:00
|
|
|
# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link
|
|
|
|
# git with the external SHA1 collision-detect library.
|
|
|
|
# Without this option, i.e. the default behavior is to build git with its
|
|
|
|
# own built-in code (or submodule).
|
|
|
|
#
|
2017-07-02 00:05:46 +02:00
|
|
|
# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the
|
|
|
|
# sha1collisiondetection shipped as a submodule instead of the
|
|
|
|
# non-submodule copy in sha1dc/. This is an experimental option used
|
|
|
|
# by the git project to migrate to using sha1collisiondetection as a
|
|
|
|
# submodule.
|
|
|
|
#
|
2017-03-17 18:00:15 +01:00
|
|
|
# Define OPENSSL_SHA1 environment variable when running make to link
|
|
|
|
# with the SHA1 routine from openssl library.
|
|
|
|
#
|
2015-11-05 07:38:42 +01:00
|
|
|
# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
|
|
|
|
# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
|
|
|
|
# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
|
|
|
|
#
|
2018-11-14 05:09:37 +01:00
|
|
|
# Define BLK_SHA256 to use the built-in SHA-256 routines.
|
|
|
|
#
|
|
|
|
# Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt.
|
|
|
|
#
|
2018-11-14 05:09:38 +01:00
|
|
|
# Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL.
|
|
|
|
#
|
2009-09-08 15:54:38 +02:00
|
|
|
# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
|
|
|
|
#
|
|
|
|
# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
|
2005-09-06 01:24:03 +02:00
|
|
|
#
|
2005-09-07 21:22:56 +02:00
|
|
|
# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
|
2005-09-06 01:24:03 +02:00
|
|
|
#
|
2012-09-19 12:03:30 +02:00
|
|
|
# Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
|
|
|
|
#
|
2014-04-01 00:11:46 +02:00
|
|
|
# Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
|
2012-09-19 12:03:30 +02:00
|
|
|
#
|
|
|
|
# Define NO_UINTMAX_T if you don't have uintmax_t.
|
|
|
|
#
|
2005-09-06 01:24:03 +02:00
|
|
|
# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
|
|
|
|
# Patrick Mauritz).
|
|
|
|
#
|
2009-06-06 01:36:10 +02:00
|
|
|
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
|
|
|
|
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
|
|
|
|
# inet_ntop and inet_pton additionally reside there.
|
|
|
|
#
|
2005-10-09 00:54:36 +02:00
|
|
|
# Define NO_MMAP if you want to avoid mmap.
|
|
|
|
#
|
2017-09-25 10:00:10 +02:00
|
|
|
# Define MMAP_PREVENTS_DELETE if a file that is currently mmapped cannot be
|
|
|
|
# deleted or cannot be replaced using rename().
|
|
|
|
#
|
2018-11-14 02:10:43 +01:00
|
|
|
# Define NO_POLL_H if you don't have poll.h.
|
|
|
|
#
|
2012-09-17 23:16:39 +02:00
|
|
|
# Define NO_SYS_POLL_H if you don't have sys/poll.h.
|
|
|
|
#
|
|
|
|
# Define NO_POLL if you do not have or don't want to use poll().
|
2018-11-14 02:10:43 +01:00
|
|
|
# This also implies NO_POLL_H and NO_SYS_POLL_H.
|
2012-09-17 23:16:39 +02:00
|
|
|
#
|
git-compat-util.h: do not #include <sys/param.h> by default
Earlier we allowed platforms that lack <sys/param.h> not to include
the header file from git-compat-util.h; we have included this header
file since the early days back when we used MAXPATHLEN (which we no
longer use) and also depended on it slurping ULONG_MAX (which we get
by including stdint.h or inttypes.h these days).
It turns out that we can compile our modern codebase just file
without including it on many platforms (so far, Fedora, Debian,
Ubuntu, MinGW, Mac OS X, Cygwin, HP-Nonstop, QNX and z/OS are
reported to be OK).
Let's stop including it by default, and on platforms that need it to
be included, leave "make NEEDS_SYS_PARAM_H=YesPlease" as an escape
hatch and ask them to report to us, so that we can find out about
the real dependency and fix it in a more platform agnostic way.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-18 18:35:33 +01:00
|
|
|
# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
|
|
|
|
# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
|
|
|
|
# we want to know more about the issue.
|
2012-12-14 20:56:58 +01:00
|
|
|
#
|
2008-11-15 13:08:14 +01:00
|
|
|
# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
|
|
|
|
#
|
2007-01-09 22:04:12 +01:00
|
|
|
# Define NO_PREAD if you have a problem with pread() system call (e.g.
|
2010-04-02 00:43:54 +02:00
|
|
|
# cygwin1.dll before v1.5.22).
|
2007-01-09 22:04:12 +01:00
|
|
|
#
|
2012-09-08 18:54:34 +02:00
|
|
|
# Define NO_SETITIMER if you don't have setitimer()
|
|
|
|
#
|
|
|
|
# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
|
|
|
|
# This also implies NO_SETITIMER
|
|
|
|
#
|
2006-12-14 12:15:57 +01:00
|
|
|
# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
|
|
|
|
# generally faster on your platform than accessing the working directory.
|
|
|
|
#
|
2006-12-31 05:53:55 +01:00
|
|
|
# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
|
|
|
|
# the executable mode bit, but doesn't really do so.
|
|
|
|
#
|
2014-12-04 03:24:17 +01:00
|
|
|
# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
|
|
|
|
# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
|
|
|
|
# usual 0xF000).
|
|
|
|
#
|
2005-09-29 01:52:21 +02:00
|
|
|
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
|
|
|
|
#
|
2011-12-12 22:12:56 +01:00
|
|
|
# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
|
|
|
|
#
|
2006-01-20 02:13:32 +01:00
|
|
|
# Define NO_SOCKADDR_STORAGE if your platform does not have struct
|
|
|
|
# sockaddr_storage.
|
|
|
|
#
|
2006-02-16 09:38:01 +01:00
|
|
|
# Define NO_ICONV if your libc does not properly support iconv.
|
|
|
|
#
|
2007-03-03 19:29:03 +01:00
|
|
|
# Define OLD_ICONV if your library has an old iconv(), where the second
|
|
|
|
# (input buffer pointer) parameter is declared with type (const char **).
|
|
|
|
#
|
utf8: handle systems that don't write BOM for UTF-16
When serializing UTF-16 (and UTF-32), there are three possible ways to
write the stream. One can write the data with a BOM in either big-endian
or little-endian format, or one can write the data without a BOM in
big-endian format.
Most systems' iconv implementations choose to write it with a BOM in
some endianness, since this is the most foolproof, and it is resistant
to misinterpretation on Windows, where UTF-16 and the little-endian
serialization are very common. For compatibility with Windows and to
avoid accidental misuse there, Git always wants to write UTF-16 with a
BOM, and will refuse to read UTF-16 without it.
However, musl's iconv implementation writes UTF-16 without a BOM,
relying on the user to interpret it as big-endian. This causes t0028 and
the related functionality to fail, since Git won't read the file without
a BOM.
Add a Makefile and #define knob, ICONV_OMITS_BOM, that can be set if the
iconv implementation has this behavior. When set, Git will write a BOM
manually for UTF-16 and UTF-32 and then force the data to be written in
UTF-16BE or UTF-32BE. We choose big-endian behavior here because the
tests use the raw "UTF-16" encoding, which will be big-endian when the
implementation requires this knob to be set.
Update the tests to detect this case and write test data with an added
BOM if necessary. Always write the BOM in the tests in big-endian
format, since all iconv implementations that omit a BOM must use
big-endian serialization according to the Unicode standard.
Preserve the existing behavior for systems which do not have this knob
enabled, since they may use optimized implementations, including
defaulting to the native endianness, which may improve performance.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-12 01:52:06 +01:00
|
|
|
# Define ICONV_OMITS_BOM if your iconv implementation does not write a
|
|
|
|
# byte-order mark (BOM) when writing UTF-16 or UTF-32 and always writes in
|
|
|
|
# big-endian format.
|
|
|
|
#
|
2007-11-07 04:24:28 +01:00
|
|
|
# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
|
|
|
|
#
|
2011-06-19 03:07:03 +02:00
|
|
|
# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
|
|
|
|
# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
|
|
|
|
#
|
2005-07-29 17:48:26 +02:00
|
|
|
# Define USE_NSEC below if you want git to care about sub-second file mtimes
|
2015-07-01 21:10:52 +02:00
|
|
|
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
|
|
|
|
# Linux, kernel 2.6.11 or newer is required for reliable sub-second file times
|
|
|
|
# on file systems with exactly 1 ns or 1 s resolution. If you intend to use Git
|
|
|
|
# on other file systems (e.g. CEPH, CIFS, NTFS, UDF), don't enable USE_NSEC. See
|
|
|
|
# Documentation/technical/racy-git.txt for details.
|
2006-06-24 02:57:48 +02:00
|
|
|
#
|
2009-03-08 21:04:28 +01:00
|
|
|
# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
|
|
|
|
# "st_ctim"
|
|
|
|
#
|
2009-03-04 18:47:40 +01:00
|
|
|
# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
|
|
|
|
# available. This automatically turns USE_NSEC off.
|
|
|
|
#
|
2005-07-29 17:48:26 +02:00
|
|
|
# Define USE_STDEV below if you want git to care about the underlying device
|
2007-11-30 12:35:23 +01:00
|
|
|
# change being considered an inode change from the update-index perspective.
|
2006-12-04 10:50:04 +01:00
|
|
|
#
|
2008-08-18 21:57:16 +02:00
|
|
|
# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
|
|
|
|
# field that counts the on-disk footprint in 512-byte blocks.
|
|
|
|
#
|
2009-10-22 10:19:06 +02:00
|
|
|
# Define GNU_ROFF if your target system uses GNU groff. This forces
|
|
|
|
# apostrophes to be ASCII so that cut&pasting examples to the shell
|
|
|
|
# will work.
|
|
|
|
#
|
2017-01-22 03:41:56 +01:00
|
|
|
# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
|
|
|
|
# documentation.
|
|
|
|
#
|
|
|
|
# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
|
|
|
|
# Extensions Lab if you have it available.
|
|
|
|
#
|
2013-01-14 07:48:07 +01:00
|
|
|
# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
|
|
|
|
#
|
2009-04-03 21:32:20 +02:00
|
|
|
# Define NO_PERL if you do not want Perl scripts or libraries at all.
|
|
|
|
#
|
2018-03-03 16:38:16 +01:00
|
|
|
# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
|
|
|
|
# copies of CPAN modules that serve as a fallback in case the modules
|
|
|
|
# are not available on the system. This option is intended for
|
|
|
|
# distributions that want to use their packaged versions of Perl
|
|
|
|
# modules, instead of the fallbacks shipped with Git.
|
|
|
|
#
|
2013-01-14 07:48:07 +01:00
|
|
|
# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
|
|
|
|
# but /usr/bin/python2.7 on some platforms).
|
|
|
|
#
|
2009-11-18 02:42:31 +01:00
|
|
|
# Define NO_PYTHON if you do not want Python scripts or libraries at all.
|
|
|
|
#
|
2007-03-28 13:00:23 +02:00
|
|
|
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
|
|
|
|
#
|
2016-03-09 00:47:57 +01:00
|
|
|
# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
|
|
|
|
# and egrep that are pickier when their input contains non-ASCII data.
|
|
|
|
#
|
2007-05-08 05:36:31 +02:00
|
|
|
# The TCL_PATH variable governs the location of the Tcl interpreter
|
|
|
|
# used to optimize git-gui for your system. Only used if NO_TCLTK
|
|
|
|
# is not set. Defaults to the bare 'tclsh'.
|
|
|
|
#
|
|
|
|
# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
|
2007-03-28 13:12:07 +02:00
|
|
|
# If not set it defaults to the bare 'wish'. If it is set to the empty
|
|
|
|
# string then NO_TCLTK will be forced (this is used by configure script).
|
|
|
|
#
|
2008-02-05 22:10:44 +01:00
|
|
|
# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
|
|
|
|
# is a simplified version of the merge sort used in glibc. This is
|
|
|
|
# recommended if Git triggers O(n^2) behavior in your platform's qsort().
|
|
|
|
#
|
2017-01-22 18:51:11 +01:00
|
|
|
# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
|
|
|
|
# compatible with the one described in C11 Annex K.
|
|
|
|
#
|
2009-04-20 10:17:00 +02:00
|
|
|
# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
|
|
|
|
# information on a not yet closed file that lstat would return for the same
|
|
|
|
# file after it was closed.
|
2009-04-25 11:57:14 +02:00
|
|
|
#
|
2009-04-28 00:32:25 +02:00
|
|
|
# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
|
|
|
|
# when hardlinking a file to another name and unlinking the original file right
|
2009-04-25 11:57:14 +02:00
|
|
|
# away (some NTFS drivers seem to zero the contents in that scenario).
|
2009-05-23 10:43:08 +02:00
|
|
|
#
|
Makefile: optionally symlink libexec/git-core binaries to bin/git
Add a INSTALL_SYMLINKS option which if enabled, changes the default
hardlink installation method to one where the relevant binaries in
libexec/git-core are symlinked back to ../../bin, instead of being
hardlinked.
This new option also overrides the behavior of the existing
NO_*_HARDLINKS variables which in some cases would produce symlinks
within to libexec/, e.g. "git-add" symlinked to "git" which would be
copy of the "git" found in bin/, now "git-add" in libexec/ is always
going to be symlinked to the "git" found in the bin/ directory.
This option is being added because:
1) I think it makes what we're doing a lot more obvious. E.g. I'd
never noticed that the libexec binaries were really just hardlinks
since e.g. ls(1) won't show that in any obvious way. You need to
start stat(1)-ing things and look at the inodes to see what's
going on.
2) Some tools have very crappy support for hardlinks, e.g. the Git
shipped with GitLab is much bigger than it should be because
they're using a chef module that doesn't know about hardlinks, see
https://github.com/chef/omnibus/issues/827
I've also ran into other related issues that I think are explained
by this, e.g. compiling git with debugging and rpm refusing to
install a ~200MB git package with 2GB left on the FS, I think that
was because it doesn't consider hardlinks, just the sum of the
byte size of everything in the package.
As for the implementation, the "../../bin" noted above will vary given
some given some values of "../.." and "bin" depending on the depth of
the gitexecdir relative to the destdir, and the "bindir" target,
e.g. setting "bindir=/tmp/git/binaries gitexecdir=foo/bar/baz" will do
the right thing and produce this result:
$ file /tmp/git/foo/bar/baz/git-add
/tmp/git/foo/bar/baz/git-add: symbolic link to ../../../binaries/git
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-13 21:39:35 +01:00
|
|
|
# Define INSTALL_SYMLINKS if you prefer to have everything that can be
|
|
|
|
# symlinked between bin/ and libexec/ to use relative symlinks between
|
|
|
|
# the two. This option overrides NO_CROSS_DIRECTORY_HARDLINKS and
|
|
|
|
# NO_INSTALL_HARDLINKS which will also use symlinking by indirection
|
|
|
|
# within the same directory in some cases, INSTALL_SYMLINKS will
|
|
|
|
# always symlink to the final target directly.
|
|
|
|
#
|
2009-05-11 13:02:18 +02:00
|
|
|
# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
|
|
|
|
# programs as a tar, where bin/ and libexec/ might be on different file systems.
|
2009-05-31 18:15:23 +02:00
|
|
|
#
|
2012-05-03 00:12:10 +02:00
|
|
|
# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
|
|
|
|
# copies to install built-in git commands e.g. git-cat-file.
|
|
|
|
#
|
2009-05-31 18:15:23 +02:00
|
|
|
# Define USE_NED_ALLOCATOR if you want to replace the platforms default
|
|
|
|
# memory allocators with the nedmalloc allocator written by Niall Douglas.
|
2009-06-16 21:07:40 +02:00
|
|
|
#
|
2016-09-03 17:59:15 +02:00
|
|
|
# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
|
|
|
|
# This is necessary when using a custom allocator in order to avoid
|
|
|
|
# crashes due to allocation and free working on different 'heaps'.
|
|
|
|
# It's defined automatically if USE_NED_ALLOCATOR is set.
|
|
|
|
#
|
2016-09-21 20:24:04 +02:00
|
|
|
# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
|
|
|
|
# feature.
|
2009-10-31 02:44:41 +01:00
|
|
|
#
|
add generic terminal prompt function
When we need to prompt the user for input interactively, we
want to access their terminal directly. We can't rely on
stdio because it may be connected to pipes or files, rather
than the terminal. Instead, we use "getpass()", because it
abstracts the idea of prompting and reading from the
terminal. However, it has some problems:
1. It never echoes the typed characters, which makes it OK
for passwords but annoying for other input (like usernames).
2. Some implementations of getpass() have an extremely
small input buffer (e.g., Solaris 8 is reported to
support only 8 characters).
3. Some implementations of getpass() will fall back to
reading from stdin (e.g., glibc). We explicitly don't
want this, because our stdin may be connected to a pipe
speaking a particular protocol, and reading will
disrupt the protocol flow (e.g., the remote-curl
helper).
4. Some implementations of getpass() turn off signals, so
that hitting "^C" on the terminal does not break out of
the password prompt. This can be a mild annoyance.
Instead, let's provide an abstract "git_terminal_prompt"
function that addresses these concerns. This patch includes
an implementation based on /dev/tty, enabled by setting
HAVE_DEV_TTY. The fallback is to use getpass() as before.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-10 11:41:01 +01:00
|
|
|
# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
|
|
|
|
# user.
|
|
|
|
#
|
2009-09-01 13:39:20 +02:00
|
|
|
# Define JSMIN to point to JavaScript minifier that functions as
|
|
|
|
# a filter to have gitweb.js minified.
|
2009-12-01 20:28:15 +01:00
|
|
|
#
|
2010-04-03 02:35:05 +02:00
|
|
|
# Define CSSMIN to point to a CSS minifier in order to generate a minified
|
|
|
|
# version of gitweb.css
|
|
|
|
#
|
2009-10-31 02:45:34 +01:00
|
|
|
# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
|
|
|
|
# you want to use something different. The value will be interpreted by the
|
|
|
|
# shell at runtime when it is used.
|
|
|
|
#
|
2009-10-31 02:44:41 +01:00
|
|
|
# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
|
|
|
|
# want to use something different. The value will be interpreted by the shell
|
|
|
|
# if necessary when it is used. Examples:
|
|
|
|
#
|
|
|
|
# DEFAULT_EDITOR='~/bin/vi',
|
|
|
|
# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
|
|
|
|
# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
|
2010-01-26 16:52:49 +01:00
|
|
|
#
|
2011-11-18 10:58:21 +01:00
|
|
|
# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
|
|
|
|
# header files to be automatically computed, to avoid rebuilding objects when
|
|
|
|
# an unrelated header file changes. Define it to "no" to use the hard-coded
|
|
|
|
# dependency rules. The default is "auto", which means to use computed header
|
|
|
|
# dependencies if your compiler is detected to support it.
|
|
|
|
#
|
2010-06-04 21:29:08 +02:00
|
|
|
# Define NATIVE_CRLF if your platform uses CRLF for line endings.
|
2012-04-06 23:01:23 +02:00
|
|
|
#
|
2012-06-02 21:01:12 +02:00
|
|
|
# Define GIT_USER_AGENT if you want to change how git identifies itself during
|
|
|
|
# network interactions. The default is "git/$(GIT_VERSION)".
|
2012-06-21 23:42:38 +02:00
|
|
|
#
|
2012-06-06 22:28:16 +02:00
|
|
|
# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
|
|
|
|
# (defaults to "man") if you want to have a different default when
|
|
|
|
# "git help" is called without a parameter specifying the format.
|
2014-02-23 21:49:58 +01:00
|
|
|
#
|
2018-09-19 01:29:36 +02:00
|
|
|
# Define GIT_TEST_INDEX_VERSION to 2, 3 or 4 to run the test suite
|
2014-02-23 21:49:58 +01:00
|
|
|
# with a different indexfile format version. If it isn't set the index
|
|
|
|
# file format used is index-v[23].
|
2014-04-08 20:59:05 +02:00
|
|
|
#
|
Makefile: add NEEDS_LIBRT to optionally link with librt
We unconditionally link with librt, when HAVE_CLOCK_GETTIME is defined.
But clock_gettime() has been available in most libc implementations for
some time now (e.g., for glibc since version 2.17) and no longer
requires linking with librt. Furthermore, commit a6c3c63 (configure.ac:
check for clock_gettime() and CLOCK_MONOTONIC) will automatically
determined which library (libc or librt) is required for linking when
checking for clock_gettime().
The assumption to unconditionally link with librt was OK, since either
almost every Unix-like system provides a version of librt for backwards
compatibility or other systems, namely Windows or OS X, never provided
clock_gettime(). However, in the latest release of OS X (macOS Sierra),
this function has been added to OS X libc version. As a result, when
running the configuration script, HAVE_CLOCK_GETTIME is set and since
librt is not present, it causes a linker error.
This patches requires those not building via the configuration scripts
to define NEEDS_LIBRT in addition to HAVE_CLOCK_GETTIME, if needed.
Signed-off-by: Ronald Wampler <rdwampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-07 22:45:54 +02:00
|
|
|
# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
|
2015-01-08 21:00:56 +01:00
|
|
|
#
|
Makefile: add NEEDS_LIBRT to optionally link with librt
We unconditionally link with librt, when HAVE_CLOCK_GETTIME is defined.
But clock_gettime() has been available in most libc implementations for
some time now (e.g., for glibc since version 2.17) and no longer
requires linking with librt. Furthermore, commit a6c3c63 (configure.ac:
check for clock_gettime() and CLOCK_MONOTONIC) will automatically
determined which library (libc or librt) is required for linking when
checking for clock_gettime().
The assumption to unconditionally link with librt was OK, since either
almost every Unix-like system provides a version of librt for backwards
compatibility or other systems, namely Windows or OS X, never provided
clock_gettime(). However, in the latest release of OS X (macOS Sierra),
this function has been added to OS X libc version. As a result, when
running the configuration script, HAVE_CLOCK_GETTIME is set and since
librt is not present, it causes a linker error.
This patches requires those not building via the configuration scripts
to define NEEDS_LIBRT in addition to HAVE_CLOCK_GETTIME, if needed.
Signed-off-by: Ronald Wampler <rdwampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-07 22:45:54 +02:00
|
|
|
# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
|
|
|
|
#
|
|
|
|
# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
|
|
|
|
# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
|
2015-01-08 21:00:57 +01:00
|
|
|
#
|
2015-01-11 21:09:22 +01:00
|
|
|
# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
|
|
|
|
# compiles the following initialization:
|
|
|
|
#
|
|
|
|
# static const char s[] = ("FOO");
|
|
|
|
#
|
|
|
|
# and define it to "no" if you need to remove the parentheses () around the
|
|
|
|
# constant. The default is "auto", which means to use parentheses if your
|
|
|
|
# compiler is detected to support it.
|
2015-03-20 21:11:49 +01:00
|
|
|
#
|
2015-03-08 08:14:36 +01:00
|
|
|
# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
|
2015-04-16 11:01:38 +02:00
|
|
|
#
|
|
|
|
# Define HAVE_GETDELIM if your system has the getdelim() function.
|
2016-08-04 13:40:25 +02:00
|
|
|
#
|
2019-02-12 15:14:41 +01:00
|
|
|
# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function.
|
|
|
|
#
|
2019-04-25 09:01:56 +02:00
|
|
|
# Define NEED_ACCESS_ROOT_HANDLER if access() under root may success for X_OK
|
|
|
|
# even if execution permission isn't granted for any user.
|
|
|
|
#
|
2016-08-04 13:40:25 +02:00
|
|
|
# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
|
|
|
|
# default environment variables to be passed when a pager is spawned, e.g.
|
|
|
|
#
|
|
|
|
# PAGER_ENV = LESS=FRX LV=-c
|
|
|
|
#
|
|
|
|
# to say "export LESS=FRX (and LV=-c) if the environment variable
|
|
|
|
# LESS (and LV) is not set, respectively".
|
2017-12-15 00:34:34 +01:00
|
|
|
#
|
t/Makefile: introduce TEST_SHELL_PATH
You may want to run the test suite with a different shell
than you use to build Git. For instance, you may build with
SHELL_PATH=/bin/sh (because it's faster, or it's what you
expect to exist on systems where the build will be used) but
want to run the test suite with bash (e.g., since that
allows using "-x" reliably across the whole test suite).
There's currently no good way to do this.
You might think that doing two separate make invocations,
like:
make &&
make -C t SHELL_PATH=/bin/bash
would work. And it _almost_ does. The second make will see
our bash SHELL_PATH, and we'll use that to run the
individual test scripts (or tell prove to use it to do so).
So far so good.
But this breaks down when "--tee" or "--verbose-log" is
used. Those options cause the test script to actually
re-exec itself using $SHELL_PATH. But wait, wouldn't our
second make invocation have set SHELL_PATH correctly in the
environment?
Yes, but test-lib.sh sources GIT-BUILD-OPTIONS, which we
built during the first "make". And that overrides the
environment, giving us the original SHELL_PATH again.
Let's introduce a new variable that lets you specify a
specific shell to be run for the test scripts. Note that we
have to touch both the main and t/ Makefiles, since we have
to record it in GIT-BUILD-OPTIONS in one, and use it in the
latter.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-08 11:47:22 +01:00
|
|
|
# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
|
|
|
|
# running the test scripts (e.g., bash has better support for "set -x"
|
|
|
|
# tracing).
|
2018-01-05 22:28:09 +01:00
|
|
|
#
|
2017-12-15 00:34:34 +01:00
|
|
|
# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
|
|
|
|
# which the built Git will run (for instance "x86_64").
|
2018-04-10 17:05:43 +02:00
|
|
|
#
|
|
|
|
# Define RUNTIME_PREFIX to configure Git to resolve its ancillary tooling and
|
|
|
|
# support files relative to the location of the runtime binary, rather than
|
|
|
|
# hard-coding them into the binary. Git installations built with RUNTIME_PREFIX
|
|
|
|
# can be moved to arbitrary filesystem locations. RUNTIME_PREFIX also causes
|
|
|
|
# Perl scripts to use a modified entry point header allowing them to resolve
|
|
|
|
# support files at runtime.
|
2018-04-10 17:05:44 +02:00
|
|
|
#
|
|
|
|
# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform
|
|
|
|
# supports the KERN_PROC BSD sysctl function.
|
|
|
|
#
|
|
|
|
# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform
|
|
|
|
# mounts a "procfs" filesystem capable of resolving the path of the current
|
|
|
|
# executable. If defined, this must be the canonical path for the "procfs"
|
|
|
|
# current executable path.
|
|
|
|
#
|
|
|
|
# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform
|
|
|
|
# supports calling _NSGetExecutablePath to retrieve the path of the running
|
|
|
|
# executable.
|
2018-04-10 17:05:45 +02:00
|
|
|
#
|
|
|
|
# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
|
|
|
|
# the global variable _wpgmptr containing the absolute path of the current
|
|
|
|
# executable (this is the case on Windows).
|
2018-05-08 08:59:21 +02:00
|
|
|
#
|
2018-04-14 21:19:44 +02:00
|
|
|
# Define DEVELOPER to enable more compiler warnings. Compiler version
|
|
|
|
# and family are auto detected, but could be overridden by defining
|
2019-02-22 15:41:27 +01:00
|
|
|
# COMPILER_FEATURES (see config.mak.dev). You can still set
|
|
|
|
# CFLAGS="..." in combination with DEVELOPER enables, whether that's
|
|
|
|
# for tweaking something unrelated (e.g. optimization level), or for
|
|
|
|
# selectively overriding something DEVELOPER or one of the DEVOPTS
|
|
|
|
# (see just below) brings in.
|
2018-04-14 21:19:45 +02:00
|
|
|
#
|
|
|
|
# When DEVELOPER is set, DEVOPTS can be used to control compiler
|
|
|
|
# options. This variable contains keywords separated by
|
2019-12-15 16:12:24 +01:00
|
|
|
# whitespace. The following keywords are recognized:
|
2018-04-14 21:19:45 +02:00
|
|
|
#
|
|
|
|
# no-error:
|
|
|
|
#
|
|
|
|
# suppresses the -Werror that implicitly comes with
|
|
|
|
# DEVELOPER=1. Useful for getting the full set of errors
|
|
|
|
# without immediately dying, or for logging them.
|
2018-04-14 21:19:46 +02:00
|
|
|
#
|
|
|
|
# extra-all:
|
|
|
|
#
|
|
|
|
# The DEVELOPER mode enables -Wextra with a few exceptions. By
|
|
|
|
# setting this flag the exceptions are removed, and all of
|
|
|
|
# -Wextra is used.
|
2018-07-24 21:26:43 +02:00
|
|
|
#
|
|
|
|
# pedantic:
|
|
|
|
#
|
|
|
|
# Enable -pedantic compilation. This also disables
|
|
|
|
# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
|
2005-07-29 17:48:26 +02:00
|
|
|
|
2010-01-06 09:06:58 +01:00
|
|
|
GIT-VERSION-FILE: FORCE
|
2006-02-14 00:15:14 +01:00
|
|
|
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
2005-12-27 23:40:17 +01:00
|
|
|
-include GIT-VERSION-FILE
|
2005-07-07 22:09:50 +02:00
|
|
|
|
2019-02-22 15:41:24 +01:00
|
|
|
# Set our default configuration.
|
|
|
|
#
|
2008-07-23 21:12:18 +02:00
|
|
|
# Among the variables below, these:
|
|
|
|
# gitexecdir
|
|
|
|
# template_dir
|
2011-05-09 10:24:55 +02:00
|
|
|
# sysconfdir
|
2009-01-18 13:00:09 +01:00
|
|
|
# can be specified as a relative path some/where/else;
|
|
|
|
# this is interpreted as relative to $(prefix) and "git" at
|
2008-07-23 21:12:18 +02:00
|
|
|
# runtime figures out where they are based on the path to the executable.
|
2013-02-24 20:55:01 +01:00
|
|
|
# Additionally, the following will be treated as relative by "git" if they
|
|
|
|
# begin with "$(prefix)/":
|
|
|
|
# mandir
|
|
|
|
# infodir
|
|
|
|
# htmldir
|
2018-04-10 17:05:43 +02:00
|
|
|
# localedir
|
|
|
|
# perllibdir
|
2008-07-23 21:12:18 +02:00
|
|
|
# This can help installing the suite in a relocatable way.
|
|
|
|
|
2005-08-06 07:36:15 +02:00
|
|
|
prefix = $(HOME)
|
Makefile: fix broken bindir_relative variable
Change the bindir_relative variable to work like the other *_relative
variables, which are computed as a function of the absolute
path. Before this change, supplying e.g. bindir=/tmp/git/binaries to
the Makefile would yield a bindir_relative of just "bin", as opposed
to "binaries".
This logic was originally added back in 026fa0d5ad ("Move computation
of absolute paths from Makefile to runtime (in preparation for
RUNTIME_PREFIX)", 2009-01-18), then later in 971f85388f ("Makefile:
make mandir, htmldir and infodir absolute", 2013-02-24) when
more *_relative variables were added those new variables didn't have
this bug, but bindir_relative was never fixed.
There is a small change in behavior here, which is that setting
bindir_relative as an argument to the Makefile won't work anymore, I
think that's fine, since this was always intended as an internal
variable (e.g. INSTALL documents bindir=*, not bindir_relative=*).
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-13 21:39:33 +01:00
|
|
|
bindir = $(prefix)/bin
|
2013-02-24 20:55:01 +01:00
|
|
|
mandir = $(prefix)/share/man
|
|
|
|
infodir = $(prefix)/share/info
|
2009-01-18 13:00:09 +01:00
|
|
|
gitexecdir = libexec/git-core
|
2011-08-18 09:23:46 +02:00
|
|
|
mergetoolsdir = $(gitexecdir)/mergetools
|
2007-06-11 10:02:17 +02:00
|
|
|
sharedir = $(prefix)/share
|
2010-05-28 08:25:50 +02:00
|
|
|
gitwebdir = $(sharedir)/gitweb
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
perllibdir = $(sharedir)/perl5
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
localedir = $(sharedir)/locale
|
2009-01-18 13:00:09 +01:00
|
|
|
template_dir = share/git-core/templates
|
2013-02-24 20:55:01 +01:00
|
|
|
htmldir = $(prefix)/share/doc/git-doc
|
2009-01-18 13:00:09 +01:00
|
|
|
ETC_GITCONFIG = $(sysconfdir)/gitconfig
|
2010-09-01 00:42:43 +02:00
|
|
|
ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
|
2007-08-01 06:30:35 +02:00
|
|
|
lib = lib
|
2012-12-09 11:36:17 +01:00
|
|
|
# DESTDIR =
|
2009-05-23 10:04:48 +02:00
|
|
|
pathsep = :
|
2005-04-13 11:14:06 +02:00
|
|
|
|
Makefile: fix broken bindir_relative variable
Change the bindir_relative variable to work like the other *_relative
variables, which are computed as a function of the absolute
path. Before this change, supplying e.g. bindir=/tmp/git/binaries to
the Makefile would yield a bindir_relative of just "bin", as opposed
to "binaries".
This logic was originally added back in 026fa0d5ad ("Move computation
of absolute paths from Makefile to runtime (in preparation for
RUNTIME_PREFIX)", 2009-01-18), then later in 971f85388f ("Makefile:
make mandir, htmldir and infodir absolute", 2013-02-24) when
more *_relative variables were added those new variables didn't have
this bug, but bindir_relative was never fixed.
There is a small change in behavior here, which is that setting
bindir_relative as an argument to the Makefile won't work anymore, I
think that's fine, since this was always intended as an internal
variable (e.g. INSTALL documents bindir=*, not bindir_relative=*).
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-13 21:39:33 +01:00
|
|
|
bindir_relative = $(patsubst $(prefix)/%,%,$(bindir))
|
2013-02-24 20:55:01 +01:00
|
|
|
mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
|
|
|
|
infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
|
2018-03-13 21:39:34 +01:00
|
|
|
gitexecdir_relative = $(patsubst $(prefix)/%,%,$(gitexecdir))
|
2018-04-10 17:05:43 +02:00
|
|
|
localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
|
2013-02-24 20:55:01 +01:00
|
|
|
htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
|
2018-04-10 17:05:43 +02:00
|
|
|
perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
|
2013-02-24 20:55:01 +01:00
|
|
|
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
|
2006-06-29 22:11:25 +02:00
|
|
|
|
2019-02-22 15:41:24 +01:00
|
|
|
# Set our default programs
|
2011-12-21 00:40:47 +01:00
|
|
|
CC = cc
|
2005-08-06 07:36:15 +02:00
|
|
|
AR = ar
|
2007-07-14 19:51:44 +02:00
|
|
|
RM = rm -f
|
2010-05-14 11:31:36 +02:00
|
|
|
DIFF = diff
|
2005-09-23 19:41:40 +02:00
|
|
|
TAR = tar
|
2007-07-30 00:23:28 +02:00
|
|
|
FIND = find
|
2005-08-06 07:36:15 +02:00
|
|
|
INSTALL = install
|
2007-05-08 05:36:31 +02:00
|
|
|
TCL_PATH = tclsh
|
2007-03-28 13:12:07 +02:00
|
|
|
TCLTK_PATH = wish
|
2011-02-23 00:41:23 +01:00
|
|
|
XGETTEXT = xgettext
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
MSGFMT = msgfmt
|
2015-10-21 19:10:46 +02:00
|
|
|
CURL_CONFIG = curl-config
|
2010-07-26 09:43:41 +02:00
|
|
|
GCOV = gcov
|
2019-02-22 15:41:23 +01:00
|
|
|
STRIP = strip
|
2016-09-15 20:30:56 +02:00
|
|
|
SPATCH = spatch
|
2005-04-08 00:13:13 +02:00
|
|
|
|
2007-05-08 05:36:31 +02:00
|
|
|
export TCL_PATH TCLTK_PATH
|
|
|
|
|
2019-02-22 15:41:25 +01:00
|
|
|
# Set our default LIBS variables
|
|
|
|
PTHREAD_LIBS = -lpthread
|
2006-06-25 03:47:03 +02:00
|
|
|
|
2009-03-25 17:27:28 +01:00
|
|
|
# Guard against environment variables
|
|
|
|
BUILTIN_OBJS =
|
|
|
|
BUILT_INS =
|
|
|
|
COMPAT_CFLAGS =
|
|
|
|
COMPAT_OBJS =
|
2011-03-27 20:13:22 +02:00
|
|
|
XDIFF_OBJS =
|
Makefile: fold MISC_H into LIB_H
We keep a list of most of the header files in LIB_H, but
some are split out into MISC_H. The original point
of LIB_H was that it would force recompilation of C files
when any of the library headers changed. It was
over-encompassing, since not all C files included all of the
library headers; this made it simple to maintain, but meant
that we sometimes recompiled when it was not necessary.
Over time, some new headers were omitted from LIB_H, and
rules were added to the Makefile for a few specific targets
to explicitly depend on them. This avoided some unnecessary
recompilation at the cost of having to maintain the
dependency list of those targets manually (e.g., d349a03).
Later, we needed a complete list of headers from which we
should extract strings to localized. Thus 1b8b2e4 introduced
MISC_H to mention all header files not included in LIB_H,
and the concatenation of the two lists is fed to xgettext.
Headers mentioned as dependencies must also be manually
added to MISC_H to receive the benefits of localization.
Having to update multiple locations manually is a pain and
has led to errors. For example, see "git log -Swt-status.h
Makefile" for some back-and-forth between the two locations.
Or the fact that column.h was never added to MISC_H, and
therefore was not localized (which is fixed by this patch).
Moreover, the benefits of keeping these few headers out of
LIB_H is not that great, for two reasons:
1. The better way to do this is by auto-computing the
dependencies, which is more accurate and less work to
maintain. If your compiler supports it, we turn on
computed header dependencies by default these days. So
these manual dependencies are used only for people who
do not have gcc at all (which increases the chance of
them becoming stale, as many developers will never even
use them).
2. Even if you do not have gcc, the manual header
dependencies do not help all that much. They obviously
cannot help with an initial compilation (since their
purpose is to avoid unnecessary recompilation when a
header changes), which means they are only useful when
building a new version of git in the working tree that
held an existing build (e.g., after checkout or during a
bisection). But since a change of a header in LIB_H
will force recompilation, and given that the vast
majority of headers are in LIB_H, most version changes
will result in a full rebuild anyway.
Let's just fold MISC_H into LIB_H and get rid of these
manual rules. The worst case is some extra compilation, but
even that is unlikely to matter due to the reasons above.
The one exception is that we should keep common-cmds.h
separate. Because it is generated, the computed dependencies
do not handle it properly, and we must keep separate
individual dependencies on it. Let's therefore rename MISC_H
to GENERATED_H to make it more clear what should go in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-20 20:30:56 +02:00
|
|
|
GENERATED_H =
|
2010-03-20 04:20:12 +01:00
|
|
|
EXTRA_CPPFLAGS =
|
2018-10-13 02:58:40 +02:00
|
|
|
FUZZ_OBJS =
|
|
|
|
FUZZ_PROGRAMS =
|
2009-03-25 17:27:28 +01:00
|
|
|
LIB_OBJS =
|
2010-01-26 16:54:23 +01:00
|
|
|
PROGRAM_OBJS =
|
2009-03-25 17:27:28 +01:00
|
|
|
PROGRAMS =
|
2019-04-18 15:16:40 +02:00
|
|
|
EXCLUDED_PROGRAMS =
|
2009-03-25 17:27:28 +01:00
|
|
|
SCRIPT_PERL =
|
2009-11-18 02:42:31 +01:00
|
|
|
SCRIPT_PYTHON =
|
2009-03-25 17:27:28 +01:00
|
|
|
SCRIPT_SH =
|
2010-01-31 20:46:53 +01:00
|
|
|
SCRIPT_LIB =
|
2018-03-24 08:44:30 +01:00
|
|
|
TEST_BUILTINS_OBJS =
|
2010-01-26 17:08:44 +01:00
|
|
|
TEST_PROGRAMS_NEED_X =
|
2019-09-16 21:23:11 +02:00
|
|
|
THIRD_PARTY_SOURCES =
|
2009-03-25 17:27:28 +01:00
|
|
|
|
2010-03-20 01:06:15 +01:00
|
|
|
# Having this variable in your environment would break pipelines because
|
|
|
|
# you cause "cd" to echo its destination to stdout. It can also take
|
|
|
|
# scripts to unexpected places. If you like CDPATH, define it for your
|
|
|
|
# interactive shell sessions without exporting it.
|
|
|
|
unexport CDPATH
|
|
|
|
|
2008-03-12 09:46:26 +01:00
|
|
|
SCRIPT_SH += git-bisect.sh
|
2009-04-07 10:21:20 +02:00
|
|
|
SCRIPT_SH += git-difftool--helper.sh
|
2008-03-12 09:46:26 +01:00
|
|
|
SCRIPT_SH += git-filter-branch.sh
|
|
|
|
SCRIPT_SH += git-merge-octopus.sh
|
|
|
|
SCRIPT_SH += git-merge-one-file.sh
|
|
|
|
SCRIPT_SH += git-merge-resolve.sh
|
|
|
|
SCRIPT_SH += git-mergetool.sh
|
|
|
|
SCRIPT_SH += git-quiltimport.sh
|
|
|
|
SCRIPT_SH += git-request-pull.sh
|
|
|
|
SCRIPT_SH += git-submodule.sh
|
|
|
|
SCRIPT_SH += git-web--browse.sh
|
|
|
|
|
2010-01-31 20:46:53 +01:00
|
|
|
SCRIPT_LIB += git-mergetool--lib
|
|
|
|
SCRIPT_LIB += git-parse-remote
|
2018-05-28 14:34:19 +02:00
|
|
|
SCRIPT_LIB += git-rebase--preserve-merges
|
2011-05-14 15:47:43 +02:00
|
|
|
SCRIPT_LIB += git-sh-i18n
|
2020-03-21 10:21:20 +01:00
|
|
|
SCRIPT_LIB += git-sh-setup
|
2010-01-31 20:46:53 +01:00
|
|
|
|
2008-03-12 09:46:26 +01:00
|
|
|
SCRIPT_PERL += git-add--interactive.perl
|
|
|
|
SCRIPT_PERL += git-archimport.perl
|
|
|
|
SCRIPT_PERL += git-cvsexportcommit.perl
|
|
|
|
SCRIPT_PERL += git-cvsimport.perl
|
|
|
|
SCRIPT_PERL += git-cvsserver.perl
|
|
|
|
SCRIPT_PERL += git-send-email.perl
|
|
|
|
SCRIPT_PERL += git-svn.perl
|
2005-07-31 02:31:47 +02:00
|
|
|
|
2012-04-09 02:18:00 +02:00
|
|
|
SCRIPT_PYTHON += git-p4.py
|
2010-03-29 18:48:28 +02:00
|
|
|
|
2013-02-08 18:31:16 +01:00
|
|
|
# Generated files for scripts
|
|
|
|
SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
|
|
|
|
SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
|
|
|
|
SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
|
|
|
|
|
|
|
|
# Individual rules to allow e.g.
|
|
|
|
# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
|
|
|
|
# from subdirectories like contrib/*/
|
|
|
|
.PHONY: build-perl-script build-sh-script build-python-script
|
|
|
|
build-perl-script: $(SCRIPT_PERL_GEN)
|
|
|
|
build-sh-script: $(SCRIPT_SH_GEN)
|
|
|
|
build-python-script: $(SCRIPT_PYTHON_GEN)
|
|
|
|
|
|
|
|
.PHONY: install-perl-script install-sh-script install-python-script
|
2019-04-18 15:16:39 +02:00
|
|
|
install-sh-script: $(SCRIPT_SH_GEN)
|
2013-05-25 04:41:02 +02:00
|
|
|
$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2019-04-18 15:16:39 +02:00
|
|
|
install-perl-script: $(SCRIPT_PERL_GEN)
|
2013-05-25 04:41:02 +02:00
|
|
|
$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2019-04-18 15:16:39 +02:00
|
|
|
install-python-script: $(SCRIPT_PYTHON_GEN)
|
2013-05-25 04:41:02 +02:00
|
|
|
$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2013-02-08 18:31:16 +01:00
|
|
|
|
|
|
|
.PHONY: clean-perl-script clean-sh-script clean-python-script
|
|
|
|
clean-sh-script:
|
|
|
|
$(RM) $(SCRIPT_SH_GEN)
|
|
|
|
clean-perl-script:
|
|
|
|
$(RM) $(SCRIPT_PERL_GEN)
|
|
|
|
clean-python-script:
|
|
|
|
$(RM) $(SCRIPT_PYTHON_GEN)
|
|
|
|
|
2019-04-18 15:16:39 +02:00
|
|
|
SCRIPTS = $(SCRIPT_SH_GEN) \
|
|
|
|
$(SCRIPT_PERL_GEN) \
|
|
|
|
$(SCRIPT_PYTHON_GEN) \
|
2007-11-23 21:35:08 +01:00
|
|
|
git-instaweb
|
2005-11-22 00:44:15 +01:00
|
|
|
|
2010-09-28 23:08:38 +02:00
|
|
|
ETAGS_TARGET = TAGS
|
|
|
|
|
2019-01-15 23:25:50 +01:00
|
|
|
FUZZ_OBJS += fuzz-commit-graph.o
|
2018-10-13 02:58:40 +02:00
|
|
|
FUZZ_OBJS += fuzz-pack-headers.o
|
2018-10-13 02:58:41 +02:00
|
|
|
FUZZ_OBJS += fuzz-pack-idx.o
|
2018-10-13 02:58:40 +02:00
|
|
|
|
|
|
|
# Always build fuzz objects even if not testing, to prevent bit-rot.
|
|
|
|
all:: $(FUZZ_OBJS)
|
|
|
|
|
|
|
|
FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
|
|
|
|
|
2006-08-16 06:38:07 +02:00
|
|
|
# Empty...
|
|
|
|
EXTRA_PROGRAMS =
|
2005-11-22 00:44:15 +01:00
|
|
|
|
2008-03-12 09:46:26 +01:00
|
|
|
# ... and all the rest that could be moved out of bindir to gitexecdir
|
|
|
|
PROGRAMS += $(EXTRA_PROGRAMS)
|
2010-01-26 16:54:23 +01:00
|
|
|
|
2010-11-04 02:35:24 +01:00
|
|
|
PROGRAM_OBJS += daemon.o
|
2012-05-04 15:52:36 +02:00
|
|
|
PROGRAM_OBJS += http-backend.o
|
2010-01-26 16:54:23 +01:00
|
|
|
PROGRAM_OBJS += imap-send.o
|
2012-05-04 15:52:36 +02:00
|
|
|
PROGRAM_OBJS += sh-i18n--envsubst.o
|
2010-01-26 16:54:23 +01:00
|
|
|
PROGRAM_OBJS += shell.o
|
|
|
|
|
2012-02-08 11:59:04 +01:00
|
|
|
# Binary suffix, set to .exe for Windows builds
|
|
|
|
X =
|
|
|
|
|
2010-01-26 16:54:23 +01:00
|
|
|
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
|
2008-03-12 09:46:26 +01:00
|
|
|
|
2020-03-02 21:01:59 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-advise.o
|
2020-03-30 02:31:24 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-bloom.o
|
2018-03-24 08:44:31 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-chmtime.o
|
2018-03-24 08:44:34 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-config.o
|
2018-03-24 08:44:35 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-ctype.o
|
2018-03-24 08:44:36 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-date.o
|
2018-03-24 08:44:37 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-delta.o
|
2019-07-11 01:58:57 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-dir-iterator.o
|
2018-03-24 08:44:38 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-drop-caches.o
|
2018-03-24 08:44:39 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-dump-cache-tree.o
|
2018-09-09 19:36:30 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
|
2018-03-24 08:44:40 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-dump-split-index.o
|
2018-09-09 19:36:27 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
|
2018-03-24 08:44:41 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-example-decorate.o
|
2018-03-24 08:44:42 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-genrandom.o
|
tests: teach the test-tool to generate NUL bytes and use it
In cc95bc2025 (t5562: replace /dev/zero with a pipe from
generate_zero_bytes, 2019-02-09), we replaced usage of /dev/zero (which
is not available on NonStop, apparently) by a Perl script snippet to
generate NUL bytes.
Sadly, it does not seem to work on NonStop, as t5562 reportedly hangs.
Worse, this also hangs in the Ubuntu 16.04 agents of the CI builds on
Azure Pipelines: for some reason, the Perl script snippet that is run
via `generate_zero_bytes` in t5562's 'CONTENT_LENGTH overflow ssite_t'
test case tries to write out an infinite amount of NUL bytes unless a
broken pipe is encountered, that snippet never encounters the broken
pipe, and keeps going until the build times out.
Oddly enough, this does not reproduce on the Windows and macOS agents,
nor in a local Ubuntu 18.04.
This developer tried for a day to figure out the exact circumstances
under which this hang happens, to no avail, the details remain a
mystery.
In the end, though, what counts is that this here change incidentally
fixes that hang (maybe also on NonStop?). Even more positively, it gets
rid of yet another unnecessary Perl invocation.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-14 22:33:12 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-genzeros.o
|
2020-03-21 10:21:20 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-hash-speed.o
|
2018-11-14 05:09:32 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-hash.o
|
2018-03-24 08:44:43 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-hashmap.o
|
2018-03-24 08:44:44 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-index-version.o
|
2018-07-13 18:54:08 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-json-writer.o
|
2018-03-24 08:44:33 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
|
2018-03-24 08:44:45 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-match-trees.o
|
2018-03-24 08:44:46 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-mergesort.o
|
2018-03-24 08:44:47 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-mktemp.o
|
2020-04-30 01:15:27 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-oid-array.o
|
2019-06-15 12:06:59 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-oidmap.o
|
2018-03-24 08:44:48 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-online-cpus.o
|
2018-09-09 19:36:29 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-parse-options.o
|
2019-12-31 11:15:12 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-parse-pathspec-file.o
|
2018-03-24 08:44:49 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-path-utils.o
|
2018-09-09 19:36:28 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-pkt-line.o
|
2018-03-24 08:44:50 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-prio-queue.o
|
Test the progress display
'progress.c' has seen a few fixes recently [1], and, unfortunately,
some of those fixes required further fixes [2]. It seems it's time to
have a few tests focusing on the subtleties of the progress display.
Add the 'test-tool progress' subcommand to help testing the progress
display, reading instructions from standard input and turning them
into calls to the display_progress() and display_throughput()
functions with the given parameters.
The progress display is, however, critically dependent on timing,
because it's only updated once every second or, if the toal is known
in advance, every 1%, and there is the throughput rate as well. These
make the progress display far too undeterministic for testing as-is.
To address this, add a few testing-specific variables and functions to
'progress.c', allowing the the new test helper to:
- Disable the triggered-every-second SIGALRM and set the
'progress_update' flag explicitly based in the input instructions.
This way the progress line will be updated deterministically when
the test wants it to be updated.
- Specify the time elapsed since start_progress() to make the
throughput rate calculations deterministic.
Add the new test script 't0500-progress-display.sh' to check a few
simple cases with and without throughput, and that a shorter progress
line properly covers up the previously displayed line in different
situations.
[1] See commits 545dc345eb (progress: break too long progress bar
lines, 2019-04-12) and 9f1fd84e15 (progress: clear previous
progress update dynamically, 2019-04-12).
[2] 1aed1a5f25 (progress: avoid empty line when breaking the progress
line, 2019-05-19)
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-16 22:54:12 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-progress.o
|
2018-07-20 18:33:15 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-reach.o
|
2018-03-24 08:44:51 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-read-cache.o
|
2019-11-12 17:58:20 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-read-graph.o
|
2018-07-12 21:39:23 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-read-midx.o
|
2018-03-24 08:44:52 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-ref-store.o
|
2018-03-24 08:44:53 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-regex.o
|
2018-07-12 00:42:42 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-repository.o
|
2018-03-24 08:44:54 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-revision-walking.o
|
2018-03-24 08:44:55 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-run-command.o
|
2018-03-24 08:44:56 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
|
2019-04-18 15:16:51 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-serve-v2.o
|
2018-03-24 08:44:32 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-sha1.o
|
2018-11-14 05:09:36 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-sha256.o
|
2018-03-24 08:44:58 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-sigchain.o
|
2018-03-24 08:44:59 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-strcmp-offset.o
|
2018-03-24 08:45:00 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-string-list.o
|
2018-03-24 08:45:01 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-submodule-config.o
|
2018-10-25 18:18:13 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
|
2018-03-24 08:45:02 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-subprocess.o
|
2019-02-22 23:25:10 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-trace2.o
|
2018-03-24 08:45:03 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
|
2018-03-24 08:45:04 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-wildmatch.o
|
2018-09-11 22:06:01 +02:00
|
|
|
TEST_BUILTINS_OBJS += test-windows-named-pipe.o
|
2018-03-24 08:45:05 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-write-cache.o
|
2020-03-21 10:21:20 +01:00
|
|
|
TEST_BUILTINS_OBJS += test-xml-encode.o
|
2018-03-24 08:44:31 +01:00
|
|
|
|
2018-09-09 19:36:31 +02:00
|
|
|
# Do not add more tests here unless they have extra dependencies. Add
|
|
|
|
# them in TEST_BUILTINS_OBJS above.
|
2016-01-27 17:19:37 +01:00
|
|
|
TEST_PROGRAMS_NEED_X += test-fake-ssh
|
2018-03-24 08:44:30 +01:00
|
|
|
TEST_PROGRAMS_NEED_X += test-tool
|
2010-01-26 17:08:44 +01:00
|
|
|
|
2016-04-13 15:22:42 +02:00
|
|
|
TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
|
2008-03-12 09:46:26 +01:00
|
|
|
|
2008-02-23 20:08:25 +01:00
|
|
|
# List built-in command $C whose implementation cmd_$C() is not in
|
2010-02-22 17:42:18 +01:00
|
|
|
# builtin/$C.o but is linked in as part of some other command.
|
|
|
|
BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
|
2008-03-12 09:46:26 +01:00
|
|
|
|
|
|
|
BUILT_INS += git-cherry$X
|
2009-02-09 23:00:45 +01:00
|
|
|
BUILT_INS += git-cherry-pick$X
|
2008-03-12 09:46:26 +01:00
|
|
|
BUILT_INS += git-format-patch$X
|
|
|
|
BUILT_INS += git-fsck-objects$X
|
|
|
|
BUILT_INS += git-init$X
|
|
|
|
BUILT_INS += git-merge-subtree$X
|
2019-04-25 11:45:45 +02:00
|
|
|
BUILT_INS += git-restore$X
|
2008-03-12 09:46:26 +01:00
|
|
|
BUILT_INS += git-show$X
|
2008-12-03 09:30:34 +01:00
|
|
|
BUILT_INS += git-stage$X
|
2008-03-12 09:46:26 +01:00
|
|
|
BUILT_INS += git-status$X
|
2019-03-29 11:39:05 +01:00
|
|
|
BUILT_INS += git-switch$X
|
2008-03-12 09:46:26 +01:00
|
|
|
BUILT_INS += git-whatchanged$X
|
2006-04-11 02:37:58 +02:00
|
|
|
|
2009-08-07 21:09:29 +02:00
|
|
|
# what 'all' will build and 'install' will install in gitexecdir,
|
|
|
|
# excluding programs for built-in commands
|
2007-02-07 06:27:09 +01:00
|
|
|
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
|
2005-04-08 00:13:13 +02:00
|
|
|
|
2007-03-28 13:00:23 +02:00
|
|
|
# what 'all' will build but not install in gitexecdir
|
2009-04-03 21:32:20 +02:00
|
|
|
OTHER_PROGRAMS = git$X
|
2007-03-28 13:00:23 +02:00
|
|
|
|
2009-12-03 06:14:05 +01:00
|
|
|
# what test wrappers are needed and 'install' will install, in bindir
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git-receive-pack
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git-shell
|
2020-03-21 10:21:20 +01:00
|
|
|
BINDIR_PROGRAMS_NEED_X += git-upload-archive
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git-upload-pack
|
2009-12-03 06:14:05 +01:00
|
|
|
|
|
|
|
BINDIR_PROGRAMS_NO_X += git-cvsserver
|
|
|
|
|
2005-11-21 06:11:22 +01:00
|
|
|
# Set paths to tools early so that they can be used for version tests.
|
|
|
|
ifndef SHELL_PATH
|
|
|
|
SHELL_PATH = /bin/sh
|
|
|
|
endif
|
|
|
|
ifndef PERL_PATH
|
|
|
|
PERL_PATH = /usr/bin/perl
|
|
|
|
endif
|
2009-11-18 02:42:31 +01:00
|
|
|
ifndef PYTHON_PATH
|
|
|
|
PYTHON_PATH = /usr/bin/python
|
|
|
|
endif
|
2005-09-11 02:46:27 +02:00
|
|
|
|
2006-12-15 08:03:03 +01:00
|
|
|
export PERL_PATH
|
2009-11-18 02:42:31 +01:00
|
|
|
export PYTHON_PATH
|
2006-12-15 08:03:03 +01:00
|
|
|
|
t/Makefile: introduce TEST_SHELL_PATH
You may want to run the test suite with a different shell
than you use to build Git. For instance, you may build with
SHELL_PATH=/bin/sh (because it's faster, or it's what you
expect to exist on systems where the build will be used) but
want to run the test suite with bash (e.g., since that
allows using "-x" reliably across the whole test suite).
There's currently no good way to do this.
You might think that doing two separate make invocations,
like:
make &&
make -C t SHELL_PATH=/bin/bash
would work. And it _almost_ does. The second make will see
our bash SHELL_PATH, and we'll use that to run the
individual test scripts (or tell prove to use it to do so).
So far so good.
But this breaks down when "--tee" or "--verbose-log" is
used. Those options cause the test script to actually
re-exec itself using $SHELL_PATH. But wait, wouldn't our
second make invocation have set SHELL_PATH correctly in the
environment?
Yes, but test-lib.sh sources GIT-BUILD-OPTIONS, which we
built during the first "make". And that overrides the
environment, giving us the original SHELL_PATH again.
Let's introduce a new variable that lets you specify a
specific shell to be run for the test scripts. Note that we
have to touch both the main and t/ Makefiles, since we have
to record it in GIT-BUILD-OPTIONS in one, and use it in the
latter.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-08 11:47:22 +01:00
|
|
|
TEST_SHELL_PATH = $(SHELL_PATH)
|
|
|
|
|
2012-12-09 11:36:17 +01:00
|
|
|
LIB_FILE = libgit.a
|
|
|
|
XDIFF_LIB = xdiff/lib.a
|
[PATCH] Add update-server-info.
The git-update-server-info command prepares informational files
to help clients discover the contents of a repository, and pull
from it via a dumb transport protocols. Currently, the
following files are produced.
- The $repo/info/refs file lists the name of heads and tags
available in the $repo/refs/ directory, along with their
SHA1. This can be used by git-ls-remote command running on
the client side.
- The $repo/info/rev-cache file describes the commit ancestry
reachable from references in the $repo/refs/ directory. This
file is in an append-only binary format to make the server
side friendly to rsync mirroring scheme, and can be read by
git-show-rev-cache command.
- The $repo/objects/info/pack file lists the name of the packs
available, the interdependencies among them, and the head
commits and tags contained in them. Along with the other two
files, this is designed to help clients to make smart pull
decisions.
The git-receive-pack command is changed to invoke it at the end,
so just after a push to a public repository finishes via "git
push", the server info is automatically updated.
In addition, building of the rev-cache file can be done by a
standalone git-build-rev-cache command separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-24 02:54:41 +02:00
|
|
|
|
help: move list_config_help to builtin/help
Starting in 3ac68a93fd2, help.o began to depend on builtin/branch.o,
builtin/clean.o, and builtin/config.o. This meant that help.o was
unusable outside of the context of the main Git executable.
To make help.o usable by other commands again, move list_config_help()
into builtin/help.c (where it makes sense to assume other builtin libraries
are present).
When command-list.h is included but a member is not used, we start to
hear a compiler warning. Since the config list is generated in a fairly
different way than the command list, and since commands and config
options are semantically different, move the config list into its own
header and move the generator into its own script and build rule.
For reasons explained in 976aaedc (msvc: add a Makefile target to
pre-generate the Visual Studio solution, 2019-07-29), some build
artifacts we consider non-source files cannot be generated in the
Visual Studio environment, and we already have some Makefile tweaks
to help Visual Studio to use generated command-list.h header file.
Do the same to a new generated file, config-list.h, introduced by
this change.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
2020-04-16 23:18:03 +02:00
|
|
|
GENERATED_H += config-list.h
|
2018-05-10 10:46:43 +02:00
|
|
|
GENERATED_H += command-list.h
|
2012-04-23 14:30:21 +02:00
|
|
|
|
2019-09-16 21:23:08 +02:00
|
|
|
LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
|
Makefile: use `git ls-files` to list header files, if possible
In d85b0dff72 (Makefile: use `find` to determine static header
dependencies, 2014-08-25), we switched from a static list of header
files to a dynamically-generated one, asking `find` to enumerate them.
Back in those days, we did not use `$(LIB_H)` by default, and many a
`make` implementation seems smart enough not to run that `find` command
in that case, so it was deemed okay to run `find` for special targets
requiring this macro.
However, as of ebb7baf02f (Makefile: add a hdr-check target,
2018-09-19), $(LIB_H) is part of a global rule and therefore must be
expanded. Meaning: this `find` command has to be run upon every
`make` invocation. In the presence of many a worktree, this can tax the
developers' patience quite a bit.
Even in the absence of worktrees or other untracked files and
directories, the cost of I/O to generate that list of header files is
simply a lot larger than a simple `git ls-files` call.
Therefore, just like in 335339758c (Makefile: ask "ls-files" to list
source files if available, 2011-10-18), we now prefer to use `git
ls-files` to enumerate the header files to enumerating them via `find`,
falling back to the latter if the former failed (which would be the case
e.g. in a worktree that was extracted from a source .tar file rather
than from a clone of Git's sources).
This has one notable consequence: we no longer include `command-list.h`
in `LIB_H`, as it is a generated file, not a tracked one, but that is
easily worked around. Of the three sites that use `LIB_H`, two
(`LOCALIZED_C` and `CHK_HDRS`) already handle generated headers
separately. In the third, the computed-dependency fallback, we can just
add in a reference to $(GENERATED_H).
Likewise, we no longer include not-yet-tracked header files in `LIB_H`.
Given the speed improvements, these consequences seem a comparably small
price to pay.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-04 14:47:06 +01:00
|
|
|
$(FIND) . \
|
2014-08-25 22:00:42 +02:00
|
|
|
-name .git -prune -o \
|
|
|
|
-name t -prune -o \
|
|
|
|
-name Documentation -prune -o \
|
2019-09-16 21:23:08 +02:00
|
|
|
-name '*.h' -print)))
|
2008-03-12 09:46:26 +01:00
|
|
|
|
2008-06-27 22:46:42 +02:00
|
|
|
LIB_OBJS += abspath.o
|
2019-11-13 13:40:57 +01:00
|
|
|
LIB_OBJS += add-interactive.o
|
built-in add -i: start implementing the `patch` functionality in C
In the previous steps, we re-implemented the main loop of `git add -i`
in C, and most of the commands.
Notably, we left out the actual functionality of `patch`, as the
relevant code makes up more than half of `git-add--interactive.perl`,
and is actually pretty independent of the rest of the commands.
With this commit, we start to tackle that `patch` part. For better
separation of concerns, we keep the code in a separate file,
`add-patch.c`. The new code is still guarded behind the
`add.interactive.useBuiltin` config setting, and for the moment,
it can only be called via `git add -p`.
The actual functionality follows the original implementation of
5cde71d64aff (git-add --interactive, 2006-12-10), but not too closely
(for example, we use string offsets rather than copying strings around,
and after seeing whether the `k` and `j` commands are applicable, in the
C version we remember which previous/next hunk was undecided, and use it
rather than looking again when the user asked to jump).
As a further deviation from that commit, We also use a comma instead of
a slash to separate the available commands in the prompt, as the current
version of the Perl script does this, and we also add a line about the
question mark ("print help") to the help text.
While it is tempting to use this conversion of `git add -p` as an excuse
to work on `apply_all_patches()` so that it does _not_ want to read a
file from `stdin` or from a file, but accepts, say, an `strbuf` instead,
we will refrain from this particular rabbit hole at this stage.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-12-13 09:07:48 +01:00
|
|
|
LIB_OBJS += add-patch.o
|
2009-09-09 13:38:58 +02:00
|
|
|
LIB_OBJS += advice.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += alias.o
|
|
|
|
LIB_OBJS += alloc.o
|
2016-08-08 23:03:07 +02:00
|
|
|
LIB_OBJS += apply.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += archive-tar.o
|
|
|
|
LIB_OBJS += archive-zip.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += archive.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += attr.o
|
|
|
|
LIB_OBJS += base85.o
|
2009-03-26 05:55:24 +01:00
|
|
|
LIB_OBJS += bisect.o
|
2017-05-24 07:15:33 +02:00
|
|
|
LIB_OBJS += blame.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += blob.o
|
2020-03-30 02:31:24 +02:00
|
|
|
LIB_OBJS += bloom.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += branch.o
|
2011-10-28 23:48:40 +02:00
|
|
|
LIB_OBJS += bulk-checkin.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += bundle.o
|
|
|
|
LIB_OBJS += cache-tree.o
|
2018-03-30 20:35:04 +02:00
|
|
|
LIB_OBJS += chdir-notify.o
|
2017-11-26 20:43:51 +01:00
|
|
|
LIB_OBJS += checkout.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += color.o
|
2012-04-21 06:44:32 +02:00
|
|
|
LIB_OBJS += column.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += combine-diff.o
|
2018-04-02 22:34:19 +02:00
|
|
|
LIB_OBJS += commit-graph.o
|
2018-07-20 18:33:02 +02:00
|
|
|
LIB_OBJS += commit-reach.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += commit.o
|
2011-08-21 00:40:40 +02:00
|
|
|
LIB_OBJS += compat/obstack.o
|
add generic terminal prompt function
When we need to prompt the user for input interactively, we
want to access their terminal directly. We can't rely on
stdio because it may be connected to pipes or files, rather
than the terminal. Instead, we use "getpass()", because it
abstracts the idea of prompting and reading from the
terminal. However, it has some problems:
1. It never echoes the typed characters, which makes it OK
for passwords but annoying for other input (like usernames).
2. Some implementations of getpass() have an extremely
small input buffer (e.g., Solaris 8 is reported to
support only 8 characters).
3. Some implementations of getpass() will fall back to
reading from stdin (e.g., glibc). We explicitly don't
want this, because our stdin may be connected to a pipe
speaking a particular protocol, and reading will
disrupt the protocol flow (e.g., the remote-curl
helper).
4. Some implementations of getpass() turn off signals, so
that hitting "^C" on the terminal does not break out of
the password prompt. This can be a mild annoyance.
Instead, let's provide an abstract "git_terminal_prompt"
function that addresses these concerns. This patch includes
an implementation based on /dev/tty, enabled by setting
HAVE_DEV_TTY. The fallback is to use getpass() as before.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-10 11:41:01 +01:00
|
|
|
LIB_OBJS += compat/terminal.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += config.o
|
|
|
|
LIB_OBJS += connect.o
|
2011-09-03 01:33:22 +02:00
|
|
|
LIB_OBJS += connected.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += convert.o
|
|
|
|
LIB_OBJS += copy.o
|
2011-12-10 11:31:11 +01:00
|
|
|
LIB_OBJS += credential.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += csum-file.o
|
|
|
|
LIB_OBJS += ctype.o
|
|
|
|
LIB_OBJS += date.o
|
|
|
|
LIB_OBJS += decorate.o
|
2018-08-16 08:13:07 +02:00
|
|
|
LIB_OBJS += delta-islands.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += diff-delta.o
|
|
|
|
LIB_OBJS += diff-lib.o
|
|
|
|
LIB_OBJS += diff-no-index.o
|
|
|
|
LIB_OBJS += diff.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += diffcore-break.o
|
|
|
|
LIB_OBJS += diffcore-delta.o
|
|
|
|
LIB_OBJS += diffcore-order.o
|
|
|
|
LIB_OBJS += diffcore-pickaxe.o
|
|
|
|
LIB_OBJS += diffcore-rename.o
|
2016-06-18 06:15:18 +02:00
|
|
|
LIB_OBJS += dir-iterator.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += dir.o
|
2008-07-25 18:28:41 +02:00
|
|
|
LIB_OBJS += editor.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += entry.o
|
|
|
|
LIB_OBJS += environment.o
|
2013-11-14 13:43:51 +01:00
|
|
|
LIB_OBJS += ewah/bitmap.o
|
|
|
|
LIB_OBJS += ewah/ewah_bitmap.o
|
|
|
|
LIB_OBJS += ewah/ewah_io.o
|
|
|
|
LIB_OBJS += ewah/ewah_rlw.o
|
2018-04-10 23:26:18 +02:00
|
|
|
LIB_OBJS += exec-cmd.o
|
2018-06-15 00:54:28 +02:00
|
|
|
LIB_OBJS += fetch-negotiator.o
|
2012-10-26 17:53:55 +02:00
|
|
|
LIB_OBJS += fetch-pack.o
|
2020-03-24 02:07:51 +01:00
|
|
|
LIB_OBJS += fmt-merge-msg.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += fsck.o
|
2017-09-22 18:35:40 +02:00
|
|
|
LIB_OBJS += fsmonitor.o
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
LIB_OBJS += gettext.o
|
2012-05-04 15:52:36 +02:00
|
|
|
LIB_OBJS += gpg-interface.o
|
2008-05-04 12:36:53 +02:00
|
|
|
LIB_OBJS += graph.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += grep.o
|
2013-11-14 20:17:54 +01:00
|
|
|
LIB_OBJS += hashmap.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += help.o
|
2010-01-22 00:25:19 +01:00
|
|
|
LIB_OBJS += hex.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += ident.o
|
2018-07-22 11:57:05 +02:00
|
|
|
LIB_OBJS += interdiff.o
|
2018-07-13 18:54:08 +02:00
|
|
|
LIB_OBJS += json-writer.o
|
Use kwset in pickaxe
Benchmarks in the hot cache case:
before:
$ perf stat --repeat=5 git log -Sqwerty
Performance counter stats for 'git log -Sqwerty' (5 runs):
47,092,744 cache-misses # 2.825 M/sec ( +- 1.607% )
123,368,389 cache-references # 7.400 M/sec ( +- 0.812% )
330,040,998 branch-misses # 3.134 % ( +- 0.257% )
10,530,896,750 branches # 631.663 M/sec ( +- 0.121% )
62,037,201,030 instructions # 1.399 IPC ( +- 0.142% )
44,331,294,321 cycles # 2659.073 M/sec ( +- 0.326% )
96,794 page-faults # 0.006 M/sec ( +- 11.952% )
25 CPU-migrations # 0.000 M/sec ( +- 25.266% )
1,424 context-switches # 0.000 M/sec ( +- 0.540% )
16671.708650 task-clock-msecs # 0.997 CPUs ( +- 0.343% )
16.728692052 seconds time elapsed ( +- 0.344% )
after:
$ perf stat --repeat=5 git log -Sqwerty
Performance counter stats for 'git log -Sqwerty' (5 runs):
51,385,522 cache-misses # 4.619 M/sec ( +- 0.565% )
129,177,880 cache-references # 11.611 M/sec ( +- 0.219% )
319,222,775 branch-misses # 6.946 % ( +- 0.134% )
4,595,913,233 branches # 413.086 M/sec ( +- 0.112% )
31,395,042,533 instructions # 1.062 IPC ( +- 0.129% )
29,558,348,598 cycles # 2656.740 M/sec ( +- 0.204% )
93,224 page-faults # 0.008 M/sec ( +- 4.487% )
19 CPU-migrations # 0.000 M/sec ( +- 10.425% )
950 context-switches # 0.000 M/sec ( +- 0.360% )
11125.796039 task-clock-msecs # 0.997 CPUs ( +- 0.239% )
11.164216599 seconds time elapsed ( +- 0.240% )
So the kwset code is about 33% faster.
Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-21 00:41:57 +02:00
|
|
|
LIB_OBJS += kwset.o
|
2008-08-31 15:50:23 +02:00
|
|
|
LIB_OBJS += levenshtein.o
|
Implement line-history search (git log -L)
This is a rewrite of much of Bo's work, mainly in an effort to split
it into smaller, easier to understand routines.
The algorithm is built around the struct range_set, which encodes a
series of line ranges as intervals [a,b). This is used in two
contexts:
* A set of lines we are tracking (which will change as we dig through
history).
* To encode diffs, as pairs of ranges.
The main routine is range_set_map_across_diff(). It processes the
diff between a commit C and some parent P. It determines which diff
hunks are relevant to the ranges tracked in C, and computes the new
ranges for P.
The algorithm is then simply to process history in topological order
from newest to oldest, computing ranges and (partial) diffs. At
branch points, we need to merge the ranges we are watching. We will
find that many commits do not affect the chosen ranges, and mark them
TREESAME (in addition to those already filtered by pathspec limiting).
Another pass of history simplification then gets rid of such commits.
This is wired as an extra filtering pass in the log machinery. This
currently only reduces code duplication, but should allow for other
simplifications and options to be used.
Finally, we hook a diff printer into the output chain. Ideally we
would wire directly into the diff logic, to optionally use features
like word diff. However, that will require some major reworking of
the diff chain, so we completely replace the output with our own diff
for now.
As this was a GSoC project, and has quite some history by now, many
people have helped. In no particular order, thanks go to
Jakub Narebski <jnareb@gmail.com>
Jens Lehmann <Jens.Lehmann@web.de>
Jonathan Nieder <jrnieder@gmail.com>
Junio C Hamano <gitster@pobox.com>
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Will Palmer <wmpalmer@gmail.com>
Apologies to everyone I forgot.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-28 17:47:32 +01:00
|
|
|
LIB_OBJS += line-log.o
|
2013-03-28 17:47:30 +01:00
|
|
|
LIB_OBJS += line-range.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += linear-assignment.o
|
2017-11-21 21:58:50 +01:00
|
|
|
LIB_OBJS += list-objects-filter-options.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += list-objects-filter.o
|
|
|
|
LIB_OBJS += list-objects.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += ll-merge.o
|
|
|
|
LIB_OBJS += lockfile.o
|
|
|
|
LIB_OBJS += log-tree.o
|
2018-03-15 18:31:20 +01:00
|
|
|
LIB_OBJS += ls-refs.o
|
2015-10-15 02:44:55 +02:00
|
|
|
LIB_OBJS += mailinfo.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += mailmap.o
|
|
|
|
LIB_OBJS += match-trees.o
|
2018-04-11 20:37:55 +02:00
|
|
|
LIB_OBJS += mem-pool.o
|
2012-12-07 00:08:01 +01:00
|
|
|
LIB_OBJS += merge-blobs.o
|
2008-08-12 18:45:14 +02:00
|
|
|
LIB_OBJS += merge-recursive.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += merge.o
|
2012-04-01 00:10:11 +02:00
|
|
|
LIB_OBJS += mergesort.o
|
2018-07-12 21:39:21 +02:00
|
|
|
LIB_OBJS += midx.o
|
2008-03-21 21:16:24 +01:00
|
|
|
LIB_OBJS += name-hash.o
|
2018-06-15 00:54:28 +02:00
|
|
|
LIB_OBJS += negotiator/default.o
|
2018-07-16 20:44:01 +02:00
|
|
|
LIB_OBJS += negotiator/skipping.o
|
2010-04-02 02:07:40 +02:00
|
|
|
LIB_OBJS += notes-cache.o
|
2010-11-09 22:49:46 +01:00
|
|
|
LIB_OBJS += notes-merge.o
|
2013-06-12 02:13:00 +02:00
|
|
|
LIB_OBJS += notes-utils.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += notes.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += object.o
|
2020-04-30 01:15:27 +02:00
|
|
|
LIB_OBJS += oid-array.o
|
2017-09-30 00:54:22 +02:00
|
|
|
LIB_OBJS += oidmap.o
|
2017-02-08 21:53:07 +01:00
|
|
|
LIB_OBJS += oidset.o
|
pack-objects: implement bitmap writing
This commit extends more the functionality of `pack-objects` by allowing
it to write out a `.bitmap` index next to any written packs, together
with the `.idx` index that currently gets written.
If bitmap writing is enabled for a given repository (either by calling
`pack-objects` with the `--write-bitmap-index` flag or by having
`pack.writebitmaps` set to `true` in the config) and pack-objects is
writing a packfile that would normally be indexed (i.e. not piping to
stdout), we will attempt to write the corresponding bitmap index for the
packfile.
Bitmap index writing happens after the packfile and its index has been
successfully written to disk (`finish_tmp_packfile`). The process is
performed in several steps:
1. `bitmap_writer_set_checksum`: this call stores the partial
checksum for the packfile being written; the checksum will be
written in the resulting bitmap index to verify its integrity
2. `bitmap_writer_build_type_index`: this call uses the array of
`struct object_entry` that has just been sorted when writing out
the actual packfile index to disk to generate 4 type-index bitmaps
(one for each object type).
These bitmaps have their nth bit set if the given object is of
the bitmap's type. E.g. the nth bit of the Commits bitmap will be
1 if the nth object in the packfile index is a commit.
This is a very cheap operation because the bitmap writing code has
access to the metadata stored in the `struct object_entry` array,
and hence the real type for each object in the packfile.
3. `bitmap_writer_reuse_bitmaps`: if there exists an existing bitmap
index for one of the packfiles we're trying to repack, this call
will efficiently rebuild the existing bitmaps so they can be
reused on the new index. All the existing bitmaps will be stored
in a `reuse` hash table, and the commit selection phase will
prioritize these when selecting, as they can be written directly
to the new index without having to perform a revision walk to
fill the bitmap. This can greatly speed up the repack of a
repository that already has bitmaps.
4. `bitmap_writer_select_commits`: if bitmap writing is enabled for
a given `pack-objects` run, the sequence of commits generated
during the Counting Objects phase will be stored in an array.
We then use that array to build up the list of selected commits.
Writing a bitmap in the index for each object in the repository
would be cost-prohibitive, so we use a simple heuristic to pick
the commits that will be indexed with bitmaps.
The current heuristics are a simplified version of JGit's
original implementation. We select a higher density of commits
depending on their age: the 100 most recent commits are always
selected, after that we pick 1 commit of each 100, and the gap
increases as the commits grow older. On top of that, we make sure
that every single branch that has not been merged (all the tips
that would be required from a clone) gets their own bitmap, and
when selecting commits between a gap, we tend to prioritize the
commit with the most parents.
Do note that there is no right/wrong way to perform commit
selection; different selection algorithms will result in
different commits being selected, but there's no such thing as
"missing a commit". The bitmap walker algorithm implemented in
`prepare_bitmap_walk` is able to adapt to missing bitmaps by
performing manual walks that complete the bitmap: the ideal
selection algorithm, however, would select the commits that are
more likely to be used as roots for a walk in the future (e.g.
the tips of each branch, and so on) to ensure a bitmap for them
is always available.
5. `bitmap_writer_build`: this is the computationally expensive part
of bitmap generation. Based on the list of commits that were
selected in the previous step, we perform several incremental
walks to generate the bitmap for each commit.
The walks begin from the oldest commit, and are built up
incrementally for each branch. E.g. consider this dag where A, B,
C, D, E, F are the selected commits, and a, b, c, e are a chunk
of simplified history that will not receive bitmaps.
A---a---B--b--C--c--D
\
E--e--F
We start by building the bitmap for A, using A as the root for a
revision walk and marking all the objects that are reachable
until the walk is over. Once this bitmap is stored, we reuse the
bitmap walker to perform the walk for B, assuming that once we
reach A again, the walk will be terminated because A has already
been SEEN on the previous walk.
This process is repeated for C, and D, but when we try to
generate the bitmaps for E, we can reuse neither the current walk
nor the bitmap we have generated so far.
What we do now is resetting both the walk and clearing the
bitmap, and performing the walk from scratch using E as the
origin. This new walk, however, does not need to be completed.
Once we hit B, we can lookup the bitmap we have already stored
for that commit and OR it with the existing bitmap we've composed
so far, allowing us to limit the walk early.
After all the bitmaps have been generated, another iteration
through the list of commits is performed to find the best XOR
offsets for compression before writing them to disk. Because of
the incremental nature of these bitmaps, XORing one of them with
its predecesor results in a minimal "bitmap delta" most of the
time. We can write this delta to the on-disk bitmap index, and
then re-compose the original bitmaps by XORing them again when
loaded.
This is a phase very similar to pack-object's `find_delta` (using
bitmaps instead of objects, of course), except the heuristics
have been greatly simplified: we only check the 10 bitmaps before
any given one to find best compressing one. This gives good
results in practice, because there is locality in the ordering of
the objects (and therefore bitmaps) in the packfile.
6. `bitmap_writer_finish`: the last step in the process is
serializing to disk all the bitmap data that has been generated
in the two previous steps.
The bitmap is written to a tmp file and then moved atomically to
its final destination, using the same process as
`pack-write.c:write_idx_file`.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-21 15:00:16 +01:00
|
|
|
LIB_OBJS += pack-bitmap-write.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += pack-bitmap.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += pack-check.o
|
2013-10-24 20:01:06 +02:00
|
|
|
LIB_OBJS += pack-objects.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += pack-revindex.o
|
|
|
|
LIB_OBJS += pack-write.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += packfile.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += pager.o
|
2011-08-11 11:15:38 +02:00
|
|
|
LIB_OBJS += parse-options-cb.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += parse-options.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += patch-delta.o
|
|
|
|
LIB_OBJS += patch-ids.o
|
|
|
|
LIB_OBJS += path.o
|
2013-01-06 17:58:08 +01:00
|
|
|
LIB_OBJS += pathspec.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += pkt-line.o
|
2009-02-09 23:00:45 +01:00
|
|
|
LIB_OBJS += preload-index.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += pretty.o
|
2013-06-07 04:13:50 +02:00
|
|
|
LIB_OBJS += prio-queue.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += progress.o
|
2019-06-25 15:40:27 +02:00
|
|
|
LIB_OBJS += promisor-remote.o
|
2011-12-10 11:40:54 +01:00
|
|
|
LIB_OBJS += prompt.o
|
2017-10-16 19:55:24 +02:00
|
|
|
LIB_OBJS += protocol.o
|
2020-03-24 02:07:52 +01:00
|
|
|
LIB_OBJS += prune-packed.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += quote.o
|
2018-08-13 13:33:04 +02:00
|
|
|
LIB_OBJS += range-diff.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += reachable.o
|
|
|
|
LIB_OBJS += read-cache.o
|
2018-08-10 18:51:29 +02:00
|
|
|
LIB_OBJS += rebase-interactive.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += rebase.o
|
|
|
|
LIB_OBJS += ref-filter.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += reflog-walk.o
|
|
|
|
LIB_OBJS += refs.o
|
2015-11-09 14:34:01 +01:00
|
|
|
LIB_OBJS += refs/files-backend.o
|
refs: introduce an iterator interface
Currently, the API for iterating over references is via a family of
for_each_ref()-type functions that invoke a callback function for each
selected reference. All of these eventually call do_for_each_ref(),
which knows how to do one thing: iterate in parallel through two
ref_caches, one for loose and one for packed refs, giving loose
references precedence over packed refs. This is rather complicated code,
and is quite specialized to the files backend. It also requires callers
to encapsulate their work into a callback function, which often means
that they have to define and use a "cb_data" struct to manage their
context.
The current design is already bursting at the seams, and will become
even more awkward in the upcoming world of multiple reference storage
backends:
* Per-worktree vs. shared references are currently handled via a kludge
in git_path() rather than iterating over each part of the reference
namespace separately and merging the results. This kludge will cease
to work when we have multiple reference storage backends.
* The current scheme is inflexible. What if we sometimes want to bypass
the ref_cache, or use it only for packed or only for loose refs? What
if we want to store symbolic refs in one type of storage backend and
non-symbolic ones in another?
In the future, each reference backend will need to define its own way of
iterating over references. The crux of the problem with the current
design is that it is impossible to compose for_each_ref()-style
iterations, because the flow of control is owned by the for_each_ref()
function. There is nothing that a caller can do but iterate through all
references in a single burst, so there is no way for it to interleave
references from multiple backends and present the result to the rest of
the world as a single compound backend.
This commit introduces a new iteration primitive for references: a
ref_iterator. A ref_iterator is a polymorphic object that a reference
storage backend can be asked to instantiate. There are three functions
that can be applied to a ref_iterator:
* ref_iterator_advance(): move to the next reference in the iteration
* ref_iterator_abort(): end the iteration before it is exhausted
* ref_iterator_peel(): peel the reference currently being looked at
Iterating using a ref_iterator leaves the flow of control in the hands
of the caller, which means that ref_iterators from multiple
sources (e.g., loose and packed refs) can be composed and presented to
the world as a single compound ref_iterator.
It also means that the backend code for implementing reference iteration
will sometimes be more complicated. For example, the
cache_ref_iterator (which iterates over a ref_cache) can't use the C
stack to recurse; instead, it must manage its own stack internally as
explicit data structures. There is also a lot of boilerplate connected
with object-oriented programming in C.
Eventually, end-user callers will be able to be written in a more
natural way—managing their own flow of control rather than having to
work via callbacks. Since there will only be a few reference backends
but there are many consumers of this API, this is a good tradeoff.
More importantly, we gain composability, and especially the possibility
of writing interchangeable parts that can work with any ref_iterator.
For example, merge_ref_iterator implements a generic way of merging the
contents of any two ref_iterators. It is used to merge loose + packed
refs as part of the implementation of the files_ref_iterator. But it
will also be possible to use it to merge other pairs of reference
sources (e.g., per-worktree vs. shared refs).
Another example is prefix_ref_iterator, which can be used to trim a
prefix off the front of reference names before presenting them to the
caller (e.g., "refs/heads/master" -> "master").
In this patch, we introduce the iterator abstraction and many utilities,
and implement a reference iterator for the files ref storage backend.
(I've written several other obvious utilities, for example a generic way
to filter references being iterated over. These will probably be useful
in the future. But they are not needed for this patch series, so I am
not including them at this time.)
In a moment we will rewrite do_for_each_ref() to work via reference
iterators (allowing some special-purpose code to be discarded), and do
something similar for reflogs. In future patch series, we will expose
the ref_iterator abstraction in the public refs API so that callers can
use it directly.
Implementation note: I tried abstracting this a layer further to allow
generic iterators (over arbitrary types of objects) and generic
utilities like a generic merge_iterator. But the implementation in C was
very cumbersome, involving (in my opinion) too much boilerplate and too
much unsafe casting, some of which would have had to be done on the
caller side. However, I did put a few iterator-related constants in a
top-level header file, iterator.h, as they will be useful in a moment to
implement iteration over directory trees and possibly other types of
iterators in the future.
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-18 06:15:15 +02:00
|
|
|
LIB_OBJS += refs/iterator.o
|
2017-06-23 09:01:37 +02:00
|
|
|
LIB_OBJS += refs/packed-backend.o
|
2017-04-16 08:41:31 +02:00
|
|
|
LIB_OBJS += refs/ref-cache.o
|
2018-05-17 00:57:48 +02:00
|
|
|
LIB_OBJS += refspec.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += remote.o
|
2018-04-10 23:26:21 +02:00
|
|
|
LIB_OBJS += replace-object.o
|
2019-08-13 20:37:43 +02:00
|
|
|
LIB_OBJS += repo-settings.o
|
2017-06-22 20:43:32 +02:00
|
|
|
LIB_OBJS += repository.o
|
2008-07-09 14:58:57 +02:00
|
|
|
LIB_OBJS += rerere.o
|
2020-04-07 16:28:00 +02:00
|
|
|
LIB_OBJS += reset.o
|
2009-12-25 09:30:51 +01:00
|
|
|
LIB_OBJS += resolve-undo.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += revision.o
|
|
|
|
LIB_OBJS += run-command.o
|
2012-10-26 17:53:53 +02:00
|
|
|
LIB_OBJS += send-pack.o
|
2012-05-04 15:52:36 +02:00
|
|
|
LIB_OBJS += sequencer.o
|
2018-03-15 18:31:19 +01:00
|
|
|
LIB_OBJS += serve.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += server-info.o
|
|
|
|
LIB_OBJS += setup.o
|
2018-04-10 23:26:20 +02:00
|
|
|
LIB_OBJS += sha1-file.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += sha1-lookup.o
|
2018-04-10 23:26:19 +02:00
|
|
|
LIB_OBJS += sha1-name.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += shallow.o
|
|
|
|
LIB_OBJS += sideband.o
|
chain kill signals for cleanup functions
If a piece of code wanted to do some cleanup before exiting
(e.g., cleaning up a lockfile or a tempfile), our usual
strategy was to install a signal handler that did something
like this:
do_cleanup(); /* actual work */
signal(signo, SIG_DFL); /* restore previous behavior */
raise(signo); /* deliver signal, killing ourselves */
For a single handler, this works fine. However, if we want
to clean up two _different_ things, we run into a problem.
The most recently installed handler will run, but when it
removes itself as a handler, it doesn't put back the first
handler.
This patch introduces sigchain, a tiny library for handling
a stack of signal handlers. You sigchain_push each handler,
and use sigchain_pop to restore whoever was before you in
the stack.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-22 07:02:35 +01:00
|
|
|
LIB_OBJS += sigchain.o
|
2014-06-13 14:19:36 +02:00
|
|
|
LIB_OBJS += split-index.o
|
2019-09-30 19:21:54 +02:00
|
|
|
LIB_OBJS += stable-qsort.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += strbuf.o
|
2020-07-28 22:23:39 +02:00
|
|
|
LIB_OBJS += strvec.o
|
2011-05-12 04:30:25 +02:00
|
|
|
LIB_OBJS += streaming.o
|
2009-02-09 23:00:45 +01:00
|
|
|
LIB_OBJS += string-list.o
|
2017-05-05 17:28:01 +02:00
|
|
|
LIB_OBJS += sub-process.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += submodule-config.o
|
|
|
|
LIB_OBJS += submodule.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += symlinks.o
|
|
|
|
LIB_OBJS += tag.o
|
2015-08-10 11:47:41 +02:00
|
|
|
LIB_OBJS += tempfile.o
|
2018-10-27 19:29:59 +02:00
|
|
|
LIB_OBJS += thread-utils.o
|
2016-10-03 22:49:11 +02:00
|
|
|
LIB_OBJS += tmp-objdir.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += trace.o
|
2019-02-22 23:25:01 +01:00
|
|
|
LIB_OBJS += trace2.o
|
|
|
|
LIB_OBJS += trace2/tr2_cfg.o
|
|
|
|
LIB_OBJS += trace2/tr2_cmd_name.o
|
|
|
|
LIB_OBJS += trace2/tr2_dst.o
|
|
|
|
LIB_OBJS += trace2/tr2_sid.o
|
2019-04-15 22:39:47 +02:00
|
|
|
LIB_OBJS += trace2/tr2_sysenv.o
|
2019-02-22 23:25:01 +01:00
|
|
|
LIB_OBJS += trace2/tr2_tbuf.o
|
|
|
|
LIB_OBJS += trace2/tr2_tgt_event.o
|
|
|
|
LIB_OBJS += trace2/tr2_tgt_normal.o
|
|
|
|
LIB_OBJS += trace2/tr2_tgt_perf.o
|
|
|
|
LIB_OBJS += trace2/tr2_tls.o
|
2014-10-13 20:16:23 +02:00
|
|
|
LIB_OBJS += trailer.o
|
2009-08-05 07:01:53 +02:00
|
|
|
LIB_OBJS += transport-helper.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += transport.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += tree-diff.o
|
|
|
|
LIB_OBJS += tree-walk.o
|
2020-03-21 10:21:20 +01:00
|
|
|
LIB_OBJS += tree.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += unpack-trees.o
|
2018-03-14 19:31:41 +01:00
|
|
|
LIB_OBJS += upload-pack.o
|
2010-05-23 11:17:55 +02:00
|
|
|
LIB_OBJS += url.o
|
2013-08-05 22:20:36 +02:00
|
|
|
LIB_OBJS += urlmatch.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += usage.o
|
2009-02-09 23:00:45 +01:00
|
|
|
LIB_OBJS += userdiff.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += utf8.o
|
2012-04-04 00:53:08 +02:00
|
|
|
LIB_OBJS += varint.o
|
2012-06-02 20:51:42 +02:00
|
|
|
LIB_OBJS += version.o
|
2014-02-27 13:56:52 +01:00
|
|
|
LIB_OBJS += versioncmp.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += walker.o
|
2012-10-15 08:25:55 +02:00
|
|
|
LIB_OBJS += wildmatch.o
|
2015-10-02 13:55:31 +02:00
|
|
|
LIB_OBJS += worktree.o
|
Shrink the git binary a bit by avoiding unnecessary inline functions
So I was looking at the disgusting size of the git binary, and even with
the debugging removed, and using -Os instead of -O2, the size of the text
section was pretty high. In this day and age I guess almost a megabyte of
text isn't really all that surprising, but it still doesn't exactly make
me think "lean and mean".
With -Os, a surprising amount of text space is wasted on inline functions
that end up just being replicated multiple times, and where performance
really isn't a valid reason to inline them. In particular, the trivial
wrapper functions like "xmalloc()" are used _everywhere_, and making them
inline just duplicates the text (and the string we use to 'die()' on
failure) unnecessarily.
So this just moves them into a "wrapper.c" file, getting rid of a tiny bit
of unnecessary bloat. The following numbers are both with "CFLAGS=-Os":
Before:
[torvalds@woody git]$ size git
text data bss dec hex filename
700460 15160 292184 1007804 f60bc git
After:
[torvalds@woody git]$ size git
text data bss dec hex filename
670540 15160 292184 977884 eebdc git
so it saves almost 30k of text-space (it actually saves more than that
with the default -O2, but I don't think that's necessarily a very relevant
number from a "try to shrink git" standpoint).
It might conceivably have a performance impact, but none of this should be
_that_ performance critical. The real cost is not generally in the wrapper
anyway, but in the code it wraps (ie the cost of "xread()" is all in the
read itself, not in the trivial wrapping of it).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-22 21:19:25 +02:00
|
|
|
LIB_OBJS += wrapper.o
|
2018-04-10 23:26:16 +02:00
|
|
|
LIB_OBJS += write-or-die.o
|
2008-03-12 09:46:26 +01:00
|
|
|
LIB_OBJS += ws.o
|
|
|
|
LIB_OBJS += wt-status.o
|
|
|
|
LIB_OBJS += xdiff-interface.o
|
2010-11-06 12:47:34 +01:00
|
|
|
LIB_OBJS += zlib.o
|
2008-03-12 09:46:26 +01:00
|
|
|
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/add.o
|
2015-08-04 15:51:24 +02:00
|
|
|
BUILTIN_OBJS += builtin/am.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/annotate.o
|
|
|
|
BUILTIN_OBJS += builtin/apply.o
|
|
|
|
BUILTIN_OBJS += builtin/archive.o
|
|
|
|
BUILTIN_OBJS += builtin/bisect--helper.o
|
|
|
|
BUILTIN_OBJS += builtin/blame.o
|
|
|
|
BUILTIN_OBJS += builtin/branch.o
|
2020-08-13 16:59:36 +02:00
|
|
|
BUILTIN_OBJS += builtin/bugreport.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/bundle.o
|
|
|
|
BUILTIN_OBJS += builtin/cat-file.o
|
|
|
|
BUILTIN_OBJS += builtin/check-attr.o
|
2013-01-06 17:58:13 +01:00
|
|
|
BUILTIN_OBJS += builtin/check-ignore.o
|
2013-07-13 02:53:10 +02:00
|
|
|
BUILTIN_OBJS += builtin/check-mailmap.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/check-ref-format.o
|
|
|
|
BUILTIN_OBJS += builtin/checkout-index.o
|
|
|
|
BUILTIN_OBJS += builtin/checkout.o
|
|
|
|
BUILTIN_OBJS += builtin/clean.o
|
|
|
|
BUILTIN_OBJS += builtin/clone.o
|
2020-08-13 16:58:55 +02:00
|
|
|
BUILTIN_OBJS += builtin/credential-cache.o
|
|
|
|
BUILTIN_OBJS += builtin/credential-cache--daemon.o
|
|
|
|
BUILTIN_OBJS += builtin/credential-store.o
|
2012-04-21 06:44:32 +02:00
|
|
|
BUILTIN_OBJS += builtin/column.o
|
2020-03-21 10:21:20 +01:00
|
|
|
BUILTIN_OBJS += builtin/commit-graph.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/commit-tree.o
|
|
|
|
BUILTIN_OBJS += builtin/commit.o
|
|
|
|
BUILTIN_OBJS += builtin/config.o
|
|
|
|
BUILTIN_OBJS += builtin/count-objects.o
|
2012-06-24 13:39:59 +02:00
|
|
|
BUILTIN_OBJS += builtin/credential.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/describe.o
|
|
|
|
BUILTIN_OBJS += builtin/diff-files.o
|
|
|
|
BUILTIN_OBJS += builtin/diff-index.o
|
|
|
|
BUILTIN_OBJS += builtin/diff-tree.o
|
|
|
|
BUILTIN_OBJS += builtin/diff.o
|
2017-01-17 16:54:57 +01:00
|
|
|
BUILTIN_OBJS += builtin/difftool.o
|
2019-06-21 12:18:06 +02:00
|
|
|
BUILTIN_OBJS += builtin/env--helper.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/fast-export.o
|
2020-08-13 16:59:45 +02:00
|
|
|
BUILTIN_OBJS += builtin/fast-import.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/fetch-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/fetch.o
|
|
|
|
BUILTIN_OBJS += builtin/fmt-merge-msg.o
|
|
|
|
BUILTIN_OBJS += builtin/for-each-ref.o
|
|
|
|
BUILTIN_OBJS += builtin/fsck.o
|
|
|
|
BUILTIN_OBJS += builtin/gc.o
|
2013-12-03 00:37:10 +01:00
|
|
|
BUILTIN_OBJS += builtin/get-tar-commit-id.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/grep.o
|
|
|
|
BUILTIN_OBJS += builtin/hash-object.o
|
|
|
|
BUILTIN_OBJS += builtin/help.o
|
|
|
|
BUILTIN_OBJS += builtin/index-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/init-db.o
|
2014-10-13 20:16:29 +02:00
|
|
|
BUILTIN_OBJS += builtin/interpret-trailers.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/log.o
|
|
|
|
BUILTIN_OBJS += builtin/ls-files.o
|
|
|
|
BUILTIN_OBJS += builtin/ls-remote.o
|
|
|
|
BUILTIN_OBJS += builtin/ls-tree.o
|
|
|
|
BUILTIN_OBJS += builtin/mailinfo.o
|
|
|
|
BUILTIN_OBJS += builtin/mailsplit.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-base.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-file.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-index.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-ours.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-recursive.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-tree.o
|
2020-03-21 10:21:20 +01:00
|
|
|
BUILTIN_OBJS += builtin/merge.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/mktag.o
|
|
|
|
BUILTIN_OBJS += builtin/mktree.o
|
2018-07-12 21:39:20 +02:00
|
|
|
BUILTIN_OBJS += builtin/multi-pack-index.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/mv.o
|
|
|
|
BUILTIN_OBJS += builtin/name-rev.o
|
2010-03-15 08:52:06 +01:00
|
|
|
BUILTIN_OBJS += builtin/notes.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/pack-objects.o
|
|
|
|
BUILTIN_OBJS += builtin/pack-redundant.o
|
|
|
|
BUILTIN_OBJS += builtin/pack-refs.o
|
|
|
|
BUILTIN_OBJS += builtin/patch-id.o
|
|
|
|
BUILTIN_OBJS += builtin/prune-packed.o
|
|
|
|
BUILTIN_OBJS += builtin/prune.o
|
2015-06-14 10:41:51 +02:00
|
|
|
BUILTIN_OBJS += builtin/pull.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/push.o
|
2018-08-13 13:33:02 +02:00
|
|
|
BUILTIN_OBJS += builtin/range-diff.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/read-tree.o
|
2018-08-06 21:31:09 +02:00
|
|
|
BUILTIN_OBJS += builtin/rebase.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/receive-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/reflog.o
|
2010-10-12 18:39:43 +02:00
|
|
|
BUILTIN_OBJS += builtin/remote-ext.o
|
2010-10-12 18:39:42 +02:00
|
|
|
BUILTIN_OBJS += builtin/remote-fd.o
|
2020-03-21 10:21:20 +01:00
|
|
|
BUILTIN_OBJS += builtin/remote.o
|
2013-09-15 17:33:20 +02:00
|
|
|
BUILTIN_OBJS += builtin/repack.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/replace.o
|
|
|
|
BUILTIN_OBJS += builtin/rerere.o
|
|
|
|
BUILTIN_OBJS += builtin/reset.o
|
|
|
|
BUILTIN_OBJS += builtin/rev-list.o
|
|
|
|
BUILTIN_OBJS += builtin/rev-parse.o
|
|
|
|
BUILTIN_OBJS += builtin/revert.o
|
|
|
|
BUILTIN_OBJS += builtin/rm.o
|
|
|
|
BUILTIN_OBJS += builtin/send-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/shortlog.o
|
|
|
|
BUILTIN_OBJS += builtin/show-branch.o
|
2018-05-28 11:38:53 +02:00
|
|
|
BUILTIN_OBJS += builtin/show-index.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/show-ref.o
|
2019-11-21 23:04:33 +01:00
|
|
|
BUILTIN_OBJS += builtin/sparse-checkout.o
|
2019-02-26 00:16:28 +01:00
|
|
|
BUILTIN_OBJS += builtin/stash.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/stripspace.o
|
2015-09-02 23:42:24 +02:00
|
|
|
BUILTIN_OBJS += builtin/submodule--helper.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/symbolic-ref.o
|
|
|
|
BUILTIN_OBJS += builtin/tag.o
|
|
|
|
BUILTIN_OBJS += builtin/unpack-file.o
|
|
|
|
BUILTIN_OBJS += builtin/unpack-objects.o
|
|
|
|
BUILTIN_OBJS += builtin/update-index.o
|
|
|
|
BUILTIN_OBJS += builtin/update-ref.o
|
|
|
|
BUILTIN_OBJS += builtin/update-server-info.o
|
|
|
|
BUILTIN_OBJS += builtin/upload-archive.o
|
2018-03-14 19:31:41 +01:00
|
|
|
BUILTIN_OBJS += builtin/upload-pack.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/var.o
|
2014-06-23 09:05:49 +02:00
|
|
|
BUILTIN_OBJS += builtin/verify-commit.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/verify-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/verify-tag.o
|
2015-06-29 14:51:18 +02:00
|
|
|
BUILTIN_OBJS += builtin/worktree.o
|
2010-02-22 17:42:18 +01:00
|
|
|
BUILTIN_OBJS += builtin/write-tree.o
|
2006-04-21 19:27:34 +02:00
|
|
|
|
2019-09-16 21:23:11 +02:00
|
|
|
# THIRD_PARTY_SOURCES is a list of patterns compatible with the
|
|
|
|
# $(filter) and $(filter-out) family of functions. They specify source
|
|
|
|
# files which are taken from some third-party source where we want to be
|
|
|
|
# less strict about issues such as coding style so we don't diverge from
|
|
|
|
# upstream unnecessarily (making merging in future changes easier).
|
|
|
|
THIRD_PARTY_SOURCES += compat/inet_ntop.c
|
|
|
|
THIRD_PARTY_SOURCES += compat/inet_pton.c
|
|
|
|
THIRD_PARTY_SOURCES += compat/nedmalloc/%
|
|
|
|
THIRD_PARTY_SOURCES += compat/obstack.%
|
|
|
|
THIRD_PARTY_SOURCES += compat/poll/%
|
|
|
|
THIRD_PARTY_SOURCES += compat/regex/%
|
|
|
|
THIRD_PARTY_SOURCES += sha1collisiondetection/%
|
|
|
|
THIRD_PARTY_SOURCES += sha1dc/%
|
|
|
|
|
add an extra level of indirection to main()
There are certain startup tasks that we expect every git
process to do. In some cases this is just to improve the
quality of the program (e.g., setting up gettext()). In
others it is a requirement for using certain functions in
libgit.a (e.g., system_path() expects that you have called
git_extract_argv0_path()).
Most commands are builtins and are covered by the git.c
version of main(). However, there are still a few external
commands that use their own main(). Each of these has to
remember to include the correct startup sequence, and we are
not always consistent.
Rather than just fix the inconsistencies, let's make this
harder to get wrong by providing a common main() that can
run this standard startup.
We basically have two options to do this:
- the compat/mingw.h file already does something like this by
adding a #define that replaces the definition of main with a
wrapper that calls mingw_startup().
The upside is that the code in each program doesn't need
to be changed at all; it's rewritten on the fly by the
preprocessor.
The downside is that it may make debugging of the startup
sequence a bit more confusing, as the preprocessor is
quietly inserting new code.
- the builtin functions are all of the form cmd_foo(),
and git.c's main() calls them.
This is much more explicit, which may make things more
obvious to somebody reading the code. It's also more
flexible (because of course we have to figure out _which_
cmd_foo() to call).
The downside is that each of the builtins must define
cmd_foo(), instead of just main().
This patch chooses the latter option, preferring the more
explicit approach, even though it is more invasive. We
introduce a new file common-main.c, with the "real" main. It
expects to call cmd_main() from whatever other objects it is
linked against.
We link common-main.o against anything that links against
libgit.a, since we know that such programs will need to do
this setup. Note that common-main.o can't actually go inside
libgit.a, as the linker would not pick up its main()
function automatically (it has no callers).
The rest of the patch is just adjusting all of the various
external programs (mostly in t/helper) to use cmd_main().
I've provided a global declaration for cmd_main(), which
means that all of the programs also need to match its
signature. In particular, many functions need to switch to
"const char **" instead of "char **" for argv. This effect
ripples out to a few other variables and functions, as well.
This makes the patch even more invasive, but the end result
is much better. We should be treating argv strings as const
anyway, and now all programs conform to the same signature
(which also matches the way builtins are defined).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-01 07:58:58 +02:00
|
|
|
GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
|
2007-07-29 20:35:45 +02:00
|
|
|
EXTLIBS =
|
2005-04-21 21:33:22 +02:00
|
|
|
|
2012-06-02 21:01:12 +02:00
|
|
|
GIT_USER_AGENT = git/$(GIT_VERSION)
|
|
|
|
|
2017-07-02 00:05:47 +02:00
|
|
|
ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
|
|
|
|
DC_SHA1_SUBMODULE = auto
|
|
|
|
endif
|
|
|
|
|
2019-02-22 15:41:26 +01:00
|
|
|
# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
|
|
|
|
# tweaked by config.* below as well as the command-line, both of
|
|
|
|
# which'll override these defaults.
|
|
|
|
CFLAGS = -g -O2 -Wall
|
|
|
|
LDFLAGS =
|
Makefile: remove the NO_R_TO_GCC_LINKER flag
Change our default CC_LD_DYNPATH invocation to something GCC likes
these days. Since the GCC 4.6 release unknown flags haven't been
passed through to ld(1). Thus our previous default of CC_LD_DYNPATH=-R
would cause an error on modern GCC unless NO_R_TO_GCC_LINKER was set.
This CC_LD_DYNPATH flag is really obscure, and I don't expect anyone
except those working on git development ever use this.
It's not needed to simply link to libraries like say libpcre,
but *only* for those cases where we're linking to such a library not
present in the OS's library directories. See e.g. ldconfig(8) on Linux
for more details.
I use this to compile my git with a LIBPCREDIR=$HOME/g/pcre2/inst as
I'm building that from source, but someone maintaining an OS package
is almost certainly not going to use this. They're just going to set
USE_LIBPCRE=YesPlease after installing the libpcre dependency,
which'll point to OS libraries which ld(1) will find without the help
of CC_LD_DYNPATH.
Another thing that helps mitigate any potential breakage is that we
detect the right type of invocation in configure.ac, which e.g. HP/UX
uses[1], as does IBM's AIX package[2]. From what I can tell both AIX
and Solaris packagers are building git with GCC, so I'm not adding a
corresponding config.mak.uname default to cater to their OS-native
linkers.
Now for an overview of past development in this area:
Our use of "-R" dates back to 455a7f3275 ("More portability.",
2005-09-30). Soon after that in bbfc63dd78 ("gcc does not necessarily
pass runtime libpath with -R", 2006-12-27) the NO_R_TO_GCC flag was
added, allowing optional use of "-Wl,-rpath=".
Then in f5b904db6b ("Makefile: Allow CC_LD_DYNPATH to be overriden",
2008-08-16) the ability to override this flag to something else
entirely was added, as some linkers use neither "-Wl,-rpath," nor
"-R".
From what I can tell we should, with the benefit of hindsight, have
made this change back in 2006. GCC & ld supported this type of
invocation back then, or since at least binutils-gdb.git's[3]
a1ad915dc4 ("[...]Add support for -rpath[...]", 1994-07-20).
Further reading and prior art can be found at [4][5][6][7]. Making a
plain "-R" an error seems from reading those reports to have been
introduced in GCC 4.6 released on March 25, 2011[8], but I couldn't
confirm this with absolute certainty, its release notes are ambiguous
on the subject, and I couldn't be bothered to try to build & bisect it
against GCC 4.5.
1. https://public-inbox.org/git/20190516093412.14795-1-avarab@gmail.com/
2. https://www.ibm.com/developerworks/aix/library/aix-toolbox/alpha.html
3. git://sourceware.org/git/binutils-gdb.git
4. https://github.com/tsuna/boost.m4/issues/15
5. https://bugzilla.gnome.org/show_bug.cgi?id=641416
6. https://stackoverflow.com/questions/12629042/g-4-6-real-error-unrecognized-option-r
7. https://curl.haxx.se/mail/archive-2014-11/0005.html
8. https://gcc.gnu.org/gcc-4.6/changes.html
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-17 23:58:47 +02:00
|
|
|
CC_LD_DYNPATH = -Wl,-rpath,
|
2019-02-22 15:41:26 +01:00
|
|
|
BASIC_CFLAGS = -I.
|
|
|
|
BASIC_LDFLAGS =
|
|
|
|
|
|
|
|
# library flags
|
|
|
|
ARFLAGS = rcs
|
|
|
|
PTHREAD_CFLAGS =
|
|
|
|
|
|
|
|
# For the 'sparse' target
|
|
|
|
SPARSE_FLAGS ?=
|
2020-05-22 02:25:02 +02:00
|
|
|
SP_EXTRA_FLAGS = -Wno-universal-initializer
|
2019-02-22 15:41:26 +01:00
|
|
|
|
2019-05-07 01:43:34 +02:00
|
|
|
# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
|
|
|
|
# usually result in less CPU usage at the cost of higher peak memory.
|
2019-05-08 09:07:54 +02:00
|
|
|
# Setting it to 0 will feed all files in a single spatch invocation.
|
2019-02-22 15:41:26 +01:00
|
|
|
SPATCH_FLAGS = --all-includes --patch .
|
2019-05-07 01:43:34 +02:00
|
|
|
SPATCH_BATCH_SIZE = 1
|
2019-02-22 15:41:26 +01:00
|
|
|
|
Makefile: hoist uname autodetection to config.mak.uname
Our Makefile first sets up some sane per-platform defaults
by looking at "uname", then modifies that according to the
results of autoconf (if any), then modifies that according
to the user's wishes in config.mak.
For sub-Makefiles like Documentation/Makefile, the latter
two are available, but the uname defaults are available only
to the main Makefile. This hasn't been a problem so far,
because the sub-Makefiles do not rely on any of those
automatic settings to do their work.
This patch puts the uname magic into its own file so it can
be reused in other Makefiles, opening up the possibility of
new knobs.
Note that we leave one reference to uname in the top-level
Makefile: if we are on Darwin, we must check the NO_FINK and
NO_DARWIN_PORTS settings. But because we are combining uname
settings with user-options, we must do so after all of the
config is loaded. This is acceptable, as the resulting
conditionals are about setting variables specific to the
top-level Makefile (and if that ever changes, we can hoist
them into a separate post-config include, too).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-03 22:05:41 +01:00
|
|
|
include config.mak.uname
|
2006-07-03 01:56:48 +02:00
|
|
|
-include config.mak.autogen
|
2005-10-12 00:22:47 +02:00
|
|
|
-include config.mak
|
2005-09-07 21:22:56 +02:00
|
|
|
|
2016-05-31 15:24:43 +02:00
|
|
|
ifdef DEVELOPER
|
2018-04-14 21:19:44 +02:00
|
|
|
include config.mak.dev
|
2016-05-31 15:24:43 +02:00
|
|
|
endif
|
|
|
|
|
2019-02-22 15:41:27 +01:00
|
|
|
ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
|
2019-02-22 15:41:26 +01:00
|
|
|
ALL_LDFLAGS = $(LDFLAGS)
|
|
|
|
|
2017-07-15 19:18:56 +02:00
|
|
|
comma := ,
|
|
|
|
empty :=
|
|
|
|
space := $(empty) $(empty)
|
|
|
|
|
2017-07-10 15:24:42 +02:00
|
|
|
ifdef SANITIZE
|
2017-07-15 19:18:56 +02:00
|
|
|
SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
|
2017-07-10 15:24:42 +02:00
|
|
|
BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
|
2017-07-10 15:24:47 +02:00
|
|
|
BASIC_CFLAGS += -fno-omit-frame-pointer
|
2017-07-15 19:18:56 +02:00
|
|
|
ifneq ($(filter undefined,$(SANITIZERS)),)
|
2017-07-10 15:24:50 +02:00
|
|
|
BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
|
2019-03-12 22:06:26 +01:00
|
|
|
BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
|
2017-07-10 15:24:50 +02:00
|
|
|
endif
|
add UNLEAK annotation for reducing leak false positives
It's a common pattern in git commands to allocate some
memory that should last for the lifetime of the program and
then not bother to free it, relying on the OS to throw it
away.
This keeps the code simple, and it's fast (we don't waste
time traversing structures or calling free at the end of the
program). But it also triggers warnings from memory-leak
checkers like valgrind or LSAN. They know that the memory
was still allocated at program exit, but they don't know
_when_ the leaked memory stopped being useful. If it was
early in the program, then it's probably a real and
important leak. But if it was used right up until program
exit, it's not an interesting leak and we'd like to suppress
it so that we can see the real leaks.
This patch introduces an UNLEAK() macro that lets us do so.
To understand its design, let's first look at some of the
alternatives.
Unfortunately the suppression systems offered by
leak-checking tools don't quite do what we want. A
leak-checker basically knows two things:
1. Which blocks were allocated via malloc, and the
callstack during the allocation.
2. Which blocks were left un-freed at the end of the
program (and which are unreachable, but more on that
later).
Their suppressions work by mentioning the function or
callstack of a particular allocation, and marking it as OK
to leak. So imagine you have code like this:
int cmd_foo(...)
{
/* this allocates some memory */
char *p = some_function();
printf("%s", p);
return 0;
}
You can say "ignore allocations from some_function(),
they're not leaks". But that's not right. That function may
be called elsewhere, too, and we would potentially want to
know about those leaks.
So you can say "ignore the callstack when main calls
some_function". That works, but your annotations are
brittle. In this case it's only two functions, but you can
imagine that the actual allocation is much deeper. If any of
the intermediate code changes, you have to update the
suppression.
What we _really_ want to say is that "the value assigned to
p at the end of the function is not a real leak". But
leak-checkers can't understand that; they don't know about
"p" in the first place.
However, we can do something a little bit tricky if we make
some assumptions about how leak-checkers work. They
generally don't just report all un-freed blocks. That would
report even globals which are still accessible when the
leak-check is run. Instead they take some set of memory
(like BSS) as a root and mark it as "reachable". Then they
scan the reachable blocks for anything that looks like a
pointer to a malloc'd block, and consider that block
reachable. And then they scan those blocks, and so on,
transitively marking anything reachable from a global as
"not leaked" (or at least leaked in a different category).
So we can mark the value of "p" as reachable by putting it
into a variable with program lifetime. One way to do that is
to just mark "p" as static. But that actually affects the
run-time behavior if the function is called twice (you
aren't likely to call main() twice, but some of our cmd_*()
functions are called from other commands).
Instead, we can trick the leak-checker by putting the value
into _any_ reachable bytes. This patch keeps a global
linked-list of bytes copied from "unleaked" variables. That
list is reachable even at program exit, which confers
recursive reachability on whatever values we unleak.
In other words, you can do:
int cmd_foo(...)
{
char *p = some_function();
printf("%s", p);
UNLEAK(p);
return 0;
}
to annotate "p" and suppress the leak report.
But wait, couldn't we just say "free(p)"? In this toy
example, yes. But UNLEAK()'s byte-copying strategy has
several advantages over actually freeing the memory:
1. It's recursive across structures. In many cases our "p"
is not just a pointer, but a complex struct whose
fields may have been allocated by a sub-function. And
in some cases (e.g., dir_struct) we don't even have a
function which knows how to free all of the struct
members.
By marking the struct itself as reachable, that confers
reachability on any pointers it contains (including those
found in embedded structs, or reachable by walking
heap blocks recursively.
2. It works on cases where we're not sure if the value is
allocated or not. For example:
char *p = argc > 1 ? argv[1] : some_function();
It's safe to use UNLEAK(p) here, because it's not
freeing any memory. In the case that we're pointing to
argv here, the reachability checker will just ignore
our bytes.
3. Likewise, it works even if the variable has _already_
been freed. We're just copying the pointer bytes. If
the block has been freed, the leak-checker will skip
over those bytes as uninteresting.
4. Because it's not actually freeing memory, you can
UNLEAK() before we are finished accessing the variable.
This is helpful in cases like this:
char *p = some_function();
return another_function(p);
Writing this with free() requires:
int ret;
char *p = some_function();
ret = another_function(p);
free(p);
return ret;
But with unleak we can just write:
char *p = some_function();
UNLEAK(p);
return another_function(p);
This patch adds the UNLEAK() macro and enables it
automatically when Git is compiled with SANITIZE=leak. In
normal builds it's a noop, so we pay no runtime cost.
It also adds some UNLEAK() annotations to show off how the
feature works. On top of other recent leak fixes, these are
enough to get t0000 and t0001 to pass when compiled with
LSAN.
Note the case in commit.c which actually converts a
strbuf_release() into an UNLEAK. This code was already
non-leaky, but the free didn't do anything useful, since
we're exiting. Converting it to an annotation means that
non-leak-checking builds pay no runtime cost. The cost is
minimal enough that it's probably not worth going on a
crusade to convert these kinds of frees to UNLEAKS. I did it
here for consistency with the "sb" leak (though it would
have been equally correct to go the other way, and turn them
both into strbuf_release() calls).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-09-08 08:38:41 +02:00
|
|
|
ifneq ($(filter leak,$(SANITIZERS)),)
|
|
|
|
BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
|
|
|
|
endif
|
Makefile: use compat regex with SANITIZE=address
Recent versions of the gcc and clang Address Sanitizer produce test
failures related to regexec(). This triggers with gcc-10 and clang-8
(but not gcc-9 nor clang-7). Running:
make CC=gcc-10 SANITIZE=address test
results in failures in t4018, t3206, and t4062.
The cause seems to be that when built with ASan, we use a different
version of regexec() than normal. And this version doesn't understand
the REG_STARTEND flag. Here's my evidence supporting that.
The failure in t4062 is an ASan warning:
expecting success of 4062.2 '-G matches':
git diff --name-only -G "^(0{64}){64}$" HEAD^ >out &&
test 4096-zeroes.txt = "$(cat out)"
=================================================================
==672994==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fa76f672000 at pc 0x7fa7726f75b6 bp 0x7ffe41bdda70 sp 0x7ffe41bdd220
READ of size 4097 at 0x7fa76f672000 thread T0
#0 0x7fa7726f75b5 (/lib/x86_64-linux-gnu/libasan.so.6+0x4f5b5)
#1 0x562ae0c9c40e in regexec_buf /home/peff/compile/git/git-compat-util.h:1117
#2 0x562ae0c9c40e in diff_grep /home/peff/compile/git/diffcore-pickaxe.c:52
#3 0x562ae0c9cc28 in pickaxe_match /home/peff/compile/git/diffcore-pickaxe.c:166
[...]
In this case we're looking in a buffer which was mmap'd via
reuse_worktree_file(), and whose size is 4096 bytes. But libasan's
regex tries to look at byte 4097 anyway! If we tweak Git like this:
diff --git a/diff.c b/diff.c
index 8e2914c031..cfae60c120 100644
--- a/diff.c
+++ b/diff.c
@@ -3880,7 +3880,7 @@ static int reuse_worktree_file(struct index_state *istate,
*/
if (ce_uptodate(ce) ||
(!lstat(name, &st) && !ie_match_stat(istate, ce, &st, 0)))
- return 1;
+ return 0;
return 0;
}
to use a regular buffer (with a trailing NUL) instead of an mmap, then
the complaint goes away.
The other failures are actually diff output with an incorrect funcname
header. If I instrument xdiff to show the funcname matching like so:
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 8509f9ea22..f6c3dc1986 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -197,6 +197,7 @@ struct ff_regs {
struct ff_reg {
regex_t re;
int negate;
+ char *printable;
} *array;
};
@@ -218,7 +219,12 @@ static long ff_regexp(const char *line, long len,
for (i = 0; i < regs->nr; i++) {
struct ff_reg *reg = regs->array + i;
- if (!regexec_buf(®->re, line, len, 2, pmatch, 0)) {
+ int ret = regexec_buf(®->re, line, len, 2, pmatch, 0);
+ warning("regexec %s:\n regex: %s\n buf: %.*s",
+ ret == 0 ? "matched" : "did not match",
+ reg->printable,
+ (int)len, line);
+ if (!ret) {
if (reg->negate)
return -1;
break;
@@ -264,6 +270,7 @@ void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value, int cflags)
expression = value;
if (regcomp(®->re, expression, cflags))
die("Invalid regexp to look for hunk header: %s", expression);
+ reg->printable = xstrdup(expression);
free(buffer);
value = ep + 1;
}
then when compiling with ASan and gcc-10, running the diff from t4018.66
produces this:
$ git diff -U1 cpp-skip-access-specifiers
warning: regexec did not match:
regex: ^[ ]*[A-Za-z_][A-Za-z_0-9]*:[[:space:]]*($|/[/*])
buf: private:
warning: regexec matched:
regex: ^((::[[:space:]]*)?[A-Za-z_].*)$
buf: private:
diff --git a/cpp-skip-access-specifiers b/cpp-skip-access-specifiers
index 4d4a9db..ebd6f42 100644
--- a/cpp-skip-access-specifiers
+++ b/cpp-skip-access-specifiers
@@ -6,3 +6,3 @@ private:
void DoSomething();
int ChangeMe;
};
void DoSomething();
- int ChangeMe;
+ int IWasChanged;
};
That first regex should match (and is negated, so it should be telling
us _not_ to match "private:"). But it wouldn't if regexec() is looking
at the whole buffer, and not just the length-limited line we've fed to
regexec_buf(). So this is consistent again with REG_STARTEND being
ignored.
The correct output (compiling without ASan, or gcc-9 with Asan) looks
like this:
warning: regexec matched:
regex: ^[ ]*[A-Za-z_][A-Za-z_0-9]*:[[:space:]]*($|/[/*])
buf: private:
[...more lines that we end up not using...]
warning: regexec matched:
regex: ^((::[[:space:]]*)?[A-Za-z_].*)$
buf: class RIGHT : public Baseclass
diff --git a/cpp-skip-access-specifiers b/cpp-skip-access-specifiers
index 4d4a9db..ebd6f42 100644
--- a/cpp-skip-access-specifiers
+++ b/cpp-skip-access-specifiers
@@ -6,3 +6,3 @@ class RIGHT : public Baseclass
void DoSomething();
- int ChangeMe;
+ int IWasChanged;
};
So it really does seem like libasan's regex engine is ignoring
REG_STARTEND. We should be able to work around it by compiling with
NO_REGEX, which would use our local regexec(). But to make matters even
more interesting, this isn't enough by itself.
Because ASan has support from the compiler, it doesn't seem to intercept
our call to regexec() at the dynamic library level. It actually
recognizes when we are compiling a call to regexec() and replaces it
with ASan-specific code at that point. And unlike most of our other
compat code, where we might have git_mmap() or similar, the actual
symbol name in the compiled compat/regex code is regexec(). So just
compiling with NO_REGEX isn't enough; we still end up in libasan!
We can work around that by having the preprocessor replace regexec with
git_regexec (both in the callers and in the actual implementation), and
we truly end up with a call to our custom regex code, even when
compiling with ASan. That's probably a good thing to do anyway, as it
means anybody looking at the symbols later (e.g., in a debugger) would
have a better indication of which function is which. So we'll do the
same for the other common regex functions (even though just regexec() is
enough to fix this ASan problem).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-01-16 18:51:38 +01:00
|
|
|
ifneq ($(filter address,$(SANITIZERS)),)
|
|
|
|
NO_REGEX = NeededForASAN
|
|
|
|
endif
|
2017-07-10 15:24:42 +02:00
|
|
|
endif
|
|
|
|
|
2011-05-09 10:24:55 +02:00
|
|
|
ifndef sysconfdir
|
|
|
|
ifeq ($(prefix),/usr)
|
|
|
|
sysconfdir = /etc
|
|
|
|
else
|
|
|
|
sysconfdir = etc
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-08-18 20:34:39 +02:00
|
|
|
ifndef COMPUTE_HEADER_DEPENDENCIES
|
2011-11-18 10:58:21 +01:00
|
|
|
COMPUTE_HEADER_DEPENDENCIES = auto
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
|
2011-08-30 10:27:35 +02:00
|
|
|
dep_check = $(shell $(CC) $(ALL_CFLAGS) \
|
2011-11-19 00:23:24 +01:00
|
|
|
-c -MF /dev/null -MQ /dev/null -MMD -MP \
|
|
|
|
-x c /dev/null -o /dev/null 2>&1; \
|
2011-08-30 10:27:35 +02:00
|
|
|
echo $$?)
|
2011-08-18 20:34:39 +02:00
|
|
|
ifeq ($(dep_check),0)
|
2011-11-18 10:58:21 +01:00
|
|
|
override COMPUTE_HEADER_DEPENDENCIES = yes
|
|
|
|
else
|
|
|
|
override COMPUTE_HEADER_DEPENDENCIES = no
|
2011-08-18 20:34:39 +02:00
|
|
|
endif
|
2010-01-26 16:57:15 +01:00
|
|
|
endif
|
|
|
|
|
2011-11-18 10:58:21 +01:00
|
|
|
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
|
2010-01-26 16:57:15 +01:00
|
|
|
USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
|
2011-11-18 10:58:21 +01:00
|
|
|
else
|
|
|
|
ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
|
|
|
|
$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
|
|
|
|
(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
|
|
|
|
endif
|
2010-01-26 16:57:15 +01:00
|
|
|
endif
|
|
|
|
|
2009-06-06 01:36:15 +02:00
|
|
|
ifdef SANE_TOOL_PATH
|
2009-06-08 18:41:49 +02:00
|
|
|
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
|
2019-06-19 23:06:06 +02:00
|
|
|
BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
|
2009-06-06 01:36:15 +02:00
|
|
|
PATH := $(SANE_TOOL_PATH):${PATH}
|
|
|
|
else
|
2009-06-08 18:41:49 +02:00
|
|
|
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
|
2009-06-06 01:36:15 +02:00
|
|
|
endif
|
|
|
|
|
2017-12-15 00:34:34 +01:00
|
|
|
ifeq (,$(HOST_CPU))
|
|
|
|
BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
|
|
|
|
else
|
|
|
|
BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
|
|
|
|
endif
|
|
|
|
|
2010-05-14 11:31:43 +02:00
|
|
|
ifneq (,$(INLINE))
|
|
|
|
BASIC_CFLAGS += -Dinline=$(INLINE)
|
|
|
|
endif
|
|
|
|
|
2010-05-14 11:31:42 +02:00
|
|
|
ifneq (,$(SOCKLEN_T))
|
|
|
|
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
|
|
|
|
endif
|
|
|
|
|
2015-01-11 21:09:22 +01:00
|
|
|
ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
|
|
|
|
BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
|
|
|
|
else
|
|
|
|
ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
|
|
|
|
BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2006-12-12 18:01:47 +01:00
|
|
|
ifeq ($(uname_S),Darwin)
|
|
|
|
ifndef NO_FINK
|
|
|
|
ifeq ($(shell test -d /sw/lib && echo y),y)
|
|
|
|
BASIC_CFLAGS += -I/sw/include
|
|
|
|
BASIC_LDFLAGS += -L/sw/lib
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifndef NO_DARWIN_PORTS
|
|
|
|
ifeq ($(shell test -d /opt/local/lib && echo y),y)
|
|
|
|
BASIC_CFLAGS += -I/opt/local/include
|
|
|
|
BASIC_LDFLAGS += -L/opt/local/lib
|
|
|
|
endif
|
|
|
|
endif
|
2013-05-19 12:23:34 +02:00
|
|
|
ifndef NO_APPLE_COMMON_CRYPTO
|
2016-11-06 20:35:04 +01:00
|
|
|
NO_OPENSSL = YesPlease
|
2013-05-19 12:23:34 +02:00
|
|
|
APPLE_COMMON_CRYPTO = YesPlease
|
|
|
|
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
|
|
|
|
endif
|
2013-05-11 10:22:26 +02:00
|
|
|
NO_REGEX = YesPlease
|
2009-01-26 20:03:59 +01:00
|
|
|
PTHREAD_LIBS =
|
2006-12-12 18:01:47 +01:00
|
|
|
endif
|
|
|
|
|
2009-05-31 10:35:51 +02:00
|
|
|
ifdef NO_LIBGEN_H
|
|
|
|
COMPAT_CFLAGS += -DNO_LIBGEN_H
|
|
|
|
COMPAT_OBJS += compat/basename.o
|
|
|
|
endif
|
|
|
|
|
2018-03-11 14:26:09 +01:00
|
|
|
USE_LIBPCRE2 ?= $(USE_LIBPCRE)
|
grep: add support for PCRE v2
Add support for v2 of the PCRE API. This is a new major version of
PCRE that came out in early 2015[1].
The regular expression syntax is the same, but while the API is
similar, pretty much every function is either renamed or takes
different arguments. Thus using it via entirely new functions makes
sense, as opposed to trying to e.g. have one compile_pcre_pattern()
that would call either PCRE v1 or v2 functions.
Git can now be compiled with either USE_LIBPCRE1=YesPlease or
USE_LIBPCRE2=YesPlease, with USE_LIBPCRE=YesPlease currently being a
synonym for the former. Providing both is a compile-time error.
With earlier patches to enable JIT for PCRE v1 the performance of the
release versions of both libraries is almost exactly the same, with
PCRE v2 being around 1% slower.
However after I reported this to the pcre-dev mailing list[2] I got a
lot of help with the API use from Zoltán Herczeg, he subsequently
optimized some of the JIT functionality in v2 of the library.
Running the p7820-grep-engines.sh performance test against the latest
Subversion trunk of both, with both them and git compiled as -O3, and
the test run against linux.git, gives the following results. Just the
/perl/ tests shown:
$ GIT_PERF_REPEAT_COUNT=30 GIT_PERF_LARGE_REPO=~/g/linux GIT_PERF_MAKE_COMMAND='grep -q LIBPCRE2 Makefile && make -j8 USE_LIBPCRE2=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre2/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre2/inst/lib || make -j8 USE_LIBPCRE=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre/inst/lib' ./run HEAD~5 HEAD~ HEAD p7820-grep-engines.sh
[...]
Test HEAD~5 HEAD~ HEAD
-----------------------------------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.31(1.10+0.48) 0.21(0.35+0.56) -32.3% 0.21(0.34+0.55) -32.3%
7820.7: perl grep '^how to' 0.56(2.70+0.40) 0.24(0.64+0.52) -57.1% 0.20(0.28+0.60) -64.3%
7820.11: perl grep '[how] to' 0.56(2.66+0.38) 0.29(0.95+0.45) -48.2% 0.23(0.45+0.54) -58.9%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 1.02(5.77+0.42) 0.31(1.02+0.54) -69.6% 0.23(0.50+0.54) -77.5%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.38(1.57+0.42) 0.27(0.85+0.46) -28.9% 0.21(0.33+0.57) -44.7%
See commit ("perf: add a comparison test of grep regex engines",
2017-04-19) for details on the machine the above test run was executed
on.
Here HEAD~2 is git with PCRE v1 without JIT, HEAD~ is PCRE v1 with
JIT, and HEAD is PCRE v2 (also with JIT). See previous commits of mine
mentioning p7820-grep-engines.sh for more details on the test setup.
For ease of readability, a different run just of HEAD~ (PCRE v1 with
JIT v.s. PCRE v2), again with just the /perl/ tests shown:
[...]
Test HEAD~ HEAD
----------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.21(0.42+0.52) 0.21(0.31+0.58) +0.0%
7820.7: perl grep '^how to' 0.25(0.65+0.50) 0.20(0.31+0.57) -20.0%
7820.11: perl grep '[how] to' 0.30(0.90+0.50) 0.23(0.46+0.53) -23.3%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 0.30(1.19+0.38) 0.23(0.51+0.51) -23.3%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.27(0.84+0.48) 0.21(0.34+0.57) -22.2%
I.e. the two are either neck-to-neck, but PCRE v2 usually pulls ahead,
when it does it's around 20% faster.
A brief note on thread safety: As noted in pcre2api(3) & pcre2jit(3)
the compiled pattern can be shared between threads, but not some of
the JIT context, however the grep threading support does all pattern &
JIT compilation in separate threads, so this code doesn't need to
concern itself with thread safety.
See commit 63e7e9d8b6 ("git-grep: Learn PCRE", 2011-05-09) for the
initial addition of PCRE v1. This change follows some of the same
patterns it did (and which were discussed on list at the time),
e.g. mocking up types with typedef instead of ifdef-ing them out when
USE_LIBPCRE2 isn't defined. This adds some trivial memory use to the
program, but makes the code look nicer.
1. https://lists.exim.org/lurker/message/20150105.162835.0666407a.en.html
2. https://lists.exim.org/lurker/thread/20170419.172322.833ee099.en.html
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:56 +02:00
|
|
|
|
2018-03-11 14:26:09 +01:00
|
|
|
ifneq (,$(USE_LIBPCRE2))
|
|
|
|
ifdef USE_LIBPCRE1
|
|
|
|
$(error Only set USE_LIBPCRE2 (or its alias USE_LIBPCRE) or USE_LIBPCRE1, not both!)
|
2011-05-09 23:52:05 +02:00
|
|
|
endif
|
grep: add support for PCRE v2
Add support for v2 of the PCRE API. This is a new major version of
PCRE that came out in early 2015[1].
The regular expression syntax is the same, but while the API is
similar, pretty much every function is either renamed or takes
different arguments. Thus using it via entirely new functions makes
sense, as opposed to trying to e.g. have one compile_pcre_pattern()
that would call either PCRE v1 or v2 functions.
Git can now be compiled with either USE_LIBPCRE1=YesPlease or
USE_LIBPCRE2=YesPlease, with USE_LIBPCRE=YesPlease currently being a
synonym for the former. Providing both is a compile-time error.
With earlier patches to enable JIT for PCRE v1 the performance of the
release versions of both libraries is almost exactly the same, with
PCRE v2 being around 1% slower.
However after I reported this to the pcre-dev mailing list[2] I got a
lot of help with the API use from Zoltán Herczeg, he subsequently
optimized some of the JIT functionality in v2 of the library.
Running the p7820-grep-engines.sh performance test against the latest
Subversion trunk of both, with both them and git compiled as -O3, and
the test run against linux.git, gives the following results. Just the
/perl/ tests shown:
$ GIT_PERF_REPEAT_COUNT=30 GIT_PERF_LARGE_REPO=~/g/linux GIT_PERF_MAKE_COMMAND='grep -q LIBPCRE2 Makefile && make -j8 USE_LIBPCRE2=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre2/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre2/inst/lib || make -j8 USE_LIBPCRE=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre/inst/lib' ./run HEAD~5 HEAD~ HEAD p7820-grep-engines.sh
[...]
Test HEAD~5 HEAD~ HEAD
-----------------------------------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.31(1.10+0.48) 0.21(0.35+0.56) -32.3% 0.21(0.34+0.55) -32.3%
7820.7: perl grep '^how to' 0.56(2.70+0.40) 0.24(0.64+0.52) -57.1% 0.20(0.28+0.60) -64.3%
7820.11: perl grep '[how] to' 0.56(2.66+0.38) 0.29(0.95+0.45) -48.2% 0.23(0.45+0.54) -58.9%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 1.02(5.77+0.42) 0.31(1.02+0.54) -69.6% 0.23(0.50+0.54) -77.5%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.38(1.57+0.42) 0.27(0.85+0.46) -28.9% 0.21(0.33+0.57) -44.7%
See commit ("perf: add a comparison test of grep regex engines",
2017-04-19) for details on the machine the above test run was executed
on.
Here HEAD~2 is git with PCRE v1 without JIT, HEAD~ is PCRE v1 with
JIT, and HEAD is PCRE v2 (also with JIT). See previous commits of mine
mentioning p7820-grep-engines.sh for more details on the test setup.
For ease of readability, a different run just of HEAD~ (PCRE v1 with
JIT v.s. PCRE v2), again with just the /perl/ tests shown:
[...]
Test HEAD~ HEAD
----------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.21(0.42+0.52) 0.21(0.31+0.58) +0.0%
7820.7: perl grep '^how to' 0.25(0.65+0.50) 0.20(0.31+0.57) -20.0%
7820.11: perl grep '[how] to' 0.30(0.90+0.50) 0.23(0.46+0.53) -23.3%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 0.30(1.19+0.38) 0.23(0.51+0.51) -23.3%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.27(0.84+0.48) 0.21(0.34+0.57) -22.2%
I.e. the two are either neck-to-neck, but PCRE v2 usually pulls ahead,
when it does it's around 20% faster.
A brief note on thread safety: As noted in pcre2api(3) & pcre2jit(3)
the compiled pattern can be shared between threads, but not some of
the JIT context, however the grep threading support does all pattern &
JIT compilation in separate threads, so this code doesn't need to
concern itself with thread safety.
See commit 63e7e9d8b6 ("git-grep: Learn PCRE", 2011-05-09) for the
initial addition of PCRE v1. This change follows some of the same
patterns it did (and which were discussed on list at the time),
e.g. mocking up types with typedef instead of ifdef-ing them out when
USE_LIBPCRE2 isn't defined. This adds some trivial memory use to the
program, but makes the code look nicer.
1. https://lists.exim.org/lurker/message/20150105.162835.0666407a.en.html
2. https://lists.exim.org/lurker/thread/20170419.172322.833ee099.en.html
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:56 +02:00
|
|
|
|
2018-03-11 14:26:09 +01:00
|
|
|
BASIC_CFLAGS += -DUSE_LIBPCRE2
|
|
|
|
EXTLIBS += -lpcre2-8
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef USE_LIBPCRE1
|
grep: add support for PCRE v2
Add support for v2 of the PCRE API. This is a new major version of
PCRE that came out in early 2015[1].
The regular expression syntax is the same, but while the API is
similar, pretty much every function is either renamed or takes
different arguments. Thus using it via entirely new functions makes
sense, as opposed to trying to e.g. have one compile_pcre_pattern()
that would call either PCRE v1 or v2 functions.
Git can now be compiled with either USE_LIBPCRE1=YesPlease or
USE_LIBPCRE2=YesPlease, with USE_LIBPCRE=YesPlease currently being a
synonym for the former. Providing both is a compile-time error.
With earlier patches to enable JIT for PCRE v1 the performance of the
release versions of both libraries is almost exactly the same, with
PCRE v2 being around 1% slower.
However after I reported this to the pcre-dev mailing list[2] I got a
lot of help with the API use from Zoltán Herczeg, he subsequently
optimized some of the JIT functionality in v2 of the library.
Running the p7820-grep-engines.sh performance test against the latest
Subversion trunk of both, with both them and git compiled as -O3, and
the test run against linux.git, gives the following results. Just the
/perl/ tests shown:
$ GIT_PERF_REPEAT_COUNT=30 GIT_PERF_LARGE_REPO=~/g/linux GIT_PERF_MAKE_COMMAND='grep -q LIBPCRE2 Makefile && make -j8 USE_LIBPCRE2=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre2/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre2/inst/lib || make -j8 USE_LIBPCRE=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre/inst/lib' ./run HEAD~5 HEAD~ HEAD p7820-grep-engines.sh
[...]
Test HEAD~5 HEAD~ HEAD
-----------------------------------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.31(1.10+0.48) 0.21(0.35+0.56) -32.3% 0.21(0.34+0.55) -32.3%
7820.7: perl grep '^how to' 0.56(2.70+0.40) 0.24(0.64+0.52) -57.1% 0.20(0.28+0.60) -64.3%
7820.11: perl grep '[how] to' 0.56(2.66+0.38) 0.29(0.95+0.45) -48.2% 0.23(0.45+0.54) -58.9%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 1.02(5.77+0.42) 0.31(1.02+0.54) -69.6% 0.23(0.50+0.54) -77.5%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.38(1.57+0.42) 0.27(0.85+0.46) -28.9% 0.21(0.33+0.57) -44.7%
See commit ("perf: add a comparison test of grep regex engines",
2017-04-19) for details on the machine the above test run was executed
on.
Here HEAD~2 is git with PCRE v1 without JIT, HEAD~ is PCRE v1 with
JIT, and HEAD is PCRE v2 (also with JIT). See previous commits of mine
mentioning p7820-grep-engines.sh for more details on the test setup.
For ease of readability, a different run just of HEAD~ (PCRE v1 with
JIT v.s. PCRE v2), again with just the /perl/ tests shown:
[...]
Test HEAD~ HEAD
----------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.21(0.42+0.52) 0.21(0.31+0.58) +0.0%
7820.7: perl grep '^how to' 0.25(0.65+0.50) 0.20(0.31+0.57) -20.0%
7820.11: perl grep '[how] to' 0.30(0.90+0.50) 0.23(0.46+0.53) -23.3%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 0.30(1.19+0.38) 0.23(0.51+0.51) -23.3%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.27(0.84+0.48) 0.21(0.34+0.57) -22.2%
I.e. the two are either neck-to-neck, but PCRE v2 usually pulls ahead,
when it does it's around 20% faster.
A brief note on thread safety: As noted in pcre2api(3) & pcre2jit(3)
the compiled pattern can be shared between threads, but not some of
the JIT context, however the grep threading support does all pattern &
JIT compilation in separate threads, so this code doesn't need to
concern itself with thread safety.
See commit 63e7e9d8b6 ("git-grep: Learn PCRE", 2011-05-09) for the
initial addition of PCRE v1. This change follows some of the same
patterns it did (and which were discussed on list at the time),
e.g. mocking up types with typedef instead of ifdef-ing them out when
USE_LIBPCRE2 isn't defined. This adds some trivial memory use to the
program, but makes the code look nicer.
1. https://lists.exim.org/lurker/message/20150105.162835.0666407a.en.html
2. https://lists.exim.org/lurker/thread/20170419.172322.833ee099.en.html
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:56 +02:00
|
|
|
BASIC_CFLAGS += -DUSE_LIBPCRE1
|
2011-05-09 23:52:05 +02:00
|
|
|
EXTLIBS += -lpcre
|
grep: un-break building with PCRE >= 8.32 without --enable-jit
Amend my change earlier in this series ("grep: add support for the
PCRE v1 JIT API", 2017-04-11) to un-break the build on PCRE v1
versions later than 8.31 compiled without --enable-jit.
As explained in that change and a later compatibility change in this
series ("grep: un-break building with PCRE < 8.32", 2017-05-10) the
pcre_jit_exec() function is a faster path to execute the JIT.
Unfortunately there's no compatibility stub for that function compiled
into the library if pcre_config(PCRE_CONFIG_JIT, &ret) would return 0,
and no macro that can be used to check for it, so the only portable
option to support builds without --enable-jit is via a new
NO_LIBPCRE1_JIT=UnfortunatelyYes Makefile option[1].
Another option would be to make the JIT opt-in via
USE_LIBPCRE1_JIT=YesPlease, after all it's not a default option of
PCRE v1.
I think it makes more sense to make it opt-out since even though it's
not a default option, most packagers of PCRE seem to turn it on by
default, with the notable exception of the MinGW package.
Make the MinGW platform work by default by changing the build defaults
to turn on NO_LIBPCRE1_JIT=UnfortunatelyYes. It is the only platform
that turns on USE_LIBPCRE=YesPlease by default, see commit
df5218b4c3 ("config.mak.uname: support MSys2", 2016-01-13) for that
change.
1. "How do I support pcre1 JIT on all
versions?" (https://lists.exim.org/lurker/thread/20170601.103148.10253788.en.html)
2. https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-pcre/PKGBUILD
(referenced from "Re: PCRE v2 compile error, was Re: What's cooking
in git.git (May 2017, #01; Mon, 1)";
<alpine.DEB.2.20.1705021756530.3480@virtualbox>)
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:55 +02:00
|
|
|
|
|
|
|
ifdef NO_LIBPCRE1_JIT
|
|
|
|
BASIC_CFLAGS += -DNO_LIBPCRE1_JIT
|
|
|
|
endif
|
2011-05-09 23:52:05 +02:00
|
|
|
endif
|
|
|
|
|
grep: add support for PCRE v2
Add support for v2 of the PCRE API. This is a new major version of
PCRE that came out in early 2015[1].
The regular expression syntax is the same, but while the API is
similar, pretty much every function is either renamed or takes
different arguments. Thus using it via entirely new functions makes
sense, as opposed to trying to e.g. have one compile_pcre_pattern()
that would call either PCRE v1 or v2 functions.
Git can now be compiled with either USE_LIBPCRE1=YesPlease or
USE_LIBPCRE2=YesPlease, with USE_LIBPCRE=YesPlease currently being a
synonym for the former. Providing both is a compile-time error.
With earlier patches to enable JIT for PCRE v1 the performance of the
release versions of both libraries is almost exactly the same, with
PCRE v2 being around 1% slower.
However after I reported this to the pcre-dev mailing list[2] I got a
lot of help with the API use from Zoltán Herczeg, he subsequently
optimized some of the JIT functionality in v2 of the library.
Running the p7820-grep-engines.sh performance test against the latest
Subversion trunk of both, with both them and git compiled as -O3, and
the test run against linux.git, gives the following results. Just the
/perl/ tests shown:
$ GIT_PERF_REPEAT_COUNT=30 GIT_PERF_LARGE_REPO=~/g/linux GIT_PERF_MAKE_COMMAND='grep -q LIBPCRE2 Makefile && make -j8 USE_LIBPCRE2=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre2/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre2/inst/lib || make -j8 USE_LIBPCRE=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre/inst/lib' ./run HEAD~5 HEAD~ HEAD p7820-grep-engines.sh
[...]
Test HEAD~5 HEAD~ HEAD
-----------------------------------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.31(1.10+0.48) 0.21(0.35+0.56) -32.3% 0.21(0.34+0.55) -32.3%
7820.7: perl grep '^how to' 0.56(2.70+0.40) 0.24(0.64+0.52) -57.1% 0.20(0.28+0.60) -64.3%
7820.11: perl grep '[how] to' 0.56(2.66+0.38) 0.29(0.95+0.45) -48.2% 0.23(0.45+0.54) -58.9%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 1.02(5.77+0.42) 0.31(1.02+0.54) -69.6% 0.23(0.50+0.54) -77.5%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.38(1.57+0.42) 0.27(0.85+0.46) -28.9% 0.21(0.33+0.57) -44.7%
See commit ("perf: add a comparison test of grep regex engines",
2017-04-19) for details on the machine the above test run was executed
on.
Here HEAD~2 is git with PCRE v1 without JIT, HEAD~ is PCRE v1 with
JIT, and HEAD is PCRE v2 (also with JIT). See previous commits of mine
mentioning p7820-grep-engines.sh for more details on the test setup.
For ease of readability, a different run just of HEAD~ (PCRE v1 with
JIT v.s. PCRE v2), again with just the /perl/ tests shown:
[...]
Test HEAD~ HEAD
----------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.21(0.42+0.52) 0.21(0.31+0.58) +0.0%
7820.7: perl grep '^how to' 0.25(0.65+0.50) 0.20(0.31+0.57) -20.0%
7820.11: perl grep '[how] to' 0.30(0.90+0.50) 0.23(0.46+0.53) -23.3%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 0.30(1.19+0.38) 0.23(0.51+0.51) -23.3%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.27(0.84+0.48) 0.21(0.34+0.57) -22.2%
I.e. the two are either neck-to-neck, but PCRE v2 usually pulls ahead,
when it does it's around 20% faster.
A brief note on thread safety: As noted in pcre2api(3) & pcre2jit(3)
the compiled pattern can be shared between threads, but not some of
the JIT context, however the grep threading support does all pattern &
JIT compilation in separate threads, so this code doesn't need to
concern itself with thread safety.
See commit 63e7e9d8b6 ("git-grep: Learn PCRE", 2011-05-09) for the
initial addition of PCRE v1. This change follows some of the same
patterns it did (and which were discussed on list at the time),
e.g. mocking up types with typedef instead of ifdef-ing them out when
USE_LIBPCRE2 isn't defined. This adds some trivial memory use to the
program, but makes the code look nicer.
1. https://lists.exim.org/lurker/message/20150105.162835.0666407a.en.html
2. https://lists.exim.org/lurker/thread/20170419.172322.833ee099.en.html
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:56 +02:00
|
|
|
ifdef LIBPCREDIR
|
|
|
|
BASIC_CFLAGS += -I$(LIBPCREDIR)/include
|
|
|
|
EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
|
2011-05-09 23:52:05 +02:00
|
|
|
endif
|
|
|
|
|
Portable alloca for Git
In the next patch we'll have to use alloca() for performance reasons,
but since alloca is non-standardized and is not portable, let's have a
trick with compatibility wrappers:
1. at configure time, determine, do we have working alloca() through
alloca.h, and define
#define HAVE_ALLOCA_H
if yes.
2. in code
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
# define xalloca(size) (alloca(size))
# define xalloca_free(p) do {} while(0)
#else
# define xalloca(size) (xmalloc(size))
# define xalloca_free(p) (free(p))
#endif
and use it like
func() {
p = xalloca(size);
...
xalloca_free(p);
}
This way, for systems, where alloca is available, we'll have optimal
on-stack allocations with fast executions. On the other hand, on
systems, where alloca is not available, this gracefully fallbacks to
xmalloc/free.
Both autoconf and config.mak.uname configurations were updated. For
autoconf, we are not bothering considering cases, when no alloca.h is
available, but alloca() works some other way - its simply alloca.h is
available and works or not, everything else is deep legacy.
For config.mak.uname, I've tried to make my almost-sure guess for where
alloca() is available, but since I only have access to Linux it is the
only change I can be sure about myself, with relevant to other changed
systems people Cc'ed.
NOTE
SunOS and Windows had explicit -DHAVE_ALLOCA_H in their configurations.
I've changed that to now-common HAVE_ALLOCA_H=YesPlease which should be
correct.
Cc: Brandon Casey <drafnel@gmail.com>
Cc: Marius Storm-Olsen <mstormo@gmail.com>
Cc: Johannes Sixt <j6t@kdbg.org>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Gerrit Pape <pape@smarden.org>
Cc: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Thomas Schwinge <thomas@codesourcery.com> (GNU Hurd changes)
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-27 15:22:50 +01:00
|
|
|
ifdef HAVE_ALLOCA_H
|
|
|
|
BASIC_CFLAGS += -DHAVE_ALLOCA_H
|
|
|
|
endif
|
|
|
|
|
2014-11-09 15:55:53 +01:00
|
|
|
IMAP_SEND_BUILDDEPS =
|
2015-10-21 19:01:13 +02:00
|
|
|
IMAP_SEND_LDFLAGS =
|
2014-11-09 15:55:53 +01:00
|
|
|
|
2007-09-11 05:02:45 +02:00
|
|
|
ifdef NO_CURL
|
|
|
|
BASIC_CFLAGS += -DNO_CURL
|
2010-01-19 16:39:12 +01:00
|
|
|
REMOTE_CURL_PRIMARY =
|
|
|
|
REMOTE_CURL_ALIASES =
|
|
|
|
REMOTE_CURL_NAMES =
|
2019-04-18 15:16:40 +02:00
|
|
|
EXCLUDED_PROGRAMS += git-http-fetch git-http-push
|
2007-09-11 05:02:45 +02:00
|
|
|
else
|
2005-09-23 19:41:40 +02:00
|
|
|
ifdef CURLDIR
|
2014-04-30 19:58:10 +02:00
|
|
|
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
|
2020-03-26 09:08:55 +01:00
|
|
|
CURL_CFLAGS = -I$(CURLDIR)/include
|
2018-11-03 06:12:11 +01:00
|
|
|
CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
|
2014-04-28 23:01:23 +02:00
|
|
|
else
|
2020-03-26 09:08:55 +01:00
|
|
|
CURL_CFLAGS =
|
2018-11-03 06:12:11 +01:00
|
|
|
CURL_LIBCURL =
|
2014-04-30 19:58:10 +02:00
|
|
|
endif
|
2011-07-20 00:55:47 +02:00
|
|
|
|
2020-03-26 09:06:45 +01:00
|
|
|
ifndef CURL_LDFLAGS
|
2020-04-04 16:58:29 +02:00
|
|
|
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
|
2020-03-26 09:06:45 +01:00
|
|
|
endif
|
2018-11-03 06:12:11 +01:00
|
|
|
CURL_LIBCURL += $(CURL_LDFLAGS)
|
|
|
|
|
2020-03-26 09:08:55 +01:00
|
|
|
ifndef CURL_CFLAGS
|
2020-04-04 16:58:29 +02:00
|
|
|
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
|
2020-03-26 09:08:55 +01:00
|
|
|
endif
|
|
|
|
BASIC_CFLAGS += $(CURL_CFLAGS)
|
2018-11-03 06:12:11 +01:00
|
|
|
|
2010-01-19 16:39:12 +01:00
|
|
|
REMOTE_CURL_PRIMARY = git-remote-http$X
|
|
|
|
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
|
|
|
|
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
|
2010-01-26 16:54:23 +01:00
|
|
|
PROGRAM_OBJS += http-fetch.o
|
|
|
|
PROGRAMS += $(REMOTE_CURL_NAMES)
|
2015-10-21 19:10:46 +02:00
|
|
|
curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
|
2005-11-19 02:08:36 +01:00
|
|
|
ifeq "$(curl_check)" "070908"
|
|
|
|
ifndef NO_EXPAT
|
2010-01-26 16:54:23 +01:00
|
|
|
PROGRAM_OBJS += http-push.o
|
2019-04-18 15:16:40 +02:00
|
|
|
else
|
|
|
|
EXCLUDED_PROGRAMS += git-http-push
|
2005-11-19 02:08:36 +01:00
|
|
|
endif
|
2019-04-18 15:16:40 +02:00
|
|
|
else
|
|
|
|
EXCLUDED_PROGRAMS += git-http-push
|
2005-11-02 20:19:24 +01:00
|
|
|
endif
|
2015-10-21 19:10:46 +02:00
|
|
|
curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
|
2014-11-09 15:55:53 +01:00
|
|
|
ifeq "$(curl_check)" "072200"
|
|
|
|
USE_CURL_FOR_IMAP_SEND = YesPlease
|
|
|
|
endif
|
|
|
|
ifdef USE_CURL_FOR_IMAP_SEND
|
|
|
|
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
|
|
|
|
IMAP_SEND_BUILDDEPS = http.o
|
|
|
|
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
|
|
|
|
endif
|
2006-04-05 16:22:40 +02:00
|
|
|
ifndef NO_EXPAT
|
2009-01-28 21:43:57 +01:00
|
|
|
ifdef EXPATDIR
|
|
|
|
BASIC_CFLAGS += -I$(EXPATDIR)/include
|
|
|
|
EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
|
|
|
|
else
|
|
|
|
EXPAT_LIBEXPAT = -lexpat
|
|
|
|
endif
|
2013-02-11 23:03:45 +01:00
|
|
|
ifdef EXPAT_NEEDS_XMLPARSE_H
|
|
|
|
BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
|
|
|
|
endif
|
2006-04-05 16:22:40 +02:00
|
|
|
endif
|
2005-09-23 19:41:40 +02:00
|
|
|
endif
|
2015-10-21 19:01:13 +02:00
|
|
|
IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
|
2005-09-23 19:41:40 +02:00
|
|
|
|
2007-07-29 20:35:45 +02:00
|
|
|
ifdef ZLIB_PATH
|
|
|
|
BASIC_CFLAGS += -I$(ZLIB_PATH)/include
|
2007-08-01 06:30:35 +02:00
|
|
|
EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
|
2007-07-29 20:35:45 +02:00
|
|
|
endif
|
|
|
|
EXTLIBS += -lz
|
|
|
|
|
2005-07-29 17:50:51 +02:00
|
|
|
ifndef NO_OPENSSL
|
2005-09-08 02:26:23 +02:00
|
|
|
OPENSSL_LIBSSL = -lssl
|
2005-09-30 22:31:16 +02:00
|
|
|
ifdef OPENSSLDIR
|
2006-06-25 03:47:03 +02:00
|
|
|
BASIC_CFLAGS += -I$(OPENSSLDIR)/include
|
2007-08-01 06:30:35 +02:00
|
|
|
OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
|
2005-09-30 22:31:16 +02:00
|
|
|
else
|
|
|
|
OPENSSL_LINK =
|
|
|
|
endif
|
2009-09-08 15:54:38 +02:00
|
|
|
ifdef NEEDS_CRYPTO_WITH_SSL
|
2011-07-20 00:55:47 +02:00
|
|
|
OPENSSL_LIBSSL += -lcrypto
|
2009-09-08 15:54:38 +02:00
|
|
|
endif
|
2005-07-29 17:50:51 +02:00
|
|
|
else
|
2006-06-25 03:47:03 +02:00
|
|
|
BASIC_CFLAGS += -DNO_OPENSSL
|
2005-09-08 02:26:23 +02:00
|
|
|
OPENSSL_LIBSSL =
|
2005-07-29 17:50:51 +02:00
|
|
|
endif
|
2010-12-08 23:54:13 +01:00
|
|
|
ifdef NO_OPENSSL
|
|
|
|
LIB_4_CRYPTO =
|
|
|
|
else
|
2005-09-07 21:22:56 +02:00
|
|
|
ifdef NEEDS_SSL_WITH_CRYPTO
|
2005-09-30 22:31:16 +02:00
|
|
|
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
|
2005-09-07 21:22:56 +02:00
|
|
|
else
|
2005-09-30 22:31:16 +02:00
|
|
|
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
|
2005-09-07 21:22:56 +02:00
|
|
|
endif
|
2013-08-05 17:59:22 +02:00
|
|
|
ifdef APPLE_COMMON_CRYPTO
|
|
|
|
LIB_4_CRYPTO += -framework Security -framework CoreFoundation
|
|
|
|
endif
|
2010-12-08 23:54:13 +01:00
|
|
|
endif
|
2018-06-15 04:25:03 +02:00
|
|
|
ifndef NO_ICONV
|
|
|
|
ifdef NEEDS_LIBICONV
|
|
|
|
ifdef ICONVDIR
|
|
|
|
BASIC_CFLAGS += -I$(ICONVDIR)/include
|
|
|
|
ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
|
|
|
|
else
|
|
|
|
ICONV_LINK =
|
|
|
|
endif
|
|
|
|
ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
|
|
|
|
ICONV_LINK += -lintl
|
|
|
|
endif
|
|
|
|
EXTLIBS += $(ICONV_LINK) -liconv
|
2012-09-19 12:03:30 +02:00
|
|
|
endif
|
2005-09-07 21:22:56 +02:00
|
|
|
endif
|
utf8: handle systems that don't write BOM for UTF-16
When serializing UTF-16 (and UTF-32), there are three possible ways to
write the stream. One can write the data with a BOM in either big-endian
or little-endian format, or one can write the data without a BOM in
big-endian format.
Most systems' iconv implementations choose to write it with a BOM in
some endianness, since this is the most foolproof, and it is resistant
to misinterpretation on Windows, where UTF-16 and the little-endian
serialization are very common. For compatibility with Windows and to
avoid accidental misuse there, Git always wants to write UTF-16 with a
BOM, and will refuse to read UTF-16 without it.
However, musl's iconv implementation writes UTF-16 without a BOM,
relying on the user to interpret it as big-endian. This causes t0028 and
the related functionality to fail, since Git won't read the file without
a BOM.
Add a Makefile and #define knob, ICONV_OMITS_BOM, that can be set if the
iconv implementation has this behavior. When set, Git will write a BOM
manually for UTF-16 and UTF-32 and then force the data to be written in
UTF-16BE or UTF-32BE. We choose big-endian behavior here because the
tests use the raw "UTF-16" encoding, which will be big-endian when the
implementation requires this knob to be set.
Update the tests to detect this case and write test data with an added
BOM if necessary. Always write the BOM in the tests in big-endian
format, since all iconv implementations that omit a BOM must use
big-endian serialization according to the Unicode standard.
Preserve the existing behavior for systems which do not have this knob
enabled, since they may use optimized implementations, including
defaulting to the native endianness, which may improve performance.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-12 01:52:06 +01:00
|
|
|
ifdef ICONV_OMITS_BOM
|
|
|
|
BASIC_CFLAGS += -DICONV_OMITS_BOM
|
|
|
|
endif
|
2009-07-10 19:10:45 +02:00
|
|
|
ifdef NEEDS_LIBGEN
|
|
|
|
EXTLIBS += -lgen
|
|
|
|
endif
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
ifndef NO_GETTEXT
|
|
|
|
ifndef LIBC_CONTAINS_LIBINTL
|
|
|
|
EXTLIBS += -lintl
|
|
|
|
endif
|
|
|
|
endif
|
2005-09-06 01:24:03 +02:00
|
|
|
ifdef NEEDS_SOCKET
|
2006-06-25 03:35:12 +02:00
|
|
|
EXTLIBS += -lsocket
|
2005-09-06 01:24:03 +02:00
|
|
|
endif
|
2005-09-12 07:25:49 +02:00
|
|
|
ifdef NEEDS_NSL
|
2006-06-25 03:35:12 +02:00
|
|
|
EXTLIBS += -lnsl
|
2005-09-12 07:25:49 +02:00
|
|
|
endif
|
2009-06-06 01:36:10 +02:00
|
|
|
ifdef NEEDS_RESOLV
|
|
|
|
EXTLIBS += -lresolv
|
|
|
|
endif
|
2006-01-20 02:13:57 +01:00
|
|
|
ifdef NO_D_TYPE_IN_DIRENT
|
2006-06-25 03:47:03 +02:00
|
|
|
BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
|
2006-01-20 02:13:57 +01:00
|
|
|
endif
|
2012-12-14 20:56:59 +01:00
|
|
|
ifdef NO_GECOS_IN_PWENT
|
|
|
|
BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
|
|
|
|
endif
|
2008-08-18 21:57:16 +02:00
|
|
|
ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
|
|
|
|
BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
|
|
|
|
endif
|
2009-03-08 22:22:51 +01:00
|
|
|
ifdef USE_NSEC
|
|
|
|
BASIC_CFLAGS += -DUSE_NSEC
|
|
|
|
endif
|
2009-03-08 21:04:28 +01:00
|
|
|
ifdef USE_ST_TIMESPEC
|
|
|
|
BASIC_CFLAGS += -DUSE_ST_TIMESPEC
|
|
|
|
endif
|
2011-06-19 03:07:03 +02:00
|
|
|
ifdef NO_NORETURN
|
|
|
|
BASIC_CFLAGS += -DNO_NORETURN
|
|
|
|
endif
|
2009-03-04 18:47:40 +01:00
|
|
|
ifdef NO_NSEC
|
|
|
|
BASIC_CFLAGS += -DNO_NSEC
|
|
|
|
endif
|
2008-03-05 16:46:13 +01:00
|
|
|
ifdef SNPRINTF_RETURNS_BOGUS
|
|
|
|
COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
|
|
|
|
COMPAT_OBJS += compat/snprintf.o
|
|
|
|
endif
|
2008-02-09 03:32:47 +01:00
|
|
|
ifdef FREAD_READS_DIRECTORIES
|
|
|
|
COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
|
|
|
|
COMPAT_OBJS += compat/fopen.o
|
|
|
|
endif
|
2006-05-02 09:40:24 +02:00
|
|
|
ifdef NO_SYMLINK_HEAD
|
2006-06-25 03:47:03 +02:00
|
|
|
BASIC_CFLAGS += -DNO_SYMLINK_HEAD
|
2006-05-02 09:40:24 +02:00
|
|
|
endif
|
2011-02-23 00:41:21 +01:00
|
|
|
ifdef GETTEXT_POISON
|
2018-11-08 22:15:30 +01:00
|
|
|
$(warning The GETTEXT_POISON option has been removed in favor of runtime GIT_TEST_GETTEXT_POISON. See t/README!)
|
2011-02-23 00:41:21 +01:00
|
|
|
endif
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
ifdef NO_GETTEXT
|
|
|
|
BASIC_CFLAGS += -DNO_GETTEXT
|
2012-01-24 01:31:09 +01:00
|
|
|
USE_GETTEXT_SCHEME ?= fallthrough
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
endif
|
2012-09-17 23:16:39 +02:00
|
|
|
ifdef NO_POLL
|
2018-11-14 02:10:43 +01:00
|
|
|
NO_POLL_H = YesPlease
|
2012-09-17 23:16:39 +02:00
|
|
|
NO_SYS_POLL_H = YesPlease
|
|
|
|
COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
|
|
|
|
COMPAT_OBJS += compat/poll/poll.o
|
|
|
|
endif
|
2005-09-19 03:30:50 +02:00
|
|
|
ifdef NO_STRCASESTR
|
2005-12-05 20:54:29 +01:00
|
|
|
COMPAT_CFLAGS += -DNO_STRCASESTR
|
2005-12-03 00:08:28 +01:00
|
|
|
COMPAT_OBJS += compat/strcasestr.o
|
|
|
|
endif
|
2006-06-24 16:01:25 +02:00
|
|
|
ifdef NO_STRLCPY
|
|
|
|
COMPAT_CFLAGS += -DNO_STRLCPY
|
|
|
|
COMPAT_OBJS += compat/strlcpy.o
|
|
|
|
endif
|
2007-02-20 01:22:56 +01:00
|
|
|
ifdef NO_STRTOUMAX
|
|
|
|
COMPAT_CFLAGS += -DNO_STRTOUMAX
|
2011-11-02 16:46:22 +01:00
|
|
|
COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
|
2007-02-20 01:22:56 +01:00
|
|
|
endif
|
|
|
|
ifdef NO_STRTOULL
|
|
|
|
COMPAT_CFLAGS += -DNO_STRTOULL
|
|
|
|
endif
|
2005-12-03 00:08:28 +01:00
|
|
|
ifdef NO_SETENV
|
2005-12-05 20:54:29 +01:00
|
|
|
COMPAT_CFLAGS += -DNO_SETENV
|
2005-12-03 00:08:28 +01:00
|
|
|
COMPAT_OBJS += compat/setenv.o
|
2005-09-19 03:30:50 +02:00
|
|
|
endif
|
2007-10-20 22:03:49 +02:00
|
|
|
ifdef NO_MKDTEMP
|
|
|
|
COMPAT_CFLAGS += -DNO_MKDTEMP
|
|
|
|
COMPAT_OBJS += compat/mkdtemp.o
|
|
|
|
endif
|
2012-09-08 19:01:31 +02:00
|
|
|
ifdef MKDIR_WO_TRAILING_SLASH
|
|
|
|
COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
|
|
|
|
COMPAT_OBJS += compat/mkdir.o
|
|
|
|
endif
|
2006-08-29 12:51:14 +02:00
|
|
|
ifdef NO_UNSETENV
|
2006-01-25 21:38:36 +01:00
|
|
|
COMPAT_CFLAGS += -DNO_UNSETENV
|
|
|
|
COMPAT_OBJS += compat/unsetenv.o
|
|
|
|
endif
|
2008-01-24 19:34:46 +01:00
|
|
|
ifdef NO_SYS_SELECT_H
|
|
|
|
BASIC_CFLAGS += -DNO_SYS_SELECT_H
|
|
|
|
endif
|
2018-11-14 02:10:43 +01:00
|
|
|
ifdef NO_POLL_H
|
|
|
|
BASIC_CFLAGS += -DNO_POLL_H
|
|
|
|
endif
|
2010-10-27 10:39:52 +02:00
|
|
|
ifdef NO_SYS_POLL_H
|
|
|
|
BASIC_CFLAGS += -DNO_SYS_POLL_H
|
|
|
|
endif
|
git-compat-util.h: do not #include <sys/param.h> by default
Earlier we allowed platforms that lack <sys/param.h> not to include
the header file from git-compat-util.h; we have included this header
file since the early days back when we used MAXPATHLEN (which we no
longer use) and also depended on it slurping ULONG_MAX (which we get
by including stdint.h or inttypes.h these days).
It turns out that we can compile our modern codebase just file
without including it on many platforms (so far, Fedora, Debian,
Ubuntu, MinGW, Mac OS X, Cygwin, HP-Nonstop, QNX and z/OS are
reported to be OK).
Let's stop including it by default, and on platforms that need it to
be included, leave "make NEEDS_SYS_PARAM_H=YesPlease" as an escape
hatch and ask them to report to us, so that we can find out about
the real dependency and fix it in a more platform agnostic way.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-18 18:35:33 +01:00
|
|
|
ifdef NEEDS_SYS_PARAM_H
|
|
|
|
BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
|
2012-12-14 20:56:58 +01:00
|
|
|
endif
|
2010-10-27 10:39:52 +02:00
|
|
|
ifdef NO_INTTYPES_H
|
|
|
|
BASIC_CFLAGS += -DNO_INTTYPES_H
|
|
|
|
endif
|
|
|
|
ifdef NO_INITGROUPS
|
|
|
|
BASIC_CFLAGS += -DNO_INITGROUPS
|
|
|
|
endif
|
2005-10-09 00:54:36 +02:00
|
|
|
ifdef NO_MMAP
|
2005-12-05 20:54:29 +01:00
|
|
|
COMPAT_CFLAGS += -DNO_MMAP
|
2005-12-03 00:08:28 +01:00
|
|
|
COMPAT_OBJS += compat/mmap.o
|
2009-03-13 16:50:45 +01:00
|
|
|
else
|
|
|
|
ifdef USE_WIN32_MMAP
|
|
|
|
COMPAT_CFLAGS += -DUSE_WIN32_MMAP
|
|
|
|
COMPAT_OBJS += compat/win32mmap.o
|
|
|
|
endif
|
2005-10-09 00:54:36 +02:00
|
|
|
endif
|
2017-09-25 10:00:10 +02:00
|
|
|
ifdef MMAP_PREVENTS_DELETE
|
|
|
|
BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
|
|
|
|
endif
|
2009-04-28 00:32:25 +02:00
|
|
|
ifdef OBJECT_CREATION_USES_RENAMES
|
|
|
|
COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
|
2009-04-25 11:57:14 +02:00
|
|
|
endif
|
2012-09-08 18:54:34 +02:00
|
|
|
ifdef NO_STRUCT_ITIMERVAL
|
|
|
|
COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
|
2012-12-09 11:36:17 +01:00
|
|
|
NO_SETITIMER = YesPlease
|
2012-09-08 18:54:34 +02:00
|
|
|
endif
|
|
|
|
ifdef NO_SETITIMER
|
|
|
|
COMPAT_CFLAGS += -DNO_SETITIMER
|
|
|
|
endif
|
2007-01-09 22:04:12 +01:00
|
|
|
ifdef NO_PREAD
|
|
|
|
COMPAT_CFLAGS += -DNO_PREAD
|
|
|
|
COMPAT_OBJS += compat/pread.o
|
|
|
|
endif
|
2006-12-14 12:15:57 +01:00
|
|
|
ifdef NO_FAST_WORKING_DIRECTORY
|
|
|
|
BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
|
|
|
|
endif
|
2006-12-31 05:53:55 +01:00
|
|
|
ifdef NO_TRUSTABLE_FILEMODE
|
|
|
|
BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
|
|
|
|
endif
|
2014-12-04 03:24:17 +01:00
|
|
|
ifdef NEEDS_MODE_TRANSLATION
|
|
|
|
COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
|
|
|
|
COMPAT_OBJS += compat/stat.o
|
|
|
|
endif
|
2005-09-29 01:52:21 +02:00
|
|
|
ifdef NO_IPV6
|
2006-06-25 03:47:03 +02:00
|
|
|
BASIC_CFLAGS += -DNO_IPV6
|
2006-01-20 02:13:32 +01:00
|
|
|
endif
|
2012-09-19 12:03:30 +02:00
|
|
|
ifdef NO_INTPTR_T
|
|
|
|
COMPAT_CFLAGS += -DNO_INTPTR_T
|
|
|
|
endif
|
2008-10-26 12:52:37 +01:00
|
|
|
ifdef NO_UINTMAX_T
|
|
|
|
BASIC_CFLAGS += -Duintmax_t=uint32_t
|
|
|
|
endif
|
2006-01-20 02:13:32 +01:00
|
|
|
ifdef NO_SOCKADDR_STORAGE
|
|
|
|
ifdef NO_IPV6
|
2006-06-25 03:47:03 +02:00
|
|
|
BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
|
2006-01-20 02:13:32 +01:00
|
|
|
else
|
2006-06-25 03:47:03 +02:00
|
|
|
BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
|
2006-01-20 02:13:32 +01:00
|
|
|
endif
|
2005-09-29 01:52:21 +02:00
|
|
|
endif
|
2006-05-21 23:37:00 +02:00
|
|
|
ifdef NO_INET_NTOP
|
|
|
|
LIB_OBJS += compat/inet_ntop.o
|
2010-11-04 02:35:11 +01:00
|
|
|
BASIC_CFLAGS += -DNO_INET_NTOP
|
2006-05-21 23:37:00 +02:00
|
|
|
endif
|
2006-09-26 16:47:43 +02:00
|
|
|
ifdef NO_INET_PTON
|
|
|
|
LIB_OBJS += compat/inet_pton.o
|
2010-11-04 02:35:11 +01:00
|
|
|
BASIC_CFLAGS += -DNO_INET_PTON
|
2006-09-26 16:47:43 +02:00
|
|
|
endif
|
2019-02-22 23:25:01 +01:00
|
|
|
ifdef NO_UNIX_SOCKETS
|
|
|
|
BASIC_CFLAGS += -DNO_UNIX_SOCKETS
|
|
|
|
else
|
2011-12-12 22:12:56 +01:00
|
|
|
LIB_OBJS += unix-socket.o
|
|
|
|
endif
|
2005-04-21 21:33:22 +02:00
|
|
|
|
2006-02-16 09:38:01 +01:00
|
|
|
ifdef NO_ICONV
|
2006-06-25 03:47:03 +02:00
|
|
|
BASIC_CFLAGS += -DNO_ICONV
|
2006-02-16 09:38:01 +01:00
|
|
|
endif
|
|
|
|
|
2007-03-03 19:29:03 +01:00
|
|
|
ifdef OLD_ICONV
|
|
|
|
BASIC_CFLAGS += -DOLD_ICONV
|
|
|
|
endif
|
|
|
|
|
2007-11-07 04:24:28 +01:00
|
|
|
ifdef NO_DEFLATE_BOUND
|
|
|
|
BASIC_CFLAGS += -DNO_DEFLATE_BOUND
|
|
|
|
endif
|
|
|
|
|
2010-11-04 02:35:24 +01:00
|
|
|
ifdef NO_POSIX_GOODIES
|
|
|
|
BASIC_CFLAGS += -DNO_POSIX_GOODIES
|
|
|
|
endif
|
|
|
|
|
2015-11-05 07:38:42 +01:00
|
|
|
ifdef APPLE_COMMON_CRYPTO
|
|
|
|
# Apple CommonCrypto requires chunking
|
|
|
|
SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
|
|
|
|
endif
|
|
|
|
|
2017-03-17 18:00:15 +01:00
|
|
|
ifdef OPENSSL_SHA1
|
|
|
|
EXTLIBS += $(LIB_4_CRYPTO)
|
|
|
|
BASIC_CFLAGS += -DSHA1_OPENSSL
|
2017-03-16 23:09:12 +01:00
|
|
|
else
|
2009-08-06 01:13:20 +02:00
|
|
|
ifdef BLK_SHA1
|
|
|
|
LIB_OBJS += block-sha1/sha1.o
|
2017-03-11 23:28:18 +01:00
|
|
|
BASIC_CFLAGS += -DSHA1_BLK
|
2009-08-06 01:13:20 +02:00
|
|
|
else
|
2005-09-20 18:27:13 +02:00
|
|
|
ifdef PPC_SHA1
|
|
|
|
LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
|
2017-03-11 23:28:18 +01:00
|
|
|
BASIC_CFLAGS += -DSHA1_PPC
|
2013-05-19 12:23:35 +02:00
|
|
|
else
|
|
|
|
ifdef APPLE_COMMON_CRYPTO
|
|
|
|
COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
|
2017-03-11 23:28:18 +01:00
|
|
|
BASIC_CFLAGS += -DSHA1_APPLE
|
2005-09-20 18:27:13 +02:00
|
|
|
else
|
2017-03-17 18:00:15 +01:00
|
|
|
DC_SHA1 := YesPlease
|
2017-08-15 14:04:16 +02:00
|
|
|
BASIC_CFLAGS += -DSHA1_DC
|
|
|
|
LIB_OBJS += sha1dc_git.o
|
2017-08-15 14:04:17 +02:00
|
|
|
ifdef DC_SHA1_EXTERNAL
|
|
|
|
ifdef DC_SHA1_SUBMODULE
|
2017-12-08 23:29:57 +01:00
|
|
|
ifneq ($(DC_SHA1_SUBMODULE),auto)
|
2017-08-15 14:04:17 +02:00
|
|
|
$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
|
2017-12-08 23:29:57 +01:00
|
|
|
endif
|
2017-08-15 14:04:17 +02:00
|
|
|
endif
|
|
|
|
BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
|
|
|
|
EXTLIBS += -lsha1detectcoll
|
|
|
|
else
|
2017-07-02 00:05:46 +02:00
|
|
|
ifdef DC_SHA1_SUBMODULE
|
|
|
|
LIB_OBJS += sha1collisiondetection/lib/sha1.o
|
|
|
|
LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
|
|
|
|
BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
|
|
|
|
else
|
2017-03-17 18:00:15 +01:00
|
|
|
LIB_OBJS += sha1dc/sha1.o
|
|
|
|
LIB_OBJS += sha1dc/ubc_check.o
|
2017-07-02 00:05:46 +02:00
|
|
|
endif
|
2017-05-20 13:54:28 +02:00
|
|
|
BASIC_CFLAGS += \
|
|
|
|
-DSHA1DC_NO_STANDARD_INCLUDES \
|
|
|
|
-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
|
|
|
|
-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
|
|
|
|
-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
|
2005-09-20 18:27:13 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2013-05-19 12:23:35 +02:00
|
|
|
endif
|
2017-08-15 14:04:17 +02:00
|
|
|
endif
|
2013-05-19 12:23:35 +02:00
|
|
|
|
2018-11-14 05:09:38 +01:00
|
|
|
ifdef OPENSSL_SHA256
|
|
|
|
EXTLIBS += $(LIB_4_CRYPTO)
|
|
|
|
BASIC_CFLAGS += -DSHA256_OPENSSL
|
|
|
|
else
|
2018-11-14 05:09:37 +01:00
|
|
|
ifdef GCRYPT_SHA256
|
|
|
|
BASIC_CFLAGS += -DSHA256_GCRYPT
|
|
|
|
EXTLIBS += -lgcrypt
|
|
|
|
else
|
|
|
|
LIB_OBJS += sha256/block/sha256.o
|
|
|
|
BASIC_CFLAGS += -DSHA256_BLK
|
|
|
|
endif
|
2018-11-14 05:09:38 +01:00
|
|
|
endif
|
2018-11-14 05:09:36 +01:00
|
|
|
|
2015-11-05 07:38:42 +01:00
|
|
|
ifdef SHA1_MAX_BLOCK_SIZE
|
|
|
|
LIB_OBJS += compat/sha1-chunked.o
|
|
|
|
BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
|
|
|
|
endif
|
2007-06-13 20:54:32 +02:00
|
|
|
ifdef NO_HSTRERROR
|
|
|
|
COMPAT_CFLAGS += -DNO_HSTRERROR
|
|
|
|
COMPAT_OBJS += compat/hstrerror.o
|
|
|
|
endif
|
2007-09-07 00:32:54 +02:00
|
|
|
ifdef NO_MEMMEM
|
|
|
|
COMPAT_CFLAGS += -DNO_MEMMEM
|
|
|
|
COMPAT_OBJS += compat/memmem.o
|
|
|
|
endif
|
2012-12-18 23:03:55 +01:00
|
|
|
ifdef NO_GETPAGESIZE
|
|
|
|
COMPAT_CFLAGS += -DNO_GETPAGESIZE
|
|
|
|
endif
|
2008-02-05 22:10:44 +01:00
|
|
|
ifdef INTERNAL_QSORT
|
|
|
|
COMPAT_CFLAGS += -DINTERNAL_QSORT
|
|
|
|
endif
|
2017-01-22 18:51:11 +01:00
|
|
|
ifdef HAVE_ISO_QSORT_S
|
|
|
|
COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
|
|
|
|
else
|
|
|
|
COMPAT_OBJS += compat/qsort_s.o
|
|
|
|
endif
|
Compute prefix at runtime if RUNTIME_PREFIX is set
This commit adds support for relocatable binaries (called
RUNTIME_PREFIX). Such binaries can be moved together with the
system configuration files to a different directory, as long as the
relative paths from the binary to the configuration files is
preserved. This functionality is essential on Windows where we
deliver git binaries with an installer that allows to freely choose
the installation location.
If RUNTIME_PREFIX is unset we use the static prefix. This will be
the default on Unix. Thus, the behavior on Unix will remain
identical to the old implementation, which used to add the prefix
in the Makefile.
If RUNTIME_PREFIX is set the prefix is computed from the location
of the executable. In this case, system_path() tries to strip
known directories that executables can be located in from the path
of the executable. If the path is successfully stripped it is used
as the prefix. For example, if the executable is
"/msysgit/bin/git" and BINDIR is "bin", then the prefix computed is
"/msysgit".
If the runtime prefix computation fails, we fall back to the static
prefix specified in the makefile. This can be the case if the
executable is not installed at a known location. Note that our
test system sets GIT_CONFIG_NOSYSTEM to tell git to ignore global
configuration files during testing. Hence testing does not trigger
the fall back.
Note that RUNTIME_PREFIX only works on Windows, though adding
support on Unix should not be too hard. The implementation
requires argv0_path to be set to an absolute path. argv0_path must
point to the directory of the executable. We use assert() to
verify this in debug builds. On Windows, the wrapper for main()
(see compat/mingw.h) guarantees that argv0_path is correctly
initialized. On Unix, further work is required before
RUNTIME_PREFIX can be enabled.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-18 13:00:14 +01:00
|
|
|
ifdef RUNTIME_PREFIX
|
|
|
|
COMPAT_CFLAGS += -DRUNTIME_PREFIX
|
|
|
|
endif
|
2007-03-07 00:44:49 +01:00
|
|
|
|
2008-11-15 13:08:14 +01:00
|
|
|
ifdef NO_PTHREADS
|
|
|
|
BASIC_CFLAGS += -DNO_PTHREADS
|
|
|
|
else
|
2010-05-14 11:31:34 +02:00
|
|
|
BASIC_CFLAGS += $(PTHREAD_CFLAGS)
|
2008-11-15 13:08:14 +01:00
|
|
|
EXTLIBS += $(PTHREAD_LIBS)
|
2007-09-06 08:13:11 +02:00
|
|
|
endif
|
2010-01-30 02:22:19 +01:00
|
|
|
|
2010-04-13 11:07:13 +02:00
|
|
|
ifdef HAVE_PATHS_H
|
|
|
|
BASIC_CFLAGS += -DHAVE_PATHS_H
|
|
|
|
endif
|
|
|
|
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
ifdef HAVE_LIBCHARSET_H
|
|
|
|
BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
|
2012-02-12 17:23:36 +01:00
|
|
|
EXTLIBS += $(CHARSET_LIB)
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
endif
|
|
|
|
|
2012-12-14 20:57:01 +01:00
|
|
|
ifdef HAVE_STRINGS_H
|
|
|
|
BASIC_CFLAGS += -DHAVE_STRINGS_H
|
|
|
|
endif
|
|
|
|
|
add generic terminal prompt function
When we need to prompt the user for input interactively, we
want to access their terminal directly. We can't rely on
stdio because it may be connected to pipes or files, rather
than the terminal. Instead, we use "getpass()", because it
abstracts the idea of prompting and reading from the
terminal. However, it has some problems:
1. It never echoes the typed characters, which makes it OK
for passwords but annoying for other input (like usernames).
2. Some implementations of getpass() have an extremely
small input buffer (e.g., Solaris 8 is reported to
support only 8 characters).
3. Some implementations of getpass() will fall back to
reading from stdin (e.g., glibc). We explicitly don't
want this, because our stdin may be connected to a pipe
speaking a particular protocol, and reading will
disrupt the protocol flow (e.g., the remote-curl
helper).
4. Some implementations of getpass() turn off signals, so
that hitting "^C" on the terminal does not break out of
the password prompt. This can be a mild annoyance.
Instead, let's provide an abstract "git_terminal_prompt"
function that addresses these concerns. This patch includes
an implementation based on /dev/tty, enabled by setting
HAVE_DEV_TTY. The fallback is to use getpass() as before.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-10 11:41:01 +01:00
|
|
|
ifdef HAVE_DEV_TTY
|
|
|
|
BASIC_CFLAGS += -DHAVE_DEV_TTY
|
|
|
|
endif
|
|
|
|
|
2008-03-05 00:15:39 +01:00
|
|
|
ifdef DIR_HAS_BSD_GROUP_SEMANTICS
|
|
|
|
COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
|
|
|
|
endif
|
2009-04-20 10:17:00 +02:00
|
|
|
ifdef UNRELIABLE_FSTAT
|
|
|
|
BASIC_CFLAGS += -DUNRELIABLE_FSTAT
|
|
|
|
endif
|
2009-06-16 21:07:40 +02:00
|
|
|
ifdef NO_REGEX
|
|
|
|
COMPAT_CFLAGS += -Icompat/regex
|
|
|
|
COMPAT_OBJS += compat/regex/regex.o
|
|
|
|
endif
|
2014-08-30 23:38:59 +02:00
|
|
|
ifdef NATIVE_CRLF
|
|
|
|
BASIC_CFLAGS += -DNATIVE_CRLF
|
|
|
|
endif
|
2007-09-06 08:13:11 +02:00
|
|
|
|
2009-05-31 18:15:23 +02:00
|
|
|
ifdef USE_NED_ALLOCATOR
|
2016-09-03 17:59:15 +02:00
|
|
|
COMPAT_CFLAGS += -Icompat/nedmalloc
|
|
|
|
COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
|
|
|
|
OVERRIDE_STRDUP = YesPlease
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef OVERRIDE_STRDUP
|
|
|
|
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
|
|
|
|
COMPAT_OBJS += compat/strdup.o
|
2009-05-31 18:15:23 +02:00
|
|
|
endif
|
|
|
|
|
2010-06-01 02:35:20 +02:00
|
|
|
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
|
|
|
|
export GIT_TEST_CMP_USE_COPIED_CONTEXT
|
|
|
|
endif
|
|
|
|
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
ifndef NO_MSGFMT_EXTENDED_OPTIONS
|
|
|
|
MSGFMT += --check --statistics
|
|
|
|
endif
|
|
|
|
|
2014-07-12 02:05:42 +02:00
|
|
|
ifdef HAVE_CLOCK_GETTIME
|
|
|
|
BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
|
|
|
|
endif
|
|
|
|
|
2015-01-08 21:00:56 +01:00
|
|
|
ifdef HAVE_CLOCK_MONOTONIC
|
|
|
|
BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
|
|
|
|
endif
|
|
|
|
|
Makefile: add NEEDS_LIBRT to optionally link with librt
We unconditionally link with librt, when HAVE_CLOCK_GETTIME is defined.
But clock_gettime() has been available in most libc implementations for
some time now (e.g., for glibc since version 2.17) and no longer
requires linking with librt. Furthermore, commit a6c3c63 (configure.ac:
check for clock_gettime() and CLOCK_MONOTONIC) will automatically
determined which library (libc or librt) is required for linking when
checking for clock_gettime().
The assumption to unconditionally link with librt was OK, since either
almost every Unix-like system provides a version of librt for backwards
compatibility or other systems, namely Windows or OS X, never provided
clock_gettime(). However, in the latest release of OS X (macOS Sierra),
this function has been added to OS X libc version. As a result, when
running the configuration script, HAVE_CLOCK_GETTIME is set and since
librt is not present, it causes a linker error.
This patches requires those not building via the configuration scripts
to define NEEDS_LIBRT in addition to HAVE_CLOCK_GETTIME, if needed.
Signed-off-by: Ronald Wampler <rdwampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-07 22:45:54 +02:00
|
|
|
ifdef NEEDS_LIBRT
|
|
|
|
EXTLIBS += -lrt
|
|
|
|
endif
|
|
|
|
|
2015-03-08 08:14:36 +01:00
|
|
|
ifdef HAVE_BSD_SYSCTL
|
|
|
|
BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
|
|
|
|
endif
|
|
|
|
|
2018-04-10 17:05:44 +02:00
|
|
|
ifdef HAVE_BSD_KERN_PROC_SYSCTL
|
|
|
|
BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
|
|
|
|
endif
|
|
|
|
|
2015-04-16 11:01:38 +02:00
|
|
|
ifdef HAVE_GETDELIM
|
|
|
|
BASIC_CFLAGS += -DHAVE_GETDELIM
|
|
|
|
endif
|
|
|
|
|
2018-04-10 17:05:44 +02:00
|
|
|
ifneq ($(PROCFS_EXECUTABLE_PATH),)
|
|
|
|
procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
|
|
|
|
BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef HAVE_NS_GET_EXECUTABLE_PATH
|
|
|
|
BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
|
|
|
|
endif
|
|
|
|
|
2018-04-10 17:05:45 +02:00
|
|
|
ifdef HAVE_WPGMPTR
|
|
|
|
BASIC_CFLAGS += -DHAVE_WPGMPTR
|
|
|
|
endif
|
|
|
|
|
2019-02-12 15:14:41 +01:00
|
|
|
ifdef FILENO_IS_A_MACRO
|
|
|
|
COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
|
|
|
|
COMPAT_OBJS += compat/fileno.o
|
|
|
|
endif
|
|
|
|
|
2019-04-25 09:01:56 +02:00
|
|
|
ifdef NEED_ACCESS_ROOT_HANDLER
|
|
|
|
COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
|
|
|
|
COMPAT_OBJS += compat/access.o
|
|
|
|
endif
|
|
|
|
|
2007-03-28 13:12:07 +02:00
|
|
|
ifeq ($(TCLTK_PATH),)
|
2012-12-09 11:36:17 +01:00
|
|
|
NO_TCLTK = NoThanks
|
2007-03-28 13:12:07 +02:00
|
|
|
endif
|
|
|
|
|
2009-04-03 21:32:20 +02:00
|
|
|
ifeq ($(PERL_PATH),)
|
2012-12-09 11:36:17 +01:00
|
|
|
NO_PERL = NoThanks
|
2009-04-03 21:32:20 +02:00
|
|
|
endif
|
|
|
|
|
2009-11-18 02:42:31 +01:00
|
|
|
ifeq ($(PYTHON_PATH),)
|
2012-12-09 11:36:17 +01:00
|
|
|
NO_PYTHON = NoThanks
|
2009-11-18 02:42:31 +01:00
|
|
|
endif
|
|
|
|
|
2016-08-04 13:40:25 +02:00
|
|
|
ifndef PAGER_ENV
|
|
|
|
PAGER_ENV = LESS=FRX LV=-c
|
|
|
|
endif
|
|
|
|
|
2007-04-04 22:42:33 +02:00
|
|
|
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
|
2007-03-07 00:44:49 +01:00
|
|
|
QUIET_SUBDIR1 =
|
|
|
|
|
2015-09-05 14:22:10 +02:00
|
|
|
ifneq ($(findstring w,$(MAKEFLAGS)),w)
|
2007-03-07 00:05:34 +01:00
|
|
|
PRINT_DIR = --no-print-directory
|
|
|
|
else # "make -w"
|
|
|
|
NO_SUBDIR = :
|
|
|
|
endif
|
|
|
|
|
2015-09-05 14:22:10 +02:00
|
|
|
ifneq ($(findstring s,$(MAKEFLAGS)),s)
|
2007-03-06 08:09:14 +01:00
|
|
|
ifndef V
|
2007-03-06 23:37:18 +01:00
|
|
|
QUIET_CC = @echo ' ' CC $@;
|
2007-03-06 07:35:01 +01:00
|
|
|
QUIET_AR = @echo ' ' AR $@;
|
|
|
|
QUIET_LINK = @echo ' ' LINK $@;
|
|
|
|
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
|
|
|
|
QUIET_GEN = @echo ' ' GEN $@;
|
2009-08-07 07:08:09 +02:00
|
|
|
QUIET_LNCP = @echo ' ' LN/CP $@;
|
2011-02-23 00:41:23 +01:00
|
|
|
QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
QUIET_MSGFMT = @echo ' ' MSGFMT $@;
|
2010-07-25 21:52:40 +02:00
|
|
|
QUIET_GCOV = @echo ' ' GCOV $@;
|
2011-04-21 21:14:42 +02:00
|
|
|
QUIET_SP = @echo ' ' SP $<;
|
Makefile: emulate compile in $(HCO) target better
Currently, when testing headers using `make hdr-check`, headers are
directly compiled. Although this seems to test the headers, this is too
strict since we treat the headers as C sources. As a result, this will
cause warnings to appear that would otherwise not, such as a static
variable definition intended for later use throwing a unused variable
warning.
In addition, on platforms that can run `make hdr-check` but require
custom flags, this target was failing because none of them were being
passed to the compiler. For example, on MacOS, the NO_OPENSSL flag was
being set but it was not being passed into compiler so the check was
failing.
Fix these problems by emulating the compile process better, including
test compiling dummy *.hcc C sources generated from the *.h files and
passing $(ALL_CFLAGS) into the compiler for the $(HCO) target so that
these custom flags can be used.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-25 10:21:01 +02:00
|
|
|
QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
|
2012-05-24 01:56:24 +02:00
|
|
|
QUIET_RC = @echo ' ' RC $@;
|
2019-10-09 22:43:46 +02:00
|
|
|
QUIET_SPATCH = @echo ' ' SPATCH $<;
|
2007-04-04 22:42:33 +02:00
|
|
|
QUIET_SUBDIR0 = +@subdir=
|
2007-03-07 00:05:34 +01:00
|
|
|
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
|
|
|
|
$(MAKE) $(PRINT_DIR) -C $$subdir
|
2007-03-06 08:09:14 +01:00
|
|
|
export V
|
2007-03-06 23:37:18 +01:00
|
|
|
export QUIET_GEN
|
2007-03-07 00:44:49 +01:00
|
|
|
export QUIET_BUILT_IN
|
|
|
|
endif
|
2007-03-06 07:35:01 +01:00
|
|
|
endif
|
2005-09-20 18:27:13 +02:00
|
|
|
|
2012-05-03 00:12:10 +02:00
|
|
|
ifdef NO_INSTALL_HARDLINKS
|
|
|
|
export NO_INSTALL_HARDLINKS
|
|
|
|
endif
|
|
|
|
|
2012-02-06 07:00:17 +01:00
|
|
|
### profile feedback build
|
|
|
|
#
|
|
|
|
|
|
|
|
# Can adjust this to be a global directory if you want to do extended
|
|
|
|
# data gathering
|
|
|
|
PROFILE_DIR := $(CURDIR)
|
|
|
|
|
2012-02-09 09:22:26 +01:00
|
|
|
ifeq ("$(PROFILE)","GEN")
|
2014-07-05 01:43:48 +02:00
|
|
|
BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
|
2012-02-06 07:00:17 +01:00
|
|
|
EXTLIBS += -lgcov
|
2012-12-09 11:36:17 +01:00
|
|
|
export CCACHE_DISABLE = t
|
|
|
|
V = 1
|
2012-02-09 09:22:26 +01:00
|
|
|
else
|
|
|
|
ifneq ("$(PROFILE)","")
|
2014-07-05 01:43:48 +02:00
|
|
|
BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
|
2012-12-09 11:36:17 +01:00
|
|
|
export CCACHE_DISABLE = t
|
|
|
|
V = 1
|
2012-02-06 07:00:17 +01:00
|
|
|
endif
|
2012-02-09 09:22:26 +01:00
|
|
|
endif
|
2012-02-06 07:00:17 +01:00
|
|
|
|
2006-07-09 09:44:30 +02:00
|
|
|
# Shell quote (do not use $(call) to accommodate ancient setups);
|
2006-02-18 12:40:22 +01:00
|
|
|
|
2007-02-14 12:48:14 +01:00
|
|
|
ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
|
2010-09-01 00:42:43 +02:00
|
|
|
ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
|
2006-02-18 12:40:22 +01:00
|
|
|
|
|
|
|
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
|
|
|
bindir_SQ = $(subst ','\'',$(bindir))
|
2009-01-18 13:00:09 +01:00
|
|
|
bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
mandir_SQ = $(subst ','\'',$(mandir))
|
2013-02-24 20:55:01 +01:00
|
|
|
mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
|
|
|
|
infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
perllibdir_SQ = $(subst ','\'',$(perllibdir))
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
localedir_SQ = $(subst ','\'',$(localedir))
|
2018-04-10 17:05:43 +02:00
|
|
|
localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
|
2006-02-18 12:40:22 +01:00
|
|
|
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
|
2018-03-13 21:39:34 +01:00
|
|
|
gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative))
|
2006-02-18 12:40:22 +01:00
|
|
|
template_dir_SQ = $(subst ','\'',$(template_dir))
|
2013-02-24 20:55:01 +01:00
|
|
|
htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
|
2006-06-15 00:36:00 +02:00
|
|
|
prefix_SQ = $(subst ','\'',$(prefix))
|
2018-04-10 17:05:43 +02:00
|
|
|
perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
|
2010-05-28 08:25:52 +02:00
|
|
|
gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
|
2006-02-18 12:40:22 +01:00
|
|
|
|
|
|
|
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
t/Makefile: introduce TEST_SHELL_PATH
You may want to run the test suite with a different shell
than you use to build Git. For instance, you may build with
SHELL_PATH=/bin/sh (because it's faster, or it's what you
expect to exist on systems where the build will be used) but
want to run the test suite with bash (e.g., since that
allows using "-x" reliably across the whole test suite).
There's currently no good way to do this.
You might think that doing two separate make invocations,
like:
make &&
make -C t SHELL_PATH=/bin/bash
would work. And it _almost_ does. The second make will see
our bash SHELL_PATH, and we'll use that to run the
individual test scripts (or tell prove to use it to do so).
So far so good.
But this breaks down when "--tee" or "--verbose-log" is
used. Those options cause the test script to actually
re-exec itself using $SHELL_PATH. But wait, wouldn't our
second make invocation have set SHELL_PATH correctly in the
environment?
Yes, but test-lib.sh sources GIT-BUILD-OPTIONS, which we
built during the first "make". And that overrides the
environment, giving us the original SHELL_PATH again.
Let's introduce a new variable that lets you specify a
specific shell to be run for the test scripts. Note that we
have to touch both the main and t/ Makefiles, since we have
to record it in GIT-BUILD-OPTIONS in one, and use it in the
latter.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-08 11:47:22 +01:00
|
|
|
TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
|
2006-02-18 12:40:22 +01:00
|
|
|
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
|
2009-11-18 02:42:31 +01:00
|
|
|
PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
|
2007-03-28 13:12:07 +02:00
|
|
|
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
|
2010-06-05 18:36:13 +02:00
|
|
|
DIFF_SQ = $(subst ','\'',$(DIFF))
|
2013-11-15 22:10:28 +01:00
|
|
|
PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
|
2006-02-18 12:40:22 +01:00
|
|
|
|
2018-04-10 17:05:43 +02:00
|
|
|
# RUNTIME_PREFIX's resolution logic requires resource paths to be expressed
|
|
|
|
# relative to each other and share an installation path.
|
|
|
|
#
|
|
|
|
# This is a dependency in:
|
|
|
|
# - Git's binary RUNTIME_PREFIX logic in (see "exec_cmd.c").
|
|
|
|
# - The runtime prefix Perl header (see
|
|
|
|
# "perl/header_templates/runtime_prefix.template.pl").
|
|
|
|
ifdef RUNTIME_PREFIX
|
|
|
|
|
|
|
|
ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
|
|
|
|
$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter /%,$(firstword $(localedir_relative))),)
|
|
|
|
$(error RUNTIME_PREFIX requires a relative localedir, not: $(localedir))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef NO_PERL
|
|
|
|
ifneq ($(filter /%,$(firstword $(perllibdir_relative))),)
|
|
|
|
$(error RUNTIME_PREFIX requires a relative perllibdir, not: $(perllibdir))
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
add an extra level of indirection to main()
There are certain startup tasks that we expect every git
process to do. In some cases this is just to improve the
quality of the program (e.g., setting up gettext()). In
others it is a requirement for using certain functions in
libgit.a (e.g., system_path() expects that you have called
git_extract_argv0_path()).
Most commands are builtins and are covered by the git.c
version of main(). However, there are still a few external
commands that use their own main(). Each of these has to
remember to include the correct startup sequence, and we are
not always consistent.
Rather than just fix the inconsistencies, let's make this
harder to get wrong by providing a common main() that can
run this standard startup.
We basically have two options to do this:
- the compat/mingw.h file already does something like this by
adding a #define that replaces the definition of main with a
wrapper that calls mingw_startup().
The upside is that the code in each program doesn't need
to be changed at all; it's rewritten on the fly by the
preprocessor.
The downside is that it may make debugging of the startup
sequence a bit more confusing, as the preprocessor is
quietly inserting new code.
- the builtin functions are all of the form cmd_foo(),
and git.c's main() calls them.
This is much more explicit, which may make things more
obvious to somebody reading the code. It's also more
flexible (because of course we have to figure out _which_
cmd_foo() to call).
The downside is that each of the builtins must define
cmd_foo(), instead of just main().
This patch chooses the latter option, preferring the more
explicit approach, even though it is more invasive. We
introduce a new file common-main.c, with the "real" main. It
expects to call cmd_main() from whatever other objects it is
linked against.
We link common-main.o against anything that links against
libgit.a, since we know that such programs will need to do
this setup. Note that common-main.o can't actually go inside
libgit.a, as the linker would not pick up its main()
function automatically (it has no callers).
The rest of the patch is just adjusting all of the various
external programs (mostly in t/helper) to use cmd_main().
I've provided a global declaration for cmd_main(), which
means that all of the programs also need to match its
signature. In particular, many functions need to switch to
"const char **" instead of "char **" for argv. This effect
ripples out to a few other variables and functions, as well.
This makes the patch even more invasive, but the end result
is much better. We should be treating argv strings as const
anyway, and now all programs conform to the same signature
(which also matches the way builtins are defined).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-01 07:58:58 +02:00
|
|
|
# We must filter out any object files from $(GITLIBS),
|
|
|
|
# as it is typically used like:
|
|
|
|
#
|
|
|
|
# foo: foo.o $(GITLIBS)
|
|
|
|
# $(CC) $(filter %.o,$^) $(LIBS)
|
|
|
|
#
|
|
|
|
# where we use it as a dependency. Since we also pull object files
|
|
|
|
# from the dependency list, that would make each entry appear twice.
|
|
|
|
LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
|
2006-06-25 03:35:12 +02:00
|
|
|
|
2017-03-11 23:28:18 +01:00
|
|
|
BASIC_CFLAGS += $(COMPAT_CFLAGS)
|
2005-12-03 00:08:28 +01:00
|
|
|
LIB_OBJS += $(COMPAT_OBJS)
|
2006-06-25 03:47:03 +02:00
|
|
|
|
2009-10-31 02:44:41 +01:00
|
|
|
# Quote for C
|
|
|
|
|
|
|
|
ifdef DEFAULT_EDITOR
|
|
|
|
DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
|
|
|
|
DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
|
|
|
|
|
|
|
|
BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
|
|
|
|
endif
|
|
|
|
|
2009-10-31 02:45:34 +01:00
|
|
|
ifdef DEFAULT_PAGER
|
|
|
|
DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
|
|
|
|
DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
|
|
|
|
|
|
|
|
BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
|
|
|
|
endif
|
|
|
|
|
2012-03-31 03:33:21 +02:00
|
|
|
ifdef SHELL_PATH
|
|
|
|
SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
|
|
|
|
SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
|
|
|
|
|
|
|
|
BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
|
|
|
|
endif
|
|
|
|
|
2012-06-02 21:01:12 +02:00
|
|
|
GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
|
|
|
|
GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
|
|
|
|
GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
|
2012-06-20 20:31:51 +02:00
|
|
|
GIT-USER-AGENT: FORCE
|
|
|
|
@if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
|
|
|
|
echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
|
|
|
|
fi
|
2012-06-02 21:01:12 +02:00
|
|
|
|
2012-06-06 22:28:16 +02:00
|
|
|
ifdef DEFAULT_HELP_FORMAT
|
|
|
|
BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
|
|
|
|
endif
|
|
|
|
|
2016-08-04 13:40:25 +02:00
|
|
|
PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
|
|
|
|
PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
|
|
|
|
PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
|
|
|
|
BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
|
|
|
|
|
2006-06-25 03:47:03 +02:00
|
|
|
ALL_CFLAGS += $(BASIC_CFLAGS)
|
|
|
|
ALL_LDFLAGS += $(BASIC_LDFLAGS)
|
|
|
|
|
2010-05-14 11:31:36 +02:00
|
|
|
export DIFF TAR INSTALL DESTDIR SHELL_PATH
|
2006-06-25 03:35:12 +02:00
|
|
|
|
|
|
|
|
2005-07-29 17:50:24 +02:00
|
|
|
### Build rules
|
|
|
|
|
2008-08-07 21:03:42 +02:00
|
|
|
SHELL = $(SHELL_PATH)
|
|
|
|
|
2012-02-06 07:00:17 +01:00
|
|
|
all:: shell_compatibility_test
|
|
|
|
|
|
|
|
ifeq "$(PROFILE)" "BUILD"
|
2014-07-08 08:35:11 +02:00
|
|
|
all:: profile
|
|
|
|
endif
|
|
|
|
|
|
|
|
profile:: profile-clean
|
2012-02-06 07:00:17 +01:00
|
|
|
$(MAKE) PROFILE=GEN all
|
|
|
|
$(MAKE) PROFILE=GEN -j1 test
|
2014-08-19 08:12:03 +02:00
|
|
|
@if test -n "$$GIT_PERF_REPO" || test -d .git; then \
|
|
|
|
$(MAKE) PROFILE=GEN -j1 perf; \
|
|
|
|
else \
|
|
|
|
echo "Skipping profile of perf tests..."; \
|
|
|
|
fi
|
2014-07-08 08:35:11 +02:00
|
|
|
$(MAKE) PROFILE=USE all
|
|
|
|
|
|
|
|
profile-fast: profile-clean
|
|
|
|
$(MAKE) PROFILE=GEN all
|
|
|
|
$(MAKE) PROFILE=GEN -j1 perf
|
|
|
|
$(MAKE) PROFILE=USE all
|
|
|
|
|
2012-02-06 07:00:17 +01:00
|
|
|
|
|
|
|
all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
|
2007-01-10 21:24:54 +01:00
|
|
|
ifneq (,$X)
|
2009-10-27 12:23:33 +01:00
|
|
|
$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
|
2007-01-10 21:24:54 +01:00
|
|
|
endif
|
2005-04-30 22:19:56 +02:00
|
|
|
|
2007-01-10 21:24:54 +01:00
|
|
|
all::
|
2007-03-28 13:00:23 +02:00
|
|
|
ifndef NO_TCLTK
|
2008-07-28 09:02:48 +02:00
|
|
|
$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
|
2007-11-17 19:51:16 +01:00
|
|
|
$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
|
2009-04-03 21:32:20 +02:00
|
|
|
endif
|
2010-03-20 15:48:08 +01:00
|
|
|
$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
|
2005-08-06 07:36:15 +02:00
|
|
|
|
2008-08-07 21:06:26 +02:00
|
|
|
please_set_SHELL_PATH_to_a_more_modern_shell:
|
|
|
|
@$$(:)
|
|
|
|
|
|
|
|
shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
|
|
|
|
|
2006-01-13 06:42:25 +01:00
|
|
|
strip: $(PROGRAMS) git$X
|
2013-05-25 04:41:02 +02:00
|
|
|
$(STRIP) $(STRIP_OPTS) $^
|
2006-01-13 06:42:25 +01:00
|
|
|
|
2012-07-07 06:19:09 +02:00
|
|
|
### Target-specific flags and dependencies
|
|
|
|
|
|
|
|
# The generic compilation pattern rule and automatically
|
|
|
|
# computed header dependencies (falling back to a dependency on
|
|
|
|
# LIB_H) are enough to describe how most targets should be built,
|
|
|
|
# but some targets are special enough to need something a little
|
|
|
|
# different.
|
|
|
|
#
|
|
|
|
# - When a source file "foo.c" #includes a generated header file,
|
|
|
|
# we need to list that dependency for the "foo.o" target.
|
|
|
|
#
|
|
|
|
# We also list it from other targets that are built from foo.c
|
|
|
|
# like "foo.sp" and "foo.s", even though that is easy to forget
|
|
|
|
# to do because the generated header is already present around
|
|
|
|
# after a regular build attempt.
|
|
|
|
#
|
|
|
|
# - Some code depends on configuration kept in makefile
|
|
|
|
# variables. The target-specific variable EXTRA_CPPFLAGS can
|
|
|
|
# be used to convey that information to the C preprocessor
|
|
|
|
# using -D options.
|
|
|
|
#
|
|
|
|
# The "foo.o" target should have a corresponding dependency on
|
|
|
|
# a file that changes when the value of the makefile variable
|
|
|
|
# changes. For example, targets making use of the
|
|
|
|
# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
|
|
|
|
#
|
|
|
|
# Technically the ".sp" and ".s" targets do not need this
|
|
|
|
# dependency because they are force-built, but they get the
|
|
|
|
# same dependency for consistency. This way, you do not have to
|
|
|
|
# know how each target is implemented. And it means the
|
|
|
|
# dependencies here will not need to change if the force-build
|
|
|
|
# details change some day.
|
|
|
|
|
2012-06-20 20:31:55 +02:00
|
|
|
git.sp git.s git.o: GIT-PREFIX
|
2012-06-02 20:51:42 +02:00
|
|
|
git.sp git.s git.o: EXTRA_CPPFLAGS = \
|
2013-02-24 20:55:01 +01:00
|
|
|
'-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
|
|
|
|
'-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
|
|
|
|
'-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
|
2007-06-13 10:28:21 +02:00
|
|
|
|
2011-06-22 12:50:56 +02:00
|
|
|
git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
|
add an extra level of indirection to main()
There are certain startup tasks that we expect every git
process to do. In some cases this is just to improve the
quality of the program (e.g., setting up gettext()). In
others it is a requirement for using certain functions in
libgit.a (e.g., system_path() expects that you have called
git_extract_argv0_path()).
Most commands are builtins and are covered by the git.c
version of main(). However, there are still a few external
commands that use their own main(). Each of these has to
remember to include the correct startup sequence, and we are
not always consistent.
Rather than just fix the inconsistencies, let's make this
harder to get wrong by providing a common main() that can
run this standard startup.
We basically have two options to do this:
- the compat/mingw.h file already does something like this by
adding a #define that replaces the definition of main with a
wrapper that calls mingw_startup().
The upside is that the code in each program doesn't need
to be changed at all; it's rewritten on the fly by the
preprocessor.
The downside is that it may make debugging of the startup
sequence a bit more confusing, as the preprocessor is
quietly inserting new code.
- the builtin functions are all of the form cmd_foo(),
and git.c's main() calls them.
This is much more explicit, which may make things more
obvious to somebody reading the code. It's also more
flexible (because of course we have to figure out _which_
cmd_foo() to call).
The downside is that each of the builtins must define
cmd_foo(), instead of just main().
This patch chooses the latter option, preferring the more
explicit approach, even though it is more invasive. We
introduce a new file common-main.c, with the "real" main. It
expects to call cmd_main() from whatever other objects it is
linked against.
We link common-main.o against anything that links against
libgit.a, since we know that such programs will need to do
this setup. Note that common-main.o can't actually go inside
libgit.a, as the linker would not pick up its main()
function automatically (it has no callers).
The rest of the patch is just adjusting all of the various
external programs (mostly in t/helper) to use cmd_main().
I've provided a global declaration for cmd_main(), which
means that all of the programs also need to match its
signature. In particular, many functions need to switch to
"const char **" instead of "char **" for argv. This effect
ripples out to a few other variables and functions, as well.
This makes the patch even more invasive, but the end result
is much better. We should be treating argv strings as const
anyway, and now all programs conform to the same signature
(which also matches the way builtins are defined).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-01 07:58:58 +02:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
|
|
|
|
$(filter %.o,$^) $(LIBS)
|
2005-09-08 06:26:52 +02:00
|
|
|
|
2018-05-10 10:46:43 +02:00
|
|
|
help.sp help.s help.o: command-list.h
|
2010-11-26 17:00:39 +01:00
|
|
|
|
help: move list_config_help to builtin/help
Starting in 3ac68a93fd2, help.o began to depend on builtin/branch.o,
builtin/clean.o, and builtin/config.o. This meant that help.o was
unusable outside of the context of the main Git executable.
To make help.o usable by other commands again, move list_config_help()
into builtin/help.c (where it makes sense to assume other builtin libraries
are present).
When command-list.h is included but a member is not used, we start to
hear a compiler warning. Since the config list is generated in a fairly
different way than the command list, and since commands and config
options are semantically different, move the config list into its own
header and move the generator into its own script and build rule.
For reasons explained in 976aaedc (msvc: add a Makefile target to
pre-generate the Visual Studio solution, 2019-07-29), some build
artifacts we consider non-source files cannot be generated in the
Visual Studio environment, and we already have some Makefile tweaks
to help Visual Studio to use generated command-list.h header file.
Do the same to a new generated file, config-list.h, introduced by
this change.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
2020-04-16 23:18:03 +02:00
|
|
|
builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
|
2011-04-21 21:14:42 +02:00
|
|
|
builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
|
2013-02-24 20:55:01 +01:00
|
|
|
'-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
|
|
|
|
'-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
|
|
|
|
'-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
|
2006-04-22 06:56:13 +02:00
|
|
|
|
2012-06-20 20:32:22 +02:00
|
|
|
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
|
2012-06-02 20:51:42 +02:00
|
|
|
version.sp version.s version.o: EXTRA_CPPFLAGS = \
|
2012-06-20 20:31:51 +02:00
|
|
|
'-DGIT_VERSION="$(GIT_VERSION)"' \
|
2017-12-15 00:34:38 +01:00
|
|
|
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
|
Makefile: fix the "built from commit" code
In ed32b788c06 (version --build-options: report commit, too, if
possible, 2017-12-15), we introduced code to let `git version
--build-options` report the current commit from which the binaries were
built, if any.
To prevent erroneous commits from being reported (e.g. when unpacking
Git's source code from a .tar.gz file into a subdirectory of a different
Git project, as e.g. git_osx_installer does), we painstakingly set
GIT_CEILING_DIRECTORIES when trying to determine the current commit.
Except that we got the quoting wrong, and that variable therefore does
not have the desired effect.
The issue is that the $(shell) is resolved before the output is stuffed
into the command-line with -DGIT_BUILT_FROM_COMMIT, and therefore is
*not* inside quotes. And thus backslashing the quotes is wrong, as the
quote gets literally inserted into the CEILING_DIRECTORIES variable.
Let's fix that quoting, and while at it, also suppress the unhelpful
message
fatal: not a git repository (or any of the parent directories): .git
that gets printed to stderr if no current commit could be determined,
and might scare the occasional developer who simply tries to build Git
from scratch.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-06-27 21:35:23 +02:00
|
|
|
'-DGIT_BUILT_FROM_COMMIT="$(shell \
|
|
|
|
GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
|
|
|
|
git rev-parse -q --verify HEAD 2>/dev/null)"'
|
2012-06-02 20:51:42 +02:00
|
|
|
|
2006-04-11 02:37:58 +02:00
|
|
|
$(BUILT_INS): git$X
|
2008-08-25 17:33:03 +02:00
|
|
|
$(QUIET_BUILT_IN)$(RM) $@ && \
|
2013-05-25 04:41:03 +02:00
|
|
|
ln $< $@ 2>/dev/null || \
|
|
|
|
ln -s $< $@ 2>/dev/null || \
|
|
|
|
cp $< $@
|
2006-04-11 02:37:58 +02:00
|
|
|
|
help: move list_config_help to builtin/help
Starting in 3ac68a93fd2, help.o began to depend on builtin/branch.o,
builtin/clean.o, and builtin/config.o. This meant that help.o was
unusable outside of the context of the main Git executable.
To make help.o usable by other commands again, move list_config_help()
into builtin/help.c (where it makes sense to assume other builtin libraries
are present).
When command-list.h is included but a member is not used, we start to
hear a compiler warning. Since the config list is generated in a fairly
different way than the command list, and since commands and config
options are semantically different, move the config list into its own
header and move the generator into its own script and build rule.
For reasons explained in 976aaedc (msvc: add a Makefile target to
pre-generate the Visual Studio solution, 2019-07-29), some build
artifacts we consider non-source files cannot be generated in the
Visual Studio environment, and we already have some Makefile tweaks
to help Visual Studio to use generated command-list.h header file.
Do the same to a new generated file, config-list.h, introduced by
this change.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
2020-04-16 23:18:03 +02:00
|
|
|
config-list.h: generate-configlist.sh
|
|
|
|
|
|
|
|
config-list.h:
|
|
|
|
$(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \
|
|
|
|
>$@+ && mv $@+ $@
|
|
|
|
|
2018-05-10 10:46:41 +02:00
|
|
|
command-list.h: generate-cmdlist.sh command-list.txt
|
2007-06-13 11:00:01 +02:00
|
|
|
|
2018-10-27 08:22:34 +02:00
|
|
|
command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
|
2019-04-18 15:16:40 +02:00
|
|
|
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
|
|
|
|
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
|
|
|
|
command-list.txt >$@+ && mv $@+ $@
|
2006-03-09 17:24:19 +01:00
|
|
|
|
2012-06-20 20:32:16 +02:00
|
|
|
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
|
2012-06-20 20:32:19 +02:00
|
|
|
$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
|
|
|
|
$(perllibdir_SQ)
|
2010-01-31 20:46:53 +01:00
|
|
|
define cmd_munge_script
|
|
|
|
$(RM) $@ $@+ && \
|
|
|
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
|
2010-06-05 18:36:13 +02:00
|
|
|
-e 's|@@DIFF@@|$(DIFF_SQ)|' \
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
-e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
|
2010-01-31 20:46:53 +01:00
|
|
|
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
|
2012-01-23 23:04:29 +01:00
|
|
|
-e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
|
2010-01-31 20:46:53 +01:00
|
|
|
-e $(BROKEN_PATH_FIX) \
|
2012-06-20 20:32:19 +02:00
|
|
|
-e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
|
|
|
|
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
|
2016-03-09 00:47:57 +01:00
|
|
|
-e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
|
2016-08-04 13:40:25 +02:00
|
|
|
-e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
|
2010-01-31 20:46:53 +01:00
|
|
|
$@.sh >$@+
|
|
|
|
endef
|
|
|
|
|
2012-06-20 20:32:16 +02:00
|
|
|
GIT-SCRIPT-DEFINES: FORCE
|
|
|
|
@FLAGS='$(SCRIPT_DEFINES)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
|
2012-12-18 16:26:39 +01:00
|
|
|
echo >&2 " * new script parameters"; \
|
2012-06-20 20:32:16 +02:00
|
|
|
echo "$$FLAGS" >$@; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2014-11-18 19:38:38 +01:00
|
|
|
$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
|
2010-01-31 20:46:53 +01:00
|
|
|
$(QUIET_GEN)$(cmd_munge_script) && \
|
2007-03-06 07:35:01 +01:00
|
|
|
chmod +x $@+ && \
|
Don't write directly to a make target ($@).
Otherwise, if make is suspended, or killed with prejudice, or if the
system crashes, you could be left with an up-to-date, yet corrupt,
generated file.
I left off the `clean' addition, because I believe "make clean" should
not remove wildcard patterns like "*+", on the off-chance that someone
uses names like that for files they care about. Besides, in practice,
those temporary files are left behind so rarely that they're not a bother,
and they're removed again as part of the next build.
[jc: sign-off?]
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-25 18:52:01 +02:00
|
|
|
mv $@+ $@
|
2005-09-09 03:50:33 +02:00
|
|
|
|
2012-06-20 20:32:16 +02:00
|
|
|
$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
|
2010-01-31 20:46:53 +01:00
|
|
|
$(QUIET_GEN)$(cmd_munge_script) && \
|
|
|
|
mv $@+ $@
|
|
|
|
|
2018-11-06 15:55:50 +01:00
|
|
|
git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
|
2012-05-24 01:56:24 +02:00
|
|
|
$(QUIET_RC)$(RC) \
|
2017-10-30 18:19:42 +01:00
|
|
|
$(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
|
|
|
|
$(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
|
2017-01-07 22:41:10 +01:00
|
|
|
-DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
|
2012-05-24 01:56:24 +02:00
|
|
|
|
2014-11-18 18:43:09 +01:00
|
|
|
# This makes sure we depend on the NO_PERL setting itself.
|
2014-11-18 19:38:38 +01:00
|
|
|
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
|
2014-11-18 18:43:09 +01:00
|
|
|
|
2018-04-10 17:05:43 +02:00
|
|
|
# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX
|
|
|
|
# since the locale directory is injected.
|
|
|
|
perl_localedir_SQ = $(localedir_SQ)
|
2006-12-04 10:50:04 +01:00
|
|
|
|
2009-04-03 21:32:20 +02:00
|
|
|
ifndef NO_PERL
|
2018-04-10 17:05:42 +02:00
|
|
|
PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
|
2018-04-10 17:05:42 +02:00
|
|
|
|
2018-04-10 17:05:43 +02:00
|
|
|
PERL_DEFINES := $(PERL_PATH_SQ) $(PERLLIB_EXTRA_SQ) $(perllibdir_SQ)
|
|
|
|
PERL_DEFINES += $(RUNTIME_PREFIX)
|
|
|
|
|
|
|
|
# Support Perl runtime prefix. In this mode, a different header is installed
|
|
|
|
# into Perl scripts.
|
|
|
|
ifdef RUNTIME_PREFIX
|
|
|
|
|
|
|
|
PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl
|
|
|
|
|
|
|
|
# Don't export a fixed $(localedir) path; it will be resolved by the Perl header
|
|
|
|
# at runtime.
|
|
|
|
perl_localedir_SQ =
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
|
|
|
|
|
2018-04-10 17:05:42 +02:00
|
|
|
$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
|
2007-07-14 19:51:44 +02:00
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
2006-07-07 22:04:35 +02:00
|
|
|
sed -e '1{' \
|
|
|
|
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
|
2018-06-25 21:13:25 +02:00
|
|
|
-e ' r GIT-PERL-HEADER' \
|
2018-04-10 17:05:42 +02:00
|
|
|
-e ' G' \
|
2006-07-07 22:04:35 +02:00
|
|
|
-e '}' \
|
2005-10-04 21:41:35 +02:00
|
|
|
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
|
2013-05-25 04:41:03 +02:00
|
|
|
$< >$@+ && \
|
2007-03-06 07:35:01 +01:00
|
|
|
chmod +x $@+ && \
|
Don't write directly to a make target ($@).
Otherwise, if make is suspended, or killed with prejudice, or if the
system crashes, you could be left with an up-to-date, yet corrupt,
generated file.
I left off the `clean' addition, because I believe "make clean" should
not remove wildcard patterns like "*+", on the off-chance that someone
uses names like that for files they care about. Besides, in practice,
those temporary files are left behind so rarely that they're not a bother,
and they're removed again as part of the next build.
[jc: sign-off?]
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-25 18:52:01 +02:00
|
|
|
mv $@+ $@
|
2005-09-09 03:50:33 +02:00
|
|
|
|
2018-04-10 17:05:43 +02:00
|
|
|
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
|
2013-11-18 23:23:11 +01:00
|
|
|
GIT-PERL-DEFINES: FORCE
|
|
|
|
@FLAGS='$(PERL_DEFINES)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
|
|
|
|
echo >&2 " * new perl-specific parameters"; \
|
|
|
|
echo "$$FLAGS" >$@; \
|
|
|
|
fi
|
|
|
|
|
2018-04-10 17:05:42 +02:00
|
|
|
GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
|
|
|
|
$(QUIET_GEN)$(RM) $@ && \
|
|
|
|
INSTLIBDIR='$(perllibdir_SQ)' && \
|
|
|
|
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
|
|
|
|
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
|
|
|
|
sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
|
2018-04-24 01:25:35 +02:00
|
|
|
-e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
|
2018-04-10 17:05:43 +02:00
|
|
|
-e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
|
|
|
|
-e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
|
|
|
|
-e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
|
2018-04-10 17:05:42 +02:00
|
|
|
$< >$@+ && \
|
|
|
|
mv $@+ $@
|
2010-01-30 23:30:40 +01:00
|
|
|
|
2018-04-18 23:44:40 +02:00
|
|
|
.PHONY: perllibdir
|
2018-04-10 15:36:41 +02:00
|
|
|
perllibdir:
|
|
|
|
@echo '$(perllibdir_SQ)'
|
2010-01-30 23:30:40 +01:00
|
|
|
|
|
|
|
.PHONY: gitweb
|
|
|
|
gitweb:
|
|
|
|
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
|
|
|
|
|
2015-05-29 09:25:45 +02:00
|
|
|
git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
|
2012-06-20 20:32:19 +02:00
|
|
|
$(QUIET_GEN)$(cmd_munge_script) && \
|
2007-03-06 07:35:01 +01:00
|
|
|
chmod +x $@+ && \
|
2006-07-02 00:14:14 +02:00
|
|
|
mv $@+ $@
|
2009-04-03 21:32:20 +02:00
|
|
|
else # NO_PERL
|
2014-11-18 19:38:38 +01:00
|
|
|
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
|
2009-04-03 21:32:20 +02:00
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
|
|
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
|
|
|
|
unimplemented.sh >$@+ && \
|
|
|
|
chmod +x $@+ && \
|
|
|
|
mv $@+ $@
|
|
|
|
endif # NO_PERL
|
2006-07-02 00:14:14 +02:00
|
|
|
|
2014-11-18 19:43:47 +01:00
|
|
|
# This makes sure we depend on the NO_PYTHON setting itself.
|
|
|
|
$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
|
|
|
|
|
2009-11-18 02:42:32 +01:00
|
|
|
ifndef NO_PYTHON
|
2013-05-25 04:41:01 +02:00
|
|
|
$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
|
|
|
|
$(SCRIPT_PYTHON_GEN): % : %.py
|
2009-11-18 02:42:32 +01:00
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
2010-04-09 17:57:45 +02:00
|
|
|
sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
|
2013-05-25 04:41:03 +02:00
|
|
|
$< >$@+ && \
|
2009-11-18 02:42:32 +01:00
|
|
|
chmod +x $@+ && \
|
|
|
|
mv $@+ $@
|
|
|
|
else # NO_PYTHON
|
2013-05-25 04:41:01 +02:00
|
|
|
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
|
2009-11-18 02:42:32 +01:00
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
|
|
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
|
|
|
|
unimplemented.sh >$@+ && \
|
|
|
|
chmod +x $@+ && \
|
|
|
|
mv $@+ $@
|
|
|
|
endif # NO_PYTHON
|
|
|
|
|
2013-02-21 07:26:14 +01:00
|
|
|
CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
|
|
|
|
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
|
|
|
|
configure.ac >configure.ac+ && \
|
|
|
|
autoconf -o configure configure.ac+ && \
|
|
|
|
$(RM) configure.ac+
|
|
|
|
|
2012-06-20 20:32:22 +02:00
|
|
|
configure: configure.ac GIT-VERSION-FILE
|
2013-02-21 07:26:14 +01:00
|
|
|
$(QUIET_GEN)$(CONFIGURE_RECIPE)
|
2006-08-08 18:35:23 +02:00
|
|
|
|
2012-07-19 09:50:02 +02:00
|
|
|
ifdef AUTOCONFIGURED
|
2013-01-02 09:25:44 +01:00
|
|
|
# We avoid depending on 'configure' here, because it gets rebuilt
|
|
|
|
# every time GIT-VERSION-FILE is modified, only to update the embedded
|
|
|
|
# version number string, which config.status does not care about. We
|
|
|
|
# do want to recheck when the platform/environment detection logic
|
|
|
|
# changes, hence this depends on configure.ac.
|
|
|
|
config.status: configure.ac
|
2013-02-21 07:26:14 +01:00
|
|
|
$(QUIET_GEN)$(CONFIGURE_RECIPE) && \
|
2013-01-02 09:25:44 +01:00
|
|
|
if test -f config.status; then \
|
2012-07-19 09:50:02 +02:00
|
|
|
./config.status --recheck; \
|
|
|
|
else \
|
|
|
|
./configure; \
|
|
|
|
fi
|
|
|
|
reconfigure config.mak.autogen: config.status
|
|
|
|
$(QUIET_GEN)./config.status
|
|
|
|
.PHONY: reconfigure # This is a convenience target.
|
|
|
|
endif
|
|
|
|
|
2011-03-27 20:13:22 +02:00
|
|
|
XDIFF_OBJS += xdiff/xdiffi.o
|
|
|
|
XDIFF_OBJS += xdiff/xemit.o
|
2020-03-21 10:21:20 +01:00
|
|
|
XDIFF_OBJS += xdiff/xhistogram.o
|
2011-03-27 20:13:22 +02:00
|
|
|
XDIFF_OBJS += xdiff/xmerge.o
|
|
|
|
XDIFF_OBJS += xdiff/xpatience.o
|
2020-03-21 10:21:20 +01:00
|
|
|
XDIFF_OBJS += xdiff/xprepare.o
|
|
|
|
XDIFF_OBJS += xdiff/xutils.o
|
2011-03-27 20:13:22 +02:00
|
|
|
|
2018-03-24 08:44:30 +01:00
|
|
|
TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
|
2012-07-07 05:39:18 +02:00
|
|
|
OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
|
|
|
|
$(XDIFF_OBJS) \
|
2018-10-13 02:58:40 +02:00
|
|
|
$(FUZZ_OBJS) \
|
add an extra level of indirection to main()
There are certain startup tasks that we expect every git
process to do. In some cases this is just to improve the
quality of the program (e.g., setting up gettext()). In
others it is a requirement for using certain functions in
libgit.a (e.g., system_path() expects that you have called
git_extract_argv0_path()).
Most commands are builtins and are covered by the git.c
version of main(). However, there are still a few external
commands that use their own main(). Each of these has to
remember to include the correct startup sequence, and we are
not always consistent.
Rather than just fix the inconsistencies, let's make this
harder to get wrong by providing a common main() that can
run this standard startup.
We basically have two options to do this:
- the compat/mingw.h file already does something like this by
adding a #define that replaces the definition of main with a
wrapper that calls mingw_startup().
The upside is that the code in each program doesn't need
to be changed at all; it's rewritten on the fly by the
preprocessor.
The downside is that it may make debugging of the startup
sequence a bit more confusing, as the preprocessor is
quietly inserting new code.
- the builtin functions are all of the form cmd_foo(),
and git.c's main() calls them.
This is much more explicit, which may make things more
obvious to somebody reading the code. It's also more
flexible (because of course we have to figure out _which_
cmd_foo() to call).
The downside is that each of the builtins must define
cmd_foo(), instead of just main().
This patch chooses the latter option, preferring the more
explicit approach, even though it is more invasive. We
introduce a new file common-main.c, with the "real" main. It
expects to call cmd_main() from whatever other objects it is
linked against.
We link common-main.o against anything that links against
libgit.a, since we know that such programs will need to do
this setup. Note that common-main.o can't actually go inside
libgit.a, as the linker would not pick up its main()
function automatically (it has no callers).
The rest of the patch is just adjusting all of the various
external programs (mostly in t/helper) to use cmd_main().
I've provided a global declaration for cmd_main(), which
means that all of the programs also need to match its
signature. In particular, many functions need to switch to
"const char **" instead of "char **" for argv. This effect
ripples out to a few other variables and functions, as well.
This makes the patch even more invasive, but the end result
is much better. We should be treating argv strings as const
anyway, and now all programs conform to the same signature
(which also matches the way builtins are defined).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-01 07:58:58 +02:00
|
|
|
common-main.o \
|
2012-07-07 05:39:18 +02:00
|
|
|
git.o
|
|
|
|
ifndef NO_CURL
|
|
|
|
OBJECTS += http.o http-walker.o remote-curl.o
|
|
|
|
endif
|
2010-01-26 16:52:11 +01:00
|
|
|
|
2010-01-31 22:23:53 +01:00
|
|
|
dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
|
2010-01-31 22:37:25 +01:00
|
|
|
dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
|
2010-01-26 16:49:33 +01:00
|
|
|
|
2011-11-18 10:58:21 +01:00
|
|
|
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
|
2010-01-26 16:52:49 +01:00
|
|
|
$(dep_dirs):
|
2011-09-11 21:40:18 +02:00
|
|
|
@mkdir -p $@
|
2010-01-26 16:52:49 +01:00
|
|
|
|
|
|
|
missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
|
2010-01-31 22:23:53 +01:00
|
|
|
dep_file = $(dir $@).depend/$(notdir $@).d
|
2011-11-19 00:23:24 +01:00
|
|
|
dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
|
2010-01-26 16:57:15 +01:00
|
|
|
endif
|
|
|
|
|
2011-11-18 10:58:21 +01:00
|
|
|
ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
|
2010-01-26 16:52:49 +01:00
|
|
|
dep_dirs =
|
|
|
|
missing_dep_dirs =
|
2010-01-26 16:57:15 +01:00
|
|
|
dep_args =
|
|
|
|
endif
|
|
|
|
|
|
|
|
ASM_SRC := $(wildcard $(OBJECTS:o=S))
|
|
|
|
ASM_OBJ := $(ASM_SRC:S=o)
|
|
|
|
C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
|
|
|
|
|
2010-01-26 16:51:24 +01:00
|
|
|
.SUFFIXES:
|
|
|
|
|
2010-01-26 16:52:49 +01:00
|
|
|
$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
|
2010-03-20 04:20:12 +01:00
|
|
|
$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
|
2010-01-26 16:52:49 +01:00
|
|
|
$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)
|
2010-03-20 04:20:12 +01:00
|
|
|
$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
|
2010-01-26 16:52:49 +01:00
|
|
|
|
2010-01-06 09:06:58 +01:00
|
|
|
%.s: %.c GIT-CFLAGS FORCE
|
2012-07-23 01:47:26 +02:00
|
|
|
$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
|
2010-01-26 16:57:15 +01:00
|
|
|
|
|
|
|
ifdef USE_COMPUTED_HEADER_DEPENDENCIES
|
2010-01-26 16:52:49 +01:00
|
|
|
# Take advantage of gcc's on-the-fly dependency generation
|
|
|
|
# See <http://gcc.gnu.org/gcc-3.0/features.html>.
|
2010-01-26 16:57:15 +01:00
|
|
|
dep_files_present := $(wildcard $(dep_files))
|
|
|
|
ifneq ($(dep_files_present),)
|
|
|
|
include $(dep_files_present)
|
2010-01-26 16:52:49 +01:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
# Dependencies on header files, for platforms that do not support
|
|
|
|
# the gcc -MMD option.
|
|
|
|
#
|
2018-05-10 10:46:43 +02:00
|
|
|
# Dependencies on automatically generated headers such as command-list.h
|
2010-01-26 16:52:49 +01:00
|
|
|
# should _not_ be included here, since they are necessary even when
|
|
|
|
# building an object for the first time.
|
2010-08-10 00:04:29 +02:00
|
|
|
|
Makefile: use `git ls-files` to list header files, if possible
In d85b0dff72 (Makefile: use `find` to determine static header
dependencies, 2014-08-25), we switched from a static list of header
files to a dynamically-generated one, asking `find` to enumerate them.
Back in those days, we did not use `$(LIB_H)` by default, and many a
`make` implementation seems smart enough not to run that `find` command
in that case, so it was deemed okay to run `find` for special targets
requiring this macro.
However, as of ebb7baf02f (Makefile: add a hdr-check target,
2018-09-19), $(LIB_H) is part of a global rule and therefore must be
expanded. Meaning: this `find` command has to be run upon every
`make` invocation. In the presence of many a worktree, this can tax the
developers' patience quite a bit.
Even in the absence of worktrees or other untracked files and
directories, the cost of I/O to generate that list of header files is
simply a lot larger than a simple `git ls-files` call.
Therefore, just like in 335339758c (Makefile: ask "ls-files" to list
source files if available, 2011-10-18), we now prefer to use `git
ls-files` to enumerate the header files to enumerating them via `find`,
falling back to the latter if the former failed (which would be the case
e.g. in a worktree that was extracted from a source .tar file rather
than from a clone of Git's sources).
This has one notable consequence: we no longer include `command-list.h`
in `LIB_H`, as it is a generated file, not a tracked one, but that is
easily worked around. Of the three sites that use `LIB_H`, two
(`LOCALIZED_C` and `CHK_HDRS`) already handle generated headers
separately. In the third, the computed-dependency fallback, we can just
add in a reference to $(GENERATED_H).
Likewise, we no longer include not-yet-tracked header files in `LIB_H`.
Given the speed improvements, these consequences seem a comparably small
price to pay.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-04 14:47:06 +01:00
|
|
|
$(OBJECTS): $(LIB_H) $(GENERATED_H)
|
2010-01-26 16:52:49 +01:00
|
|
|
endif
|
2005-05-19 16:27:14 +02:00
|
|
|
|
2018-04-10 23:26:18 +02:00
|
|
|
exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
|
|
|
|
exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
|
2010-01-06 09:05:04 +01:00
|
|
|
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
|
2018-04-10 17:05:44 +02:00
|
|
|
'-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
|
2010-01-06 09:05:04 +01:00
|
|
|
'-DBINDIR="$(bindir_relative_SQ)"' \
|
2018-04-21 13:18:42 +02:00
|
|
|
'-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
|
2009-01-18 13:00:09 +01:00
|
|
|
|
2012-06-20 20:31:55 +02:00
|
|
|
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
|
2011-04-21 21:14:42 +02:00
|
|
|
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
|
2010-01-06 09:05:04 +01:00
|
|
|
-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
|
2006-01-11 03:12:17 +01:00
|
|
|
|
2012-06-20 20:31:55 +02:00
|
|
|
config.sp config.s config.o: GIT-PREFIX
|
2011-04-21 21:14:42 +02:00
|
|
|
config.sp config.s config.o: EXTRA_CPPFLAGS = \
|
|
|
|
-DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
|
2007-11-13 21:05:05 +01:00
|
|
|
|
2012-06-20 20:31:55 +02:00
|
|
|
attr.sp attr.s attr.o: GIT-PREFIX
|
2011-04-21 21:14:42 +02:00
|
|
|
attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
|
|
|
|
-DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
|
2010-09-01 00:42:43 +02:00
|
|
|
|
2012-06-20 20:31:55 +02:00
|
|
|
gettext.sp gettext.s gettext.o: GIT-PREFIX
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
|
2018-04-10 17:05:44 +02:00
|
|
|
-DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
|
2019-02-05 03:27:48 +01:00
|
|
|
http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
|
sparse: suppress some "using sizeof on a function" warnings
Sparse issues an "using sizeof on a function" warning for each
call to curl_easy_setopt() which sets an option that takes a
function pointer parameter. (currently 12 such warnings over 4
files.)
The warnings relate to the use of the "typecheck-gcc.h" header
file which adds a layer of type-checking macros to the curl
function invocations (for gcc >= 4.3 and !__cplusplus). As part
of the type-checking layer, 'sizeof' is applied to the function
parameter of curl_easy_setopt(). Note that, in the context of
sizeof, the function to function pointer conversion is not
performed and that sizeof(f) != sizeof(&f).
A simple solution, therefore, would be to replace the function
name in each such call to curl_easy_setopt() with an explicit
function pointer expression (i.e. replace f with &f).
However, the "typecheck-gcc.h" header file is only conditionally
included, in addition to the gcc and C++ checks mentioned above,
depending on the CURL_DISABLE_TYPECHECK preprocessor variable.
In order to suppress the warnings, we use target-specific variable
assignments to add -DCURL_DISABLE_TYPECHECK to SPARSE_FLAGS for
each file affected (http-push.c, http.c, http-walker.c and
remote-curl.c).
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2013-10-06 22:52:21 +02:00
|
|
|
-DCURL_DISABLE_TYPECHECK
|
|
|
|
|
2019-02-05 03:27:48 +01:00
|
|
|
pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
|
2018-02-12 01:21:02 +01:00
|
|
|
|
2006-04-04 14:33:18 +02:00
|
|
|
ifdef NO_EXPAT
|
2011-04-21 21:14:42 +02:00
|
|
|
http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
|
2006-04-04 14:33:18 +02:00
|
|
|
endif
|
|
|
|
|
2010-08-17 11:24:39 +02:00
|
|
|
ifdef NO_REGEX
|
2011-04-21 21:14:42 +02:00
|
|
|
compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
|
|
|
|
-DGAWK -DNO_MBSUPPORT
|
2010-08-17 11:24:39 +02:00
|
|
|
endif
|
|
|
|
|
2010-09-11 11:59:18 +02:00
|
|
|
ifdef USE_NED_ALLOCATOR
|
2011-04-21 21:14:42 +02:00
|
|
|
compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
|
2016-09-03 17:59:15 +02:00
|
|
|
-DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
|
2019-02-05 03:27:48 +01:00
|
|
|
compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
|
2010-09-11 11:59:18 +02:00
|
|
|
endif
|
|
|
|
|
2011-06-22 12:50:56 +02:00
|
|
|
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
|
2007-03-06 07:35:01 +01:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
|
2005-07-29 19:21:53 +02:00
|
|
|
|
2014-11-09 15:55:53 +01:00
|
|
|
git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
|
2008-07-09 23:29:00 +02:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
2017-01-08 07:12:38 +01:00
|
|
|
$(IMAP_SEND_LDFLAGS) $(LIBS)
|
2006-03-10 06:32:50 +01:00
|
|
|
|
2014-01-25 14:11:44 +01:00
|
|
|
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
|
2009-08-05 07:01:59 +02:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
2015-10-21 19:01:13 +02:00
|
|
|
$(CURL_LIBCURL) $(LIBS)
|
2014-01-25 14:11:44 +01:00
|
|
|
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
|
2007-03-06 07:35:01 +01:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
2015-10-21 19:01:13 +02:00
|
|
|
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
|
2006-02-18 12:40:22 +01:00
|
|
|
|
2009-12-09 16:26:34 +01:00
|
|
|
$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
|
|
|
|
$(QUIET_LNCP)$(RM) $@ && \
|
|
|
|
ln $< $@ 2>/dev/null || \
|
|
|
|
ln -s $< $@ 2>/dev/null || \
|
|
|
|
cp $< $@
|
|
|
|
|
2011-06-22 12:50:56 +02:00
|
|
|
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
|
2009-08-05 07:01:56 +02:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
2015-10-21 19:01:13 +02:00
|
|
|
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
|
2009-08-05 07:01:56 +02:00
|
|
|
|
2005-07-29 17:50:24 +02:00
|
|
|
$(LIB_FILE): $(LIB_OBJS)
|
2015-09-10 23:27:21 +02:00
|
|
|
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
|
2005-07-29 17:50:24 +02:00
|
|
|
|
Use a *real* built-in diff generator
This uses a simplified libxdiff setup to generate unified diffs _without_
doing fork/execve of GNU "diff".
This has several huge advantages, for example:
Before:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m24.818s
user 0m13.332s
sys 0m8.664s
After:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m4.563s
user 0m2.944s
sys 0m1.580s
and the fact that this should be a lot more portable (ie we can ignore all
the issues with doing fork/execve under Windows).
Perhaps even more importantly, this allows us to do diffs without actually
ever writing out the git file contents to a temporary file (and without
any of the shell quoting issues on filenames etc etc).
NOTE! THIS PATCH DOES NOT DO THAT OPTIMIZATION YET! I was lazy, and the
current "diff-core" code actually will always write the temp-files,
because it used to be something that you simply had to do. So this current
one actually writes a temp-file like before, and then reads it into memory
again just to do the diff. Stupid.
But if this basic infrastructure is accepted, we can start switching over
diff-core to not write temp-files, which should speed things up even
further, especially when doing big tree-to-tree diffs.
Now, in the interest of full disclosure, I should also point out a few
downsides:
- the libxdiff algorithm is different, and I bet GNU diff has gotten a
lot more testing. And the thing is, generating a diff is not an exact
science - you can get two different diffs (and you will), and they can
both be perfectly valid. So it's not possible to "validate" the
libxdiff output by just comparing it against GNU diff.
- GNU diff does some nice eye-candy, like trying to figure out what the
last function was, and adding that information to the "@@ .." line.
libxdiff doesn't do that.
- The libxdiff thing has some known deficiencies. In particular, it gets
the "\No newline at end of file" case wrong. So this is currently for
the experimental branch only. I hope Davide will help fix it.
That said, I think the huge performance advantage, and the fact that it
integrates better is definitely worth it. But it should go into a
development branch at least due to the missing newline issue.
Technical note: this is based on libxdiff-0.17, but I did some surgery to
get rid of the extraneous fat - stuff that git doesn't need, and seriously
cutting down on mmfile_t, which had much more capabilities than the diff
algorithm either needed or used. In this version, "mmfile_t" is just a
trivial <pointer,length> tuple.
That said, I tried to keep the differences to simple removals, so that you
can do a diff between this and the libxdiff origin, and you'll basically
see just things getting deleted. Even the mmfile_t simplifications are
left in a state where the diffs should be readable.
Apologies to Davide, whom I'd love to get feedback on this all from (I
wrote my own "fill_mmfile()" for the new simpler mmfile_t format: the old
complex format had a helper function for that, but I did my surgery with
the goal in mind that eventually we _should_ just do
mmfile_t mf;
buf = read_sha1_file(sha1, type, &size);
mf->ptr = buf;
mf->size = size;
.. use "mf" directly ..
which was really a nightmare with the old "helpful" mmfile_t, and really
is that easy with the new cut-down interfaces).
[ Btw, as any hawk-eye can see from the diff, this was actually generated
with itself, so it is "self-hosting". That's about all the testing it
has gotten, along with the above kernel diff, which eye-balls correctly,
but shows the newline issue when you double-check it with "git-apply" ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-25 05:13:22 +01:00
|
|
|
$(XDIFF_LIB): $(XDIFF_OBJS)
|
2015-09-10 23:27:21 +02:00
|
|
|
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
|
Use a *real* built-in diff generator
This uses a simplified libxdiff setup to generate unified diffs _without_
doing fork/execve of GNU "diff".
This has several huge advantages, for example:
Before:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m24.818s
user 0m13.332s
sys 0m8.664s
After:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m4.563s
user 0m2.944s
sys 0m1.580s
and the fact that this should be a lot more portable (ie we can ignore all
the issues with doing fork/execve under Windows).
Perhaps even more importantly, this allows us to do diffs without actually
ever writing out the git file contents to a temporary file (and without
any of the shell quoting issues on filenames etc etc).
NOTE! THIS PATCH DOES NOT DO THAT OPTIMIZATION YET! I was lazy, and the
current "diff-core" code actually will always write the temp-files,
because it used to be something that you simply had to do. So this current
one actually writes a temp-file like before, and then reads it into memory
again just to do the diff. Stupid.
But if this basic infrastructure is accepted, we can start switching over
diff-core to not write temp-files, which should speed things up even
further, especially when doing big tree-to-tree diffs.
Now, in the interest of full disclosure, I should also point out a few
downsides:
- the libxdiff algorithm is different, and I bet GNU diff has gotten a
lot more testing. And the thing is, generating a diff is not an exact
science - you can get two different diffs (and you will), and they can
both be perfectly valid. So it's not possible to "validate" the
libxdiff output by just comparing it against GNU diff.
- GNU diff does some nice eye-candy, like trying to figure out what the
last function was, and adding that information to the "@@ .." line.
libxdiff doesn't do that.
- The libxdiff thing has some known deficiencies. In particular, it gets
the "\No newline at end of file" case wrong. So this is currently for
the experimental branch only. I hope Davide will help fix it.
That said, I think the huge performance advantage, and the fact that it
integrates better is definitely worth it. But it should go into a
development branch at least due to the missing newline issue.
Technical note: this is based on libxdiff-0.17, but I did some surgery to
get rid of the extraneous fat - stuff that git doesn't need, and seriously
cutting down on mmfile_t, which had much more capabilities than the diff
algorithm either needed or used. In this version, "mmfile_t" is just a
trivial <pointer,length> tuple.
That said, I tried to keep the differences to simple removals, so that you
can do a diff between this and the libxdiff origin, and you'll basically
see just things getting deleted. Even the mmfile_t simplifications are
left in a state where the diffs should be readable.
Apologies to Davide, whom I'd love to get feedback on this all from (I
wrote my own "fill_mmfile()" for the new simpler mmfile_t format: the old
complex format had a helper function for that, but I did my surgery with
the goal in mind that eventually we _should_ just do
mmfile_t mf;
buf = read_sha1_file(sha1, type, &size);
mf->ptr = buf;
mf->size = size;
.. use "mf" directly ..
which was really a nightmare with the old "helpful" mmfile_t, and really
is that easy with the new cut-down interfaces).
[ Btw, as any hawk-eye can see from the diff, this was actually generated
with itself, so it is "self-hosting". That's about all the testing it
has gotten, along with the above kernel diff, which eye-balls correctly,
but shows the newline issue when you double-check it with "git-apply" ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-25 05:13:22 +01:00
|
|
|
|
2012-03-31 10:44:53 +02:00
|
|
|
export DEFAULT_EDITOR DEFAULT_PAGER
|
|
|
|
|
2019-04-18 15:16:44 +02:00
|
|
|
Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
|
|
|
|
@EXCLUDED='EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)'; \
|
|
|
|
if test x"$$EXCLUDED" != \
|
|
|
|
x"`cat Documentation/GIT-EXCLUDED-PROGRAMS 2>/dev/null`" ; then \
|
|
|
|
echo >&2 " * new documentation flags"; \
|
|
|
|
echo "$$EXCLUDED" >Documentation/GIT-EXCLUDED-PROGRAMS; \
|
|
|
|
fi
|
|
|
|
|
Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with
simple make rules, 2017-12-10), the Git(3pm) man page is only
generated as an indirect dependency of the 'install-doc' and
'install-man' Makefile targets. Consequently, if someone runs 'make
man && sudo make install-man' (or their 'doc' counterparts), then
Git(3pm) will be generated as root, and the resulting root-owned files
and directories will in turn cause the next user-run 'make clean' to
fail. This was not an issue in the past, because Git(3pm) was
generated when 'make all' descended into 'perl/', which is usually not
run as root.
List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,
too, so it gets generated by targets that are usually built as
ordinary users.
While at it, add 'install-man-perl' to the list of .PHONY targets.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-15 03:14:10 +01:00
|
|
|
.PHONY: doc man man-perl html info pdf
|
|
|
|
doc: man-perl
|
2005-07-29 17:50:24 +02:00
|
|
|
$(MAKE) -C Documentation all
|
|
|
|
|
Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with
simple make rules, 2017-12-10), the Git(3pm) man page is only
generated as an indirect dependency of the 'install-doc' and
'install-man' Makefile targets. Consequently, if someone runs 'make
man && sudo make install-man' (or their 'doc' counterparts), then
Git(3pm) will be generated as root, and the resulting root-owned files
and directories will in turn cause the next user-run 'make clean' to
fail. This was not an issue in the past, because Git(3pm) was
generated when 'make all' descended into 'perl/', which is usually not
run as root.
List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,
too, so it gets generated by targets that are usually built as
ordinary users.
While at it, add 'install-man-perl' to the list of .PHONY targets.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-15 03:14:10 +01:00
|
|
|
man: man-perl
|
2008-09-10 10:19:34 +02:00
|
|
|
$(MAKE) -C Documentation man
|
|
|
|
|
Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with
simple make rules, 2017-12-10), the Git(3pm) man page is only
generated as an indirect dependency of the 'install-doc' and
'install-man' Makefile targets. Consequently, if someone runs 'make
man && sudo make install-man' (or their 'doc' counterparts), then
Git(3pm) will be generated as root, and the resulting root-owned files
and directories will in turn cause the next user-run 'make clean' to
fail. This was not an issue in the past, because Git(3pm) was
generated when 'make all' descended into 'perl/', which is usually not
run as root.
List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,
too, so it gets generated by targets that are usually built as
ordinary users.
While at it, add 'install-man-perl' to the list of .PHONY targets.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-15 03:14:10 +01:00
|
|
|
man-perl: perl/build/man/man3/Git.3pm
|
|
|
|
|
2008-09-10 10:19:34 +02:00
|
|
|
html:
|
|
|
|
$(MAKE) -C Documentation html
|
|
|
|
|
2007-08-06 12:22:57 +02:00
|
|
|
info:
|
|
|
|
$(MAKE) -C Documentation info
|
|
|
|
|
2008-12-10 23:44:50 +01:00
|
|
|
pdf:
|
|
|
|
$(MAKE) -C Documentation pdf
|
|
|
|
|
2011-02-23 00:41:23 +01:00
|
|
|
XGETTEXT_FLAGS = \
|
|
|
|
--force-po \
|
i18n: only extract comments marked with "TRANSLATORS:"
When extract l10n messages, we use "--add-comments" option to keep
comments right above the l10n messages for references. But sometimes
irrelevant comments are also extracted. For example in the following
code block, the comment in line 2 will be extracted as comment for the
l10n message in line 3, but obviously it's wrong.
{ OPTION_CALLBACK, 0, "ignore-removal", &addremove_explicit,
NULL /* takes no arguments */,
N_("ignore paths removed in the working tree (same as
--no-all)"),
PARSE_OPT_NOARG, ignore_removal_cb },
Since almost all comments for l10n translators are marked with the same
prefix (tag): "TRANSLATORS:", it's safe to only extract comments with
this special tag. I.E. it's better to call xgettext as:
xgettext --add-comments=TRANSLATORS: ...
Also tweaks the multi-line comment in "init-db.c", to make it start with
the proper tag, not "* TRANSLATORS:" (which has a star before the tag).
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-17 07:37:18 +02:00
|
|
|
--add-comments=TRANSLATORS: \
|
2011-02-23 00:41:23 +01:00
|
|
|
--msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
|
|
|
|
--from-code=UTF-8
|
2011-04-10 21:37:01 +02:00
|
|
|
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
|
|
|
|
--keyword=_ --keyword=N_ --keyword="Q_:1,2"
|
2012-07-25 16:53:07 +02:00
|
|
|
XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
|
|
|
|
--keyword=gettextln --keyword=eval_gettextln
|
2016-12-14 13:54:29 +01:00
|
|
|
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
|
2016-12-14 13:54:30 +01:00
|
|
|
--keyword=__ --keyword=N__ --keyword="__n:1,2"
|
2014-08-25 22:00:42 +02:00
|
|
|
LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
|
2016-06-17 22:21:02 +02:00
|
|
|
LOCALIZED_SH = $(SCRIPT_SH)
|
|
|
|
LOCALIZED_SH += git-parse-remote.sh
|
2018-05-28 14:34:19 +02:00
|
|
|
LOCALIZED_SH += git-rebase--preserve-merges.sh
|
2016-06-17 22:21:02 +02:00
|
|
|
LOCALIZED_SH += git-sh-setup.sh
|
2014-08-25 22:00:42 +02:00
|
|
|
LOCALIZED_PERL = $(SCRIPT_PERL)
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
|
|
|
|
ifdef XGETTEXT_INCLUDE_TESTS
|
|
|
|
LOCALIZED_C += t/t0200/test.c
|
|
|
|
LOCALIZED_SH += t/t0200/test.sh
|
|
|
|
LOCALIZED_PERL += t/t0200/test.perl
|
|
|
|
endif
|
2011-02-23 00:41:23 +01:00
|
|
|
|
2017-07-20 20:57:01 +02:00
|
|
|
## Note that this is meant to be run only by the localization coordinator
|
|
|
|
## under a very controlled condition, i.e. (1) it is to be run in a
|
|
|
|
## Git repository (not a tarball extract), (2) any local modifications
|
|
|
|
## will be lost.
|
|
|
|
## Gettext tools cannot work with our own custom PRItime type, so
|
|
|
|
## we replace PRItime with PRIuMAX. We need to update this to
|
|
|
|
## PRIdMAX if we switch to a signed type later.
|
|
|
|
|
2014-08-22 06:32:08 +02:00
|
|
|
po/git.pot: $(GENERATED_H) FORCE
|
2017-07-20 20:57:01 +02:00
|
|
|
# All modifications will be reverted at the end, so we do not
|
|
|
|
# want to have any local change.
|
|
|
|
git diff --quiet HEAD && git diff --quiet --cached
|
|
|
|
|
|
|
|
@for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
|
|
|
|
do \
|
|
|
|
sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
|
|
|
|
cat "$$s+" >"$$s" && rm "$$s+"; \
|
|
|
|
done
|
|
|
|
|
2011-05-14 15:47:45 +02:00
|
|
|
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
|
|
|
|
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
|
|
|
|
$(LOCALIZED_SH)
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
|
|
|
|
$(LOCALIZED_PERL)
|
2017-07-20 20:57:01 +02:00
|
|
|
|
|
|
|
# Reverting the munged source, leaving only the updated $@
|
|
|
|
git reset --hard
|
2011-02-23 00:41:23 +01:00
|
|
|
mv $@+ $@
|
|
|
|
|
2015-12-15 16:21:00 +01:00
|
|
|
.PHONY: pot
|
2011-02-23 00:41:23 +01:00
|
|
|
pot: po/git.pot
|
|
|
|
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
POFILES := $(wildcard po/*.po)
|
|
|
|
MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
|
|
|
|
|
|
|
|
ifndef NO_GETTEXT
|
|
|
|
all:: $(MOFILES)
|
|
|
|
endif
|
|
|
|
|
|
|
|
po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
|
|
|
|
$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
|
|
|
|
|
2017-12-22 20:07:21 +01:00
|
|
|
LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
|
|
|
|
LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
|
2018-03-03 16:38:15 +01:00
|
|
|
LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
|
|
|
|
LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
|
|
|
|
ifndef NO_PERL
|
2017-12-22 20:07:21 +01:00
|
|
|
all:: $(LIB_PERL_GEN)
|
2018-03-03 16:38:16 +01:00
|
|
|
ifndef NO_PERL_CPAN_FALLBACKS
|
2018-03-03 16:38:15 +01:00
|
|
|
all:: $(LIB_CPAN_GEN)
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
endif
|
2018-03-03 16:38:17 +01:00
|
|
|
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
endif
|
|
|
|
|
2017-12-22 20:07:21 +01:00
|
|
|
perl/build/lib/%.pm: perl/%.pm
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
$(QUIET_GEN)mkdir -p $(dir $@) && \
|
2018-04-10 17:05:43 +02:00
|
|
|
sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
|
2018-03-03 16:38:17 +01:00
|
|
|
-e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
|
|
|
|
< $< > $@
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
|
|
|
|
perl/build/man/man3/Git.3pm: perl/Git.pm
|
|
|
|
$(QUIET_GEN)mkdir -p $(dir $@) && \
|
|
|
|
pod2man $< $@
|
|
|
|
|
2016-12-14 15:26:55 +01:00
|
|
|
FIND_SOURCE_FILES = ( \
|
2016-12-14 15:28:04 +01:00
|
|
|
git ls-files \
|
|
|
|
'*.[hcS]' \
|
2016-12-14 15:29:44 +01:00
|
|
|
'*.sh' \
|
2016-12-14 15:28:04 +01:00
|
|
|
':!*[tp][0-9][0-9][0-9][0-9]*' \
|
2016-12-14 15:32:35 +01:00
|
|
|
':!contrib' \
|
2016-12-14 15:28:04 +01:00
|
|
|
2>/dev/null || \
|
2016-12-14 15:26:55 +01:00
|
|
|
$(FIND) . \
|
|
|
|
\( -name .git -type d -prune \) \
|
2016-12-14 15:29:44 +01:00
|
|
|
-o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
|
2016-12-14 15:32:35 +01:00
|
|
|
-o \( -name contrib -type d -prune \) \
|
2016-12-14 15:28:04 +01:00
|
|
|
-o \( -name build -type d -prune \) \
|
|
|
|
-o \( -name 'trash*' -type d -prune \) \
|
2016-12-14 15:26:55 +01:00
|
|
|
-o \( -name '*.[hcS]' -type f -print \) \
|
2016-12-14 15:29:44 +01:00
|
|
|
-o \( -name '*.sh' -type f -print \) \
|
2019-09-16 21:23:14 +02:00
|
|
|
| sed -e 's|^\./||' \
|
2016-12-14 15:26:55 +01:00
|
|
|
)
|
2011-10-18 09:26:18 +02:00
|
|
|
|
2010-09-28 23:08:38 +02:00
|
|
|
$(ETAGS_TARGET): FORCE
|
|
|
|
$(RM) $(ETAGS_TARGET)
|
2011-10-18 09:26:18 +02:00
|
|
|
$(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)
|
2006-03-18 11:07:12 +01:00
|
|
|
|
2010-09-28 23:08:38 +02:00
|
|
|
tags: FORCE
|
2007-07-14 19:51:44 +02:00
|
|
|
$(RM) tags
|
2011-10-18 09:26:18 +02:00
|
|
|
$(FIND_SOURCE_FILES) | xargs ctags -a
|
2005-07-29 17:50:24 +02:00
|
|
|
|
2007-10-06 16:24:42 +02:00
|
|
|
cscope:
|
|
|
|
$(RM) cscope*
|
2011-10-18 09:26:18 +02:00
|
|
|
$(FIND_SOURCE_FILES) | xargs cscope -b
|
2007-10-06 16:24:42 +02:00
|
|
|
|
2006-06-15 00:36:00 +02:00
|
|
|
### Detect prefix changes
|
2012-06-20 20:31:55 +02:00
|
|
|
TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
|
|
|
|
$(localedir_SQ)
|
|
|
|
|
|
|
|
GIT-PREFIX: FORCE
|
|
|
|
@FLAGS='$(TRACK_PREFIX)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
|
2012-12-18 16:26:39 +01:00
|
|
|
echo >&2 " * new prefix flags"; \
|
2012-06-20 20:31:55 +02:00
|
|
|
echo "$$FLAGS" >GIT-PREFIX; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
|
2006-06-15 00:36:00 +02:00
|
|
|
|
2010-01-06 09:06:58 +01:00
|
|
|
GIT-CFLAGS: FORCE
|
2006-06-15 00:36:00 +02:00
|
|
|
@FLAGS='$(TRACK_CFLAGS)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
|
2012-12-18 16:26:39 +01:00
|
|
|
echo >&2 " * new build flags"; \
|
2006-06-15 00:36:00 +02:00
|
|
|
echo "$$FLAGS" >GIT-CFLAGS; \
|
|
|
|
fi
|
|
|
|
|
2011-06-22 12:50:56 +02:00
|
|
|
TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
|
|
|
|
|
|
|
|
GIT-LDFLAGS: FORCE
|
|
|
|
@FLAGS='$(TRACK_LDFLAGS)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
|
2012-12-18 16:26:39 +01:00
|
|
|
echo >&2 " * new link flags"; \
|
2011-06-22 12:50:56 +02:00
|
|
|
echo "$$FLAGS" >GIT-LDFLAGS; \
|
|
|
|
fi
|
|
|
|
|
2008-07-25 21:35:10 +02:00
|
|
|
# We need to apply sq twice, once to protect from the shell
|
|
|
|
# that runs GIT-BUILD-OPTIONS, and then again to protect it
|
|
|
|
# and the first level quoting from the shell that runs "echo".
|
2010-01-06 09:06:58 +01:00
|
|
|
GIT-BUILD-OPTIONS: FORCE
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
|
t/Makefile: introduce TEST_SHELL_PATH
You may want to run the test suite with a different shell
than you use to build Git. For instance, you may build with
SHELL_PATH=/bin/sh (because it's faster, or it's what you
expect to exist on systems where the build will be used) but
want to run the test suite with bash (e.g., since that
allows using "-x" reliably across the whole test suite).
There's currently no good way to do this.
You might think that doing two separate make invocations,
like:
make &&
make -C t SHELL_PATH=/bin/bash
would work. And it _almost_ does. The second make will see
our bash SHELL_PATH, and we'll use that to run the
individual test scripts (or tell prove to use it to do so).
So far so good.
But this breaks down when "--tee" or "--verbose-log" is
used. Those options cause the test script to actually
re-exec itself using $SHELL_PATH. But wait, wouldn't our
second make invocation have set SHELL_PATH correctly in the
environment?
Yes, but test-lib.sh sources GIT-BUILD-OPTIONS, which we
built during the first "make". And that overrides the
environment, giving us the original SHELL_PATH again.
Let's introduce a new variable that lets you specify a
specific shell to be run for the test scripts. Note that we
have to touch both the main and t/ Makefiles, since we have
to record it in GIT-BUILD-OPTIONS in one, and use it in the
latter.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-08 11:47:22 +01:00
|
|
|
@echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
|
|
|
|
@echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
|
|
|
|
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
|
|
|
|
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
|
|
|
|
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
|
2015-06-16 23:27:06 +02:00
|
|
|
@echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
|
grep: add support for PCRE v2
Add support for v2 of the PCRE API. This is a new major version of
PCRE that came out in early 2015[1].
The regular expression syntax is the same, but while the API is
similar, pretty much every function is either renamed or takes
different arguments. Thus using it via entirely new functions makes
sense, as opposed to trying to e.g. have one compile_pcre_pattern()
that would call either PCRE v1 or v2 functions.
Git can now be compiled with either USE_LIBPCRE1=YesPlease or
USE_LIBPCRE2=YesPlease, with USE_LIBPCRE=YesPlease currently being a
synonym for the former. Providing both is a compile-time error.
With earlier patches to enable JIT for PCRE v1 the performance of the
release versions of both libraries is almost exactly the same, with
PCRE v2 being around 1% slower.
However after I reported this to the pcre-dev mailing list[2] I got a
lot of help with the API use from Zoltán Herczeg, he subsequently
optimized some of the JIT functionality in v2 of the library.
Running the p7820-grep-engines.sh performance test against the latest
Subversion trunk of both, with both them and git compiled as -O3, and
the test run against linux.git, gives the following results. Just the
/perl/ tests shown:
$ GIT_PERF_REPEAT_COUNT=30 GIT_PERF_LARGE_REPO=~/g/linux GIT_PERF_MAKE_COMMAND='grep -q LIBPCRE2 Makefile && make -j8 USE_LIBPCRE2=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre2/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre2/inst/lib || make -j8 USE_LIBPCRE=YesPlease CC=~/perl5/installed/bin/gcc NO_R_TO_GCC_LINKER=YesPlease CFLAGS=-O3 LIBPCREDIR=/home/avar/g/pcre/inst LDFLAGS=-Wl,-rpath,/home/avar/g/pcre/inst/lib' ./run HEAD~5 HEAD~ HEAD p7820-grep-engines.sh
[...]
Test HEAD~5 HEAD~ HEAD
-----------------------------------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.31(1.10+0.48) 0.21(0.35+0.56) -32.3% 0.21(0.34+0.55) -32.3%
7820.7: perl grep '^how to' 0.56(2.70+0.40) 0.24(0.64+0.52) -57.1% 0.20(0.28+0.60) -64.3%
7820.11: perl grep '[how] to' 0.56(2.66+0.38) 0.29(0.95+0.45) -48.2% 0.23(0.45+0.54) -58.9%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 1.02(5.77+0.42) 0.31(1.02+0.54) -69.6% 0.23(0.50+0.54) -77.5%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.38(1.57+0.42) 0.27(0.85+0.46) -28.9% 0.21(0.33+0.57) -44.7%
See commit ("perf: add a comparison test of grep regex engines",
2017-04-19) for details on the machine the above test run was executed
on.
Here HEAD~2 is git with PCRE v1 without JIT, HEAD~ is PCRE v1 with
JIT, and HEAD is PCRE v2 (also with JIT). See previous commits of mine
mentioning p7820-grep-engines.sh for more details on the test setup.
For ease of readability, a different run just of HEAD~ (PCRE v1 with
JIT v.s. PCRE v2), again with just the /perl/ tests shown:
[...]
Test HEAD~ HEAD
----------------------------------------------------------------------------------------
7820.3: perl grep 'how.to' 0.21(0.42+0.52) 0.21(0.31+0.58) +0.0%
7820.7: perl grep '^how to' 0.25(0.65+0.50) 0.20(0.31+0.57) -20.0%
7820.11: perl grep '[how] to' 0.30(0.90+0.50) 0.23(0.46+0.53) -23.3%
7820.15: perl grep '(e.t[^ ]*|v.ry) rare' 0.30(1.19+0.38) 0.23(0.51+0.51) -23.3%
7820.19: perl grep 'm(ú|u)lt.b(æ|y)te' 0.27(0.84+0.48) 0.21(0.34+0.57) -22.2%
I.e. the two are either neck-to-neck, but PCRE v2 usually pulls ahead,
when it does it's around 20% faster.
A brief note on thread safety: As noted in pcre2api(3) & pcre2jit(3)
the compiled pattern can be shared between threads, but not some of
the JIT context, however the grep threading support does all pattern &
JIT compilation in separate threads, so this code doesn't need to
concern itself with thread safety.
See commit 63e7e9d8b6 ("git-grep: Learn PCRE", 2011-05-09) for the
initial addition of PCRE v1. This change follows some of the same
patterns it did (and which were discussed on list at the time),
e.g. mocking up types with typedef instead of ifdef-ing them out when
USE_LIBPCRE2 isn't defined. This adds some trivial memory use to the
program, but makes the code look nicer.
1. https://lists.exim.org/lurker/message/20150105.162835.0666407a.en.html
2. https://lists.exim.org/lurker/thread/20170419.172322.833ee099.en.html
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:56 +02:00
|
|
|
@echo USE_LIBPCRE1=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE1)))'\' >>$@+
|
|
|
|
@echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
|
grep: un-break building with PCRE >= 8.32 without --enable-jit
Amend my change earlier in this series ("grep: add support for the
PCRE v1 JIT API", 2017-04-11) to un-break the build on PCRE v1
versions later than 8.31 compiled without --enable-jit.
As explained in that change and a later compatibility change in this
series ("grep: un-break building with PCRE < 8.32", 2017-05-10) the
pcre_jit_exec() function is a faster path to execute the JIT.
Unfortunately there's no compatibility stub for that function compiled
into the library if pcre_config(PCRE_CONFIG_JIT, &ret) would return 0,
and no macro that can be used to check for it, so the only portable
option to support builds without --enable-jit is via a new
NO_LIBPCRE1_JIT=UnfortunatelyYes Makefile option[1].
Another option would be to make the JIT opt-in via
USE_LIBPCRE1_JIT=YesPlease, after all it's not a default option of
PCRE v1.
I think it makes more sense to make it opt-out since even though it's
not a default option, most packagers of PCRE seem to turn it on by
default, with the notable exception of the MinGW package.
Make the MinGW platform work by default by changing the build defaults
to turn on NO_LIBPCRE1_JIT=UnfortunatelyYes. It is the only platform
that turns on USE_LIBPCRE=YesPlease by default, see commit
df5218b4c3 ("config.mak.uname: support MSys2", 2016-01-13) for that
change.
1. "How do I support pcre1 JIT on all
versions?" (https://lists.exim.org/lurker/thread/20170601.103148.10253788.en.html)
2. https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-pcre/PKGBUILD
(referenced from "Re: PCRE v2 compile error, was Re: What's cooking
in git.git (May 2017, #01; Mon, 1)";
<alpine.DEB.2.20.1705021756530.3480@virtualbox>)
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-01 20:20:55 +02:00
|
|
|
@echo NO_LIBPCRE1_JIT=\''$(subst ','\'',$(subst ','\'',$(NO_LIBPCRE1_JIT)))'\' >>$@+
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
|
2017-05-25 21:45:31 +02:00
|
|
|
@echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
|
|
|
|
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
|
2016-08-04 13:40:25 +02:00
|
|
|
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
|
2017-03-16 23:09:36 +01:00
|
|
|
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
|
tests: explicitly use `git.exe` on Windows
On Windows, when we refer to `/an/absolute/path/to/git`, it magically
resolves `git.exe` at that location. Except if something of the name
`git` exists next to that `git.exe`. So if we call `$BUILD_DIR/git`, it
will find `$BUILD_DIR/git.exe` *only* if there is not, say, a directory
called `$BUILD_DIR/git`.
Such a directory, however, exists in Git for Windows when building with
Visual Studio (our Visual Studio project generator defaults to putting
the build files into a directory whose name is the base name of the
corresponding `.exe`).
In the bin-wrappers/* scripts, we already take pains to use `git.exe`
rather than `git`, as this could pick up the wrong thing on Windows
(i.e. if there exists a `git` file or directory in the build directory).
Now we do the same in the tests' start-up code.
This also helps when testing an installed Git, as there might be even
more likely some stray file or directory in the way.
Note: the only way we can record whether the `.exe` suffix is by writing
it to the `GIT-BUILD-OPTIONS` file and sourcing it at the beginning of
`t/test-lib.sh`. This is not a requirement introduced by this patch, but
we move the call to be able to use the `$X` variable that holds the file
extension, if any.
Note also: the many, many calls to `git this` and `git that` are
unaffected, as the regular PATH search will find the `.exe` files on
Windows (and not be confused by a directory of the name `git` that is
in one of the directories listed in the `PATH` variable), while
`/path/to/git` would not, per se, know that it is looking for an
executable and happily prefer such a directory.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-14 17:32:11 +01:00
|
|
|
@echo X=\'$(X)\' >>$@+
|
2013-04-29 20:16:21 +02:00
|
|
|
ifdef TEST_OUTPUT_DIRECTORY
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
|
2013-04-29 20:16:21 +02:00
|
|
|
endif
|
2012-02-17 11:25:09 +01:00
|
|
|
ifdef GIT_TEST_OPTS
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
|
2012-02-17 11:25:09 +01:00
|
|
|
endif
|
2010-06-11 18:40:25 +02:00
|
|
|
ifdef GIT_TEST_CMP
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
|
2010-06-11 18:40:25 +02:00
|
|
|
endif
|
|
|
|
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
|
2010-06-11 18:40:25 +02:00
|
|
|
endif
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
|
2012-02-17 11:25:09 +01:00
|
|
|
ifdef GIT_PERF_REPEAT_COUNT
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
|
2012-02-17 11:25:09 +01:00
|
|
|
endif
|
|
|
|
ifdef GIT_PERF_REPO
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
|
2012-02-17 11:25:09 +01:00
|
|
|
endif
|
|
|
|
ifdef GIT_PERF_LARGE_REPO
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
|
2012-02-17 11:25:09 +01:00
|
|
|
endif
|
|
|
|
ifdef GIT_PERF_MAKE_OPTS
|
2015-05-29 09:26:30 +02:00
|
|
|
@echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
|
2012-02-17 11:25:09 +01:00
|
|
|
endif
|
2017-05-20 23:42:18 +02:00
|
|
|
ifdef GIT_PERF_MAKE_COMMAND
|
|
|
|
@echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
|
|
|
|
endif
|
2017-02-25 10:37:07 +01:00
|
|
|
ifdef GIT_INTEROP_MAKE_OPTS
|
|
|
|
@echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
|
|
|
|
endif
|
2018-09-19 01:29:36 +02:00
|
|
|
ifdef GIT_TEST_INDEX_VERSION
|
|
|
|
@echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
|
2014-02-23 21:49:58 +01:00
|
|
|
endif
|
2015-05-29 09:26:30 +02:00
|
|
|
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
|
2008-02-24 20:40:45 +01:00
|
|
|
|
2012-12-18 16:26:38 +01:00
|
|
|
### Detect Python interpreter path changes
|
|
|
|
ifndef NO_PYTHON
|
|
|
|
TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
|
2007-03-28 13:22:02 +02:00
|
|
|
|
2012-12-18 16:26:38 +01:00
|
|
|
GIT-PYTHON-VARS: FORCE
|
|
|
|
@VARS='$(TRACK_PYTHON)'; \
|
2007-03-28 13:22:02 +02:00
|
|
|
if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
|
2012-12-18 16:26:39 +01:00
|
|
|
echo >&2 " * new Python interpreter location"; \
|
2007-03-28 13:22:02 +02:00
|
|
|
echo "$$VARS" >$@; \
|
|
|
|
fi
|
|
|
|
endif
|
|
|
|
|
2009-12-03 06:14:05 +01:00
|
|
|
test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
|
|
|
|
|
|
|
|
all:: $(TEST_PROGRAMS) $(test_bindir_programs)
|
|
|
|
|
|
|
|
bin-wrappers/%: wrap-for-bin.sh
|
|
|
|
@mkdir -p bin-wrappers
|
|
|
|
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
|
2019-07-29 22:08:16 +02:00
|
|
|
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
|
2009-12-03 06:14:05 +01:00
|
|
|
chmod +x $@
|
2007-04-29 00:32:49 +02:00
|
|
|
|
2006-02-18 13:01:18 +01:00
|
|
|
# GNU make supports exporting all variables by "export" without parameters.
|
|
|
|
# However, the environment gets quite big, and some programs have problems
|
|
|
|
# with that.
|
|
|
|
|
2006-07-07 13:26:31 +02:00
|
|
|
export NO_SVN_TESTS
|
2012-10-06 19:33:08 +02:00
|
|
|
export TEST_NO_MALLOC_CHECK
|
2006-02-18 13:01:18 +01:00
|
|
|
|
2010-01-26 17:08:44 +01:00
|
|
|
### Testing rules
|
|
|
|
|
2007-04-29 00:32:49 +02:00
|
|
|
test: all
|
2005-07-29 17:50:24 +02:00
|
|
|
$(MAKE) -C t/ all
|
|
|
|
|
2012-02-17 11:25:09 +01:00
|
|
|
perf: all
|
|
|
|
$(MAKE) -C t/perf/ all
|
|
|
|
|
|
|
|
.PHONY: test perf
|
|
|
|
|
2010-01-26 16:45:54 +01:00
|
|
|
.PRECIOUS: $(TEST_OBJS)
|
2007-08-31 04:14:31 +02:00
|
|
|
|
2018-03-24 08:44:30 +01:00
|
|
|
t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
|
|
|
|
|
2016-04-13 15:22:42 +02:00
|
|
|
t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
|
2010-08-10 00:34:42 +02:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
|
2007-04-11 19:59:51 +02:00
|
|
|
|
2018-03-24 08:44:32 +01:00
|
|
|
check-sha1:: t/helper/test-tool$X
|
2016-04-13 15:22:42 +02:00
|
|
|
t/helper/test-sha1.sh
|
2006-06-24 09:59:49 +02:00
|
|
|
|
2011-04-21 21:14:42 +02:00
|
|
|
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
|
|
|
|
|
|
|
|
$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
|
|
|
|
$(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
|
2019-02-05 03:27:48 +01:00
|
|
|
$(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $<
|
2011-04-21 21:14:42 +02:00
|
|
|
|
|
|
|
.PHONY: sparse $(SP_OBJ)
|
|
|
|
sparse: $(SP_OBJ)
|
|
|
|
|
help: move list_config_help to builtin/help
Starting in 3ac68a93fd2, help.o began to depend on builtin/branch.o,
builtin/clean.o, and builtin/config.o. This meant that help.o was
unusable outside of the context of the main Git executable.
To make help.o usable by other commands again, move list_config_help()
into builtin/help.c (where it makes sense to assume other builtin libraries
are present).
When command-list.h is included but a member is not used, we start to
hear a compiler warning. Since the config list is generated in a fairly
different way than the command list, and since commands and config
options are semantically different, move the config list into its own
header and move the generator into its own script and build rule.
For reasons explained in 976aaedc (msvc: add a Makefile target to
pre-generate the Visual Studio solution, 2019-07-29), some build
artifacts we consider non-source files cannot be generated in the
Visual Studio environment, and we already have some Makefile tweaks
to help Visual Studio to use generated command-list.h header file.
Do the same to a new generated file, config-list.h, introduced by
this change.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
2020-04-16 23:18:03 +02:00
|
|
|
EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/%
|
2019-03-06 01:11:13 +01:00
|
|
|
ifndef GCRYPT_SHA256
|
|
|
|
EXCEPT_HDRS += sha256/gcrypt.h
|
|
|
|
endif
|
2019-09-16 21:23:08 +02:00
|
|
|
CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
|
2018-09-19 02:07:08 +02:00
|
|
|
HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
|
Makefile: emulate compile in $(HCO) target better
Currently, when testing headers using `make hdr-check`, headers are
directly compiled. Although this seems to test the headers, this is too
strict since we treat the headers as C sources. As a result, this will
cause warnings to appear that would otherwise not, such as a static
variable definition intended for later use throwing a unused variable
warning.
In addition, on platforms that can run `make hdr-check` but require
custom flags, this target was failing because none of them were being
passed to the compiler. For example, on MacOS, the NO_OPENSSL flag was
being set but it was not being passed into compiler so the check was
failing.
Fix these problems by emulating the compile process better, including
test compiling dummy *.hcc C sources generated from the *.h files and
passing $(ALL_CFLAGS) into the compiler for the $(HCO) target so that
these custom flags can be used.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-25 10:21:01 +02:00
|
|
|
HCC = $(HCO:hco=hcc)
|
2018-09-19 02:07:08 +02:00
|
|
|
|
Makefile: emulate compile in $(HCO) target better
Currently, when testing headers using `make hdr-check`, headers are
directly compiled. Although this seems to test the headers, this is too
strict since we treat the headers as C sources. As a result, this will
cause warnings to appear that would otherwise not, such as a static
variable definition intended for later use throwing a unused variable
warning.
In addition, on platforms that can run `make hdr-check` but require
custom flags, this target was failing because none of them were being
passed to the compiler. For example, on MacOS, the NO_OPENSSL flag was
being set but it was not being passed into compiler so the check was
failing.
Fix these problems by emulating the compile process better, including
test compiling dummy *.hcc C sources generated from the *.h files and
passing $(ALL_CFLAGS) into the compiler for the $(HCO) target so that
these custom flags can be used.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-25 10:21:01 +02:00
|
|
|
%.hcc: %.h
|
|
|
|
@echo '#include "git-compat-util.h"' >$@
|
|
|
|
@echo '#include "$<"' >>$@
|
|
|
|
|
|
|
|
$(HCO): %.hco: %.hcc FORCE
|
|
|
|
$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
|
2018-09-19 02:07:08 +02:00
|
|
|
|
|
|
|
.PHONY: hdr-check $(HCO)
|
|
|
|
hdr-check: $(HCO)
|
|
|
|
|
2017-08-14 23:30:46 +02:00
|
|
|
.PHONY: style
|
|
|
|
style:
|
|
|
|
git clang-format --style file --diff --extensions c,h
|
|
|
|
|
help: move list_config_help to builtin/help
Starting in 3ac68a93fd2, help.o began to depend on builtin/branch.o,
builtin/clean.o, and builtin/config.o. This meant that help.o was
unusable outside of the context of the main Git executable.
To make help.o usable by other commands again, move list_config_help()
into builtin/help.c (where it makes sense to assume other builtin libraries
are present).
When command-list.h is included but a member is not used, we start to
hear a compiler warning. Since the config list is generated in a fairly
different way than the command list, and since commands and config
options are semantically different, move the config list into its own
header and move the generator into its own script and build rule.
For reasons explained in 976aaedc (msvc: add a Makefile target to
pre-generate the Visual Studio solution, 2019-07-29), some build
artifacts we consider non-source files cannot be generated in the
Visual Studio environment, and we already have some Makefile tweaks
to help Visual Studio to use generated command-list.h header file.
Do the same to a new generated file, config-list.h, introduced by
this change.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
2020-04-16 23:18:03 +02:00
|
|
|
check: config-list.h command-list.h
|
2011-04-07 20:22:18 +02:00
|
|
|
@if sparse; \
|
2008-11-11 22:12:17 +01:00
|
|
|
then \
|
2016-04-05 09:02:14 +02:00
|
|
|
echo >&2 "Use 'make sparse' instead"; \
|
2011-04-21 21:14:42 +02:00
|
|
|
$(MAKE) --no-print-directory sparse; \
|
2008-11-11 22:12:17 +01:00
|
|
|
else \
|
2016-04-05 09:02:14 +02:00
|
|
|
echo >&2 "Did you mean 'make test'?"; \
|
2008-11-11 22:12:17 +01:00
|
|
|
exit 1; \
|
|
|
|
fi
|
2005-07-29 17:50:24 +02:00
|
|
|
|
Makefile: run coccicheck on more source files
Before, when running the "coccicheck" target, only the source files
which were being compiled would have been checked by Coccinelle.
However, just because we aren't compiling a source file doesn't mean we
have to exclude it from analysis. This will allow us to catch more
mistakes, in particular ones that affect Windows-only sources since
Coccinelle currently runs only on Linux.
Make the "coccicheck" target run on all C sources except for those that
are taken from some third-party source. We don't want to patch these
files since we want them to be as close to upstream as possible so that
it'll be easier to pull in upstream updates.
When running a build on Arch Linux with no additional flags provided,
after applying this patch, the following sources are now checked:
* block-sha1/sha1.c
* compat/access.c
* compat/basename.c
* compat/fileno.c
* compat/gmtime.c
* compat/hstrerror.c
* compat/memmem.c
* compat/mingw.c
* compat/mkdir.c
* compat/mkdtemp.c
* compat/mmap.c
* compat/msvc.c
* compat/pread.c
* compat/precompose_utf8.c
* compat/qsort.c
* compat/setenv.c
* compat/sha1-chunked.c
* compat/snprintf.c
* compat/stat.c
* compat/strcasestr.c
* compat/strdup.c
* compat/strtoimax.c
* compat/strtoumax.c
* compat/unsetenv.c
* compat/win32/dirent.c
* compat/win32/path-utils.c
* compat/win32/pthread.c
* compat/win32/syslog.c
* compat/win32/trace2_win32_process_info.c
* compat/win32mmap.c
* compat/winansi.c
* ppc/sha1.c
This also results in the following source now being excluded:
* compat/obstack.c
Instead of generating $(FOUND_C_SOURCES) from a
`$(shell $(FIND_SOURCE_FILES))` invocation, an alternative design was
considered which involved converting $(FIND_SOURCE_FILES) into
$(SOURCE_FILES) which would hold a list of filenames from the
$(FIND_SOURCE_FILES) invocation. We would simply filter `%.c` files into
$(ALL_C_SOURCES). $(SOURCE_FILES) would then be passed directly to the
etags, ctags and cscope commands. We can see from the following
invocation
$ git ls-files '*.[hcS]' '*.sh' ':!*[tp][0-9][0-9][0-9][0-9]*' ':!contrib' | wc -c
12779
that the number of characters in this list would pose a problem on
platforms with short command-line length limits (such as CMD which has a
max of 8191 characters). As a result, we don't perform this change.
However, we can see that the same issue may apply when running
Coccinelle since $(COCCI_SOURCES) is also a list of filenames:
if ! echo $(COCCI_SOURCES) | xargs $$limit \
$(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
>$@+ 2>$@.log; \
This is justified since platforms that support Coccinelle generally have
reasonably long command-line length limits and so we are safe for the
foreseeable future.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-16 21:23:16 +02:00
|
|
|
FOUND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
|
|
|
|
COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
|
2018-07-23 15:50:58 +02:00
|
|
|
|
|
|
|
%.cocci.patch: %.cocci $(COCCI_SOURCES)
|
2019-10-09 22:43:46 +02:00
|
|
|
$(QUIET_SPATCH) \
|
2019-05-08 09:07:54 +02:00
|
|
|
if test $(SPATCH_BATCH_SIZE) = 0; then \
|
|
|
|
limit=; \
|
|
|
|
else \
|
|
|
|
limit='-n $(SPATCH_BATCH_SIZE)'; \
|
|
|
|
fi; \
|
|
|
|
if ! echo $(COCCI_SOURCES) | xargs $$limit \
|
2019-05-07 01:43:34 +02:00
|
|
|
$(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
|
|
|
|
>$@+ 2>$@.log; \
|
2017-03-10 09:31:18 +01:00
|
|
|
then \
|
|
|
|
cat $@.log; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
mv $@+ $@; \
|
2016-09-15 20:30:56 +02:00
|
|
|
if test -s $@; \
|
|
|
|
then \
|
|
|
|
echo ' ' SPATCH result: $@; \
|
|
|
|
fi
|
2018-11-10 01:10:52 +01:00
|
|
|
coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
|
2016-09-15 20:30:56 +02:00
|
|
|
|
2018-11-10 01:10:52 +01:00
|
|
|
# See contrib/coccinelle/README
|
|
|
|
coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
|
|
|
|
|
|
|
|
.PHONY: coccicheck coccicheck-pending
|
2016-09-15 20:30:56 +02:00
|
|
|
|
2005-07-29 17:50:24 +02:00
|
|
|
### Installation rules
|
|
|
|
|
2009-02-05 09:04:17 +01:00
|
|
|
ifneq ($(filter /%,$(firstword $(template_dir))),)
|
2008-01-01 22:15:21 +01:00
|
|
|
template_instdir = $(template_dir)
|
2009-01-18 13:00:09 +01:00
|
|
|
else
|
|
|
|
template_instdir = $(prefix)/$(template_dir)
|
2008-01-01 22:15:21 +01:00
|
|
|
endif
|
|
|
|
export template_instdir
|
|
|
|
|
2009-02-05 09:04:17 +01:00
|
|
|
ifneq ($(filter /%,$(firstword $(gitexecdir))),)
|
2008-07-23 21:12:18 +02:00
|
|
|
gitexec_instdir = $(gitexecdir)
|
2009-01-18 13:00:09 +01:00
|
|
|
else
|
|
|
|
gitexec_instdir = $(prefix)/$(gitexecdir)
|
2008-07-23 21:12:18 +02:00
|
|
|
endif
|
|
|
|
gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
|
|
|
|
export gitexec_instdir
|
|
|
|
|
2011-08-18 09:23:46 +02:00
|
|
|
ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
|
|
|
|
mergetools_instdir = $(mergetoolsdir)
|
|
|
|
else
|
|
|
|
mergetools_instdir = $(prefix)/$(mergetoolsdir)
|
|
|
|
endif
|
|
|
|
mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
|
|
|
|
|
2009-12-03 06:14:05 +01:00
|
|
|
install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
|
|
|
|
|
2015-12-15 16:21:00 +01:00
|
|
|
.PHONY: profile-install profile-fast-install
|
2014-07-08 08:35:11 +02:00
|
|
|
profile-install: profile
|
|
|
|
$(MAKE) install
|
|
|
|
|
|
|
|
profile-fast-install: profile-fast
|
|
|
|
$(MAKE) install
|
|
|
|
|
2005-11-22 00:44:15 +01:00
|
|
|
install: all
|
2007-12-01 18:05:40 +01:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
|
2008-07-23 21:12:18 +02:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2010-01-31 20:46:53 +01:00
|
|
|
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2009-12-03 06:14:05 +01:00
|
|
|
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
|
2019-06-25 16:49:39 +02:00
|
|
|
ifdef MSVC
|
|
|
|
# We DO NOT install the individual foo.o.pdb files because they
|
|
|
|
# have already been rolled up into the exe's pdb file.
|
|
|
|
# We DO NOT have pdb files for the builtin commands (like git-status.exe)
|
|
|
|
# because it is just a copy/hardlink of git.exe, rather than a unique binary.
|
|
|
|
$(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
|
|
|
|
$(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
|
|
|
|
$(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
$(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
$(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
$(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
$(INSTALL) git-imap-send.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
$(INSTALL) git-remote-http.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
$(INSTALL) git-sh-i18n--envsubst.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
ifndef DEBUG
|
|
|
|
$(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
|
|
|
|
$(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
|
|
|
|
else
|
|
|
|
$(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
|
|
|
|
$(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
|
|
|
|
endif
|
|
|
|
endif
|
2006-07-29 18:25:03 +02:00
|
|
|
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
|
2011-08-18 09:23:46 +02:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
|
2011-10-09 11:17:07 +02:00
|
|
|
$(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
ifndef NO_GETTEXT
|
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
|
|
|
|
(cd po/build/locale && $(TAR) cf - .) | \
|
|
|
|
(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
|
|
|
|
endif
|
2009-04-23 07:42:28 +02:00
|
|
|
ifndef NO_PERL
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
|
|
|
|
(cd perl/build/lib && $(TAR) cf - .) | \
|
|
|
|
(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
|
2010-06-21 15:02:44 +02:00
|
|
|
$(MAKE) -C gitweb install
|
2009-04-23 07:42:28 +02:00
|
|
|
endif
|
2007-03-28 13:00:23 +02:00
|
|
|
ifndef NO_TCLTK
|
2007-11-17 19:51:16 +01:00
|
|
|
$(MAKE) -C gitk-git install
|
2008-07-23 21:12:18 +02:00
|
|
|
$(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
|
2007-03-28 13:00:23 +02:00
|
|
|
endif
|
2007-01-10 21:24:54 +01:00
|
|
|
ifneq (,$X)
|
2009-04-28 14:28:31 +02:00
|
|
|
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
|
2007-01-10 21:24:54 +01:00
|
|
|
endif
|
2009-12-09 16:26:34 +01:00
|
|
|
|
2008-07-21 21:19:51 +02:00
|
|
|
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
|
2008-07-23 21:12:18 +02:00
|
|
|
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
|
Makefile: optionally symlink libexec/git-core binaries to bin/git
Add a INSTALL_SYMLINKS option which if enabled, changes the default
hardlink installation method to one where the relevant binaries in
libexec/git-core are symlinked back to ../../bin, instead of being
hardlinked.
This new option also overrides the behavior of the existing
NO_*_HARDLINKS variables which in some cases would produce symlinks
within to libexec/, e.g. "git-add" symlinked to "git" which would be
copy of the "git" found in bin/, now "git-add" in libexec/ is always
going to be symlinked to the "git" found in the bin/ directory.
This option is being added because:
1) I think it makes what we're doing a lot more obvious. E.g. I'd
never noticed that the libexec binaries were really just hardlinks
since e.g. ls(1) won't show that in any obvious way. You need to
start stat(1)-ing things and look at the inodes to see what's
going on.
2) Some tools have very crappy support for hardlinks, e.g. the Git
shipped with GitLab is much bigger than it should be because
they're using a chef module that doesn't know about hardlinks, see
https://github.com/chef/omnibus/issues/827
I've also ran into other related issues that I think are explained
by this, e.g. compiling git with debugging and rpm refusing to
install a ~200MB git package with 2GB left on the FS, I think that
was because it doesn't consider hardlinks, just the sum of the
byte size of everything in the package.
As for the implementation, the "../../bin" noted above will vary given
some given some values of "../.." and "bin" depending on the depth of
the gitexecdir relative to the destdir, and the "bindir" target,
e.g. setting "bindir=/tmp/git/binaries gitexecdir=foo/bar/baz" will do
the right thing and produce this result:
$ file /tmp/git/foo/bar/baz/git-add
/tmp/git/foo/bar/baz/git-add: symbolic link to ../../../binaries/git
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-13 21:39:35 +01:00
|
|
|
destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
|
2009-07-11 05:17:33 +02:00
|
|
|
{ test "$$bindir/" = "$$execdir/" || \
|
2010-07-23 19:50:45 +02:00
|
|
|
for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
|
|
|
|
$(RM) "$$execdir/$$p" && \
|
Makefile: optionally symlink libexec/git-core binaries to bin/git
Add a INSTALL_SYMLINKS option which if enabled, changes the default
hardlink installation method to one where the relevant binaries in
libexec/git-core are symlinked back to ../../bin, instead of being
hardlinked.
This new option also overrides the behavior of the existing
NO_*_HARDLINKS variables which in some cases would produce symlinks
within to libexec/, e.g. "git-add" symlinked to "git" which would be
copy of the "git" found in bin/, now "git-add" in libexec/ is always
going to be symlinked to the "git" found in the bin/ directory.
This option is being added because:
1) I think it makes what we're doing a lot more obvious. E.g. I'd
never noticed that the libexec binaries were really just hardlinks
since e.g. ls(1) won't show that in any obvious way. You need to
start stat(1)-ing things and look at the inodes to see what's
going on.
2) Some tools have very crappy support for hardlinks, e.g. the Git
shipped with GitLab is much bigger than it should be because
they're using a chef module that doesn't know about hardlinks, see
https://github.com/chef/omnibus/issues/827
I've also ran into other related issues that I think are explained
by this, e.g. compiling git with debugging and rpm refusing to
install a ~200MB git package with 2GB left on the FS, I think that
was because it doesn't consider hardlinks, just the sum of the
byte size of everything in the package.
As for the implementation, the "../../bin" noted above will vary given
some given some values of "../.." and "bin" depending on the depth of
the gitexecdir relative to the destdir, and the "bindir" target,
e.g. setting "bindir=/tmp/git/binaries gitexecdir=foo/bar/baz" will do
the right thing and produce this result:
$ file /tmp/git/foo/bar/baz/git-add
/tmp/git/foo/bar/baz/git-add: symbolic link to ../../../binaries/git
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-13 21:39:35 +01:00
|
|
|
test -n "$(INSTALL_SYMLINKS)" && \
|
|
|
|
ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
|
|
|
|
{ test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
|
|
|
|
ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
|
2010-07-23 19:50:45 +02:00
|
|
|
done; \
|
|
|
|
} && \
|
2010-07-23 19:50:44 +02:00
|
|
|
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
|
|
|
|
$(RM) "$$bindir/$$p" && \
|
Makefile: optionally symlink libexec/git-core binaries to bin/git
Add a INSTALL_SYMLINKS option which if enabled, changes the default
hardlink installation method to one where the relevant binaries in
libexec/git-core are symlinked back to ../../bin, instead of being
hardlinked.
This new option also overrides the behavior of the existing
NO_*_HARDLINKS variables which in some cases would produce symlinks
within to libexec/, e.g. "git-add" symlinked to "git" which would be
copy of the "git" found in bin/, now "git-add" in libexec/ is always
going to be symlinked to the "git" found in the bin/ directory.
This option is being added because:
1) I think it makes what we're doing a lot more obvious. E.g. I'd
never noticed that the libexec binaries were really just hardlinks
since e.g. ls(1) won't show that in any obvious way. You need to
start stat(1)-ing things and look at the inodes to see what's
going on.
2) Some tools have very crappy support for hardlinks, e.g. the Git
shipped with GitLab is much bigger than it should be because
they're using a chef module that doesn't know about hardlinks, see
https://github.com/chef/omnibus/issues/827
I've also ran into other related issues that I think are explained
by this, e.g. compiling git with debugging and rpm refusing to
install a ~200MB git package with 2GB left on the FS, I think that
was because it doesn't consider hardlinks, just the sum of the
byte size of everything in the package.
As for the implementation, the "../../bin" noted above will vary given
some given some values of "../.." and "bin" depending on the depth of
the gitexecdir relative to the destdir, and the "bindir" target,
e.g. setting "bindir=/tmp/git/binaries gitexecdir=foo/bar/baz" will do
the right thing and produce this result:
$ file /tmp/git/foo/bar/baz/git-add
/tmp/git/foo/bar/baz/git-add: symbolic link to ../../../binaries/git
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-13 21:39:35 +01:00
|
|
|
test -n "$(INSTALL_SYMLINKS)" && \
|
|
|
|
ln -s "git$X" "$$bindir/$$p" || \
|
|
|
|
{ test -z "$(NO_INSTALL_HARDLINKS)" && \
|
|
|
|
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
|
|
|
|
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
|
|
|
|
cp "$$bindir/git$X" "$$bindir/$$p" || exit; } \
|
2010-07-23 19:50:44 +02:00
|
|
|
done && \
|
2010-07-02 20:50:28 +02:00
|
|
|
for p in $(BUILT_INS); do \
|
2009-01-20 02:44:03 +01:00
|
|
|
$(RM) "$$execdir/$$p" && \
|
Makefile: optionally symlink libexec/git-core binaries to bin/git
Add a INSTALL_SYMLINKS option which if enabled, changes the default
hardlink installation method to one where the relevant binaries in
libexec/git-core are symlinked back to ../../bin, instead of being
hardlinked.
This new option also overrides the behavior of the existing
NO_*_HARDLINKS variables which in some cases would produce symlinks
within to libexec/, e.g. "git-add" symlinked to "git" which would be
copy of the "git" found in bin/, now "git-add" in libexec/ is always
going to be symlinked to the "git" found in the bin/ directory.
This option is being added because:
1) I think it makes what we're doing a lot more obvious. E.g. I'd
never noticed that the libexec binaries were really just hardlinks
since e.g. ls(1) won't show that in any obvious way. You need to
start stat(1)-ing things and look at the inodes to see what's
going on.
2) Some tools have very crappy support for hardlinks, e.g. the Git
shipped with GitLab is much bigger than it should be because
they're using a chef module that doesn't know about hardlinks, see
https://github.com/chef/omnibus/issues/827
I've also ran into other related issues that I think are explained
by this, e.g. compiling git with debugging and rpm refusing to
install a ~200MB git package with 2GB left on the FS, I think that
was because it doesn't consider hardlinks, just the sum of the
byte size of everything in the package.
As for the implementation, the "../../bin" noted above will vary given
some given some values of "../.." and "bin" depending on the depth of
the gitexecdir relative to the destdir, and the "bindir" target,
e.g. setting "bindir=/tmp/git/binaries gitexecdir=foo/bar/baz" will do
the right thing and produce this result:
$ file /tmp/git/foo/bar/baz/git-add
/tmp/git/foo/bar/baz/git-add: symbolic link to ../../../binaries/git
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-13 21:39:35 +01:00
|
|
|
test -n "$(INSTALL_SYMLINKS)" && \
|
|
|
|
ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
|
|
|
|
{ test -z "$(NO_INSTALL_HARDLINKS)" && \
|
|
|
|
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
cp "$$execdir/git$X" "$$execdir/$$p" || exit; } \
|
2010-07-02 20:50:28 +02:00
|
|
|
done && \
|
Makefile: work around ksh's failure to handle missing list argument to for loop
ksh does not like it when the list argument is missing in a 'for' loop.
This can happen when NO_CURL is set which causes REMOTE_CURL_ALIASES to be
unset. In this case, the 'for' loop in the Makefile is expanded to look
like this:
for p in ; do
and ksh complains like this:
/bin/ksh: syntax error at line 15 : `;' unexpected
The existing attempt to work around this issue, introduced by 70b89f87,
tried to protect the 'for' loop by first testing whether REMOTE_CURL_ALIASES
was empty, but this does not work since, as Johannes Sixt explains, "Before
the test for emptyness can happen, the complete statement must be parsed,
but ksh finds a syntax error in the statement and, therefore, cannot even
begin to execute the statement. (ksh doesn't follow POSIX in this regard,
where this would not be a syntax error.)".
Make's $(foreach) function could be used to avoid this shell glitch, but
since it has already caused a problem once before by generating a command
line that exceeded the maximum argument list length on IRIX, let's adopt
Bruce Stephens's suggestion for working around this issue in the same way
the OpenSSL folks have done it. This solution first assigns the contents
of the REMOTE_CURL_ALIASES make variable to a shell variable and then
supplies the shell variable as the list argument in the 'for' loop. This
satisfies ksh and has the expected behavior even if $(REMOTE_CURL_ALIASES)
is empty.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-06 23:56:51 +02:00
|
|
|
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
|
|
|
|
for p in $$remote_curl_aliases; do \
|
2009-12-09 16:26:34 +01:00
|
|
|
$(RM) "$$execdir/$$p" && \
|
Makefile: optionally symlink libexec/git-core binaries to bin/git
Add a INSTALL_SYMLINKS option which if enabled, changes the default
hardlink installation method to one where the relevant binaries in
libexec/git-core are symlinked back to ../../bin, instead of being
hardlinked.
This new option also overrides the behavior of the existing
NO_*_HARDLINKS variables which in some cases would produce symlinks
within to libexec/, e.g. "git-add" symlinked to "git" which would be
copy of the "git" found in bin/, now "git-add" in libexec/ is always
going to be symlinked to the "git" found in the bin/ directory.
This option is being added because:
1) I think it makes what we're doing a lot more obvious. E.g. I'd
never noticed that the libexec binaries were really just hardlinks
since e.g. ls(1) won't show that in any obvious way. You need to
start stat(1)-ing things and look at the inodes to see what's
going on.
2) Some tools have very crappy support for hardlinks, e.g. the Git
shipped with GitLab is much bigger than it should be because
they're using a chef module that doesn't know about hardlinks, see
https://github.com/chef/omnibus/issues/827
I've also ran into other related issues that I think are explained
by this, e.g. compiling git with debugging and rpm refusing to
install a ~200MB git package with 2GB left on the FS, I think that
was because it doesn't consider hardlinks, just the sum of the
byte size of everything in the package.
As for the implementation, the "../../bin" noted above will vary given
some given some values of "../.." and "bin" depending on the depth of
the gitexecdir relative to the destdir, and the "bindir" target,
e.g. setting "bindir=/tmp/git/binaries gitexecdir=foo/bar/baz" will do
the right thing and produce this result:
$ file /tmp/git/foo/bar/baz/git-add
/tmp/git/foo/bar/baz/git-add: symbolic link to ../../../binaries/git
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-13 21:39:35 +01:00
|
|
|
test -n "$(INSTALL_SYMLINKS)" && \
|
|
|
|
ln -s "git-remote-http$X" "$$execdir/$$p" || \
|
|
|
|
{ test -z "$(NO_INSTALL_HARDLINKS)" && \
|
|
|
|
ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
|
Makefile: work around ksh's failure to handle missing list argument to for loop
ksh does not like it when the list argument is missing in a 'for' loop.
This can happen when NO_CURL is set which causes REMOTE_CURL_ALIASES to be
unset. In this case, the 'for' loop in the Makefile is expanded to look
like this:
for p in ; do
and ksh complains like this:
/bin/ksh: syntax error at line 15 : `;' unexpected
The existing attempt to work around this issue, introduced by 70b89f87,
tried to protect the 'for' loop by first testing whether REMOTE_CURL_ALIASES
was empty, but this does not work since, as Johannes Sixt explains, "Before
the test for emptyness can happen, the complete statement must be parsed,
but ksh finds a syntax error in the statement and, therefore, cannot even
begin to execute the statement. (ksh doesn't follow POSIX in this regard,
where this would not be a syntax error.)".
Make's $(foreach) function could be used to avoid this shell glitch, but
since it has already caused a problem once before by generating a command
line that exceeded the maximum argument list length on IRIX, let's adopt
Bruce Stephens's suggestion for working around this issue in the same way
the OpenSSL folks have done it. This solution first assigns the contents
of the REMOTE_CURL_ALIASES make variable to a shell variable and then
supplies the shell variable as the list argument in the 'for' loop. This
satisfies ksh and has the expected behavior even if $(REMOTE_CURL_ALIASES)
is empty.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-06 23:56:51 +02:00
|
|
|
done && \
|
2008-07-21 21:19:58 +02:00
|
|
|
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
|
2005-07-29 17:50:24 +02:00
|
|
|
|
Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with
simple make rules, 2017-12-10), the Git(3pm) man page is only
generated as an indirect dependency of the 'install-doc' and
'install-man' Makefile targets. Consequently, if someone runs 'make
man && sudo make install-man' (or their 'doc' counterparts), then
Git(3pm) will be generated as root, and the resulting root-owned files
and directories will in turn cause the next user-run 'make clean' to
fail. This was not an issue in the past, because Git(3pm) was
generated when 'make all' descended into 'perl/', which is usually not
run as root.
List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,
too, so it gets generated by targets that are usually built as
ordinary users.
While at it, add 'install-man-perl' to the list of .PHONY targets.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-15 03:14:10 +01:00
|
|
|
.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
|
2015-12-15 16:21:00 +01:00
|
|
|
.PHONY: quick-install-doc quick-install-man quick-install-html
|
2010-05-01 22:36:15 +02:00
|
|
|
install-gitweb:
|
|
|
|
$(MAKE) -C gitweb install
|
|
|
|
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
install-doc: install-man-perl
|
2005-07-29 17:50:24 +02:00
|
|
|
$(MAKE) -C Documentation install
|
|
|
|
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
install-man: install-man-perl
|
2008-11-02 18:53:03 +01:00
|
|
|
$(MAKE) -C Documentation install-man
|
|
|
|
|
Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with
simple make rules, 2017-12-10), the Git(3pm) man page is only
generated as an indirect dependency of the 'install-doc' and
'install-man' Makefile targets. Consequently, if someone runs 'make
man && sudo make install-man' (or their 'doc' counterparts), then
Git(3pm) will be generated as root, and the resulting root-owned files
and directories will in turn cause the next user-run 'make clean' to
fail. This was not an issue in the past, because Git(3pm) was
generated when 'make all' descended into 'perl/', which is usually not
run as root.
List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,
too, so it gets generated by targets that are usually built as
ordinary users.
While at it, add 'install-man-perl' to the list of .PHONY targets.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-15 03:14:10 +01:00
|
|
|
install-man-perl: man-perl
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
|
|
|
|
(cd perl/build/man/man3 && $(TAR) cf - .) | \
|
|
|
|
(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
|
|
|
|
|
2008-06-10 10:34:25 +02:00
|
|
|
install-html:
|
|
|
|
$(MAKE) -C Documentation install-html
|
|
|
|
|
2007-08-06 12:22:57 +02:00
|
|
|
install-info:
|
|
|
|
$(MAKE) -C Documentation install-info
|
|
|
|
|
2008-12-10 23:44:50 +01:00
|
|
|
install-pdf:
|
|
|
|
$(MAKE) -C Documentation install-pdf
|
|
|
|
|
2006-12-23 17:26:09 +01:00
|
|
|
quick-install-doc:
|
|
|
|
$(MAKE) -C Documentation quick-install
|
2005-07-29 17:50:24 +02:00
|
|
|
|
2008-11-02 18:53:03 +01:00
|
|
|
quick-install-man:
|
|
|
|
$(MAKE) -C Documentation quick-install-man
|
|
|
|
|
2008-09-09 22:44:17 +02:00
|
|
|
quick-install-html:
|
|
|
|
$(MAKE) -C Documentation quick-install-html
|
|
|
|
|
2005-07-29 17:50:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
### Maintainer's dist rules
|
|
|
|
|
2012-12-09 11:36:17 +01:00
|
|
|
GIT_TARNAME = git-$(GIT_VERSION)
|
2016-04-27 19:54:35 +02:00
|
|
|
dist: git-archive$(X) configure
|
2006-10-05 11:26:12 +02:00
|
|
|
./git-archive --format=tar \
|
|
|
|
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
|
2005-07-07 22:09:50 +02:00
|
|
|
@mkdir -p $(GIT_TARNAME)
|
2016-04-05 08:42:41 +02:00
|
|
|
@cp configure $(GIT_TARNAME)
|
2006-01-10 03:07:01 +01:00
|
|
|
@echo $(GIT_VERSION) > $(GIT_TARNAME)/version
|
2007-02-13 00:20:34 +01:00
|
|
|
@$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
|
2006-01-10 03:07:01 +01:00
|
|
|
$(TAR) rf $(GIT_TARNAME).tar \
|
2007-06-18 23:30:36 +02:00
|
|
|
$(GIT_TARNAME)/configure \
|
2007-02-13 00:20:34 +01:00
|
|
|
$(GIT_TARNAME)/version \
|
2007-03-12 18:40:31 +01:00
|
|
|
$(GIT_TARNAME)/git-gui/version
|
2017-12-08 23:29:58 +01:00
|
|
|
ifdef DC_SHA1_SUBMODULE
|
|
|
|
@mkdir -p $(GIT_TARNAME)/sha1collisiondetection/lib
|
|
|
|
@cp sha1collisiondetection/LICENSE.txt \
|
|
|
|
$(GIT_TARNAME)/sha1collisiondetection/
|
|
|
|
@cp sha1collisiondetection/LICENSE.txt \
|
|
|
|
$(GIT_TARNAME)/sha1collisiondetection/
|
|
|
|
@cp sha1collisiondetection/lib/sha1.[ch] \
|
|
|
|
$(GIT_TARNAME)/sha1collisiondetection/lib/
|
|
|
|
@cp sha1collisiondetection/lib/ubc_check.[ch] \
|
|
|
|
$(GIT_TARNAME)/sha1collisiondetection/lib/
|
|
|
|
$(TAR) rf $(GIT_TARNAME).tar \
|
|
|
|
$(GIT_TARNAME)/sha1collisiondetection/LICENSE.txt \
|
|
|
|
$(GIT_TARNAME)/sha1collisiondetection/lib/sha1.[ch] \
|
|
|
|
$(GIT_TARNAME)/sha1collisiondetection/lib/ubc_check.[ch]
|
|
|
|
endif
|
2007-07-14 19:51:44 +02:00
|
|
|
@$(RM) -r $(GIT_TARNAME)
|
2005-07-15 03:20:50 +02:00
|
|
|
gzip -f -9 $(GIT_TARNAME).tar
|
2005-07-07 22:09:50 +02:00
|
|
|
|
2016-04-05 08:42:41 +02:00
|
|
|
rpm::
|
|
|
|
@echo >&2 "Use distro packaged sources to run rpmbuild"
|
|
|
|
@false
|
|
|
|
.PHONY: rpm
|
2005-07-07 22:09:50 +02:00
|
|
|
|
2019-10-04 17:09:36 +02:00
|
|
|
ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
|
|
|
|
OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
|
|
|
|
endif
|
|
|
|
|
ci: parallelize testing on Windows
The fact that Git's test suite is implemented in Unix shell script that
is as portable as we can muster, combined with the fact that Unix shell
scripting is foreign to Windows (and therefore has to be emulated),
results in pretty abysmal speed of the test suite on that platform, for
pretty much no other reason than that language choice.
For comparison: while the Linux build & test is typically done within
about 8 minutes, the Windows build & test typically lasts about 80
minutes in Azure Pipelines.
To help with that, let's use the Azure Pipeline feature where you can
parallelize jobs, make jobs depend on each other, and pass artifacts
between them.
The tests are distributed using the following heuristic: listing all
test scripts ordered by size in descending order (as a cheap way to
estimate the overall run time), every Nth script is run (where N is the
total number of parallel jobs), starting at the index corresponding to
the parallel job. This slicing is performed by a new function that is
added to the `test-tool`.
To optimize the overall runtime of the entire Pipeline, we need to move
the Windows jobs to the beginning (otherwise there would be a very
decent chance for the Pipeline to be run only the Windows build, while
all the parallel Windows test jobs wait for this single one).
We use Azure Pipelines Artifacts for both the minimal Git for Windows
SDK as well as the built executables, as deduplication and caching close
to the agents makes that really fast. For comparison: while downloading
and unpacking the minimal Git for Windows SDK via PowerShell takes only
one minute (down from anywhere between 2.5 to 7 when using a shallow
clone), uploading it as Pipeline Artifact takes less than 30s and
downloading and unpacking less than 20s (sometimes even as little as
only twelve seconds).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-29 15:19:38 +01:00
|
|
|
artifacts-tar:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) \
|
|
|
|
GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
|
2019-04-18 15:16:39 +02:00
|
|
|
$(MOFILES)
|
ci: parallelize testing on Windows
The fact that Git's test suite is implemented in Unix shell script that
is as portable as we can muster, combined with the fact that Unix shell
scripting is foreign to Windows (and therefore has to be emulated),
results in pretty abysmal speed of the test suite on that platform, for
pretty much no other reason than that language choice.
For comparison: while the Linux build & test is typically done within
about 8 minutes, the Windows build & test typically lasts about 80
minutes in Azure Pipelines.
To help with that, let's use the Azure Pipeline feature where you can
parallelize jobs, make jobs depend on each other, and pass artifacts
between them.
The tests are distributed using the following heuristic: listing all
test scripts ordered by size in descending order (as a cheap way to
estimate the overall run time), every Nth script is run (where N is the
total number of parallel jobs), starting at the index corresponding to
the parallel job. This slicing is performed by a new function that is
added to the `test-tool`.
To optimize the overall runtime of the entire Pipeline, we need to move
the Windows jobs to the beginning (otherwise there would be a very
decent chance for the Pipeline to be run only the Windows build, while
all the parallel Windows test jobs wait for this single one).
We use Azure Pipelines Artifacts for both the minimal Git for Windows
SDK as well as the built executables, as deduplication and caching close
to the agents makes that really fast. For comparison: while downloading
and unpacking the minimal Git for Windows SDK via PowerShell takes only
one minute (down from anywhere between 2.5 to 7 when using a shallow
clone), uploading it as Pipeline Artifact takes less than 30s and
downloading and unpacking less than 20s (sometimes even as little as
only twelve seconds).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-29 15:19:38 +01:00
|
|
|
$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) \
|
|
|
|
SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
|
|
|
|
test -n "$(ARTIFACTS_DIRECTORY)"
|
|
|
|
mkdir -p "$(ARTIFACTS_DIRECTORY)"
|
|
|
|
$(TAR) czf "$(ARTIFACTS_DIRECTORY)/artifacts.tar.gz" $^ templates/blt/
|
|
|
|
.PHONY: artifacts-tar
|
|
|
|
|
2006-05-18 12:57:04 +02:00
|
|
|
htmldocs = git-htmldocs-$(GIT_VERSION)
|
|
|
|
manpages = git-manpages-$(GIT_VERSION)
|
2015-12-15 16:21:00 +01:00
|
|
|
.PHONY: dist-doc distclean
|
2006-05-18 12:57:04 +02:00
|
|
|
dist-doc:
|
2007-07-14 19:51:44 +02:00
|
|
|
$(RM) -r .doc-tmp-dir
|
2006-05-18 12:57:04 +02:00
|
|
|
mkdir .doc-tmp-dir
|
|
|
|
$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
|
|
|
|
cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
|
|
|
|
gzip -n -9 -f $(htmldocs).tar
|
|
|
|
:
|
2007-07-14 19:51:44 +02:00
|
|
|
$(RM) -r .doc-tmp-dir
|
2007-04-20 05:47:04 +02:00
|
|
|
mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
|
2006-05-25 14:37:46 +02:00
|
|
|
$(MAKE) -C Documentation DESTDIR=./ \
|
2006-06-29 23:26:54 +02:00
|
|
|
man1dir=../.doc-tmp-dir/man1 \
|
2007-04-20 05:47:04 +02:00
|
|
|
man5dir=../.doc-tmp-dir/man5 \
|
2006-06-29 23:26:54 +02:00
|
|
|
man7dir=../.doc-tmp-dir/man7 \
|
2006-05-18 12:57:04 +02:00
|
|
|
install
|
|
|
|
cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
|
|
|
|
gzip -n -9 -f $(manpages).tar
|
2007-07-14 19:51:44 +02:00
|
|
|
$(RM) -r .doc-tmp-dir
|
2006-05-18 12:57:04 +02:00
|
|
|
|
2005-07-29 17:50:24 +02:00
|
|
|
### Cleaning rules
|
2005-07-15 03:21:57 +02:00
|
|
|
|
2007-10-04 23:49:19 +02:00
|
|
|
distclean: clean
|
|
|
|
$(RM) configure
|
2012-07-19 09:50:01 +02:00
|
|
|
$(RM) config.log config.status config.cache
|
|
|
|
$(RM) config.mak.autogen config.mak.append
|
|
|
|
$(RM) -r autom4te.cache
|
2007-10-04 23:49:19 +02:00
|
|
|
|
2012-02-06 07:00:17 +01:00
|
|
|
profile-clean:
|
|
|
|
$(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
|
|
|
|
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
|
|
|
|
|
2018-07-23 15:51:00 +02:00
|
|
|
cocciclean:
|
|
|
|
$(RM) contrib/coccinelle/*.cocci.patch*
|
|
|
|
|
|
|
|
clean: profile-clean coverage-clean cocciclean
|
2016-04-15 19:06:52 +02:00
|
|
|
$(RM) *.res
|
|
|
|
$(RM) $(OBJECTS)
|
drop vcs-svn experiment
The code in vcs-svn was started in 2010 as an attempt to build a
remote-helper for interacting with svn repositories (as opposed to
git-svn). However, we never got as far as shipping a mature remote
helper, and the last substantive commit was e99d012a6bc in 2012.
We do have a git-remote-testsvn, and it is even installed as part of
"make install". But given the name, it seems unlikely to be used by
anybody (you'd have to explicitly "git clone testsvn::$url", and there
have been zero mentions of that on the mailing list since 2013, and even
that includes the phrase "you might need to hack a bit to get it working
properly"[1]).
We also ship contrib/svn-fe, which builds on the vcs-svn work. However,
it does not seem to build out of the box for me, as the link step misses
some required libraries for using libgit.a. Curiously, the original
build breakage bisects for me to eff80a9fd9 (Allow custom "comment
char", 2013-01-16), which seems unrelated. There was an attempt to fix
it in da011cb0e7 (contrib/svn-fe: fix Makefile, 2014-08-28), but on my
system that only switches the error message.
So it seems like the result is not really usable by anybody in practice.
It would be wonderful if somebody wanted to pick up the topic again, and
potentially it's worth carrying around for that reason. But the flip
side is that people doing tree-wide operations have to deal with this
code. And you can see the list with (replace "HEAD" with this commit as
appropriate):
{
echo "--"
git diff-tree --diff-filter=D -r --name-only HEAD^ HEAD
} |
git log --no-merges --oneline e99d012a6bc.. --stdin
which shows 58 times somebody had to deal with the code, generally due
to a compile or test failure, or a tree-wide style fix or API change.
Let's drop it and let anybody who wants to pick it up do so by
resurrecting it from the git history.
As a bonus, this also reduces the size of a stripped installation of Git
from 21MB to 19MB.
[1] https://lore.kernel.org/git/CALkWK0mPHzKfzFKKpZkfAus3YVC9NFYDbFnt+5JQYVKipk3bQQ@mail.gmail.com/
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-13 17:00:17 +02:00
|
|
|
$(RM) $(LIB_FILE) $(XDIFF_LIB)
|
2010-01-31 20:46:53 +01:00
|
|
|
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
|
2019-04-18 15:16:39 +02:00
|
|
|
$(RM) $(TEST_PROGRAMS)
|
2018-10-13 02:58:40 +02:00
|
|
|
$(RM) $(FUZZ_PROGRAMS)
|
Makefile: emulate compile in $(HCO) target better
Currently, when testing headers using `make hdr-check`, headers are
directly compiled. Although this seems to test the headers, this is too
strict since we treat the headers as C sources. As a result, this will
cause warnings to appear that would otherwise not, such as a static
variable definition intended for later use throwing a unused variable
warning.
In addition, on platforms that can run `make hdr-check` but require
custom flags, this target was failing because none of them were being
passed to the compiler. For example, on MacOS, the NO_OPENSSL flag was
being set but it was not being passed into compiler so the check was
failing.
Fix these problems by emulating the compile process better, including
test compiling dummy *.hcc C sources generated from the *.h files and
passing $(ALL_CFLAGS) into the compiler for the $(HCO) target so that
these custom flags can be used.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-25 10:21:01 +02:00
|
|
|
$(RM) $(HCC)
|
2013-02-13 16:57:48 +01:00
|
|
|
$(RM) -r bin-wrappers $(dep_dirs)
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 00:14:42 +01:00
|
|
|
$(RM) -r po/build/
|
Makefile: drop GEN_HDRS
When ebb7baf0 ("Makefile: add a hdr-check target", 2018-09-19)
implemented hdr-check target, it wanted to leave some header files
exempt from the stricter check the target implements, and added
GEN_HDRS macro.
This however is probably a bad move for two reasons:
- If we value the header cleanliness check, we eventually want to
teach our header generating scripts to produce clean headers.
Keeping the blanket "generated headers can be left as dirty as we
want" exception does not nudge us in the right direction.
- There is a list of generated header files, GENERATED_H, which is
used to keep track of dependencies. Presence of GEN_HDRS that is
too similarly named would confuse developers who are adding new
generated header files which list to add theirs.
- Even though unicode-width.h could be generated using a contrib/
script, as far as our build infrastructure is concerned, it is a
source file that is tracked in the source control system. Its
presence in GEN_HDRS list is doubly misleading.
Get rid of GEN_HDRS, which is used only once to list the headers we
do not run hdr-check test on, and instead explicitly list that the
ones, either tracked or generated, that we exempt from the test.
This allows GENERATED_H to be the sole "here are build artifact
header files that are expendable" list, so use it in the clean
target to $(RM) them.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-12-14 00:15:34 +01:00
|
|
|
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
|
2007-07-14 19:51:44 +02:00
|
|
|
$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
|
|
|
|
$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
|
|
|
|
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
|
2005-05-22 20:27:28 +02:00
|
|
|
$(MAKE) -C Documentation/ clean
|
2019-04-18 15:16:44 +02:00
|
|
|
$(RM) Documentation/GIT-EXCLUDED-PROGRAMS
|
2009-04-03 21:32:20 +02:00
|
|
|
ifndef NO_PERL
|
2010-05-08 19:36:15 +02:00
|
|
|
$(MAKE) -C gitweb clean
|
Makefile: replace perl/Makefile.PL with simple make rules
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].
The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.
We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].
There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.
So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt. As that's being done rename the files
from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").
While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.
Functional changes:
* This will not always install into perl's idea of its global
"installsitelib". This only potentially matters for packagers that
need to expose Git.pm for non-git use, and as explained in the
INSTALL file there's a trivial workaround.
* The scripts themselves will 'use lib' the target directory, but if
INSTLIBDIR is set it overrides it. It doesn't have to be this way,
it could be set in addition to INSTLIBDIR, but my reading of [7] is
that this is the desired behavior.
* We don't build man pages for all of the perl modules as we used to,
only Git(3pm). As discussed on-list[8] that we were building
installed manpages for purely internal APIs like Git::I18N or
private-Error.pm was always a bug anyway, and all the Git::SVN::*
ones say they're internal APIs.
There are apparently external users of Git.pm, but I don't expect
there to be any of the others.
As a side-effect of these general changes the perl documentation
now only installed by install-{doc,man}, not a mere "install" as
before.
1. 5e9637c629 ("i18n: add infrastructure for translating Git with
gettext", 2011-11-18)
2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)
3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)
4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
2006-12-04)
5. ee9be06770 ("perl: detect new files in MakeMaker builds",
2012-07-27)
6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
2017-03-29)
7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
default perl path", 2013-11-15)
8. 87bmjjv1pu.fsf@evledraar.booking.com ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-10 22:13:33 +01:00
|
|
|
$(RM) -r perl/build/
|
2009-04-03 21:32:20 +02:00
|
|
|
endif
|
Introduce Git.pm (v4)
This patch introduces a very basic and barebone Git.pm module
with a sketch of how the generic interface would look like;
most functions are missing, but this should give some good base.
I will continue expanding it.
Most desirable now is more careful error reporting, generic_in() for feeding
input to Git commands and the repository() constructor doing some poking
with git-rev-parse to get the git directory and subdirectory prefix.
Those three are basically the prerequisities for converting git-mv.
I will send them as follow-ups to this patch.
Currently Git.pm just wraps up exec()s of Git commands, but even that
is not trivial to get right and various Git perl scripts do it in
various inconsistent ways. In addition to Git.pm, there is now also
Git.xs which provides barebone Git.xs for directly interfacing with
libgit.a, and as an example providing the hash_object() function using
libgit.
This adds the Git module, integrates it to the build system and as
an example converts the git-fmt-merge-msg.perl script to it (the result
is not very impressive since its advantage is not quite apparent in this
one, but I just picked up the simplest Git user around).
Compared to v3, only very minor things were fixed in this patch (some
whitespaces, a missing export, tiny bug in git-fmt-merge-msg.perl);
at first I wanted to post them as a separate patch but since this
is still only in pu, I decided that it will be cleaner to just resend
the patch.
My current working state is available all the time at
http://pasky.or.cz/~xpasky/git-perl/Git.pm
and an irregularily updated API documentation is at
http://pasky.or.cz/~xpasky/git-perl/Git.html
Many thanks to Jakub Narebski, Junio and others for their feedback.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-24 04:34:29 +02:00
|
|
|
$(MAKE) -C templates/ clean
|
2005-08-03 02:24:11 +02:00
|
|
|
$(MAKE) -C t/ clean
|
2007-03-28 13:00:23 +02:00
|
|
|
ifndef NO_TCLTK
|
2007-11-17 19:51:16 +01:00
|
|
|
$(MAKE) -C gitk-git clean
|
2007-03-28 13:00:23 +02:00
|
|
|
$(MAKE) -C git-gui clean
|
|
|
|
endif
|
2012-12-18 16:26:37 +01:00
|
|
|
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
|
2013-11-18 23:23:11 +01:00
|
|
|
$(RM) GIT-USER-AGENT GIT-PREFIX
|
2018-04-10 17:05:42 +02:00
|
|
|
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
|
2019-06-25 16:49:39 +02:00
|
|
|
ifdef MSVC
|
|
|
|
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
|
|
|
|
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
|
|
|
|
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
|
|
|
|
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
|
|
|
|
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
|
|
|
|
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
|
|
|
|
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
|
|
|
|
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
|
|
|
|
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
|
|
|
|
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
|
|
|
|
$(RM) compat/vcbuild/MSVC-DEFS-GEN
|
|
|
|
endif
|
2005-12-27 23:40:17 +01:00
|
|
|
|
2018-07-23 15:51:00 +02:00
|
|
|
.PHONY: all install profile-clean cocciclean clean strip
|
2008-08-07 21:06:26 +02:00
|
|
|
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
|
2010-09-28 23:08:38 +02:00
|
|
|
.PHONY: FORCE cscope
|
2005-12-20 02:59:58 +01:00
|
|
|
|
2006-04-13 09:17:19 +02:00
|
|
|
### Check documentation
|
|
|
|
#
|
2012-08-08 22:56:04 +02:00
|
|
|
ALL_COMMANDS = $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS)
|
|
|
|
ALL_COMMANDS += git
|
2020-03-21 10:21:20 +01:00
|
|
|
ALL_COMMANDS += git-citool
|
|
|
|
ALL_COMMANDS += git-gui
|
2012-08-08 22:56:04 +02:00
|
|
|
ALL_COMMANDS += gitk
|
|
|
|
ALL_COMMANDS += gitweb
|
2015-12-15 16:21:00 +01:00
|
|
|
|
|
|
|
.PHONY: check-docs
|
2006-04-13 09:17:19 +02:00
|
|
|
check-docs::
|
2016-05-04 23:34:23 +02:00
|
|
|
$(MAKE) -C Documentation lint-docs
|
2019-03-25 22:41:39 +01:00
|
|
|
@(for v in $(patsubst %$X,%,$(ALL_COMMANDS)); \
|
2006-04-13 09:17:19 +02:00
|
|
|
do \
|
|
|
|
case "$$v" in \
|
|
|
|
git-merge-octopus | git-merge-ours | git-merge-recursive | \
|
2008-07-05 16:43:51 +02:00
|
|
|
git-merge-resolve | git-merge-subtree | \
|
2008-01-18 07:52:40 +01:00
|
|
|
git-fsck-objects | git-init-db | \
|
2019-04-18 15:16:46 +02:00
|
|
|
git-remote-* | git-stage | git-legacy-* | \
|
2007-12-15 07:02:57 +01:00
|
|
|
git-?*--?* ) continue ;; \
|
2006-04-13 09:17:19 +02:00
|
|
|
esac ; \
|
|
|
|
test -f "Documentation/$$v.txt" || \
|
|
|
|
echo "no doc: $$v"; \
|
2015-05-21 19:39:18 +02:00
|
|
|
sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
|
2007-02-14 07:45:22 +01:00
|
|
|
grep -q "^$$v[ ]" || \
|
2006-04-13 09:17:19 +02:00
|
|
|
case "$$v" in \
|
|
|
|
git) ;; \
|
|
|
|
*) echo "no link: $$v";; \
|
|
|
|
esac ; \
|
2007-11-09 03:38:27 +01:00
|
|
|
done; \
|
|
|
|
( \
|
2015-05-21 19:39:18 +02:00
|
|
|
sed -e '1,/^### command list/d' \
|
|
|
|
-e '/^#/d' \
|
2019-03-25 22:41:38 +01:00
|
|
|
-e '/guide$$/d' \
|
2007-11-09 03:38:27 +01:00
|
|
|
-e 's/[ ].*//' \
|
2007-12-02 08:39:19 +01:00
|
|
|
-e 's/^/listed /' command-list.txt; \
|
2012-08-08 22:57:52 +02:00
|
|
|
$(MAKE) -C Documentation print-man1 | \
|
|
|
|
grep '\.txt$$' | \
|
check-docs: really look at the documented commands again
As part of the `check-docs` target, we verify that commands that are
documented are actually in the current list of commands to be built.
However, this logic broke in 5fafce0b78 (check-docs: get documented
command list from Makefile, 2012-08-08), when we tried to make the logic
safer by not looking at the files in the worktree, but at the list of
files to be generated in `Documentation/Makefile`. While this was the
right thing to do, it failed to accommodate for the fact that `make -C
Documentation/ print-man1`, unlike `ls Documentation/*.txt`, would *not*
print lines starting with the prefix `Documentation/`.
At long last, let's fix this.
Note: This went undetected due to a funny side effect of the
`ALL_PROGRAMS` variable starting with a space. That space, together with
the extra space we inserted before `$(ALL_PROGRAMS)` in the
case " $(ALL_PROGRAMS)" in
*" $$cmd ")
[...]
construct, is responsible that this case arm is used when `cmd` is empty
(which was clearly not intended to be the case).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-25 22:41:37 +01:00
|
|
|
sed -e 's|^|documented |' \
|
2007-11-09 03:38:27 +01:00
|
|
|
-e 's/\.txt//'; \
|
|
|
|
) | while read how cmd; \
|
|
|
|
do \
|
2019-04-18 15:16:42 +02:00
|
|
|
case " $(patsubst %$X,%,$(ALL_COMMANDS) $(EXCLUDED_PROGRAMS)) " in \
|
2007-11-09 03:38:27 +01:00
|
|
|
*" $$cmd "*) ;; \
|
|
|
|
*) echo "removed but $$how: $$cmd" ;; \
|
|
|
|
esac; \
|
|
|
|
done ) | sort
|
2006-11-05 20:26:21 +01:00
|
|
|
|
|
|
|
### Make sure built-ins do not have dups and listed in git.c
|
|
|
|
#
|
|
|
|
check-builtins::
|
|
|
|
./check-builtins.sh
|
2008-01-15 00:10:38 +01:00
|
|
|
|
2009-02-19 12:13:35 +01:00
|
|
|
### Test suite coverage testing
|
|
|
|
#
|
2013-05-13 23:27:25 +02:00
|
|
|
.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
|
2015-12-15 16:21:00 +01:00
|
|
|
.PHONY: coverage-untested-functions cover_db cover_db_html
|
2013-05-13 23:27:26 +02:00
|
|
|
.PHONY: coverage-clean-results
|
2009-02-19 12:13:35 +01:00
|
|
|
|
|
|
|
coverage:
|
2013-05-13 23:27:25 +02:00
|
|
|
$(MAKE) coverage-test
|
2013-05-13 23:27:28 +02:00
|
|
|
$(MAKE) coverage-untested-functions
|
2009-02-19 12:13:35 +01:00
|
|
|
|
2010-07-25 21:52:40 +02:00
|
|
|
object_dirs := $(sort $(dir $(OBJECTS)))
|
2013-05-13 23:27:26 +02:00
|
|
|
coverage-clean-results:
|
2010-07-25 21:52:40 +02:00
|
|
|
$(RM) $(addsuffix *.gcov,$(object_dirs))
|
|
|
|
$(RM) $(addsuffix *.gcda,$(object_dirs))
|
|
|
|
$(RM) coverage-untested-functions
|
2010-07-25 21:52:42 +02:00
|
|
|
$(RM) -r cover_db/
|
2010-07-25 21:52:43 +02:00
|
|
|
$(RM) -r cover_db_html/
|
2009-02-19 12:13:35 +01:00
|
|
|
|
2013-05-13 23:27:26 +02:00
|
|
|
coverage-clean: coverage-clean-results
|
|
|
|
$(RM) $(addsuffix *.gcno,$(object_dirs))
|
|
|
|
|
2009-02-19 12:13:35 +01:00
|
|
|
COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
|
|
|
|
COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
|
2010-07-25 21:52:40 +02:00
|
|
|
GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
|
2009-02-19 12:13:35 +01:00
|
|
|
|
2013-05-13 23:27:25 +02:00
|
|
|
coverage-compile:
|
2009-02-19 12:13:35 +01:00
|
|
|
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
|
2013-05-13 23:27:25 +02:00
|
|
|
|
|
|
|
coverage-test: coverage-clean-results coverage-compile
|
2009-02-19 12:13:35 +01:00
|
|
|
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
|
2013-05-13 23:27:27 +02:00
|
|
|
DEFAULT_TEST_TARGET=test -j1 test
|
2009-02-19 12:13:35 +01:00
|
|
|
|
2019-01-29 18:05:18 +01:00
|
|
|
coverage-prove: coverage-clean-results coverage-compile
|
|
|
|
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
|
|
|
|
DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \
|
|
|
|
-j1 test
|
|
|
|
|
2009-02-19 12:13:35 +01:00
|
|
|
coverage-report:
|
2010-07-25 21:52:40 +02:00
|
|
|
$(QUIET_GCOV)for dir in $(object_dirs); do \
|
2010-07-26 09:43:41 +02:00
|
|
|
$(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
|
2010-07-25 21:52:40 +02:00
|
|
|
done
|
2010-07-25 21:52:41 +02:00
|
|
|
|
|
|
|
coverage-untested-functions: coverage-report
|
2009-02-19 12:13:35 +01:00
|
|
|
grep '^function.*called 0 ' *.c.gcov \
|
|
|
|
| sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
|
2010-07-25 21:52:40 +02:00
|
|
|
> coverage-untested-functions
|
2010-07-25 21:52:42 +02:00
|
|
|
|
|
|
|
cover_db: coverage-report
|
|
|
|
gcov2perl -db cover_db *.gcov
|
2010-07-25 21:52:43 +02:00
|
|
|
|
|
|
|
cover_db_html: cover_db
|
|
|
|
cover -report html -outputdir cover_db_html cover_db
|
2011-06-19 03:07:05 +02:00
|
|
|
|
2018-10-13 02:58:40 +02:00
|
|
|
|
|
|
|
### Fuzz testing
|
|
|
|
#
|
|
|
|
# Building fuzz targets generally requires a special set of compiler flags that
|
|
|
|
# are not necessarily appropriate for general builds, and that vary greatly
|
|
|
|
# depending on the compiler version used.
|
|
|
|
#
|
|
|
|
# An example command to build against libFuzzer from LLVM 4.0.0:
|
|
|
|
#
|
|
|
|
# make CC=clang CXX=clang++ \
|
2019-01-15 23:25:52 +01:00
|
|
|
# CFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \
|
2018-10-13 02:58:40 +02:00
|
|
|
# LIB_FUZZING_ENGINE=/usr/lib/llvm-4.0/lib/libFuzzer.a \
|
|
|
|
# fuzz-all
|
|
|
|
#
|
2018-11-14 20:41:47 +01:00
|
|
|
FUZZ_CXXFLAGS ?= $(CFLAGS)
|
|
|
|
|
2018-10-13 02:58:40 +02:00
|
|
|
.PHONY: fuzz-all
|
|
|
|
|
|
|
|
$(FUZZ_PROGRAMS): all
|
2018-11-14 20:41:47 +01:00
|
|
|
$(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
|
2018-10-13 02:58:40 +02:00
|
|
|
$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
|
|
|
|
|
|
|
|
fuzz-all: $(FUZZ_PROGRAMS)
|