threads / patch / 4658

patchGit.pm: Support for perl/ being built by a different compiler

Subject: [PATCH] Git.pm: Support for perl/ being built by a different compiler

## tl;dr

19 messages between Jun 25, 2006 and Jul 1, 2006. Diffs are folded; open one to read it.

replies: 18people: 4as markdown or json

Petr Baudis· Jun 25, 2006, 01:47 UTC · lore

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(-)
Show changes to Makefile +38 −28
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 \
Junio C Hamano· Jun 25, 2006, 03:14 UTC · re: Petr Baudis · lore

Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler

Petr Baudis <pasky@suse.cz> writes:
Show 8 quoted lines
> 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.

Petr Baudis· Jun 25, 2006, 15:27 UTC · re: Junio C Hamano · lore

Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler

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.
Dennis Stosberg· Jun 26, 2006, 08:24 UTC · re: Junio C Hamano · lore

Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler

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

Dennis Stosberg· Jun 26, 2006, 08:26 UTC · re: Dennis Stosberg · lore

[PATCH] Solaris needs inclusion of signal.h for signal()

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(-)
Show changes to 2 files +2 −0

connect.c, merge-index.c

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
Dennis Stosberg· Jun 26, 2006, 08:27 UTC · re: Dennis Stosberg · lore

[PATCH] Fix pkt-line.h to compile with a non-GCC compiler

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(-)
Show changes to pkt-line.h +2 −0
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
Dennis Stosberg· Jun 26, 2006, 08:27 UTC · re: Dennis Stosberg · lore

[PATCH] "test" in Solaris' /bin/sh does not support -e

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(-)
Show changes to Makefile +1 −2
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
Junio C Hamano· Jun 26, 2006, 09:19 UTC · re: Dennis Stosberg · lore

Re: [PATCH] "test" in Solaris' /bin/sh does not support -e

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.

---
Show changes to 4 files +5 −5

git-branch.sh, git-checkout.sh, git-clone.sh, git-tag.sh

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
Dennis Stosberg· Jun 26, 2006, 09:42 UTC · re: Junio C Hamano · lore

Re: [PATCH] "test" in Solaris' /bin/sh does not support -e

Junio C Hamano wrote:
Show 10 quoted lines
> 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

Dennis Stosberg· Jun 26, 2006, 10:04 UTC · re: Dennis Stosberg · lore

Re: [PATCH] "test" in Solaris' /bin/sh does not support -e

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

Junio C Hamano· Jun 26, 2006, 17:03 UTC · re: Dennis Stosberg · lore

Re: [PATCH] "test" in Solaris' /bin/sh does not support -e

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) && \

Dennis Stosberg· Jun 26, 2006, 22:21 UTC · re: Junio C Hamano · lore

[PATCH] Makefile fix for Solaris

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(-)
Show changes to Makefile +1 −1
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
Dennis Stosberg· Jun 26, 2006, 22:23 UTC · re: Junio C Hamano · lore

[PATCH] Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdir

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 Makefile |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Show changes to Makefile +4 −2
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
Petr Baudis· Jul 1, 2006, 22:59 UTC · re: Dennis Stosberg · lore

Re: [PATCH] Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdir

Dear diary, on Tue, Jun 27, 2006 at 12:23:08AM CEST, I got a letter where Dennis Stosberg <dennis@stosberg.net> said that...

Show 18 quoted lines
> 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
Dennis Stosberg· Jun 26, 2006, 22:25 UTC · re: Junio C Hamano · lore

Re: [PATCH] "test" in Solaris' /bin/sh does not support -e

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

Dennis Stosberg· Jun 26, 2006, 08:29 UTC · re: Dennis Stosberg · lore

Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler

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

Show changes to 2 files +4 −3

delta.h, diff-delta.c

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)
 {
Junio C Hamano· Jun 26, 2006, 09:26 UTC · re: Dennis Stosberg · lore

Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler

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.
Dennis Stosberg· Jun 26, 2006, 09:32 UTC · re: Junio C Hamano · lore

Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler

Junio C Hamano wrote:
Show 6 quoted lines
> 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

← back to recent threads