Bug 191085 - [patch] Mk/bsd.options.mk small fix for ${opt}_WITH if option is off
Summary: [patch] Mk/bsd.options.mk small fix for ${opt}_WITH if option is off
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Olli Hauer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-16 12:45 UTC by Olli Hauer
Modified: 2014-06-21 14:08 UTC (History)
0 users

See Also:


Attachments
strip argument from ${opt}_WITH if opt is disabled (430 bytes, patch)
2014-06-21 10:14 UTC, Olli Hauer
no flags Details | Diff
${opt}_with handbook fix (1.79 KB, patch)
2014-06-21 13:15 UTC, Olli Hauer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olli Hauer freebsd_committer 2014-06-16 12:45:29 UTC
The ${opt}_WITH construct is not usable in case the option has additional parameters like paths 

E.g dns/powerdns uses:

PGSQL_CONFIGURE_ON=     --with-pgsql=${LOCALBASE}
PGSQL_CONFIGURE_OFF=    --without-pgsql
MYSQL_CONFIGURE_ON=     --with-mysql=${LOCALBASE}
MYSQL_CONFIGURE_OFF=    --without-mysql


For testing change the four lines to the following two
PGSQL_CONFIGURE_WITH=     pgsql=${LOCALBASE}
MYSQL_CONFIGURE_WITH=     mysql=${LOCALBASE}

Then test with make -V CONFIGURE_ARGS WITHOUT=PGSQL -C dns/powerdns
... --without-pgsql=/usr/local
-> ${LOCALBASE} is not stripped


With the patch below it works as expected and many Makefiles can be simplified

make -V CONFIGURE_ARGS WITHOUT=PGSQL -C dns/powerdns
... --without-pgsql


Index: /usr/ports/Mk/bsd.options.mk
===================================================================
--- /usr/ports/Mk/bsd.options.mk        (revision 357956)
+++ /usr/ports/Mk/bsd.options.mk        (working copy)
@@ -470,7 +470,7 @@
 .    endif
 .    if defined(${opt}_CONFIGURE_WITH)
 .      for iopt in ${${opt}_CONFIGURE_WITH}
-CONFIGURE_ARGS+=       --without-${iopt}
+CONFIGURE_ARGS+=       --without-${iopt:C/=.*//}
 .      endfor
 .    endif
 .    for configure in CONFIGURE CMAKE QMAKE
Comment 1 Olli Hauer freebsd_committer 2014-06-21 10:14:29 UTC
Created attachment 143990 [details]
strip argument from ${opt}_WITH if opt is disabled
Comment 2 Antoine Brodin freebsd_committer 2014-06-21 11:53:47 UTC
Approved, this will fix configure of a few ports when options are unset (math/asymptote, lang/smalltalk, net-im/freetalk)

Could you update section 5.12.3.4 of the porters handbook too?
Comment 3 Olli Hauer freebsd_committer 2014-06-21 13:15:20 UTC
Created attachment 143994 [details]
${opt}_with handbook fix

I think this is the easiest way to document the patch.
Comment 4 commit-hook freebsd_committer 2014-06-21 13:30:24 UTC
A commit references this bug:

Author: ohauer
Date: Sat Jun 21 13:29:31 UTC 2014
New revision: 358699
URL: http://svnweb.freebsd.org/changeset/ports/358699

Log:
  - strip optional WITH parameter from argument if OPTION is set to off

    FOO_WITH=	foo=bar

    CONFIGURE_ARGS will become now
    ON:	--with-foo=bar
    OFF:	--without-foo

  PR:		191085
  Submitted by:	ohauer
  Approved by:	portmgr (antoine)

Changes:
  head/Mk/bsd.options.mk
Comment 5 Olli Hauer freebsd_committer 2014-06-21 14:08:56 UTC
DOCS PR 191243 was opened to reflect this patch.