* [PATCH] Git.pm: Support for perl/ being built by a different compiler
@ 2006-06-25  1:47 Petr Baudis
  2006-06-25  3:14 ` Junio C Hamano
  0 siblings, 1 reply; 19+ messages in thread
From: Petr Baudis @ 2006-06-25  1:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
dst_ on #git reported that on Solaris 9, Perl was built by Sun CC
and perl/ is therefore being built with it as well, while the rest
of Git is built with gcc. The problem (the first one visible, anyway)
is that we passed perl/ even various gcc-specific options. This
separates those to a special variable.
This is not really meant for an application yet since it's not clear
if it will alone help anything.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
 Makefile |   66 ++++++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 38 insertions(+), 28 deletions(-)
diff --git a/Makefile b/Makefile
index 4f0a501..6755f26 100644
--- a/Makefile
+++ b/Makefile
@@ -115,6 +115,11 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powe
 
 ### --- END CONFIGURATION SECTION ---
 
+# Those must not be GNU-specific; they are shared with perl/ which may
+# be built by a different compiler.
+BASIC_CFLAGS =
+BASIC_LDFLAGS =
+
 SCRIPT_SH = \
 	git-bisect.sh git-branch.sh git-checkout.sh \
 	git-cherry.sh git-clean.sh git-clone.sh git-commit.sh \
@@ -249,13 +254,13 @@ ifeq ($(uname_S),Darwin)
 	NEEDS_LIBICONV = YesPlease
 	## fink
 	ifeq ($(shell test -d /sw/lib && echo y),y)
-		ALL_CFLAGS += -I/sw/include
-		ALL_LDFLAGS += -L/sw/lib
+		BASIC_CFLAGS += -I/sw/include
+		BASIC_LDFLAGS += -L/sw/lib
 	endif
 	## darwinports
 	ifeq ($(shell test -d /opt/local/lib && echo y),y)
-		ALL_CFLAGS += -I/opt/local/include
-		ALL_LDFLAGS += -L/opt/local/lib
+		BASIC_CFLAGS += -I/opt/local/include
+		BASIC_LDFLAGS += -L/opt/local/lib
 	endif
 endif
 ifeq ($(uname_S),SunOS)
@@ -274,7 +279,7 @@ ifeq ($(uname_S),SunOS)
 	endif
 	INSTALL = ginstall
 	TAR = gtar
-	ALL_CFLAGS += -D__EXTENSIONS__
+	BASIC_CFLAGS += -D__EXTENSIONS__
 endif
 ifeq ($(uname_O),Cygwin)
 	NO_D_TYPE_IN_DIRENT = YesPlease
@@ -291,21 +296,22 @@ ifeq ($(uname_O),Cygwin)
 endif
 ifeq ($(uname_S),FreeBSD)
 	NEEDS_LIBICONV = YesPlease
-	ALL_CFLAGS += -I/usr/local/include
-	ALL_LDFLAGS += -L/usr/local/lib
+	BASIC_CFLAGS += -I/usr/local/include
+	BASIC_LDFLAGS += -L/usr/local/lib
 endif
 ifeq ($(uname_S),OpenBSD)
 	NO_STRCASESTR = YesPlease
 	NEEDS_LIBICONV = YesPlease
-	ALL_CFLAGS += -I/usr/local/include
-	ALL_LDFLAGS += -L/usr/local/lib
+	BASIC_CFLAGS += -I/usr/local/include
+	BASIC_LDFLAGS += -L/usr/local/lib
 endif
 ifeq ($(uname_S),NetBSD)
 	ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
 		NEEDS_LIBICONV = YesPlease
 	endif
-	ALL_CFLAGS += -I/usr/pkg/include
-	ALL_LDFLAGS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
+	BASIC_CFLAGS += -I/usr/pkg/include
+	BASIC_LDFLAGS += -L/usr/pkg/lib
+	ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib
 endif
 ifeq ($(uname_S),AIX)
 	NO_STRCASESTR=YesPlease
@@ -317,9 +323,9 @@ ifeq ($(uname_S),IRIX64)
 	NO_STRCASESTR=YesPlease
 	NO_SOCKADDR_STORAGE=YesPlease
 	SHELL_PATH=/usr/gnu/bin/bash
-	ALL_CFLAGS += -DPATH_MAX=1024
+	BASIC_CFLAGS += -DPATH_MAX=1024
 	# for now, build 32-bit version
-	ALL_LDFLAGS += -L/usr/lib32
+	BASIC_LDFLAGS += -L/usr/lib32
 endif
 ifneq (,$(findstring arm,$(uname_M)))
 	ARM_SHA1 = YesPlease
@@ -340,7 +346,7 @@ endif
 ifndef NO_CURL
 	ifdef CURLDIR
 		# This is still problematic -- gcc does not always want -R.
-		ALL_CFLAGS += -I$(CURLDIR)/include
+		BASIC_CFLAGS += -I$(CURLDIR)/include
 		CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl
 	else
 		CURL_LIBCURL = -lcurl
@@ -361,13 +367,13 @@ ifndef NO_OPENSSL
 	OPENSSL_LIBSSL = -lssl
 	ifdef OPENSSLDIR
 		# Again this may be problematic -- gcc does not always want -R.
-		ALL_CFLAGS += -I$(OPENSSLDIR)/include
+		BASIC_CFLAGS += -I$(OPENSSLDIR)/include
 		OPENSSL_LINK = -L$(OPENSSLDIR)/lib -R$(OPENSSLDIR)/lib
 	else
 		OPENSSL_LINK =
 	endif
 else
-	ALL_CFLAGS += -DNO_OPENSSL
+	BASIC_CFLAGS += -DNO_OPENSSL
 	MOZILLA_SHA1 = 1
 	OPENSSL_LIBSSL =
 endif
@@ -379,7 +385,7 @@ endif
 ifdef NEEDS_LIBICONV
 	ifdef ICONVDIR
 		# Again this may be problematic -- gcc does not always want -R.
-		ALL_CFLAGS += -I$(ICONVDIR)/include
+		BASIC_CFLAGS += -I$(ICONVDIR)/include
 		ICONV_LINK = -L$(ICONVDIR)/lib -R$(ICONVDIR)/lib
 	else
 		ICONV_LINK =
@@ -395,13 +401,13 @@ ifdef NEEDS_NSL
 	SIMPLE_LIB += -lnsl
 endif
 ifdef NO_D_TYPE_IN_DIRENT
-	ALL_CFLAGS += -DNO_D_TYPE_IN_DIRENT
+	BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
 endif
 ifdef NO_D_INO_IN_DIRENT
-	ALL_CFLAGS += -DNO_D_INO_IN_DIRENT
+	BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
 endif
 ifdef NO_SYMLINK_HEAD
-	ALL_CFLAGS += -DNO_SYMLINK_HEAD
+	BASIC_CFLAGS += -DNO_SYMLINK_HEAD
 endif
 ifdef NO_STRCASESTR
 	COMPAT_CFLAGS += -DNO_STRCASESTR
@@ -420,13 +426,13 @@ ifdef NO_MMAP
 	COMPAT_OBJS += compat/mmap.o
 endif
 ifdef NO_IPV6
-	ALL_CFLAGS += -DNO_IPV6
+	BASIC_CFLAGS += -DNO_IPV6
 endif
 ifdef NO_SOCKADDR_STORAGE
 ifdef NO_IPV6
-	ALL_CFLAGS += -Dsockaddr_storage=sockaddr_in
+	BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
 else
-	ALL_CFLAGS += -Dsockaddr_storage=sockaddr_in6
+	BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
 endif
 endif
 ifdef NO_INET_NTOP
@@ -434,7 +440,7 @@ ifdef NO_INET_NTOP
 endif
 
 ifdef NO_ICONV
-	ALL_CFLAGS += -DNO_ICONV
+	BASIC_CFLAGS += -DNO_ICONV
 endif
 
 ifdef PPC_SHA1
@@ -458,7 +464,7 @@ ifdef USE_PIC
 	ALL_CFLAGS += -fPIC
 endif
 ifdef NO_ACCURATE_DIFF
-	ALL_CFLAGS += -DNO_ACCURATE_DIFF
+	BASIC_CFLAGS += -DNO_ACCURATE_DIFF
 endif
 
 # Shell quote (do not use $(call) to accomodate ancient setups);
@@ -478,8 +484,12 @@ GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT
 
 LIBS = $(GITLIBS) $(EXTLIBS)
 
-ALL_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS)
+BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS)
 LIB_OBJS += $(COMPAT_OBJS)
+
+ALL_CFLAGS += $(BASIC_CFLAGS)
+ALL_LDFLAGS += $(BASIC_LDFLAGS)
+
 export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
 
 
@@ -608,9 +618,9 @@ XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare
 	rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
 
-PERL_DEFINE = $(ALL_CFLAGS) -DGIT_VERSION='"$(GIT_VERSION)"'
+PERL_DEFINE = $(BASIC_CFLAGS) -DGIT_VERSION='"$(GIT_VERSION)"'
 PERL_DEFINE_SQ = $(subst ','\'',$(PERL_DEFINE))
-PERL_LIBS = $(EXTLIBS)
+PERL_LIBS = $(BASIC_LDFLAGS) $(EXTLIBS)
 PERL_LIBS_SQ = $(subst ','\'',$(PERL_LIBS))
 perl/Makefile:	perl/Git.pm perl/Makefile.PL GIT-CFLAGS
 	(cd perl && $(PERL_PATH) Makefile.PL \
^ permalink raw reply related	[flat|nested] 19+ messages in thread
* Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler
  2006-06-25  1:47 [PATCH] Git.pm: Support for perl/ being built by a different compiler Petr Baudis
@ 2006-06-25  3:14 ` Junio C Hamano
  2006-06-25 15:27   ` Petr Baudis
  2006-06-26  8:24   ` Dennis Stosberg
  0 siblings, 2 replies; 19+ messages in thread
From: Junio C Hamano @ 2006-06-25  3:14 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git
Petr Baudis <pasky@suse.cz> writes:
> dst_ on #git reported that on Solaris 9, Perl was built by Sun CC
> and perl/ is therefore being built with it as well, while the rest
> of Git is built with gcc. The problem (the first one visible, anyway)
> is that we passed perl/ even various gcc-specific options. This
> separates those to a special variable.
>
> This is not really meant for an application yet since it's not clear
> if it will alone help anything.
Do things link and work fine if we do not have the GCC specific
options?
I would question why the rest of git is not built with Sun CC as
well if that is the case.
^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler
  2006-06-25  3:14 ` Junio C Hamano
@ 2006-06-25 15:27   ` Petr Baudis
  2006-06-26  8:24   ` Dennis Stosberg
  1 sibling, 0 replies; 19+ messages in thread
From: Petr Baudis @ 2006-06-25 15:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
Dear diary, on Sun, Jun 25, 2006 at 05:14:09AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
> > This is not really meant for an application yet since it's not clear
> > if it will alone help anything.
It appears that it did have helped and all went well, according to dst_.
> I would question why the rest of git is not built with Sun CC as
> well if that is the case.
< dst_> Three points: (1) Gcc comes along with solaris, sun cc not.
< dst_> (2) Git used a lot of GCC'isms whan I last checked a few weeks ago
< dst_> (3) a lot of other software will not ompile out of the box with suncc, so gcc is usually the safer choice
Of course (1) is troublesome since this means you can't build Git on
Solaris without installing Sun CC - I have no other answer to this than
that Solaris is horribly broken. :-( Perhaps ExtUtils::MakeMaker could
be convinced to build with gcc, I'm not sure.
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.
^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler
  2006-06-25  3:14 ` Junio C Hamano
  2006-06-25 15:27   ` Petr Baudis
@ 2006-06-26  8:24   ` Dennis Stosberg
  2006-06-26  8:26     ` [PATCH] Solaris needs inclusion of signal.h for signal() Dennis Stosberg
                       ` (4 more replies)
  1 sibling, 5 replies; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26  8:24 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git
Junio C Hamano wrote:
> Do things link and work fine if we do not have the GCC specific
> options?
Yes, with this patch I can compile Git with GCC while the Perl module
gets built with Sun CC.  The result even works.
If the git commands written in Perl will be converted to use Git.pm,
Sun CC will become a new dependency for Git on Solaris, unless
people build a separate Perl with GCC or manually edit the generated
Makefile in the perl subdir to build the module with GCC.
> I would question why the rest of git is not built with Sun CC as
> well if that is the case.
Well, GCC comes along with Solaris on the CDs while Sun CC is a
separate product.  And usually it's easier to build free software
with GCC, because many projects use GCC extensions.  Often GCC is
the only compiler installed on Solaris machines.
Until the patch series from Florian Forster removed a lot of GCC'isms
a few days ago it was not possible to build Git with Sun CC.
Yesterday I could build the next branch with Sun CC 5.8 with a few
trivial changes.  I will send four patches in reply to this mail.
Junio, please consider the first two patches for inclusion into the
next branch.  The third patch is on top of Pasky's changes in the pu
branch.  The fourth patch is a strange workaround for a strange
problem of which I think it is an error in Sun's compiler.  That one
should not make its way into Git, but maybe someone on the list has
an idea about the problem.
Regards,
Dennis
^ permalink raw reply	[flat|nested] 19+ messages in thread
* [PATCH] Solaris needs inclusion of signal.h for signal()
  2006-06-26  8:24   ` Dennis Stosberg
@ 2006-06-26  8:26     ` Dennis Stosberg
  2006-06-26  8:27     ` [PATCH] Fix pkt-line.h to compile with a non-GCC compiler Dennis Stosberg
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26  8:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git
Currently the compilation fails in connect.c and merge-index.c
---
 connect.c     |    1 +
 merge-index.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/connect.c b/connect.c
index db7342e..66e78a2 100644
--- a/connect.c
+++ b/connect.c
@@ -8,6 +8,7 @@ #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#include <signal.h>
 
 static char *server_capabilities = NULL;
 
diff --git a/merge-index.c b/merge-index.c
index 190e12f..0498a6f 100644
--- a/merge-index.c
+++ b/merge-index.c
@@ -1,5 +1,6 @@
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <signal.h>
 
 #include "cache.h"
 
-- 
1.4.0.g64e8
^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [PATCH] Fix pkt-line.h to compile with a non-GCC compiler
  2006-06-26  8:24   ` Dennis Stosberg
  2006-06-26  8:26     ` [PATCH] Solaris needs inclusion of signal.h for signal() Dennis Stosberg
@ 2006-06-26  8:27     ` Dennis Stosberg
  2006-06-26  8:27     ` [PATCH] "test" in Solaris' /bin/sh does not support -e Dennis Stosberg
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26  8:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git
pkt-line.h uses GCC's __attribute__ extension but does not include
git-compat-util.h.  So it will not compile with a compiler that does
not support this extension.
---
 pkt-line.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/pkt-line.h b/pkt-line.h
index 9abef24..9df653f 100644
--- a/pkt-line.h
+++ b/pkt-line.h
@@ -1,6 +1,8 @@
 #ifndef PKTLINE_H
 #define PKTLINE_H
 
+#include "git-compat-util.h"
+
 /*
  * Silly packetized line writing interface
  */
-- 
1.4.0.g64e8
^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [PATCH] "test" in Solaris' /bin/sh does not support -e
  2006-06-26  8:24   ` Dennis Stosberg
  2006-06-26  8:26     ` [PATCH] Solaris needs inclusion of signal.h for signal() Dennis Stosberg
  2006-06-26  8:27     ` [PATCH] Fix pkt-line.h to compile with a non-GCC compiler Dennis Stosberg
@ 2006-06-26  8:27     ` Dennis Stosberg
  2006-06-26  9:19       ` Junio C Hamano
  2006-06-26  8:29     ` [PATCH] Git.pm: Support for perl/ being built by a different compiler Dennis Stosberg
  2006-06-26  9:26     ` Junio C Hamano
  4 siblings, 1 reply; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26  8:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git
Running "make clean" currently fails:
  [ ! -e perl/Makefile ] || make -C perl/ clean
  /bin/sh: test: argument expected
  make: *** [clean] Error 1
---
Pasky said in #git that a simple -f test would suffice.
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 3dc54fe..d41d224 100644
--- a/Makefile
+++ b/Makefile
@@ -761,7 +761,7 @@ clean:
 	rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 	rm -f $(htmldocs).tar.gz $(manpages).tar.gz
 	$(MAKE) -C Documentation/ clean
-	[ ! -e perl/Makefile ] || $(MAKE) -C perl/ clean || $(MAKE) -C perl/ clean
+	[ ! -f perl/Makefile ] || $(MAKE) -C perl/ clean || $(MAKE) -C perl/ clean
 	$(MAKE) -C templates/ clean
 	$(MAKE) -C t/ clean
 	rm -f GIT-VERSION-FILE GIT-CFLAGS
--
1.4.0
^ permalink raw reply related	[flat|nested] 19+ messages in thread
* Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler
  2006-06-26  8:24   ` Dennis Stosberg
                       ` (2 preceding siblings ...)
  2006-06-26  8:27     ` [PATCH] "test" in Solaris' /bin/sh does not support -e Dennis Stosberg
@ 2006-06-26  8:29     ` Dennis Stosberg
  2006-06-26  8:51       ` Thomas Glanzmann
  2006-06-26  9:26     ` Junio C Hamano
  4 siblings, 1 reply; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26  8:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git
Sun CC 5.8 fails with a strange error compiling diff-delta.c that
looks like an error in Sun's compiler to me:
$ cc -V
cc: Sun C 5.8 Patch 121015-02 2006/03/29
$ cc -o diff-delta.o -c -I/opt/gnu/include -D__EXTENSIONS__ \
-DSHA1_HEADER='<openssl/sha.h>' -DNO_STRCASESTR -DNO_STRLCPY \
-DNO_SETENV -DNO_UNSETENV diff-delta.c
"diff-delta.c", line 251: identifier redeclared: create_delta
        current : function(pointer to const struct delta_index \
{pointer to const void src_buf, unsigned long src_size, \
unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash},\
pointer to const void, unsigned long, pointer to unsigned long, \
unsigned long) returning pointer to void
        previous: function(pointer to const struct delta_index \
{pointer to const void src_buf, unsigned long src_size, \
unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash},\
pointer to const void, unsigned long, pointer to unsigned long, \
unsigned long) returning pointer to void : "delta.h", line 37
cc: acomp failed for diff-delta.c
make: *** [diff-delta.o] Error 2
Yes, the two prototypes are identical.  Seems like the compiler has
problems with the opaque struct.  When I played around with it, I
was surprised when I found that Sun CC actually compiled this file
after I removed the const qualifier from the first parameter of the
create_delta() function.  Does anybody have a better explanation
than an error in the compiler?
Regards,
Dennis
diff --git a/delta.h b/delta.h
index 7b3f86d..ec9147c 100644
--- a/delta.h
+++ b/delta.h
@@ -34,11 +34,12 @@ extern void free_delta_index(struct delt
  * must be freed by the caller.
  */
 extern void *
-create_delta(const struct delta_index *index,
+create_delta(struct delta_index *index,
             const void *buf, unsigned long bufsize,
             unsigned long *delta_size, unsigned long max_delta_size);
-/*
+/*l
+
  * diff_delta: create a delta from source buffer to target buffer
  *
  * If max_delta_size is non-zero and the resulting delta is to be larger
diff --git a/diff-delta.c b/diff-delta.c
index 8b9172a..802be76 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -245,7 +245,7 @@ void free_delta_index(struct delta_index
 #define MAX_OP_SIZE    (5 + 5 + 1 + RABIN_WINDOW + 7)
 void *
-create_delta(const struct delta_index *index,
+create_delta(struct delta_index *index,
             const void *trg_buf, unsigned long trg_size,
             unsigned long *delta_size, unsigned long max_size)
 {
^ permalink raw reply related	[flat|nested] 19+ messages in thread
* Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler
  2006-06-26  8:29     ` [PATCH] Git.pm: Support for perl/ being built by a different compiler Dennis Stosberg
@ 2006-06-26  8:51       ` Thomas Glanzmann
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Glanzmann @ 2006-06-26  8:51 UTC (permalink / raw)
  To: Dennis Stosberg; +Cc: Junio C Hamano, Petr Baudis, git
Hello,
> -/*
> +/*l
> +
this looks like a typo in your patch.
        Thomas
^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] "test" in Solaris' /bin/sh does not support -e
  2006-06-26  8:27     ` [PATCH] "test" in Solaris' /bin/sh does not support -e Dennis Stosberg
@ 2006-06-26  9:19       ` Junio C Hamano
  2006-06-26  9:42         ` Dennis Stosberg
  0 siblings, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2006-06-26  9:19 UTC (permalink / raw)
  To: Dennis Stosberg; +Cc: Petr Baudis, git
Dennis Stosberg <dennis@stosberg.net> writes:
> Running "make clean" currently fails:
>   [ ! -e perl/Makefile ] || make -C perl/ clean
>   /bin/sh: test: argument expected
>   make: *** [clean] Error 1
Ah, _BAD_.  We seem to have the same in git-branch, git-checkout,
git-clone and git-tag.  You would probably need this on top of
"master".
-- >8 --
shell scripts: Avoid non-portable "test -e" where possible.
---
diff --git a/git-branch.sh b/git-branch.sh
index e0501ec..76971be 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -112,7 +112,7 @@ rev=$(git-rev-parse --verify "$head") ||
 git-check-ref-format "heads/$branchname" ||
 	die "we do not like '$branchname' as a branch name."
 
-if [ -e "$GIT_DIR/refs/heads/$branchname" ]
+if test -f "$GIT_DIR/refs/heads/$branchname"
 then
 	if test '' = "$force"
 	then
@@ -124,7 +124,7 @@ then
 fi
 if test "$create_log" = 'yes'
 then
-	mkdir -p $(dirname "$GIT_DIR/logs/refs/heads/$branchname")
+	mkdir -p "$(dirname "$GIT_DIR/logs/refs/heads/$branchname")"
 	touch "$GIT_DIR/logs/refs/heads/$branchname"
 fi
 git update-ref -m "branch: Created from $head" "refs/heads/$branchname" $rev
diff --git a/git-checkout.sh b/git-checkout.sh
index 77c2593..bfc2640 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -22,7 +22,7 @@ while [ "$#" != "0" ]; do
 		shift
 		[ -z "$newbranch" ] &&
 			die "git checkout: -b needs a branch name"
-		[ -e "$GIT_DIR/refs/heads/$newbranch" ] &&
+		[ -f "$GIT_DIR/refs/heads/$newbranch" ] &&
 			die "git checkout: branch $newbranch already exists"
 		git-check-ref-format "heads/$newbranch" ||
 			die "git checkout: we do not like '$newbranch' as a branch name."
diff --git a/git-clone.sh b/git-clone.sh
index 6fa0daa..b355441 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -202,7 +202,7 @@ fi
 dir="$2"
 # Try using "humanish" part of source repo if user didn't specify one
 [ -z "$dir" ] && dir=$(echo "$repo" | sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
-[ -e "$dir" ] && echo "$dir already exists." && usage
+[ -d "$dir" ] && echo "$dir already exists." && usage
 mkdir -p "$dir" &&
 D=$(cd "$dir" && pwd) &&
 trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0
diff --git a/git-tag.sh b/git-tag.sh
index a0afa25..6118b00 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -63,7 +63,7 @@ done
 
 name="$1"
 [ "$name" ] || usage
-if [ -e "$GIT_DIR/refs/tags/$name" -a -z "$force" ]; then
+if [ -f "$GIT_DIR/refs/tags/$name" -a -z "$force" ]; then
     die "tag '$name' already exists"
 fi
 shift
^ permalink raw reply related	[flat|nested] 19+ messages in thread
* Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler
  2006-06-26  8:24   ` Dennis Stosberg
                       ` (3 preceding siblings ...)
  2006-06-26  8:29     ` [PATCH] Git.pm: Support for perl/ being built by a different compiler Dennis Stosberg
@ 2006-06-26  9:26     ` Junio C Hamano
  2006-06-26  9:32       ` Dennis Stosberg
  4 siblings, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2006-06-26  9:26 UTC (permalink / raw)
  To: Dennis Stosberg; +Cc: git
Dennis Stosberg <dennis@stosberg.net> writes:
> Yesterday I could build the next branch with Sun CC 5.8 with a few
> trivial changes.  I will send four patches in reply to this mail.
Thanks.  Next time around please sign off your patches.
^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler
  2006-06-26  9:26     ` Junio C Hamano
@ 2006-06-26  9:32       ` Dennis Stosberg
  0 siblings, 0 replies; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26  9:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> Dennis Stosberg <dennis@stosberg.net> writes:
> 
> > Yesterday I could build the next branch with Sun CC 5.8 with a few
> > trivial changes.  I will send four patches in reply to this mail.
> 
> Thanks.  Next time around please sign off your patches.
Sorry, I forgot and will do next time.  Please assume the Signed-Off
is present on the first three patches.
Regards,
Dennis
^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] "test" in Solaris' /bin/sh does not support -e
  2006-06-26  9:19       ` Junio C Hamano
@ 2006-06-26  9:42         ` Dennis Stosberg
  2006-06-26 10:04           ` Dennis Stosberg
  0 siblings, 1 reply; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26  9:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git
Junio C Hamano wrote:
> Dennis Stosberg <dennis@stosberg.net> writes:
> 
> > Running "make clean" currently fails:
> >   [ ! -e perl/Makefile ] || make -C perl/ clean
> >   /bin/sh: test: argument expected
> >   make: *** [clean] Error 1
> 
> Ah, _BAD_.  We seem to have the same in git-branch, git-checkout,
> git-clone and git-tag.  You would probably need this on top of
> "master".
The SHELL_PATH in the Makefile is being set to "/bin/bash" on
Solaris, so there is currently no problem with those.
A lot of bashisms have been removed from the shell scripts since
that SHELL_PATH override was added in September 2005; I will have a
look whether it's still necessary.
Regards,
Dennis
^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] "test" in Solaris' /bin/sh does not support -e
  2006-06-26  9:42         ` Dennis Stosberg
@ 2006-06-26 10:04           ` Dennis Stosberg
  2006-06-26 17:03             ` Junio C Hamano
  0 siblings, 1 reply; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26 10:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git
Dennis Stosberg wrote:
> A lot of bashisms have been removed from the shell scripts since
> that SHELL_PATH override was added in September 2005; I will have a
> look whether it's still necessary.
Solaris is really horrible sometimes.  "/bin/sh" is linked to
"/usr/bin/sh".  The manual sh(1) reads:
     The /usr/bin/sh utility is a  command  programming  language
     that executes commands read from a terminal or a file.
     The /usr/xpg4/bin/sh utility is a standards compliant shell.
Argh!  Why don't they put their "standards compliant" shell to
/bin/sh?  The current one doesn't even support the $( )-style command
substitution, so making the scripts run with that shell would be
_really_ ugly.
Regards,
Dennis
^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] "test" in Solaris' /bin/sh does not support -e
  2006-06-26 10:04           ` Dennis Stosberg
@ 2006-06-26 17:03             ` Junio C Hamano
  2006-06-26 22:21               ` [PATCH] Makefile fix for Solaris Dennis Stosberg
                                 ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Junio C Hamano @ 2006-06-26 17:03 UTC (permalink / raw)
  To: Dennis Stosberg; +Cc: git
Dennis Stosberg <dennis@stosberg.net> writes:
> Argh!  Why don't they put their "standards compliant" shell to
> /bin/sh?  The current one doesn't even support the $( )-style command
> substitution, so making the scripts run with that shell would be
> _really_ ugly.
Which means this in pb/gitpm topic needs further changes,
perhaps.
$ git grep -n '\$\$(' pb/gitpm:Makefile
pb/gitpm:Makefile:537:	INSTLIBDIR=$$(make -s -C perl instlibdir) && \
^ permalink raw reply	[flat|nested] 19+ messages in thread
* [PATCH] Makefile fix for Solaris
  2006-06-26 17:03             ` Junio C Hamano
@ 2006-06-26 22:21               ` Dennis Stosberg
  2006-06-26 22:23               ` [PATCH] Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdir Dennis Stosberg
  2006-06-26 22:25               ` [PATCH] "test" in Solaris' /bin/sh does not support -e Dennis Stosberg
  2 siblings, 0 replies; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26 22:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
Solaris' /bin/sh does not support $( )-style command substitution
Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index a326f6e..f44fbd3 100644
--- a/Makefile
+++ b/Makefile
@@ -544,7 +544,7 @@ common-cmds.h: Documentation/git-*.txt
 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile
 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 	rm -f $@ $@+
-	INSTLIBDIR=$$(make -s -C perl instlibdir) && \
+	INSTLIBDIR=`make -s -C perl instlibdir` && \
 	sed -e '1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1|' \
 	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-- 
1.4.1.rc1.g80bff-dirty
^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [PATCH] Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdir
  2006-06-26 17:03             ` Junio C Hamano
  2006-06-26 22:21               ` [PATCH] Makefile fix for Solaris Dennis Stosberg
@ 2006-06-26 22:23               ` Dennis Stosberg
  2006-07-01 22:59                 ` Petr Baudis
  2006-06-26 22:25               ` [PATCH] "test" in Solaris' /bin/sh does not support -e Dennis Stosberg
  2 siblings, 1 reply; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26 22:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 Makefile |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index f44fbd3..306025d 100644
--- a/Makefile
+++ b/Makefile
@@ -94,6 +94,8 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
+PERL_CFLAGS =
+PERL_LDFLAGS =
 STRIP ?= strip
 
 prefix = $(HOME)
@@ -119,8 +121,8 @@ ### --- END CONFIGURATION SECTION ---
 
 # Those must not be GNU-specific; they are shared with perl/ which may
 # be built by a different compiler.
-BASIC_CFLAGS =
-BASIC_LDFLAGS =
+BASIC_CFLAGS = $(PERL_CFLAGS)
+BASIC_LDFLAGS = $(PERL_LDFLAGS)
 
 SCRIPT_SH = \
 	git-bisect.sh git-branch.sh git-checkout.sh \
-- 
1.4.1.rc1.g80bff-dirty
^ permalink raw reply related	[flat|nested] 19+ messages in thread
* Re: [PATCH] "test" in Solaris' /bin/sh does not support -e
  2006-06-26 17:03             ` Junio C Hamano
  2006-06-26 22:21               ` [PATCH] Makefile fix for Solaris Dennis Stosberg
  2006-06-26 22:23               ` [PATCH] Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdir Dennis Stosberg
@ 2006-06-26 22:25               ` Dennis Stosberg
  2 siblings, 0 replies; 19+ messages in thread
From: Dennis Stosberg @ 2006-06-26 22:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> Which means this in pb/gitpm topic needs further changes,
> perhaps.
Indeed.
The second patch makes it possible to give additional CFLAGS and
LDFLAGS for compiling the perl module.  Otherwise the compiler may
not be able to find headers and libraries for curl, expat and
openssl.  This is needed on Solaris where these libraries will
usually be in paths like /usr/local or /opt/gnu.
With the patch Pasky started this thread with, the four patches I
sent earlier and these last two patches the pu branch compiles,
tests and installs cleanly on Solaris 9, both with Sun CC 5.8 and
GCC 4.1.1.
Regards,
Dennis
^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdir
  2006-06-26 22:23               ` [PATCH] Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdir Dennis Stosberg
@ 2006-07-01 22:59                 ` Petr Baudis
  0 siblings, 0 replies; 19+ messages in thread
From: Petr Baudis @ 2006-07-01 22:59 UTC (permalink / raw)
  To: Dennis Stosberg; +Cc: Junio C Hamano, git
Dear diary, on Tue, Jun 27, 2006 at 12:23:08AM CEST, I got a letter
where Dennis Stosberg <dennis@stosberg.net> said that...
> Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
> ---
>  Makefile |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index f44fbd3..306025d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -94,6 +94,8 @@ CFLAGS = -g -O2 -Wall
>  LDFLAGS =
>  ALL_CFLAGS = $(CFLAGS)
>  ALL_LDFLAGS = $(LDFLAGS)
> +PERL_CFLAGS =
> +PERL_LDFLAGS =
>  STRIP ?= strip
>  
>  prefix = $(HOME)
Just an annotation:
	ALL_* means "use these flags for compilation of all the stuff
			except perly stuff"
	PERL_* means "use these flags for compilation of really all the
			stuff"
So "all" might not mean what you think and Perl is stonger than
everything.
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam
^ permalink raw reply	[flat|nested] 19+ messages in thread
end of thread, other threads:[~2006-07-01 22:59 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-25  1:47 [PATCH] Git.pm: Support for perl/ being built by a different compiler Petr Baudis
2006-06-25  3:14 ` Junio C Hamano
2006-06-25 15:27   ` Petr Baudis
2006-06-26  8:24   ` Dennis Stosberg
2006-06-26  8:26     ` [PATCH] Solaris needs inclusion of signal.h for signal() Dennis Stosberg
2006-06-26  8:27     ` [PATCH] Fix pkt-line.h to compile with a non-GCC compiler Dennis Stosberg
2006-06-26  8:27     ` [PATCH] "test" in Solaris' /bin/sh does not support -e Dennis Stosberg
2006-06-26  9:19       ` Junio C Hamano
2006-06-26  9:42         ` Dennis Stosberg
2006-06-26 10:04           ` Dennis Stosberg
2006-06-26 17:03             ` Junio C Hamano
2006-06-26 22:21               ` [PATCH] Makefile fix for Solaris Dennis Stosberg
2006-06-26 22:23               ` [PATCH] Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdir Dennis Stosberg
2006-07-01 22:59                 ` Petr Baudis
2006-06-26 22:25               ` [PATCH] "test" in Solaris' /bin/sh does not support -e Dennis Stosberg
2006-06-26  8:29     ` [PATCH] Git.pm: Support for perl/ being built by a different compiler Dennis Stosberg
2006-06-26  8:51       ` Thomas Glanzmann
2006-06-26  9:26     ` Junio C Hamano
2006-06-26  9:32       ` Dennis Stosberg
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).