threads / patch / 4790

patchFix compilation

Subject: [PATCH] Fix compilation

## tl;dr

4 messages between Jul 6, 2006 and Jul 8, 2006. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Johannes Schindelin· Jul 6, 2006, 23:21 UTC · lore
Without this, make 3.79.1 (Darwin) says
rm -f git-archimport git-archimport+
INSTLIBDIR=`make -C perl -s --no-print-directory instlibdir` && \
sed -e '1s|#!.*perl|#!/usr/bin/perl|1' \
    -e '2i\
        use lib (split(/:/, $ENV{GITPERLLIB} || '\'"$INSTLIBDIR"\''));' \
    -e 's|@@INSTLIBDIR@@|'"$INSTLIBDIR"'|g' \
    -e 's/@@GIT_VERSION@@/1.4.1.gb564-dirty/g' \
    git-archimport.perl >git-archimport+
sed: 1: "2i use lib (split(/:/,  ...": command i expects \ followed by text
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	Note that this just fixes compilation, not the tests. All of
	a sudden, I have to install Scalar::Util, where things were
	fine before Git.pm.
	Note also, that this patch relies on the perl scripts not
	caring if an additional command is shifted into the 2nd line.
	I checked all of them, and they don't.
 Makefile |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Show changes to Makefile +1 −2
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -563,8 +563,7 @@ common-cmds.h: Documentation/git-*.txt
 	rm -f $@ $@+
 	INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
 	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|1' \
-	    -e '2i\
-	        use lib (split(/:/, $$ENV{GITPERLLIB} || '\'"$$INSTLIBDIR"\''));' \
+	    -e "2s=^=use lib (split(/:/, \$$ENV{GITPERLLIB} || \'$$INSTLIBDIR\')); =g" \
 	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.perl >$@+
Junio C Hamano· Jul 7, 2006, 00:15 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Fix compilation

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 13 quoted lines
> Without this, make 3.79.1 (Darwin) says
>
> rm -f git-archimport git-archimport+
> INSTLIBDIR=`make -C perl -s --no-print-directory instlibdir` && \
> sed -e '1s|#!.*perl|#!/usr/bin/perl|1' \
>     -e '2i\
>         use lib (split(/:/, $ENV{GITPERLLIB} || '\'"$INSTLIBDIR"\''));' \
>     -e 's|@@INSTLIBDIR@@|'"$INSTLIBDIR"'|g' \
>     -e 's/@@GIT_VERSION@@/1.4.1.gb564-dirty/g' \
>     git-archimport.perl >git-archimport+
> sed: 1: "2i use lib (split(/:/,  ...": command i expects \ followed by text
>
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

Traditionally 'i' and 'a' command to sed has been unfriendly with make, primarily because different make implementations did unexpected things to backslashes at the end of lines.

For portability I would even suggest making that command into a separate helper shell script, and call that from the Makefile.

> 	Note that this just fixes compilation, not the tests. All of
> 	a sudden, I have to install Scalar::Util, where things were
> 	fine before Git.pm.

I recall Pasky talking about Scalar::Util removal and I thought I took a patch.

 ... goes "git grep" ...
Ah the private edition of Error.pm pulls that in.  Sheesh.
Junio C Hamano· Jul 7, 2006, 20:02 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Fix compilation

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 	Note also, that this patch relies on the perl scripts not
> 	caring if an additional command is shifted into the 2nd line.
How about doing something like this instead, then?
Show changes to Makefile +7 −3
diff --git a/Makefile b/Makefile
index 71657ec..01b9a94 100644
--- a/Makefile
+++ b/Makefile
@@ -550,9 +550,13 @@ common-cmds.h: Documentation/git-*.txt
 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 	rm -f $@ $@+
 	INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|1' \
-	    -e '2i\
-	        use lib (split(/:/, $$ENV{GITPERLLIB} || '\'"$$INSTLIBDIR"\''));' \
+	sed -e '1{' \
+	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	    -e '	h' \
+	    -e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
+	    -e '	H' \
+	    -e '	x' \
+	    -e '}' \
 	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.perl >$@+
Johannes Schindelin· Jul 8, 2006, 02:04 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix compilation

Hi,
On Fri, 7 Jul 2006, Junio C Hamano wrote:
Show 6 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > 	Note also, that this patch relies on the perl scripts not
> > 	caring if an additional command is shifted into the 2nd line.
> 
> How about doing something like this instead, then?

I will try as soon as possible. ATM my iBook is in my car, which I had to leave at a friend's place, because said friend sensibly refused to let me drive.

Ciao, Dscho

← back to recent threads