Subject: pkg/19485: multiple bmake-3.1.15 build problems under "zoularis"
To: None <gnats-bugs@gnats.netbsd.org>
From: None <fcusack@fcusack.com>
List: netbsd-bugs
Date: 12/20/2002 21:50:11
>Number:         19485
>Category:       pkg
>Synopsis:       multiple bmake-3.1.15 build problems under "zoularis"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 20 21:51:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Frank Cusack
>Release:        NetBSD 1.6
>Organization:
>Environment:
System: NetBSD moltar.savecore.net 1.6 NetBSD 1.6 (moltar) #16: Sun Nov 17 22:42:13 PST 2002 root@moltar.savecore.net:/usr/src/sys/arch/sparc64/compile/moltar sparc64
Architecture: sparc64
Machine: sparc64
>Description:
	These just fix compiler warning problems.  Since packages build with
	-Werror, these need to be fixed.  Also, one minor build error.
>How-To-Repeat:
	Just try to build bmake for zoularis.  I dare you. :-)
>Fix:
	Here's the build problem.  The first part of the patch is just a
	bandaid for zoularis.  MKSRC doesn't work right under netbsd
	either; but it works anyway because /usr/share/mk/sys.mk exists.

--- makefile.boot.in.orig	Wed Nov 27 11:04:20 2002
+++ makefile.boot.in	Fri Dec 20 18:36:59 2002
@@ -34,13 +34,13 @@
 .mk.done:
 	@if test -s ${MKSRC}/install-mk; then \
 	  sh ${MKSRC}/install-mk -v -m 644 `pwd`/mk ${USE_OS}; \
-	elif test ! -s /usr/share/mk/sys.mk; then \
+	elif test ! -s /usr/pkg/share/mk/sys.mk; then \
 	  echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false; \
 	fi
 	@touch $@
 
 bootstrap:	bmake.boot .mk.done
-	MAKESYSPATH=./mk:${MKSRC}:${MK}:${DEFAULT_MAKESYSPATH} ./bmake.boot -f Makefile 
+	MAKESYSPATH=./mk:${MKSRC}:${MK}:${DEFAULT_MAKESYSPATH} ./bmake.boot CC="$(CC)" -f Makefile 
 install:	install-bin install-man install-mk
 
 install-bin:

	Here is a patch to fix warnings due to bad #defines on Solaris:
	(and a missing prototype fix thrown in)

--- compat.c.orig	Fri Dec 20 19:46:35 2002
+++ compat.c	Fri Dec 20 19:46:19 2002
@@ -557,6 +557,11 @@
     GNode   	  *gn = NULL;/* Current root target */
     int	    	  errors;   /* Number of targets not remade due to errors */
 
+#ifdef __sun__
+#undef SIG_IGN
+#define SIG_IGN (void (*)(int))1
+#endif
+
     if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
 	signal(SIGINT, CompatInterrupt);
     }
--- job.c.orig	Fri Dec 20 19:48:29 2002
+++ job.c	Fri Dec 20 19:50:12 2002
@@ -155,6 +155,13 @@
 # define STATIC static
 #endif
 
+#ifdef __sun__
+#undef SIG_DFL
+#undef SIG_IGN
+#define SIG_DFL (void (*)(int))0
+#define SIG_IGN (void (*)(int))1
+#endif
+
 /*
  * error handling variables
  */
--- util.c.orig	Fri Dec 20 20:21:49 2002
+++ util.c	Fri Dec 20 20:24:37 2002
@@ -58,6 +58,8 @@
 #endif
 
 #if !defined(HAVE_SETENV)
+int setenv(const char *, const char *, int);
+
 int
 setenv(const char *name, const char *value, int dum)
 {
@@ -326,6 +328,9 @@
 #if defined(sun) && defined(__svr4__)
 #include <signal.h>
 
+#undef SIG_ERR
+#define SIG_ERR (void (*)(int))-1
+
 /* turn into bsd signals */
 void (*
 signal(int s, void (*a)(int)))(int)

	And here are patches for prototype and other problems.
	netbsd defines this also (in sys.mk), but gcc doesn't seem to
	trip up on the problems.  I don't get it.  Maybe cuz it's run
	as 'cc' under netbsd?

	The #define for the setenv prototypes might be better as
	#ifndef HAVE_SETENV_H

--- main.c.orig	Mon Nov 25 23:33:14 2002
+++ main.c	Fri Dec 20 20:15:45 2002
@@ -169,6 +169,10 @@
 # define MACHINE FORCE_MACHINE
 #endif
 
+#ifdef __sun__
+extern int setenv(const char *, const char *, int);
+#endif
+
 extern Lst parseIncPath;
 
 /*-
@@ -627,14 +631,14 @@
 	 */
 	if (!machine) {
 #ifndef MAKE_BOOTSTRAP
-	    struct utsname utsname;
+	    struct utsname l_utsname;
 
-	    if (uname(&utsname) == -1) {
+	    if (uname(&l_utsname) == -1) {
 		(void)fprintf(stderr, "%s: uname failed (%s).\n", progname,
 		    strerror(errno));
 		exit(2);
 	    }
-	    machine = utsname.machine;
+	    machine = l_utsname.machine;
 #else
 #ifdef MAKE_MACHINE
 	    machine = MAKE_MACHINE;
--- sigcompat.c.orig	Fri Dec 20 20:26:24 2002
+++ sigcompat.c	Fri Dec 20 20:29:58 2002
@@ -202,6 +202,7 @@
 # define ss2m(ss) (MASK_T) *(ss)
 # define m2ss(ss, m)	*ss = (sigset_t) *(m)
 #else
+static  MASK_T ss2m(sigset_t *);
 static  MASK_T
 ss2m(ss)
 	sigset_t *ss;
@@ -212,6 +213,7 @@
 	return ma[0];
 }
 
+static void m2ss(sigset_t *, MASK_T *);
 static void
 m2ss(ss, m)
 	sigset_t *ss;
@@ -225,6 +227,7 @@
 #endif
 
 #if !defined(HAVE_SIGSETMASK) || defined(FORCE_POSIX_SIGNALS)
+MASK_T sigsetmask(MASK_T);
 MASK_T
 sigsetmask(mask)
 	MASK_T  mask;
@@ -245,6 +248,7 @@
 }
 
 
+MASK_T sigblock(MASK_T);
 MASK_T
 sigblock(mask)
 	MASK_T  mask;
--- trace.c.orig	Fri Dec 20 20:17:40 2002
+++ trace.c	Fri Dec 20 20:17:49 2002
@@ -106,7 +106,7 @@
 	fprintf(trfile, "%ld.%06d %d %d %s %d %s",
 	    rightnow.tv_sec, (int)rightnow.tv_usec,
 	    jobTokensRunning, jobTokensFree,
-	    evname[event], trpid, trwd);
+	    evname[event], (int) trpid, trwd);
 	if (job != NULL) {
 		fprintf(trfile, " %s %d %x %x", job->node->name,
 		    job->pid, job->flags, job->node->type);
--- var.c.orig	Fri Dec 20 20:20:25 2002
+++ var.c	Fri Dec 20 20:20:02 2002
@@ -107,6 +107,10 @@
 #include    "make.h"
 #include    "buf.h"
 
+#ifdef __sun__
+extern int setenv(const char *, const char *, int);
+#endif
+
 /*
  * This is a harmless return value for Var_Parse that can be used by Var_Subst
  * to determine if there was an error in parsing -- easier than returning
>Release-Note:
>Audit-Trail:
>Unformatted: