* [PATCH] Allow building GIT in a different directory from the source directory
@ 2006-12-08 17:15 Han-Wen Nienhuys
2006-12-08 17:44 ` Jakub Narebski
2006-12-09 1:16 ` Alex Riesen
0 siblings, 2 replies; 9+ messages in thread
From: Han-Wen Nienhuys @ 2006-12-08 17:15 UTC (permalink / raw)
To: git
From 105d331aee95c0cf3610ac0d2fd4aa7688bd5211 Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Fri, 8 Dec 2006 18:07:56 +0100
GIT can now be built in a separate builddirectory. This is done as
follows:
mkdir build
cd build
$my_git_dir/configure
make
In this case, configure creates an empty directory tree based on the
source directory, and wraps Makefiles from source directory in the
build directory. The rest of the functionality is delivered with the
VPATH feature of Make.
To make this work the Makefile should not mention ./ explicitly in
rules, but rather use $< and $^ to automatically look in the source
dir too.
perl/Makefile and perl/Makefile.PL need special massaging because perl
is not VPATH aware.
Signed-off-by: Han-Wen Nienhuys <hanwen@xs4all.nl>
---
Makefile | 21 ++++++++++++---------
config.mak.in | 9 ++++-----
configure.ac | 34 ++++++++++++++++++++++++++++++++++
generate-cmdlist.sh | 2 +-
perl/Makefile | 4 ++++
perl/Makefile.PL | 16 +++++++++++++---
6 files changed, 68 insertions(+), 18 deletions(-)
diff --git a/Makefile b/Makefile
index cb9b745..3ed57ec 100644
--- a/Makefile
+++ b/Makefile
@@ -97,7 +97,7 @@ all:
#
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @$(SHELL_PATH) $(srcdir)/GIT-VERSION-GEN
-include GIT-VERSION-FILE
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
@@ -110,7 +110,7 @@ uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
CFLAGS = -g -O2 -Wall
LDFLAGS =
-ALL_CFLAGS = $(CFLAGS)
+ALL_CFLAGS = $(CFLAGS) -I.
ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip
@@ -120,7 +120,10 @@ datadir = $(prefix)/share
GIT_datadir = $(datadir)/git-core
gitexecdir = $(bindir)
template_dir = $(GIT_datadir)/templates/
-# DESTDIR=
+srcdir = .
+
+# this is usually set on the make command line.
+DESTDIR=
# default configuration for gitweb
GITWEB_CONFIG = gitweb_config.perl
@@ -598,8 +601,8 @@ git-merge-recur$X: git-merge-recursive$X
$(BUILT_INS): git$X
rm -f $@ && ln git$X $@
-common-cmds.h: Documentation/git-*.txt
- ./generate-cmdlist.sh > $@+
+common-cmds.h: $(wildcard $(srcdir)/Documentation/git-*.txt)
+ $(srcdir)/generate-cmdlist.sh $(srcdir)/Documentation/ > $@+
mv $@+ $@
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
@@ -609,7 +612,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's!@@GIT_datadir@@!$(GIT_datadir)!g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
- $@.sh >$@+
+ $^ >$@+
chmod +x $@+
mv $@+ $@
@@ -630,7 +633,7 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
-e '}' \
-e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
- $@.perl >$@+
+ $^ >$@+
chmod +x $@+
mv $@+ $@
@@ -674,7 +677,7 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
-e '/@@GITWEB_CGI@@/d' \
-e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
-e '/@@GITWEB_CSS@@/d' \
- $@.sh > $@+
+ $< > $@+
chmod +x $@+
mv $@+ $@
@@ -821,7 +824,7 @@ install: all
fi
$(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_datadir_SQ)'
- $(INSTALL) -m755 git-sh-setup.sh '$(DESTDIR_SQ)$(GIT_datadir_SQ)'
+ $(INSTALL) -m755 $(srcdir)/git-sh-setup.sh '$(DESTDIR_SQ)$(GIT_datadir_SQ)'
install-doc:
$(MAKE) -C Documentation install
diff --git a/config.mak.in b/config.mak.in
index 9a57840..bfbbf46 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -10,17 +10,16 @@ TAR = @TAR@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
-#gitexecdir = @libexecdir@/git-core/
+mandir=@mandir@
+
+## unused, but necessary for some autoconf versions (?)
datarootdir = @datarootdir@
-template_dir = @datadir@/git-core/templates/
-mandir=@mandir@
srcdir = @srcdir@
-VPATH = @srcdir@
export exec_prefix mandir
-export srcdir VPATH
+export srcdir
NEEDS_SSL_WITH_CRYPTO=@NEEDS_SSL_WITH_CRYPTO@
NO_OPENSSL=@NO_OPENSSL@
diff --git a/configure.ac b/configure.ac
index 34e3478..403c410 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,7 @@ AC_PREREQ(2.59)
AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
+srcdir=`cd $srcdir && pwd`
config_file=config.mak.autogen
config_append=config.mak.append
@@ -334,6 +335,39 @@ GIT_PARSE_WITH(iconv))
AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
AC_OUTPUT
+if test "$srcdir" != "."; then
+
+ ## if we're building in another directory
+ ## we need to set it up like the sourcedir
+ for d in `cd $srcdir && find . -type d -print | grep -v '\.git'` ;
+ do
+ if test ! -d $d ; then
+ echo creating $d
+ mkdir $d
+ fi
+
+ if test -f $srcdir/$d/Makefile ; then
+
+ dnl [[]] is to keep m4 happy
+ depth=`echo $d/ | sed -e 's!^\./!!g' -e 's![[^/]]*/!../!g'`
+ echo creating $d/Makefile
+
+ if test "$depth" = ""; then
+ INCLUDE_AUTOGEN="include config.mak.autogen" ;
+ else
+ INCLUDE_AUTOGEN="srcdir=$srcdir"
+ fi
+
+ cat << EOF > $d/Makefile
+$INCLUDE_AUTOGEN
+VPATH = $srcdir/$d
+export VPATH
+include $srcdir/$d/Makefile
+EOF
+
+ fi
+ done
+fi
## Cleanup
rm -f "${config_append}"
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 5450918..e744fbb 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -47,6 +47,6 @@ do
x
s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/git-$cmd.txt"
+ }' "$1/git-$cmd.txt"
done
echo "};"
diff --git a/perl/Makefile b/perl/Makefile
index bd483b0..e912191 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -28,6 +28,10 @@ $(makfile): ../GIT-CFLAGS Makefile
echo instlibdir: >> $@
echo ' echo $(instdir_SQ)' >> $@
else
+
+PERL_SRCDIR=$(srcdir)/perl
+export PERL_SRCDIR
+
$(makfile): Makefile.PL ../GIT-CFLAGS
'$(PERL_PATH_SQ)' $< FIRST_MAKEFILE='$@' PREFIX='$(prefix_SQ)'
endif
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index de73235..8a1251d 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -8,21 +8,31 @@ instlibdir:
MAKE_FRAG
}
-my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
+
+$src_prefix = '';
+if (!($ENV{'PERL_SRCDIR'} eq "")) {
+ $src_prefix = $ENV{'PERL_SRCDIR'} . "/"
+}
+
+
+my %pm = ("$src_prefix/Git.pm" => '$(INST_LIBDIR)/Git.pm');
+
+
# We come with our own bundled Error.pm. It's not in the set of default
# Perl modules so install it if it's not available on the system yet.
eval { require Error };
if ($@) {
- $pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';
+ $pm{"$src_prefix/private-Error.pm"} = '$(INST_LIBDIR)/Error.pm';
}
my %extra;
$extra{DESTDIR} = $ENV{DESTDIR} if $ENV{DESTDIR};
+
WriteMakefile(
NAME => 'Git',
- VERSION_FROM => 'Git.pm',
+ VERSION_FROM => "$src_prefix/Git.pm",
PM => \%pm,
%extra
);
--
1.4.4.1.gc9922-dirty
--
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] Allow building GIT in a different directory from the source directory
2006-12-08 17:15 [PATCH] Allow building GIT in a different directory from the source directory Han-Wen Nienhuys
@ 2006-12-08 17:44 ` Jakub Narebski
2006-12-08 18:14 ` Han-Wen Nienhuys
2006-12-09 1:16 ` Alex Riesen
1 sibling, 1 reply; 9+ messages in thread
From: Jakub Narebski @ 2006-12-08 17:44 UTC (permalink / raw)
To: git
Han-Wen Nienhuys wrote:
> From 105d331aee95c0cf3610ac0d2fd4aa7688bd5211 Mon Sep 17 00:00:00 2001
This line is not needed.
> From: Han-Wen Nienhuys <hanwen@xs4all.nl>
> Date: Fri, 8 Dec 2006 18:07:56 +0100
>
> GIT can now be built in a separate builddirectory. This is done as
> follows:
>
> mkdir build
> cd build
> $my_git_dir/configure
> make
Perhaps we should add this to INSTALL file, or to comments in either
Makefile, or configure.ac?
> In this case, configure creates an empty directory tree based on the
> source directory, and wraps Makefiles from source directory in the
> build directory. The rest of the functionality is delivered with the
> VPATH feature of Make.
>
> To make this work the Makefile should not mention ./ explicitly in
> rules, but rather use $< and $^ to automatically look in the source
> dir too.
>
> perl/Makefile and perl/Makefile.PL need special massaging because perl
> is not VPATH aware.
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@xs4all.nl>
Very nicely written commit message. Good work.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Allow building GIT in a different directory from the source directory
2006-12-08 17:15 [PATCH] Allow building GIT in a different directory from the source directory Han-Wen Nienhuys
2006-12-08 17:44 ` Jakub Narebski
@ 2006-12-09 1:16 ` Alex Riesen
1 sibling, 0 replies; 9+ messages in thread
From: Alex Riesen @ 2006-12-09 1:16 UTC (permalink / raw)
To: Han-Wen Nienhuys; +Cc: git
Han-Wen Nienhuys, Fri, Dec 08, 2006 18:15:25 +0100:
> -my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
> +
> +$src_prefix = '';
> +if (!($ENV{'PERL_SRCDIR'} eq "")) {
> + $src_prefix = $ENV{'PERL_SRCDIR'} . "/"
> +}
Hurts my eyes :)
$src_prefix = defined($ENV{PERL_SRCDIR}) ? "$ENV{PERL_SRCDIR}/": '';
could be shorter, unless you want (you do) strict syntax check.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] Allow building GIT in a different directory from the source directory
@ 2006-12-11 13:56 Han-Wen Nienhuys
2006-12-12 9:03 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Han-Wen Nienhuys @ 2006-12-11 13:56 UTC (permalink / raw)
To: git
GIT can now be built in a separate builddirectory. This is done as
follows:
mkdir build
cd build
$my_git_dir/configure
make
In this case, configure creates an empty directory tree based on the
source directory, and wraps Makefiles from source directory in the
build directory. The rest of the functionality is delivered with the
VPATH feature of Make.
To make this work the Makefile should not mention ./ explicitly in
rules, but rather use $< and $^ to automatically look in the source
dir too.
perl/Makefile and perl/Makefile.PL need special massaging because perl
is not VPATH aware.
The documentation subdirectory has limited support for separate building,
as asciidoc doesn't have a --include-path option.
Documentation/Makefile | 36 ++++++++++++++++++++++--------------
INSTALL | 7 +++++++
Makefile | 23 ++++++++++++++---------
config.mak.in | 9 ++++-----
configure.ac | 34 ++++++++++++++++++++++++++++++++++
generate-cmdlist.sh | 2 +-
perl/Makefile | 4 ++++
perl/Makefile.PL | 16 +++++++++++++---
8 files changed, 99 insertions(+), 32 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index c00f5f6..39bcd45 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,6 +1,6 @@
MAN1_TXT= \
- $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
- $(wildcard git-*.txt)) \
+ $(filter-out $(foreach i, $(ARTICLES) $(SP_ARTICLES), $(here-srcdir)/$(i).txt), \
+ $(wildcard $(here-srcdir)/git-*.txt)) \
gitk.txt
MAN7_TXT=git.txt
@@ -33,8 +33,16 @@ # DESTDIR=
INSTALL?=install
--include ../config.mak.autogen
+ifndef srcdir
+srcdir=..
+endif
+
+
+here-srcdir=$(srcdir)/Documentation
+ASCIIDOC_CONF=$(here-srcdir)/asciidoc.conf
+
+-include ../config.mak.autogen
#
# Please note that there is a minor bug in asciidoc.
# The version after 6.0.3 _will_ include the patch found here:
@@ -63,9 +71,9 @@ install: man
#
# Determine "include::" file references in asciidoc files.
#
-doc.dep : $(wildcard *.txt) build-docdep.perl
+doc.dep : $(wildcard $(here-srcdir)/*.txt) build-docdep.perl
rm -f $@+ $@
- perl ./build-docdep.perl >$@+
+ perl $(lastword $^) >$@+
mv $@+ $@
-include doc.dep
@@ -80,35 +88,35 @@ clean:
rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep README
%.html : %.txt
- asciidoc -b xhtml11 -d manpage -f asciidoc.conf $<
+ asciidoc -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) $<
%.1 %.7 : %.xml
- xmlto -m callouts.xsl man $<
+ xmlto --searchpath $(here-srcdir)/ -m callouts.xsl man $<
%.xml : %.txt
- asciidoc -b docbook -d manpage -f asciidoc.conf $<
+ asciidoc -b docbook -d manpage -f $(ASCIIDOC_CONF) $<
git.html: git.txt README
glossary.html : glossary.txt sort_glossary.pl
cat $< | \
- perl sort_glossary.pl | \
+ perl $(lastword $^) | \
asciidoc -b xhtml11 - > glossary.html
-howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
+howto-index.txt: howto-index.sh $(wildcard $(here-srcdir)/howto/*.txt)
rm -f $@+ $@
- sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
+ sh $^ >$@+
mv $@+ $@
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
- asciidoc -b xhtml11 $*.txt
+ asciidoc -b xhtml11 $<
WEBDOC_DEST = /pub/software/scm/git/docs
-$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
+$(patsubst %.txt,%.html,$(wildcard $(here-srcdir)/howto/*.txt)): %.html : %.txt
rm -f $@+ $@
sed -e '1,/^$$/d' $< | asciidoc -b xhtml11 - >$@+
mv $@+ $@
install-webdoc : html
- sh ./install-webdoc.sh $(WEBDOC_DEST)
+ sh $(here-srcdir)/install-webdoc.sh $(WEBDOC_DEST)
diff --git a/INSTALL b/INSTALL
index 8f69039..b1355fa 100644
--- a/INSTALL
+++ b/INSTALL
@@ -21,6 +21,13 @@ set up install paths (via config.mak.aut
$ make all doc ;# as yourself
# make install install-doc ;# as root
+When using configure, git may be built in a separate directory. Use
+
+ $ mkdir builddir
+ $ cd builddir
+ $ GIT-SOURCE-DIR/configure [options]
+ $ make
+ # make install
Issues of note:
diff --git a/Makefile b/Makefile
index a1861de..8e6ec62 100644
--- a/Makefile
+++ b/Makefile
@@ -97,7 +97,7 @@ # MakeMaker (e.g. using ActiveState unde
#
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @$(SHELL_PATH) $(srcdir)/GIT-VERSION-GEN
-include GIT-VERSION-FILE
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
@@ -110,15 +110,20 @@ # CFLAGS and LDFLAGS are for the users t
CFLAGS = -g -O2 -Wall
LDFLAGS =
-ALL_CFLAGS = $(CFLAGS)
+ALL_CFLAGS = $(CFLAGS) -I.
ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip
prefix = $(HOME)
bindir = $(prefix)/bin
gitexecdir = $(bindir)
-template_dir = $(prefix)/share/git-core/templates/
-# DESTDIR=
+datadir = $(prefix)/share
+GIT_datadir = $(datadir)/git-core
+template_dir = $(GIT_datadir)/templates/
+srcdir = .
+
+# this is usually set on the make command line.
+DESTDIR=
# default configuration for gitweb
GITWEB_CONFIG = gitweb_config.perl
@@ -595,8 +600,8 @@ git-merge-recur$X: git-merge-recursive$X
$(BUILT_INS): git$X
rm -f $@ && ln git$X $@
-common-cmds.h: Documentation/git-*.txt
- ./generate-cmdlist.sh > $@+
+common-cmds.h: $(wildcard $(srcdir)/Documentation/git-*.txt)
+ $(srcdir)/generate-cmdlist.sh $(srcdir)/Documentation/ > $@+
mv $@+ $@
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
@@ -605,7 +610,7 @@ common-cmds.h: Documentation/git-*.txt
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
- $@.sh >$@+
+ $^ >$@+
chmod +x $@+
mv $@+ $@
@@ -626,7 +631,7 @@ perl/perl.mak: GIT-CFLAGS
-e '}' \
-e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
- $@.perl >$@+
+ $^ >$@+
chmod +x $@+
mv $@+ $@
@@ -670,7 +675,7 @@ git-instaweb: git-instaweb.sh gitweb/git
-e '/@@GITWEB_CGI@@/d' \
-e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
-e '/@@GITWEB_CSS@@/d' \
- $@.sh > $@+
+ $< > $@+
chmod +x $@+
mv $@+ $@
diff --git a/config.mak.in b/config.mak.in
index 9a57840..bfbbf46 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -10,17 +10,16 @@ #INSTALL = @INSTALL@ # needs install-sh
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
-#gitexecdir = @libexecdir@/git-core/
+mandir=@mandir@
+
+## unused, but necessary for some autoconf versions (?)
datarootdir = @datarootdir@
-template_dir = @datadir@/git-core/templates/
-mandir=@mandir@
srcdir = @srcdir@
-VPATH = @srcdir@
export exec_prefix mandir
-export srcdir VPATH
+export srcdir
NEEDS_SSL_WITH_CRYPTO=@NEEDS_SSL_WITH_CRYPTO@
NO_OPENSSL=@NO_OPENSSL@
diff --git a/configure.ac b/configure.ac
index 34e3478..403c410 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,7 @@ AC_PREREQ(2.59)
AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
+srcdir=`cd $srcdir && pwd`
config_file=config.mak.autogen
config_append=config.mak.append
@@ -334,6 +335,39 @@ ## Output files
AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
AC_OUTPUT
+if test "$srcdir" != "."; then
+
+ ## if we're building in another directory
+ ## we need to set it up like the sourcedir
+ for d in `cd $srcdir && find . -type d -print | grep -v '\.git'` ;
+ do
+ if test ! -d $d ; then
+ echo creating $d
+ mkdir $d
+ fi
+
+ if test -f $srcdir/$d/Makefile ; then
+
+ dnl [[]] is to keep m4 happy
+ depth=`echo $d/ | sed -e 's!^\./!!g' -e 's![[^/]]*/!../!g'`
+ echo creating $d/Makefile
+
+ if test "$depth" = ""; then
+ INCLUDE_AUTOGEN="include config.mak.autogen" ;
+ else
+ INCLUDE_AUTOGEN="srcdir=$srcdir"
+ fi
+
+ cat << EOF > $d/Makefile
+$INCLUDE_AUTOGEN
+VPATH = $srcdir/$d
+export VPATH
+include $srcdir/$d/Makefile
+EOF
+
+ fi
+ done
+fi
## Cleanup
rm -f "${config_append}"
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 5450918..e744fbb 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -47,6 +47,6 @@ do
x
s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/git-$cmd.txt"
+ }' "$1/git-$cmd.txt"
done
echo "};"
diff --git a/perl/Makefile b/perl/Makefile
index 099beda..ae61cf6 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -28,6 +28,10 @@ instdir_SQ = $(subst ','\'',$(prefix)/li
echo instlibdir: >> $@
echo ' echo $(instdir_SQ)' >> $@
else
+
+PERL_SRCDIR=$(srcdir)/perl
+export PERL_SRCDIR
+
$(makfile): Makefile.PL ../GIT-CFLAGS
'$(PERL_PATH_SQ)' $< PREFIX='$(prefix_SQ)'
endif
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 4168775..c136231 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -8,21 +8,31 @@ instlibdir:
MAKE_FRAG
}
-my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
+
+$src_prefix = "";
+if (defined ($ENV{PERL_SRCDIR})) {
+ $src_prefix = "$ENV{PERL_SRCDIR}/"
+}
+
+
+my %pm = ("$src_prefix/Git.pm" => '$(INST_LIBDIR)/Git.pm');
+
+
# We come with our own bundled Error.pm. It's not in the set of default
# Perl modules so install it if it's not available on the system yet.
eval { require Error };
if ($@) {
- $pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';
+ $pm{"$src_prefix/private-Error.pm"} = '$(INST_LIBDIR)/Error.pm';
}
my %extra;
$extra{DESTDIR} = $ENV{DESTDIR} if $ENV{DESTDIR};
+
WriteMakefile(
NAME => 'Git',
- VERSION_FROM => 'Git.pm',
+ VERSION_FROM => "$src_prefix/Git.pm",
PM => \%pm,
MAKEFILE => 'perl.mak',
%extra
--
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] Allow building GIT in a different directory from the source directory
2006-12-11 13:56 Han-Wen Nienhuys
@ 2006-12-12 9:03 ` Junio C Hamano
2006-12-12 11:50 ` Han-Wen Nienhuys
0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2006-12-12 9:03 UTC (permalink / raw)
To: hanwen; +Cc: git
Han-Wen Nienhuys <hanwen@xs4all.nl> writes:
> GIT can now be built in a separate builddirectory. This is done as
> follows:
>
> mkdir build
> cd build
> $my_git_dir/configure
> make
Somehow making this depend on the use of configure feels wrong,
since we tried to keep that config.mak.gen built by configure
strictly optional. In other words, I think the result of your
patch should be buildable with or without ./configure in a
separate directory if we are going to do this.
Care to explain why it is too cumbersome to handle without
./configure magic?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Allow building GIT in a different directory from the source directory
2006-12-12 9:03 ` Junio C Hamano
@ 2006-12-12 11:50 ` Han-Wen Nienhuys
2006-12-12 18:55 ` Johannes Schindelin
0 siblings, 1 reply; 9+ messages in thread
From: Han-Wen Nienhuys @ 2006-12-12 11:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano escreveu:
> Han-Wen Nienhuys <hanwen@xs4all.nl> writes:
>
>> GIT can now be built in a separate builddirectory. This is done as
>> follows:
>>
>> mkdir build
>> cd build
>> $my_git_dir/configure
>> make
>
> Somehow making this depend on the use of configure feels wrong,
> since we tried to keep that config.mak.gen built by configure
> strictly optional. In other words, I think the result of your
> patch should be buildable with or without ./configure in a
> separate directory if we are going to do this.
>
> Care to explain why it is too cumbersome to handle without
> ./configure magic?
I already tried to explain in a previous thread on the list.
See
http://article.gmane.org/gmane.comp.version-control.git/33487
you can still build git in the same directory as source
without using autoconf, and plain make.
If you insist, I can create a separate
setup-builddir.sh
to setup the build directory; according to the principle of least
surprise, it should happen in the configure script though.
I still don't understand the problem with autoconf; there are already
plenty of baroque shell scripts in GIT. I hate writing m4 macros as
well, but that's not a problem for GIT users (ie. people who compile
GIT).
For them,
./configure ; make ; make check ; make install
is actually the standard way to compile stuff.
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Allow building GIT in a different directory from the source directory
2006-12-12 11:50 ` Han-Wen Nienhuys
@ 2006-12-12 18:55 ` Johannes Schindelin
2006-12-13 9:28 ` Andreas Ericsson
0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2006-12-12 18:55 UTC (permalink / raw)
To: Han-Wen Nienhuys; +Cc: Junio C Hamano, git
Hi,
On Tue, 12 Dec 2006, Han-Wen Nienhuys wrote:
> I still don't understand the problem with autoconf; there are already
> plenty of baroque shell scripts in GIT. I hate writing m4 macros as
> well, but that's not a problem for GIT users (ie. people who compile
> GIT).
That, together with the complexity of GIT_EXEC_DIR and path mangling
problems, makes me take every opportunity to suggest we should build in
most if not all of Git into the "git wrapper".
Granted, without completion scripts, the "git-" convention was nice.
Granted, with bash, Perl and even Python, you can rapidly prototype your
thoughts (even if I often miss the power of C there).
But in the end, I'd say it makes lots of sense to have everything in one
executable.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Allow building GIT in a different directory from the source directory
2006-12-12 18:55 ` Johannes Schindelin
@ 2006-12-13 9:28 ` Andreas Ericsson
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Ericsson @ 2006-12-13 9:28 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Han-Wen Nienhuys, Junio C Hamano, git
Johannes Schindelin wrote:
> Hi,
>
> On Tue, 12 Dec 2006, Han-Wen Nienhuys wrote:
>
>> I still don't understand the problem with autoconf; there are already
>> plenty of baroque shell scripts in GIT. I hate writing m4 macros as
>> well, but that's not a problem for GIT users (ie. people who compile
>> GIT).
>
> That, together with the complexity of GIT_EXEC_DIR and path mangling
> problems, makes me take every opportunity to suggest we should build in
> most if not all of Git into the "git wrapper".
>
> Granted, without completion scripts, the "git-" convention was nice.
>
> Granted, with bash, Perl and even Python, you can rapidly prototype your
> thoughts (even if I often miss the power of C there).
>
We could still allow that by simply not removing the "run this external
program" code from the git wrapper even if we make all default commands
built-ins. Pluggable git, just as it is today, and when something turns
out to be useful, feature-complete and stable enough "someone" will
hopefully hop in to make it a built-in.
> But in the end, I'd say it makes lots of sense to have everything in one
> executable.
>
Yup. Not least for portability issues. The lack of a native windows
client has already made us lose at least one major "customer", and afaiu
it was *only* the lack of a native windows client that caused this, so
obviously it's a big issue for big cross-platform projects.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-12-13 9:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-08 17:15 [PATCH] Allow building GIT in a different directory from the source directory Han-Wen Nienhuys
2006-12-08 17:44 ` Jakub Narebski
2006-12-08 18:14 ` Han-Wen Nienhuys
2006-12-09 1:16 ` Alex Riesen
-- strict thread matches above, loose matches on Subject: below --
2006-12-11 13:56 Han-Wen Nienhuys
2006-12-12 9:03 ` Junio C Hamano
2006-12-12 11:50 ` Han-Wen Nienhuys
2006-12-12 18:55 ` Johannes Schindelin
2006-12-13 9:28 ` Andreas Ericsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).