env and OptionsNG

Joe Marcus Clarke marcus at marcuscom.com
Wed Jan 23 13:18:07 EST 2013


On 1/23/13 11:47 AM, Tomoyuki Sakurai wrote:
> hi list,
> 
> as you have already know, new OptionsNG requires to set ${UNIQUENAME}_SET
> instead of WITH_FOO. as UNIQUENAME is unique, you don't have to write ".if
> ${.CURDIR:M*/foo/bar} ... .endif" anymore. it seems the best current practice
> to set ports options is using "${TB_ROOT}/scripts/env/etc/build.${BUILD}",
> which is sourced by sh(1).
> 
> my question is, how do you set environment variables with "-", e.g.
> "apache22-worker-mpm", "rubygem-foo", etc.
> 
> FreeBSD kernel and make(1) do accept "foo-bar" environment variable but sh(1)
> does not.
> 
> $ export foo-bar="buz"
> export: foo-bar: bad variable name
> 
> we have been using postBuildExtract hook to copy make.conf(5) into the build
> environment, but make.conf is not used when tinderbox retreives dependencies.
> that is, if the option changes dependency of the port, the build fails with
> "mtree" error.
> 
> it looks to me that, as long as sh(1) is used to setup environment variables,
> there is no way to "export foo-bar=buz". as such, tinderbox will have to support
> make.conf(5). also, "env" lacks per-port environment variable support. e.g.
> 
> .if ${.CURDIR:M*/www/mod_perl}
> APACHE_PORT=  www/apache13
> .else
> APACHE_PORT=  www/apache22
> .endif
> 
> any thoughts?

Seems like the OptionsNG guys should have thought about maintaining
sh(1) compatibility (or maybe they did and it was decided to drop it).

The buildenv process does set a few variables that may help.  First, it
sets __MAKE_CONF to point to the Jail's root make.conf file (e.g.,
{pb}/jails/9-STABLE/make.conf).  Next, if OPTIONS are enabled for your
build, it will set PORT_DBDIR to point to the specified OPTIONS
directory.  So, if you have pre-built your ports' options files, that
should be sufficient for both makemake and the build itself (assuming
you still use your Hook to copy over the make.conf for the build).

Joe

> 
> p.s. my __DSVERSION__ is 3.3.2.
> 


-- 
PGP Key : http://www.marcuscom.com/pgp.asc


More information about the tinderbox-list mailing list