Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Feb 2006 02:27:06 -0000
From:      Shaun Amott <shaun@inerd.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/93687: [PATCH] Split bsd.port.pre.mk - allow OPTIONS to be processed first
Message-ID:  <1140575226.71851@charon.picobyte.net>
Resent-Message-ID: <200602220230.k1M2U34u061338@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         93687
>Category:       ports
>Synopsis:       [PATCH] Split bsd.port.pre.mk - allow OPTIONS to be processed first
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 22 02:30:02 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Shaun Amott
>Release:        FreeBSD 6.0-STABLE i386
>Organization:
>Environment:
System: FreeBSD 6.0-STABLE i386

>Description:

Please forgive me if I'm fiddling with something I shouldn't, or if I've
overlooked something obvious. The patch seems to work fine.

Currently, bsd.port[.pre].mk is used to process OPTIONS, which can then
be tested by a port. Unfortunately, the bsd.port.pre.mk is also used to
deal with other variables such as USE_OPENSSL and USE_RUBY. This
presents a catch-22 situation, because one cannot define USE_OPENSSL,
for instance, based on a choice made by the user in OPTIONS.

So, here is a possible solution, which - I hope - maintains existing
behavior for current ports, but allows porters to avoid using hacks to
get around the limitation.

The idea is to allow for something like this:
 
---------------------------------------------------------
PORTNAME=       someport
  ...
OPTIONS=        USE_SSL "Build with OpenSSL support" on
 
.include <bsd.port.options.mk>

.if defined(WITH_SSL)
USE_OPENSSL=            yes
.endif

.include <bsd.port.pre.mk>
  ...
---------------------------------------------------------

Presumably this would also need:

- bsd.port.options.mk in /usr/share/Mk
- Porter's Handbook documentation

>How-To-Repeat:
>Fix:

--- Mk.diff begins here ---
diff -urN Mk.orig/bsd.port.mk Mk/bsd.port.mk
--- Mk.orig/bsd.port.mk	Mon Feb 20 21:50:10 2006
+++ Mk/bsd.port.mk	Wed Feb 22 02:12:28 2006
@@ -978,16 +978,8 @@
 .endif
 
 
-# Start of pre-makefile section.
-.if !defined(AFTERPORTMK)
-
-.if defined(_PREMKINCLUDED)
-check-makefile::
-	@${ECHO_CMD} "${PKGNAME}: Makefile error: you cannot include bsd.port[.pre].mk twice"
-	@${FALSE}
-.endif
-
-_PREMKINCLUDED=	yes
+# Start of options section
+.if defined(INOPTIONSMK) || ( !defined(USEOPTIONSMK) && !defined(AFTERMKPORT) )
 
 .if defined(MAKE_VERSION)
 .if ${MAKE_VERSION} >= 5200408030 || ${MAKE_VERSION} >= 4200408030 && ${MAKE_VERSION} < 5000000000
@@ -1180,6 +1172,20 @@
 .	endif
 .endif
 
+.endif
+
+
+# Start of pre-makefile section.
+.if !defined(AFTERPORTMK) && !defined(INOPTIONSMK)
+
+.if defined(_PREMKINCLUDED)
+check-makefile::
+	@${ECHO_CMD} "${PKGNAME}: Makefile error: you cannot include bsd.port[.pre].mk twice"
+	@${FALSE}
+.endif
+
+_PREMKINCLUDED=	yes
+
 # check for old, crufty, makefile types, part 1:
 .if !defined(PORTNAME) || !( defined(PORTVERSION) || defined (DISTVERSION) ) || defined(PKGNAME)
 check-makefile::
@@ -1425,7 +1431,7 @@
 # End of pre-makefile section.
 
 # Start of post-makefile section.
-.if !defined(BEFOREPORTMK)
+.if !defined(BEFOREPORTMK) && !defined(INOPTIONSMK)
 
 .if defined(_POSTMKINCLUDED)
 check-makefile::
diff -urN Mk.orig/bsd.port.options.mk Mk/bsd.port.options.mk
--- Mk.orig/bsd.port.options.mk	Thu Jan  1 01:00:00 1970
+++ Mk/bsd.port.options.mk	Wed Feb 22 00:49:40 2006
@@ -0,0 +1,8 @@
+# $FreeBSD: ports/Mk/bsd.port.pre.mk,v 1.3 1999/08/25 04:40:21 obrien Exp $
+
+USEOPTIONSMK=	yes
+INOPTIONSMK=	yes
+
+.include "bsd.port.mk"
+
+.undef INOPTIONSMK
--- Mk.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1140575226.71851>