From thorpej@nas.nasa.gov  Wed Sep 18 22:32:46 1996
Received: from nostromo.nas.nasa.gov (nostromo.nas.nasa.gov [129.99.223.15])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id WAA21004
          for <FreeBSD-gnats-submit@freebsd.org>; Wed, 18 Sep 1996 22:32:45 -0700 (PDT)
Received: (from thorpej@localhost) by nostromo.nas.nasa.gov (8.7.5/8.6.9-rAT) id WAA08592; Wed, 18 Sep 1996 22:26:38 -0700 (PDT)
Message-Id: <199609190526.WAA08592@nostromo.nas.nasa.gov>
Date: Wed, 18 Sep 1996 22:26:38 -0700 (PDT)
From: Jason Thorpe <thorpej@nas.nasa.gov>
Reply-To: thorpej@nas.nasa.gov
To: FreeBSD-gnats-submit@freebsd.org
Subject: Support for NetBSD in bsd.port.mk
X-Send-Pr-Version: 3.95

>Number:         1643
>Category:       bin
>Synopsis:       Support for NetBSD in bsd.port.mk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 18 22:40:01 PDT 1996
>Closed-Date:    Thu Oct 31 23:22:53 PST 1996
>Last-Modified:  Thu Oct 31 23:23:37 PST 1996
>Originator:     Jason Thorpe
>Release:        FreeBSD-current 960918, built on NetBSD/alpha
>Organization:
Numerical Aerodynamic Simulation Project - NASA Ames
>Environment:
	
System: NetBSD nostromo 1.2A NetBSD 1.2A (NOSY) #14: Wed Sep 18 14:54:10 PDT 1996 thorpej@nostromo:/work/clean-current/src/sys/arch/alpha/compile/NOSY alpha


>Description:
	The bsd.port.mk and bsd.port.subdir.mk files are currently
	FreeBSD-specific (well, duh! :-).  The following patches
	add support for NetBSD to the Makefiles.  It is hoped that
	FreeBSD can pick these up, so that NetBSD doesn't have to
	maintain a set of differences, thus making everyone's
	life a little easier.

>How-To-Repeat:
	N/A.

>Fix:
	Attached below are the diffs ... Note that not all of the
	programs nor the Makefiles have actually been imported into
	the NetBSD tree.  They probably will be "soon".

	The Makefile dynamically determines the operating system
	at run-time.

 ----- snip -----
Index: bsd.port.mk
===================================================================
RCS file: /mastersrc/netbsd/src/share/mk/bsd.port.mk,v
retrieving revision 1.1.1.2
retrieving revision 1.4
diff -c -r1.1.1.2 -r1.4
*** bsd.port.mk	1996/09/19 04:46:10	1.1.1.2
--- bsd.port.mk	1996/09/19 04:58:49	1.4
***************
*** 1,9 ****
  #-*- mode: Fundamental; tab-width: 4; -*-
  #
  #	bsd.port.mk - 940820 Jordan K. Hubbard.
  #	This file is in the public domain.
  #
! # $Id: bsd.port.mk,v 1.1.1.2 1996/09/19 04:46:10 thorpej Exp $
  #
  # Please view me with 4 column tabs!
  
--- 1,11 ----
  #-*- mode: Fundamental; tab-width: 4; -*-
  #
+ #	$NetBSD: $
+ #
  #	bsd.port.mk - 940820 Jordan K. Hubbard.
  #	This file is in the public domain.
  #
! # from FreeBSD Id: bsd.port.mk,v 1.224 1996/08/25 21:07:38 wosch Exp 
  #
  # Please view me with 4 column tabs!
  
***************
*** 18,24 ****
  #
  # Variables that typically apply to all ports:
  # 
! # PORTSDIR		- The root of the ports tree (default: /usr/ports).
  # DISTDIR 		- Where to get gzip'd, tarballed copies of original sources
  #				  (default: ${PORTSDIR}/distfiles/${DIST_SUBDIR}).
  # PREFIX		- Where to install things in general (default: /usr/local).
--- 20,31 ----
  #
  # Variables that typically apply to all ports:
  # 
! # OPSYS			- Portability clause.  This is the operating system the
! #				  makefile is being used on.  Automatically set to
! #				  "FreeBSD" or "NetBSD" as appropriate.
! # PORTSDIR		- The root of the ports tree.  Defaults:
! #					FreeBSD: /usr/ports
! #					NetBSD: /usr/opt
  # DISTDIR 		- Where to get gzip'd, tarballed copies of original sources
  #				  (default: ${PORTSDIR}/distfiles/${DIST_SUBDIR}).
  # PREFIX		- Where to install things in general (default: /usr/local).
***************
*** 171,176 ****
--- 178,184 ----
  #
  # Variables to change if you want a special behavior:
  #
+ #
  # ECHO_MSG		- Used to print all the '===>' style prompts - override this
  #				  to turn them off (default: /bin/echo).
  # IS_DEPENDED_TARGET -
***************
*** 222,227 ****
--- 230,244 ----
  # NEVER override the "regular" targets unless you want to open
  # a major can of worms.
  
+ # Get the operating system type
+ OPSYS!=	uname -s
+ 
+ # If NetBSD, we need to include bsd.own.mk to get system make
+ # configuration options.
+ .if (${OPSYS} == "NetBSD")
+ .include <bsd.own.mk>
+ .endif
+ 
  .if exists(${.CURDIR}/../Makefile.inc)
  .include "${.CURDIR}/../Makefile.inc"
  .endif
***************
*** 229,236 ****
  
  # These need to be absolute since we don't know how deep in the ports
  # tree we are and thus can't go relative.  They can, of course, be overridden
! # by individual Makefiles.
  PORTSDIR?=		${DESTDIR}/usr/ports
  LOCALBASE?=		/usr/local
  X11BASE?=		/usr/X11R6
  DISTDIR?=		${PORTSDIR}/distfiles/${DIST_SUBDIR}
--- 246,257 ----
  
  # These need to be absolute since we don't know how deep in the ports
  # tree we are and thus can't go relative.  They can, of course, be overridden
! # by individual Makefiles or local system make configuration.
! .if (${OPSYS} == "NetBSD")
! PORTSDIR?=		${DESTDIR}/usr/opt
! .else
  PORTSDIR?=		${DESTDIR}/usr/ports
+ .endif
  LOCALBASE?=		/usr/local
  X11BASE?=		/usr/X11R6
  DISTDIR?=		${PORTSDIR}/distfiles/${DIST_SUBDIR}
***************
*** 284,290 ****
--- 305,315 ----
  # Miscellaneous overridable commands:
  GMAKE?=			gmake
  XMKMF?=			xmkmf -a
+ .if (${OPSYS} == "NetBSD")
+ MD5?=			/usr/bin/md5
+ .else
  MD5?=			/sbin/md5
+ .endif
  MD5_FILE?=		${FILESDIR}/md5
  
  MAKE_FLAGS?=	-f
***************
*** 685,691 ****
  				${ECHO_MSG} "===>   Perhaps you forgot the -P flag to cvs co or update?"; \
  			fi; \
  		else \
! 			${ECHO_MSG} "===>  Applying FreeBSD patches for ${PKGNAME}" ; \
  			for i in ${PATCHDIR}/patch-*; do \
  				case $$i in \
  					*.orig|*~) \
--- 710,716 ----
  				${ECHO_MSG} "===>   Perhaps you forgot the -P flag to cvs co or update?"; \
  			fi; \
  		else \
! 			${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
  			for i in ${PATCHDIR}/patch-*; do \
  				case $$i in \
  					*.orig|*~) \
***************
*** 693,699 ****
  						;; \
  					*) \
  						if [ ${PATCH_DEBUG_TMP} = yes ]; then \
! 							${ECHO_MSG} "===>   Applying FreeBSD patch $$i" ; \
  						fi; \
  						${PATCH} ${PATCH_ARGS} < $$i; \
  						;; \
--- 718,724 ----
  						;; \
  					*) \
  						if [ ${PATCH_DEBUG_TMP} = yes ]; then \
! 							${ECHO_MSG} "===>   Applying ${OPSYS} patch $$i" ; \
  						fi; \
  						${PATCH} ${PATCH_ARGS} < $$i; \
  						;; \
***************
*** 1140,1146 ****
  				notfound=1; \
  			fi; \
  		else \
! 			if which -s "$$prog"; then \
  				${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
  				notfound=0; \
  			else \
--- 1165,1171 ----
  				notfound=1; \
  			fi; \
  		else \
! 			if which "$$prog" > /dev/null 2>&1 ; then \
  				${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
  				notfound=0; \
  			else \
***************
*** 1167,1172 ****
--- 1192,1198 ----
  build-depends:	_DEPENDS_USE
  run-depends:	_DEPENDS_USE
  
+ # XXXthorpej -- This needs lots of work for NetBSD!
  lib-depends:
  .if defined(LIB_DEPENDS)
  .if defined(NO_DEPENDS)
Index: bsd.port.subdir.mk
===================================================================
RCS file: /mastersrc/netbsd/src/share/mk/bsd.port.subdir.mk,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -c -r1.1.1.1 -r1.3
*** bsd.port.subdir.mk	1996/06/20 01:51:43	1.1.1.1
--- bsd.port.subdir.mk	1996/09/19 04:58:51	1.3
***************
*** 1,5 ****
  #	from: @(#)bsd.subdir.mk	5.9 (Berkeley) 2/1/91
! #	$Id: bsd.port.subdir.mk,v 1.1.1.1 1996/06/20 01:51:43 thorpej Exp $
  
  .MAIN: all
  
--- 1,5 ----
  #	from: @(#)bsd.subdir.mk	5.9 (Berkeley) 2/1/91
! # from FreeBSD Id: bsd.port.subdir.mk,v 1.14 1996/04/09 22:54:13 wosch Exp
  
  .MAIN: all
  
***************
*** 7,12 ****
--- 7,15 ----
  STRIP?=	-s
  .endif
  
+ .if !defined(OPSYS)	# XXX !!
+ OPSYS!=	uname -s
+ .endif
  
  ECHO_MSG?=	echo
  
***************
*** 71,77 ****
--- 74,84 ----
  	@make README.html
  .endif
  
+ .if (${OPSYS} == "NetBSD")
+ PORTSDIR ?= /usr/opt
+ .else
  PORTSDIR ?= /usr/ports
+ .endif
  TEMPLATES ?= ${PORTSDIR}/templates
  .if defined(PORTSTOP)
  README=	${TEMPLATES}/README.top
>Release-Note:
>Audit-Trail:

From: Julian Elischer <julian@current1.whistle.com>
To: Jason Thorpe <thorpej@nas.nasa.gov>
Cc: FreeBSD-gnats-submit@freebsd.org,
        GNATS Management <gnats@freefall.freebsd.org>,
        freebsd-bugs@freefall.freebsd.org
Subject: Re: bin/1643: Support for NetBSD in bsd.port.mk
Date: Wed, 18 Sep 1996 23:01:57 -0700 (PDT)

 On Wed, 18 Sep 1996, Jason Thorpe wrote:
 
 +> >Category:       bin
 > >Synopsis:       Support for NetBSD in bsd.port.mk
 
 oes this mean that we might be moving towards a combined
 ports collection and team?
 :)
 
 julian
 
 

From: Wolfram Schneider <wosch@cs.tu-berlin.de>
To: Julian Elischer <julian@current1.whistle.com>
Cc: Jason Thorpe <thorpej@nas.nasa.gov>, FreeBSD-gnats-submit@freebsd.org,
        GNATS Management <gnats@freefall.freebsd.org>,
        freebsd-bugs@freefall.freebsd.org
Subject: Re: bin/1643: Support for NetBSD in bsd.port.mk
Date: Thu, 19 Sep 1996 17:53:42 +0200

 Julian Elischer writes:
 >oes this mean that we might be moving towards a combined
 >ports collection and team?
 
 We have 541 #ifdef __FreeBSD__ in our ports ...
 
 Wolfram

From: Jason Thorpe <thorpej@nas.nasa.gov>
To: Wolfram Schneider <wosch@cs.tu-berlin.de>
Cc: Julian Elischer <julian@current1.whistle.com>,
        FreeBSD-gnats-submit@freebsd.org,
        GNATS Management <gnats@freefall.freebsd.org>,
        freebsd-bugs@freefall.freebsd.org
Subject: Re: bin/1643: Support for NetBSD in bsd.port.mk 
Date: Thu, 19 Sep 1996 10:41:26 -0700

 On Thu, 19 Sep 1996 17:53:42 +0200 
  Wolfram Schneider <wosch@cs.tu-berlin.de> wrote:
 
  > We have 541 #ifdef __FreeBSD__ in our ports ...
 
 True enough ... however, with a little effort, those can be change into
 
 #if defined(__FreeBSD__) || defined(__NetBSD__)
 
 ...or the appropriate
 
 #if BSD > ...
 
 conditionals.  SMOP, right?  :-)
 
  -- save the ancient forests - http://www.bayarea.net/~thorpej/forest/ -- 
 Jason R. Thorpe                                       thorpej@nas.nasa.gov
 NASA Ames Research Center                               Home: 408.866.1912
 NAS: M/S 258-6                                          Work: 415.604.0935
 Moffett Field, CA 94035                                Pager: 415.428.6939

From: Poul-Henning Kamp <phk@critter.tfs.com>
To: Jason Thorpe <thorpej@nas.nasa.gov>
Cc: Wolfram Schneider <wosch@cs.tu-berlin.de>,
        Julian Elischer <julian@current1.whistle.com>,
        FreeBSD-gnats-submit@freebsd.org,
        GNATS Management <gnats@freefall.freebsd.org>,
        freebsd-bugs@freefall.freebsd.org
Subject: Re: bin/1643: Support for NetBSD in bsd.port.mk 
Date: Thu, 19 Sep 1996 20:41:09 +0200

 In message <199609191741.KAA07179@lestat.nas.nasa.gov>, Jason Thorpe writes:
 >On Thu, 19 Sep 1996 17:53:42 +0200 
 >
 >#if BSD > ...
 >
 >conditionals.  SMOP, right?  :-)
 
 We >REALLY< need to work on some way of bumping the BSD variable in
 unison, any good suggestions ?
 
 --
 Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
 http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
 whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
 Future will arrive by its own means, progress not so.

From: Bruce Evans <bde@zeta.org.au>
To: julian@current1.whistle.com, wosch@cs.tu-berlin.de
Cc: freebsd-bugs@freefall.freebsd.org, FreeBSD-gnats-submit@freebsd.org,
        gnats@freefall.freebsd.org, thorpej@nas.nasa.gov
Subject: Re: bin/1643: Support for NetBSD in bsd.port.mk
Date: Fri, 20 Sep 1996 11:09:20 +1000

 >We have 541 #ifdef __FreeBSD__ in our ports ...
 
 We also have precisely 541 lines with __FreeBSD__ in my copy of
 /usr/src.  Half of them are in /usr/src/sys :-(.
 
 Bruce

From: asami@freebsd.org (Satoshi Asami)
To: FreeBSD-gnats-submit@freefall.FreeBSD.org
Cc:  Subject: Re: bin/1643: Support for NetBSD in bsd.port.mk
Date: Fri, 20 Sep 1996 04:13:29 -0700 (PDT)

  * From: Jason Thorpe <thorpej@nas.nasa.gov>
 
 Thanks for your submission, Jason.  Now, my comments:
 
  * ! # $Id: bsd.port.mk,v 1.1.1.2 1996/09/19 04:46:10 thorpej Exp $
 
  * ! # from FreeBSD Id: bsd.port.mk,v 1.224 1996/08/25 21:07:38 wosch Exp 
 
 You should clean up your patches before sending it over you know. :)
 
  * + # If NetBSD, we need to include bsd.own.mk to get system make
  * + # configuration options.
  * + .if (${OPSYS} == "NetBSD")
  * + .include <bsd.own.mk>
  * + .endif
  * + 
 
 This doesn't belong to bsd.port.mk.  I don't mind including NetBSD
 support, but not crude hacks of this kind.  Why does this have to be
 in bsd.port.mk?
 
  * ! # by individual Makefiles or local system make configuration.
  * ! .if (${OPSYS} == "NetBSD")
  * ! PORTSDIR?=		${DESTDIR}/usr/opt
  * ! .else
  *   PORTSDIR?=		${DESTDIR}/usr/ports
  * + .endif
 
 Looks good....
 
  * + .if (${OPSYS} == "NetBSD")
  * + MD5?=			/usr/bin/md5
  * + .else
  *   MD5?=			/sbin/md5
  * + .endif
 
 Ok....
 
  * ! 			${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
 
 Yes....
 
  * + # XXXthorpej -- This needs lots of work for NetBSD!
 
 Duh.... ;)
 
  * ! # from FreeBSD Id: bsd.port.subdir.mk,v 1.14 1996/04/09 22:54:13 wosch Exp
 
 Please.... ;>
 
 Satoshi
State-Changed-From-To: open->closed 
State-Changed-By: asami 
State-Changed-When: Thu Oct 31 23:22:53 PST 1996 
State-Changed-Why:  
Fixed in bsd.port.mk rev. 1.227 and bsd.port.mk rev. 1.15. 
>Unformatted:
