git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Building git on NetBSD
@ 2005-11-12 15:12 walt
  2005-11-12 15:32 ` Andreas Ericsson
  0 siblings, 1 reply; 5+ messages in thread
From: walt @ 2005-11-12 15:12 UTC (permalink / raw)
  To: git

This gets git going on NetBSD:

--- Makefile.orig	2005-11-12 05:06:55.000000000 -0800
+++ Makefile
@@ -212,6 +212,10 @@ ifeq ($(uname_S),OpenBSD)
 	NEEDS_LIBICONV = YesPlease
 	ALL_CFLAGS += -I/usr/local/include -L/usr/local/lib
 endif
+ifeq ($(uname_S),NetBSD)
+	NEEDS_LIBICONV = YesPlease
+	ALL_CFLAGS += -I/usr/pkg/include -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
+endif
 ifneq (,$(findstring arm,$(uname_M)))
 	ARM_SHA1 = YesPlease
 endif

I'm no software developer so I'm not sure about the syntax of the -rpath
flag.  It does what I wanted, but it results in lots of warnings about
not being used because no linking is taking place.  Should this maybe
go in LDFLAGS instead of CFLAGS?  Dunno.

Anyway, I actually used cg-clone on NetBSD to clone the git repository,
and I'll try to get the pkgsrc guys interested in creating packages for
cogito and git.

Oh, one person was concerned about the cogito scripts running on the
NetBSD version of sh, which isn't bash.  So far I've tried cg-clone,
cg-update, and gitk, and all worked just like on linux.  Any chance
that some of the other scripts may not work as well on a non-bash sh?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Building git on NetBSD
  2005-11-12 15:12 [PATCH] Building git on NetBSD walt
@ 2005-11-12 15:32 ` Andreas Ericsson
  2005-11-13  2:41   ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Ericsson @ 2005-11-12 15:32 UTC (permalink / raw)
  To: walt; +Cc: git

walt wrote:
> 
> I'm no software developer so I'm not sure about the syntax of the -rpath
> flag.  It does what I wanted, but it results in lots of warnings about
> not being used because no linking is taking place.  Should this maybe
> go in LDFLAGS instead of CFLAGS?  Dunno.
> 

Yes it should. Currently the git makefile doesn't distinguish between 
CFLAGS and LDFLAGS which results in a fair few warnings.

> Oh, one person was concerned about the cogito scripts running on the
> NetBSD version of sh, which isn't bash.  So far I've tried cg-clone,
> cg-update, and gitk, and all worked just like on linux.  Any chance
> that some of the other scripts may not work as well on a non-bash sh?
> 

gitk is in tcl so I'd be surprised if that didn't work.

I don't think there's been a whole lot of testing for other shells but 
the friendly folks on this list usually takes care of fixing such things 
fairly quickly so long as someone tells them where to look or, 
preferrably, sends a patch that does the trick.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Building git on NetBSD
  2005-11-12 15:32 ` Andreas Ericsson
@ 2005-11-13  2:41   ` Junio C Hamano
  2005-11-13  9:44     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-11-13  2:41 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: git

Andreas Ericsson <ae@op5.se> writes:

> Yes it should. Currently the git makefile doesn't distinguish between 
> CFLAGS and LDFLAGS which results in a fair few warnings.

Very well.  Maybe LDFLAGS and ALL_LDFLAGS pair to parallel
CFLAGS and ALL_CFLAGS (the former is for the end user to
override from make command line, the latter is for Makefile to
augment and use)?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Building git on NetBSD
  2005-11-13  2:41   ` Junio C Hamano
@ 2005-11-13  9:44     ` Junio C Hamano
  2005-11-13 22:51       ` wa1ter
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-11-13  9:44 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: git

Junio C Hamano <junkio@cox.net> writes:

> Andreas Ericsson <ae@op5.se> writes:
>
>> Yes it should. Currently the git makefile doesn't distinguish between 
>> CFLAGS and LDFLAGS which results in a fair few warnings.
>
> Very well.  Maybe LDFLAGS and ALL_LDFLAGS pair to parallel
> CFLAGS and ALL_CFLAGS (the former is for the end user to
> override from make command line, the latter is for Makefile to
> augment and use)?

Does this look OK?

-- >8 -- cut here -- >8 --
diff --git a/Makefile b/Makefile
index b75cb13..7713c05 100644
--- a/Makefile
+++ b/Makefile
@@ -52,10 +52,12 @@
 
 GIT_VERSION = 0.99.9.GIT
 
-# CFLAGS is for the users to override from the command line.
+# CFLAGS and LDFLAGS are for the users to override from the command line.
 
 CFLAGS = -g -O2 -Wall
+LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
+ALL_LDFLAGS = $(LDFLAGS)
 
 prefix = $(HOME)
 bindir = $(prefix)/bin
@@ -187,9 +189,11 @@ ifeq ($(uname_S),Darwin)
 	NEEDS_SSL_WITH_CRYPTO = YesPlease
 	NEEDS_LIBICONV = YesPlease
 	## fink
-	ALL_CFLAGS += -I/sw/include -L/sw/lib
+	ALL_CFLAGS += -I/sw/include
+	ALL_LDFLAGS += -L/sw/lib
 	## darwinports
-	ALL_CFLAGS += -I/opt/local/include -L/opt/local/lib
+	ALL_CFLAGS += -I/opt/local/include
+	ALL_LDFLAGS += -L/opt/local/lib
 endif
 ifeq ($(uname_S),SunOS)
 	NEEDS_SOCKET = YesPlease
@@ -211,7 +215,13 @@ endif
 ifeq ($(uname_S),OpenBSD)
 	NO_STRCASESTR = YesPlease
 	NEEDS_LIBICONV = YesPlease
-	ALL_CFLAGS += -I/usr/local/include -L/usr/local/lib
+	ALL_CFLAGS += -I/usr/local/include
+	ALL_LDFLAGS += -L/usr/local/lib
+endif
+ifeq ($(uname_S),NetBSD)
+	NEEDS_LIBICONV = YesPlease
+	ALL_CFLAGS += -I/usr/pkg/include
+	ALL_LDFLAGS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
 endif
 ifneq (,$(findstring arm,$(uname_M)))
 	ARM_SHA1 = YesPlease
@@ -221,7 +231,7 @@ endif
 
 ifndef NO_CURL
 	ifdef CURLDIR
-		# This is still problematic -- gcc does not want -R.
+		# This is still problematic -- gcc does not always want -R.
 		ALL_CFLAGS += -I$(CURLDIR)/include
 		CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl
 	else
@@ -369,12 +379,13 @@ git-cherry-pick: git-revert
 	$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 
 git-%$X: %.o $(LIB_FILE)
-	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
+	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
 
 git-mailinfo$X : SIMPLE_LIB += $(LIB_4_ICONV)
 $(SIMPLE_PROGRAMS) : $(LIB_FILE)
 $(SIMPLE_PROGRAMS) : git-%$X : %.o
-	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIB_FILE) $(SIMPLE_LIB)
+	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
+		$(LIB_FILE) $(SIMPLE_LIB)
 
 git-http-fetch$X: fetch.o
 git-local-fetch$X: fetch.o
@@ -408,10 +419,10 @@ test: all
 	$(MAKE) -C t/ all
 
 test-date$X: test-date.c date.o ctype.o
-	$(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o ctype.o
+	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o
 
 test-delta$X: test-delta.c diff-delta.o patch-delta.o
-	$(CC) $(ALL_CFLAGS) -o $@ $^
+	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $^
 
 check:
 	for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Building git on NetBSD
  2005-11-13  9:44     ` Junio C Hamano
@ 2005-11-13 22:51       ` wa1ter
  0 siblings, 0 replies; 5+ messages in thread
From: wa1ter @ 2005-11-13 22:51 UTC (permalink / raw)
  To: git

On Sun, 13 Nov 2005, Junio C Hamano wrote:

> Date: Sun, 13 Nov 2005 01:44:37 -0800
> From: Junio C Hamano <junkio@cox.net>
> Cc: git@vger.kernel.org
> Newsgroups: gmane.comp.version-control.git
> Subject: Re: [PATCH] Building git on NetBSD
>
> Junio C Hamano <junkio@cox.net> writes:
>

> > Very well.  Maybe LDFLAGS and ALL_LDFLAGS pair to parallel
> > CFLAGS and ALL_CFLAGS (the former is for the end user to
> > override from make command line, the latter is for Makefile to
> > augment and use)?
>
> Does this look OK?

<patch snipped>

Yes, git now compiles on NetBSD without modification and with no
warnings about unused linker flags.  Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-11-13 23:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-12 15:12 [PATCH] Building git on NetBSD walt
2005-11-12 15:32 ` Andreas Ericsson
2005-11-13  2:41   ` Junio C Hamano
2005-11-13  9:44     ` Junio C Hamano
2005-11-13 22:51       ` wa1ter

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).