git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael <barra_cuda@katamail.com>
To: git@vger.kernel.org
Subject: Error.pm: add configuration variable in Makefile
Date: Fri, 16 Feb 2007 22:00:15 +0100	[thread overview]
Message-ID: <200702162200.15241.barra_cuda@katamail.com> (raw)

When compiling, we check in perl/Makefile.PL if Error.pm is available. If not, 
we use our Error.pm instead. So, after a "make install" the system does have 
an Error.pm. This is fine, unless we are used to create an 
rpm/deb/whatever-it-is by ourselves and install it with the system's package 
manager: in this case, in fact, the git package we are building will have an 
Error.pm only if the package currently installed does not. Of course, once we 
install the new package, the next one won't ship Error.pm because 
perl/Makefile.PL thinks it doesn't need to; but that's obviously wrong, since 
the package manager will delete the old Error.pm when installing the new git 
package.

I guess we should use at least a configuration variable
(USE_PRIVATE_ERROR_PERL?) to let the user decide what to do: either force
the use of Error.pm shipped with git or just go on as we do today.

Something like the following, but less ugly...

---
diff --git a/Makefile b/Makefile
index 40bdcff..ff886df 100644
--- a/Makefile
+++ b/Makefile
@@ -101,6 +101,9 @@ all::
 # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
 # MakeMaker (e.g. using ActiveState under Cygwin).
 #
+# Define USE_PRIVATE_ERROR_PERL if you want to force the use of
+# perl/private-Error.pm (e.g. for packaging purposes).
+#
 
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -580,6 +583,9 @@ endif
 ifdef NO_PERL_MAKEMAKER
 	export NO_PERL_MAKEMAKER
 endif
+ifdef USE_PRIVATE_ERROR_PERL
+	export USE_PRIVATE_ERROR_PERL
+endif
 
 # Shell quote (do not use $(call) to accommodate ancient setups);
 
diff --git a/perl/Makefile b/perl/Makefile
index 099beda..84b16f9 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -27,6 +27,9 @@ $(makfile): ../GIT-CFLAGS Makefile
 	cp private-Error.pm $(instdir_SQ)/Error.pm' >> $@
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
+else ifdef USE_PRIVATE_ERROR_PERL
+$(makfile): Makefile.PL ../GIT-CFLAGS
+	'$(PERL_PATH_SQ)' $< useerror PREFIX='$(prefix_SQ)'
 else
 $(makfile): Makefile.PL ../GIT-CFLAGS
 	'$(PERL_PATH_SQ)' $< PREFIX='$(prefix_SQ)'
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 9b117fd..f11affc 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -13,7 +13,7 @@ my %pm = ('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 ($@) {
+if ($@ || $ARGV[0] eq 'useerror') {
 	$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';
 }
 

             reply	other threads:[~2007-02-16 20:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16 21:00 Michael [this message]
2007-02-16 21:18 ` Error.pm: add configuration variable in Makefile Junio C Hamano
2007-02-17 14:38 ` Sergio Callegari
2007-02-18  8:45   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200702162200.15241.barra_cuda@katamail.com \
    --to=barra_cuda@katamail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).