Bug 89648 - OPTIONS and conditional USE_* conflict in bsd.port.pre.mk
Summary: OPTIONS and conditional USE_* conflict in bsd.port.pre.mk
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-27 23:40 UTC by mats
Modified: 2008-12-25 21:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mats 2005-11-27 23:40:01 UTC
With OPTIONS in a ports Makefile it is possible to make settings being
permanent, i.e. the user just has to set them once, and at next update
the same settings are valid. It is, however, not possible to combine OPTIONS
with conditional use of e.g. USE_OPENSSL:

  OPTIONS=        SSL "Compile with SSL support" on

  .include <bsd.port.pre.mk>

  .if defined(WITHOUT_SSL)
  MAKE_ARGS+=     SSLTYPE=none
  .else
  USE_OPENSSL=  yes
  EXTRA_OPTS+=    SSLINCLUDE=${OPENSSLINC} SSLLIB=${OPENSSLLIB}
  .endif

It will fail because "bsd.port.pre.mk" must be included after "USE_OPENSSL"
is set.

  OPTIONS=        SSL "Compile with SSL support" on

  .if defined(WITHOUT_SSL)
  MAKE_ARGS+=     SSLTYPE=none
  .else
  USE_OPENSSL=  yes
  EXTRA_OPTS+=    SSLINCLUDE=${OPENSSLINC} SSLLIB=${OPENSSLLIB}
  .endif

  .include <bsd.port.pre.mk>

It will fail because "bsd.port.pre.mk" must be included directly after
OPTIONS before any option is "used".

There is a work-around in this case, and that is to copy what happens when
"USE_OPENSSL" is set:

  OPTIONS=        SSL "Compile with SSL support" on

  .include <bsd.port.pre.mk>

  .if defined(WITHOUT_SSL)
  MAKE_ARGS+=     SSLTYPE=none
  .else
  .include "${PORTSDIR}/Mk/bsd.openssl.mk"
  EXTRA_OPTS+=    SSLINCLUDE=${OPENSSLINC} SSLLIB=${OPENSSLLIB}
  .endif

The need to use the work-around makes it less appealing to use OPTIONS, and
might make the move to use OPTIONS take longer time.

Fix: 

I do not have full understanding of bsd.port.mk to include a patch. Moving the 
border between bsd.port.pre.mk and bsd.port.post.mk might be a solution.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2005-11-28 02:09:23 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Affects bsd.port.mk.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2005-12-27 00:57:34 UTC
State Changed
From-To: open->suspended

Mark suspended awaiting patches.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2007-05-25 04:19:57 UTC
State Changed
From-To: suspended->feedback

To pav: are you interested in looking at this with respect to OPTIONS?
Comment 4 Pav Lucistnik freebsd_committer 2007-05-25 11:00:02 UTC
State Changed
From-To: feedback->open

This is a valid problem. There is an on-going effort to decouple OPTIONS 
handling from pre.mk, so it can be included before pre.mk, so USE_* knobs can 
be conditionally set before pre.mk is included. 

The bsd.port.mk modifications are in the tree, what's needed now is to add 
bsd.port.options.mk stub to the base.  I hope to have this done for 7.0-RELEASE 
and 6.3-RELEASE.
Comment 5 Pav Lucistnik freebsd_committer 2007-07-22 01:36:22 UTC
State Changed
From-To: open->suspended

The relevant share/mk bits are in; now we must wait for 5.5/6.1/6.2 being EOLed.
Comment 6 Christian Ludwig 2008-07-13 15:44:45 UTC
Hello,

I ran into the same problem with OPTIONS.

Now I just wanted to know what is the status here? It looks like this
bug is resolved, since the required FreeBSD versions are EOL'ed.

-- 
Christian Ludwig <chrissicool@chrissicool.net>
Comment 7 Bruce Cran freebsd_committer 2008-12-25 21:26:16 UTC
State Changed
From-To: suspended->closed

5.5/6.1/6.2 have gone EOL.