# compiling on netbsd

2 messages from 2009-04-26 to 2009-04-27. Participants: Patrick Welche, Junio C Hamano.
Thread: https://gitlist.dev/t/19079

## Patrick Welche, 2009-04-26 13:49

Subject: compiling on netbsd
Message-ID: <20090426134900.GB454@quartz.inf.phy.cam.ac.uk>
URL: https://gitlist.dev/e/20090426134900.GB454%40quartz.inf.phy.cam.ac.uk

```
I found I needed to add the following patch in order to compile today's
git source under NetBSD-current (5.99.11)

Cheers,

Patrick


diff --git a/Makefile b/Makefile
index 5c8e83a..25d2b9c 100644
--- a/Makefile
+++ b/Makefile
@@ -764,6 +764,7 @@ ifeq ($(uname_S),NetBSD)
 	BASIC_CFLAGS += -I/usr/pkg/include
 	BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
 	THREADED_DELTA_SEARCH = YesPlease
+	USE_ST_TIMESPEC = YesPlease
 endif
 ifeq ($(uname_S),AIX)
 	NO_STRCASESTR=YesPlease
diff --git a/git-compat-util.h b/git-compat-util.h
index 785aa31..1ac16bd 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -46,6 +46,7 @@
 #define _ALL_SOURCE 1
 #define _GNU_SOURCE 1
 #define _BSD_SOURCE 1
+#define _NETBSD_SOURCE 1
 
 #include <unistd.h>
 #include <stdio.h>

```

## Junio C Hamano, 2009-04-27 16:59

Subject: Re: compiling on netbsd
Message-ID: <7vocui3udo.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vocui3udo.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20090426134900.GB454@quartz.inf.phy.cam.ac.uk>

```
Patrick Welche <prlw1@cam.ac.uk> writes:

> I found I needed to add the following patch in order to compile today's
> git source under NetBSD-current (5.99.11)

Thanks; USE_ST_TIMESPEC part is a nice companion patch to 9140804
(Makefile: turn on USE_ST_TIMESPEC for FreeBSD, 2009-03-22).

I cannot tell if "#define _NETBSD_SOURCE 1" has a potential to regress
things to existing NetBSD users with releases different from yours, so I
need to ask some help here.

Any objection from people who runs older NetBSD?

-- >8 --
From: Patrick Welche <prlw1@cam.ac.uk>
Date: Sun, 26 Apr 2009 14:49:00 +0100
Subject: [PATCH] NetBSD compilation fix

Similar to other BSD variants, it needs USE_ST_TIMESPEC.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Makefile          |    1 +
 git-compat-util.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index f006d2c..bb15c6b 100644
--- a/Makefile
+++ b/Makefile
@@ -764,6 +764,7 @@ ifeq ($(uname_S),NetBSD)
 	BASIC_CFLAGS += -I/usr/pkg/include
 	BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
 	THREADED_DELTA_SEARCH = YesPlease
+	USE_ST_TIMESPEC = YesPlease
 endif
 ifeq ($(uname_S),AIX)
 	NO_STRCASESTR=YesPlease
diff --git a/git-compat-util.h b/git-compat-util.h
index 785aa31..1ac16bd 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -46,6 +46,7 @@
 #define _ALL_SOURCE 1
 #define _GNU_SOURCE 1
 #define _BSD_SOURCE 1
+#define _NETBSD_SOURCE 1
 
 #include <unistd.h>
 #include <stdio.h>
-- 
1.6.3.rc3

```
