Subject: pkg/24731: bootstrap-pkgsrc on cygwin (patch)
To: None <gnats-bugs@gnats.netbsd.org>
From: Hubert Feyrer <feyrer@rfhpc8323.fh-regensburg.de>
List: netbsd-bugs
Date: 03/10/2004 16:12:47
>Number:         24731
>Category:       pkg
>Synopsis:       bootstrap-pkgsrc on cygwin (patch)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 10 15:13:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hubert Feyrer
>Release:        NetBSD 1.6.2
>Organization:
Hubert Feyrer <hubertf@netbsd.org>
>Environment:
	
	
System: NetBSD yui.fh-regensburg.de 1.6.2 NetBSD 1.6.2 (YUI) #1: Thu Oct 9 09:15:06 GMT 2003 feyrer@yui.fh-regensburg.de:/disk1/cvs/src-1.6/sys/arch/i386/compile/YUI i386
Architecture: i386
Machine: i386
>Description:
	Install Cygwin and whatever needed to get basic things going
	(ssh, cvs, vi, gcc, make3, ...), then try to get 
	bootstrap-pkgsrc going. See it fail.

>How-To-Repeat:
	$ cat pkgsrc.sh
	MY_HOME=$HOME/OS
	LOCALBASE=$MY_HOME/pkg
	PKG_DBDIR=$MY_HOME/db/pkg

	./bootstrap \
        	--prefix=$LOCALBASE \
        	--pkgdbdir=$PKG_DBDIR \
        	--pkgsrcdir=$MY_HOME/pkgsrc \
        	--ignore-user-check

	see it fail with unknown option "-u" to make. This comes
	from gmake adding --unix to MAKEFLAGS silently. 

>Fix:

Here is a bunch of bootstrap-pkgsrc patches to make it getting further,
based on sources from 20040310. Problem hit next after this is that
executables have a .exe suffix, which is first hit in the pax->cpio
hardlink.

Might be useful to coordinate with the winsrc project (see winsrc.sf.net).


 - Hubert

--- bmake/makefile.boot.in.orig	2004-03-10 13:54:42.000000000 +0100
+++ bmake/makefile.boot.in	2004-03-10 13:53:48.000000000 +0100
@@ -31,7 +31,7 @@
 	rm -f *.[ado] */*.[ado] 
 
 bootstrap:	bmake.boot
-	CC="$(CC)" MAKESYSPATH=${MK} ./bmake.boot -f Makefile 
+	MAKEFLAGS="" CC="$(CC)" MAKESYSPATH=${MK} ./bmake.boot -f Makefile 
 install:	install-bin install-man install-mk
 
 install-bin:
--- bmake/job.c.orig	2004-03-10 14:32:56.000000000 +0100
+++ bmake/job.c	2004-03-10 14:33:26.000000000 +0100
@@ -972,7 +972,7 @@
 #endif
 	    (void) fflush(out);
 	    return;
-	} else if (WIFSTOPPED(status) &&  WTERMSIG(status) == SIGCONT) {
+	} else if (WIFSTOPPED(status) &&  WSTOPSIG(status) == SIGCONT) {
 	    /*
 	     * If the beastie has continued, shift the Job from the stopped
 	     * list to the running one (or re-stop it if concurrency is
--- libnbcompat/nbcompat.h.orig	2004-03-10 15:01:06.000000000 +0100
+++ libnbcompat/nbcompat.h	2004-03-10 15:03:06.000000000 +0100
@@ -219,6 +219,10 @@
 # include <assert.h>
 #endif
 
+/* #if HAVE_SYS_SYSLIMITS_H */			/*HF*/
+# include <sys/syslimits.h> 	/* ARG_MAX */	/*HF*/
+/* #endif */					/*HF*/
+
 #if HAVE_ERR_H
 # include <err.h>
 #else
--- libnbcompat/pwcache.c.orig	2004-03-10 15:06:06.000000000 +0100
+++ libnbcompat/pwcache.c	2004-03-10 15:46:46.000000000 +0100
@@ -132,10 +132,10 @@
 static	struct group *	(*_pwcache_getgrnam)(const char *)	= getgrnam;
 static	struct group *	(*_pwcache_getgrgid)(gid_t)		= getgrgid;
 static	int		(*_pwcache_setpassent)(int)		=
-#if HAVE_SETPASSENT
+#if HAVE_SETGRENT	/* CygWin has both, but no header for setpassent */
+	setpwent;	
+#elif HAVE_SETPASSENT
 	setpassent;
-#elif HAVE_SETGRENT
-	setpwent;
 #else
 	NULL
 #endif
--- libnbcompat/__fts13.c.orig	2004-03-10 15:48:20.000000000 +0100
+++ libnbcompat/__fts13.c	2004-03-10 15:51:48.000000000 +0100
@@ -652,7 +652,13 @@
 static int
 dirfd(DIR *dirp)
 {
-	return (dirp == NULL) ? -1 : dirp->dd_fd;
+	return (dirp == NULL) ? -1 : dirp->
+#ifdef __CYGWIN__
+					   __fh
+#else
+					   dd_fd
+#endif
+						;
 }
 #endif
 
>Release-Note:
>Audit-Trail:
>Unformatted: