From nobody@FreeBSD.org  Fri Feb 17 22:58:16 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7EDB316A420
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 17 Feb 2006 22:58:16 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D95F743D46
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 17 Feb 2006 22:58:15 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k1HMwFsK099041
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 17 Feb 2006 22:58:15 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k1HMwF7Q099040;
	Fri, 17 Feb 2006 22:58:15 GMT
	(envelope-from nobody)
Message-Id: <200602172258.k1HMwF7Q099040@www.freebsd.org>
Date: Fri, 17 Feb 2006 22:58:15 GMT
From: Robert Millan <rmh@aybabtu.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] Fixes for non-FreeBSD in sys/conf/*.mk
X-Send-Pr-Version: www-2.3

>Number:         93502
>Category:       kern
>Synopsis:       [patch] Fixes for non-FreeBSD in sys/conf/*.mk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 17 23:00:25 GMT 2006
>Closed-Date:    Sat Feb 18 08:37:46 GMT 2006
>Last-Modified:  Sat Feb 18 08:37:46 GMT 2006
>Originator:     Robert Millan
>Release:        GNU/kFreeBSD 7.0-1-686 i686
>Organization:
>Environment:
System: GNU/kFreeBSD orthanc 7.0-1-686 #0 Fri Feb 17 22:46:33 CET 2006 i686 i386 Intel(R) Pentium(R) 4 CPU 1.80GHz GNU/kFreeBSD
Architecture: i686

>Description:
	Please could you apply a pair of fixes in sys/conf/*.mk to support
	building the kernel of FreeBSD in a non-FreeBSD system?

	- On non-FreeBSD systems:
		- disable FreeBSD extensions to GCC
		- install modules as group "root" instead of "wheel"

	Thanks for considering

>How-To-Repeat:
              
>Fix:
diff -ur sys.old/conf/kern.mk sys/conf/kern.mk
--- sys.old/conf/kern.mk	2006-02-17 20:25:31.000000000 +0100
+++ sys/conf/kern.mk	2006-02-17 20:34:31.000000000 +0100
@@ -1,5 +1,9 @@
 # $FreeBSD: src/sys/conf/kern.mk,v 1.46 2005/07/15 11:45:30 ache Exp $
 
+.if !defined(OPSYS)
+OPSYS!=		uname -s
+.endif
+
 #
 # Warning flags for compiling the kernel and components of the kernel.
 #
@@ -9,10 +13,14 @@
 .if ${CC} == "icc"
 #CWARNFLAGS=	-w2	# use this if you are terribly bored
 CWARNFLAGS=
-.else
-CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
+.elif !defined(CWARNFLAGS)
+CWARNFLAGS=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
 		-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
-		-fformat-extensions -std=c99
+		-std=c99
+.if ${OPSYS} == "FreeBSD"
+# FreeBSD extensions, not available in upstream GCC
+CWARNFLAGS+=	-fformat-extensions
+.endif
 .endif
 #
 # The following flags are next up for working on:
@@ -30,8 +38,12 @@
 # reserved for user applications.
 #
 .if ${MACHINE_ARCH} == "i386" && ${CC} != "icc"
-CFLAGS+=	-mno-align-long-strings -mpreferred-stack-boundary=2 \
+CFLAGS+=	-mpreferred-stack-boundary=2 \
 		-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
+.if ${OPSYS} == "FreeBSD"
+# FreeBSD extensions, not available in upstream GCC
+CFLAGS+=	-mno-align-long-strings
+.endif
 INLINE_LIMIT?=	8000
 .endif
 
diff -ur sys.old/conf/kern.post.mk sys/conf/kern.post.mk
--- sys.old/conf/kern.post.mk	2006-02-17 20:25:31.000000000 +0100
+++ sys/conf/kern.post.mk	2006-02-17 20:35:39.000000000 +0100
@@ -1,5 +1,15 @@
 # $FreeBSD: src/sys/conf/kern.post.mk,v 1.92 2006/02/07 13:37:26 ru Exp $
 
+.if !defined(OPSYS)
+OPSYS!=		uname -s
+.endif
+
+.if ${OPSYS} == "FreeBSD"
+WHEEL_GROUP?=	wheel
+.else
+WHEEL_GROUP?=	root
+.endif
+
 # Part of a unified Makefile for building kernels.  This part includes all
 # the definitions that need to be after all the % directives except %RULES
 # and ones that act like they are part of %RULES.
@@ -226,16 +234,16 @@
 	fi
 .endif
 	mkdir -p ${DESTDIR}${KODIR}
-	${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR}
+	${INSTALL} -p -m 555 -o root -g ${WHEEL_GROUP} ${KERNEL_KO} ${DESTDIR}${KODIR}
 .if defined(DEBUG) && !defined(INSTALL_NODEBUG)
-	${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO}.symbols ${DESTDIR}${KODIR}
+	${INSTALL} -p -m 555 -o root -g ${WHEEL_GROUP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR}
 .endif
 
 kernel-reinstall:
 	@-chflags -R noschg ${DESTDIR}${KODIR}
-	${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR}
+	${INSTALL} -p -m 555 -o root -g ${WHEEL_GROUP} ${KERNEL_KO} ${DESTDIR}${KODIR}
 .if defined(DEBUG) && !defined(INSTALL_NODEBUG)
-	${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO}.symbols ${DESTDIR}${KODIR}
+	${INSTALL} -p -m 555 -o root -g ${WHEEL_GROUP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR}
 .endif
 
 config.o env.o hints.o vers.o vnode_if.o:



>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Sat Feb 18 08:33:13 UTC 2006 
State-Changed-Why:  
sorry.  You can work around the install issue by using the 
INSTALL macro, e.g. pointing it out to src/tools/install.sh 
which works for a normal user.  You can set CWARNFLAGS to 
whatever you want.  Nothing that you want requires patching 
the .mk files, so your patch is rejected. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93502 
>Unformatted:
