[BACK]Return to bsd.options.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / mk

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /pkgsrc/mk/bsd.options.mk between version 1.19 and 1.20

version 1.19, 2005/04/28 21:58:44 version 1.20, 2005/05/08 13:43:30
Line 3 
Line 3 
 # This Makefile fragment provides boilerplate code for standard naming  # This Makefile fragment provides boilerplate code for standard naming
 # conventions for handling per-package build options.  # conventions for handling per-package build options.
 #  #
 # Before including this file, the following variables should be defined:  # Before including this file, the following variables can be defined:
 #  #
 #       PKG_OPTIONS_VAR  #       PKG_SUPPORTED_OPTIONS (must be defined)
 #               This is a list of the name of the make(1) variables that  
 #               contain the options the user wishes to select.  This  
 #               variable should be set in a package Makefile.  E.g.,  
 #  
 #                       PKG_OPTIONS_VAR=        WIBBLE_OPTIONS  
 #               or  
 #                       PKG_OPTIONS_VAR=        FOO_OPTIONS BAR_OPTIONS  
 #  
 #       PKG_SUPPORTED_OPTIONS  
 #               This is a list of build options supported by the package.  #               This is a list of build options supported by the package.
 #               This variable should be set in a package Makefile.  E.g.,  #               This variable should be set in a package Makefile.  E.g.,
 #  #
 #                       PKG_SUPPORTED_OPTIONS=  kerberos ldap ssl  #                       PKG_SUPPORTED_OPTIONS=  kerberos ldap ssl
 #  #
 # Optionally, the following variables may also be defined:  #       PKG_OPTION_VAR (must be defined)
   #               The variable the user can set to enable or disable
   #               options specifically for this package.
   #
   #       PKG_SUGGESTED_OPTIONS (defaults to empty)
   #               This is a list of build options which are enabled by default.
   #
   #       PKG_OPTION_LEGACY_VARS
   #               This is a list of USE_VARIABLE:option pairs that
   #               map legacy /etc/mk.conf variables to their option
   #               counterparts.
   #
   #
   # Optionally, the user may define the following variables in /etc/mk.conf:
 #  #
 #       PKG_DEFAULT_OPTIONS  #       PKG_DEFAULT_OPTIONS
 #               This is a list the options that should be built into  #               This variable can be used to override default
 #               every package, if that option is supported.  This  #               options for every package.  Options listed in this
 #               variable should be set in /etc/mk.conf.  #               variable will be enabled in every package that
 #  #               supports them.  If you prefix an option with `-',
 #       ${PKG_OPTIONS_VAR} (the variables named in PKG_OPTIONS_VAR)  #               it will be disabled in every package.
 #               These variables list the selected build options and  #
 #               override any default options given in PKG_DEFAULT_OPTIONS.  #       ${PKG_OPTIONS_VAR}
 #               If any of the options begin with a '-', then that option  #               This variable can be used to override default
 #               is always removed from the selected build options, e.g.  #               options and options listed in PKG_DEFAULT_OPTIONS.
 #  #               The syntax is the same as PKG_DEFAULT_OPTIONS.
 #                       PKG_DEFAULT_OPTIONS=    kerberos ldap sasl  
 #                       PKG_OPTIONS_VAR=        WIBBLE_OPTIONS  
 #                       WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl  
 #                       # implies PKG_OPTIONS == "kerberos ldap"  
 #               or  
 #                       PKG_OPTIONS_VAR=        WIBBLE_OPTIONS  
 #                       WIBBLE_OPTIONS=         kerberos -ldap ldap  
 #                       # implies PKG_OPTIONS == "kerberos"  
 #  
 #               This variable should be set in /etc/mk.conf.  
 #  
 #       PKG_FAIL_UNSUPPORTED_OPTIONS  
 #               If this is set to "yes", then the presence of unsupported  
 #               options in PKG_OPTIONS.<pkg> (see below) causes the build  
 #               to fail.  Set this to "no" to silently ignore unsupported  
 #               options.  Default: "no".  
 #  #
 # After including this file, the following variables are defined:  # After including this file, the following variables are defined:
 #  #
Line 59 
Line 47 
 # Example usage:  # Example usage:
 #  #
 # -------------8<-------------8<-------------8<-------------8<-------------  # -------------8<-------------8<-------------8<-------------8<-------------
 # # Global and legacy options  # PKG_SUPPORTED_OPTIONS=        foo ldap sasl
 # .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])  # PKG_SUGGESTED_OPTIONS=                foo
 # PKG_DEFAULT_OPTIONS+= ldap  # PKG_OPTIONS_LEGACY_VARS+=     WIBBLE_USE_OPENLDAP:ldap
 # .endif  # PKG_OPTIONS_LEGACY_VARS+=     WIBBLE_USE_SASL2:sasl
 # .if defined(WIBBLE_USE_SASL2) && !empty(WIBBLE_USE_SASL2:M[yY][eE][sS])  
 # PKG_DEFAULT_OPTIONS+= sasl  
 # .endif  
 #  #
 # PKG_OPTIONS_VAR=              PKG_OPTIONS.wibble  
 # PKG_SUPPORTED_OPTIONS=        ldap sasl  
 # #  
 # # Default options for ``wibble'' package.  
 # #  
 # .if !defined(PKG_OPTIONS.wibble)  
 # PKG_DEFAULT_OPTIONS+=         sasl  
 # .endif  
 # .include "../../mk/bsd.options.mk"  # .include "../../mk/bsd.options.mk"
 #  #
 # # Package-specific option-handling  # # Package-specific option-handling
 #  #
 # ###  # ###
   # ### FOO support
   # ###
   # .if !empty(PKG_OPTIONS:Mfoo)
   # CONFIGURE_ARGS+=      --enable-foo
   # .endif
   
   # ###
 # ### LDAP support  # ### LDAP support
 # ###  # ###
 # .if !empty(PKG_OPTIONS:Mldap)  # .if !empty(PKG_OPTIONS:Mldap)
Line 106  PKG_FAIL_REASON+= "bsd.options.mk: PKG_S
Line 90  PKG_FAIL_REASON+= "bsd.options.mk: PKG_S
 PKG_FAIL_REASON+=       "bsd.options.mk: PKG_OPTIONS_VAR is not defined."  PKG_FAIL_REASON+=       "bsd.options.mk: PKG_OPTIONS_VAR is not defined."
 .endif  .endif
   
 # If none of the variables listed in PKG_OPTIONS_VAR is defined, then use  # include deprecated variable to options mapping
 # the global options provided in ${PKG_DEFAULT_OPTIONS}.  .if exists(${.CURDIR}/mk/defaults/obsolete.mk)
 #  .  include "${.CURDIR}/mk/defaults/obsolete.mk"
 _PKG_DEFAULT_OPTIONS=   # empty  .elif exists(${.CURDIR}/../mk/defaults/obsolete.mk)
 .for _opt_ in ${PKG_DEFAULT_OPTIONS}  .  include "${.CURDIR}/../mk/defaults/obsolete.mk"
 .  if !empty(PKG_SUPPORTED_OPTIONS:M${_opt_})  .elif exists(${.CURDIR}/../../mk/defaults/obsolete.mk)
 _PKG_DEFAULT_OPTIONS+=  ${_opt_}  .  include "${.CURDIR}/../../mk/defaults/obsolete.mk"
 .  endif  
 .endfor  
 .undef _opt_  
 _PKG_OPTIONS_VAR=       # empty  
 .for _var_ in ${PKG_OPTIONS_VAR}  
 .  if defined(${_var_})  
 _PKG_OPTIONS_VAR+=      ${_var_}  
 .  endif  
 .endfor  
 .undef _var_  
 .if empty(_PKG_OPTIONS_VAR)  
 _PKG_OPTIONS_VAR=       _PKG_DEFAULT_OPTIONS  
 .endif  .endif
   
 # If this is set to "yes", then the presence of unsupported options in  .for _m_ in ${PKG_OPTIONS_LEGACY_VARS}
 # the variable named by ${PKG_OPTIONS_VAR} causes the build to fail.  Set  .if !empty(PKG_SUPPORTED_OPTIONS:M${_m_:C/.*://}) && defined(${_m_:C/:.*//}) && !empty(${_m_:C/:.*//}:M[yY][eE][sS])
 # this to "no" to silently ignore unsupported options.  _PKG_LEGACY_OPTIONS+=${_m_:C/.*://}
 #  _DEPRECATED_WARNING+="Deprecated variable "${_m_:C/:.*//:Q}" used, use PKG_DEFAULT_OPTIONS+="${_m_:C/.*://:Q}" instead."
 PKG_FAIL_UNSUPPORTED_OPTIONS?=  no  .endif
   
 # Separate out the selected options into "positive" and "negative" lists.  
 _PKG_YES_OPTIONS=       # contains the "positive" options  
 .for _var_ in ${_PKG_OPTIONS_VAR}  
 _PKG_YES_OPTIONS+=      ${${_var_}:N-*}  
 .endfor  .endfor
 _PKG_NO_OPTIONS=        # contains the "negative" options  
 .for _var_ in ${_PKG_OPTIONS_VAR}  #
 _PKG_NO_OPTIONS+=       ${${_var_}:M-*:S/^-//}  # reverse options in PKG_OPTIONS_VAR for backwards compatibility to
   #       PKG_OPTIONS.foo=${PKG_DEFAULT_OPTIONS} -foo
   #
   _PKG_OPTIONS_USER=#empty
   .for _opt_ in ${${PKG_OPTIONS_VAR}}
   _PKG_OPTIONS_USER:=${_opt_} ${_PKG_OPTIONS_USER}
 .endfor  .endfor
 .undef _var_  
   
 # Filter out unsupported and duplicate build options and store the result  #
 # in PKG_OPTIONS.  We keep all of the "positive" options first, then remove  # process options from specific to generic
 # all of the "negative" options last, so "negative" options always have  #
 # the strongest effect.  PKG_OPTIONS=#empty
 #  _PKG_OPTIONS_NOT=#empty
 PKG_OPTIONS=            # empty  .for _opt_ in ${_PKG_OPTIONS_USER} ${PKG_DEFAULT_OPTIONS} ${_PKG_LEGACY_OPTIONS} ${PKG_SUGGESTED_OPTIONS}
 .for _opt_ in ${_PKG_YES_OPTIONS}  _tmp_=${_opt_}
 .  if empty(_PKG_NO_OPTIONS:M${_opt_}) && empty(PKG_OPTIONS:M${_opt_})  .  if !empty(_tmp_:M-*) && empty(_PKG_OPTIONS_NOT:M${_opt_})
 .    if !empty(PKG_SUPPORTED_OPTIONS:M${_opt_})  _PKG_OPTIONS_NOT+=${_opt_}
 PKG_OPTIONS+=           ${_opt_}  .  elif empty(PKG_OPTIONS:M${_opt_}) && !empty(PKG_SUPPORTED_OPTIONS:M${_opt_}) && empty(_PKG_OPTIONS_NOT:M-${_opt_})
 .    elif !empty(PKG_FAIL_UNSUPPORTED_OPTIONS:M[yY][eE][sS])  PKG_OPTIONS+=${_opt_}
 PKG_FAIL_REASON+=       "\"${_opt_}\" is not a supported build option."  
 .    endif  
 .  endif  .  endif
 .endfor  .endfor
   .undef _opt_
   .undef _tmp_
   .undef _PKG_OPTIONS_NOT
   .undef _PKG_OPTIONS_USER
   
 _PKG_OPTIONS_WORDWRAP_FILTER=                                           \  _PKG_OPTIONS_WORDWRAP_FILTER=                                           \
         ${AWK} '                                                        \          ${AWK} '                                                        \
Line 176  _PKG_OPTIONS_WORDWRAP_FILTER=      \
Line 149  _PKG_OPTIONS_WORDWRAP_FILTER=      \
                 END { if (length(line) > 0) print "     "line }         \                  END { if (length(line) > 0) print "     "line }         \
         '          '
   
   .PHONY: describe-options
   describe-options:
           @${ECHO} The following options are supported by this package:
   .for _opt_ in ${PKG_SUPPORTED_OPTIONS:O}
           @${ECHO} "      "${_opt_:Q}"    "`${SED} -n "s/^"${_opt_:Q}"    //p" ../../mk/defaults/options.description`
   .endfor
           @${ECHO}
           @${ECHO} "These options are enabled by default: "${PKG_SUGGESTED_OPTIONS:O:Q}
           @${ECHO} "These options are currently enabled: "${PKG_OPTIONS:O:Q}
   
 .PHONY: show-options  .PHONY: show-options
 show-options:  show-options:
         @${ECHO} "available: "${PKG_SUPPORTED_OPTIONS:O:Q}          @${ECHO} "available: "${PKG_SUPPORTED_OPTIONS:O:Q}
         @${ECHO} "default: "${PKG_DEFAULT_OPTIONS:O:Q}          @${ECHO} "default: "${PKG_SUGGESTED_OPTIONS:O:Q}
         @${ECHO} "enabled: "${PKG_OPTIONS:O:Q}          @${ECHO} "enabled: "${PKG_OPTIONS:O:Q}
   
 .if defined(PKG_SUPPORTED_OPTIONS)  .if defined(PKG_SUPPORTED_OPTIONS)
Line 198  supported-options-message:
Line 181  supported-options-message:
         @${ECHO} ${PKG_OPTIONS:O:Q} | ${XARGS} -n 1 | ${_PKG_OPTIONS_WORDWRAP_FILTER}          @${ECHO} ${PKG_OPTIONS:O:Q} | ${XARGS} -n 1 | ${_PKG_OPTIONS_WORDWRAP_FILTER}
 .    endif  .    endif
         @${ECHO} ""          @${ECHO} ""
         @${ECHO} "You can select which build options to use by setting the following"          @${ECHO} "You can select which build options to use by setting PKG_DEFAULT_OPTIONS"
         @${ECHO} "variables.  Their current value is shown:"          @${ECHO} "or the following variable.  Its current value is shown:"
         @${ECHO} ""          @${ECHO} ""
 .    for _var_ in ${PKG_OPTIONS_VAR}  .    if !defined(${PKG_OPTIONS_VAR})
 .      if !defined(${_var_})          @${ECHO} "      ${PKG_OPTIONS_VAR} (not defined)"
         @${ECHO} "      ${_var_} (not defined)"  .    else
 .      else          @${ECHO} "      ${PKG_OPTIONS_VAR} = ${${PKG_OPTIONS_VAR}}"
         @${ECHO} "      ${_var_} = ${${_var_}}"  .    endif
 .      endif  .    if defined(_DEPRECATED_WARNING)
 .    endfor          @${ECHO}
 .    undef _var_          @for l in ${_DEPRECATED_WARNING}; \
           do \
                   ${ECHO} "$$l"; \
           done
   .    endif
         @${ECHO} ""          @${ECHO} ""
         @${ECHO} "=========================================================================="          @${ECHO} "=========================================================================="
 .  endif  .  endif

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

CVSweb <webmaster@jp.NetBSD.org>