# Automaticly Choose Defaults with make install



## Just_Johnny (Mar 8, 2009)

Is there a way to automatically choose defaults when compiling? If there is I cannot find it.


----------



## anomie (Mar 8, 2009)

IIRC, `# setenv BATCH yes` (for csh-based) or `# export BATCH="yes"` (for sh-based) should do it. It's documented in the manpages for ports(7), but its description there is not crystal clear to me. 

Failing that, you could just run `# cd /usr/ports/path/to/port && make config-recursive` -- answer all the config dialogs and then make afterwards so that you won't be bothered with them.


----------



## Mel_Flynn (Mar 8, 2009)

To describe it:
BATCH=yes surpresses everything that the ports system can surpress, which includes all OPTIONS dialogs and some pkg-install scripts that ask questions, like mail/postfix/pkg-install. It also bails out when the port has IS_INTERACTIVE set. These are circumstances where operator intervention cannot be worked around, for example accepting a license.

You can set this in your environment or in /etc/make.conf, though I advise setting it in your environment, since that allows you to easily turn it off.

I'm afraid make config-recursive is flawed. It uses the current list to traverse it's dependencies, rather then the list obtained _after_ the OPTIONS dialog.

The following script works around it:

```
#!/bin/sh
# vim: ts=4 sw=4 tw=78 noet ai

VISITED=
PORTSDIR=${PORTSDIR:="/usr/ports"}
CURDIR=$1
[ -z "${CURDIR}" ] && CURDIR=.
[ ! -d "${CURDIR}" ] && CURDIR="${PORTSDIR}/${CURDIR}"

config_port() {
        local ldeps rdeps bdeps

        make config-conditional

        ldeps=`make -V LIB_DEPENDS`
        rdeps=`make -V RUN_DEPENDS`
        bdeps=`make -V BUILD_DEPENDS`

        for dep in ${ldeps} ${rdeps} ${bdeps}; do
                dir=${dep##*:}
                case ${VISITED} in
                        *" ${dir}"*)
                        ;;
                        *)
                        echo "---> $dir"
                        VISITED="${VISITED} ${dir}"
                        cd ${dir}
                        config_port
                esac
        done
}

cd ${CURDIR}
config_port
```


----------



## tajudd (Mar 8, 2009)

personally, for a big compile like X11, gnome/kde, openoffice (i'm a glutton for punishment)..


```
make -DBATCH install
```

It'll take the default config/options in any port that hasn't had config/options already set.  I also use -DBATCH when I upgrade, since the fact that I've already had options set for a port I installed is already saved..and any new options are likely not interesting to me (yet).


The other option is to use env(1) -- it's a one-time environmental alteration utility and then executes what's on the command line.  So the confusion of setenv vs export are nullified with env(1)


Enjoy!


----------



## anomie (Mar 9, 2009)

Mel_Flynn said:
			
		

> I'm afraid make config-recursive is flawed. It uses the current list to traverse it's dependencies, rather then the list obtained _after_ the OPTIONS dialog.



Good to know. I may vaguely remember being burned by this before.


----------



## SirDice (Mar 10, 2009)

Mel_Flynn said:
			
		

> I'm afraid make config-recursive is flawed. It uses the current list to traverse it's dependencies, rather then the list obtained _after_ the OPTIONS dialog.


Just run it again after you've added some options. I usually run make config-recursive a couple of times until it returns without showing any options.


----------



## graudeejs (Mar 10, 2009)

You can install packages which are available for most ports.
They are compilled with default flags, recompiling under some other CPU won't give you real boost using them.


----------

