Subject: Re: patches

From: Jason Riedy <[email-masked]>
Date: Fri, 09 Sep 2005 15:25:22 -0700

And Patrick Mauritz writes:
 - 
 - --- git-core-0.99.5.orig/convert-cache.c	Wed Aug 17 09:55:00 2005
 - +++ git-core-0.99.5/convert-cache.c	Wed Aug 17 09:58:48 2005
 - @@ -1,4 +1,5 @@
 -  #define _XOPEN_SOURCE /* glibc2 needs this */
 - +#define __EXTENSIONS__ /* solaris needs this */

To be honest, the right place to handle both these 
#defines is the Makefile.  AIX needs its own set of 
-Ds to turn on various standards.  ugh.  I'm sure 
HP-UX needs even more magic, IRIX needs (is?) a dead 
chicken, etc.

 - +#ifndef __sun
[...]
 -  		getdomainname(real_email+len, sizeof(real_email)-len);
[...]
 - +#endif

getdomainname isn't declared, but it is in libnsl
(on Solaris 8, Sparc) and works just fine.  Sun 
documents sysinfo (2) as its replacement, but that 
call is different on different platforms.  I'd be
shocked if getdomainname disappeared from libnsl,
especially since the C++ include files declare it.
Whoops.

 - +ifeq ($(shell uname -s),SunOS)
 - +  LIBS += -lsocket
 - +endif

Traditionally, it's -lsocket -lnsl to cover all the
bases.  Old SunOS4 -> SunOS5 porting annoyance.  That 
also lets getdomainname work.

The Makefile is generally insufficient for any platform
other than Linux with system-supplied support libraries.
Fixing that will take a good deal of work and probably
will involve putting a bunch of variable-defining makefile
fragments somewhere and including the "right" one.  With
the right variable definitions, a user can over-ride any
of them from the make command...

In the meantime, my personal coping method is just to copy
the Makefile to Makefile.platform, edit it, and use make -f 
Makefile.platform.  I could be really cool and just use a 
different git branch per platform, but I'm lazy.

Jason