2006-03-21 09:05:42 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# This file is in the public domain.
|
|
|
|
|
2011-05-10 11:14:40 +00:00
|
|
|
set -o errexit
|
|
|
|
|
2006-03-21 09:05:42 +00:00
|
|
|
ident='$FreeBSD$'
|
|
|
|
|
2011-05-10 11:14:40 +00:00
|
|
|
t=$(mktemp -d -t makeman)
|
|
|
|
trap 'test -d $t && rm -rf $t' exit
|
|
|
|
|
2006-03-21 09:05:42 +00:00
|
|
|
#
|
2011-05-10 11:14:40 +00:00
|
|
|
# usage: no_targets all_targets yes_targets
|
|
|
|
#
|
|
|
|
no_targets()
|
|
|
|
{
|
|
|
|
for t1 in $1 ; do
|
|
|
|
for t2 in $2 ; do
|
|
|
|
if [ "${t1}" = "${t2}" ] ; then
|
|
|
|
continue 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo ${t1}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
show_options()
|
|
|
|
{
|
|
|
|
ALL_TARGETS=$(echo $(make -C ../../.. targets | tail -n +2))
|
|
|
|
rm -f $t/settings
|
|
|
|
for target in ${ALL_TARGETS} ; do
|
|
|
|
make -C ../../.. showconfig \
|
|
|
|
SRCCONF=/dev/null __MAKE_CONF=/dev/null \
|
|
|
|
TARGET_ARCH=${target#*/} TARGET=${target%/*} |
|
|
|
|
while read var _ val ; do
|
|
|
|
opt=${var#MK_}
|
|
|
|
case ${val} in
|
|
|
|
yes)
|
|
|
|
echo ${opt} ${target}
|
|
|
|
;;
|
|
|
|
no)
|
|
|
|
echo ${opt}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo 'make showconfig broken' >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done > $t/settings.target
|
|
|
|
if [ -r $t/settings ] ; then
|
|
|
|
join -t\ $t/settings $t/settings.target > $t/settings.new
|
|
|
|
mv $t/settings.new $t/settings
|
|
|
|
else
|
|
|
|
mv $t/settings.target $t/settings
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
cat $t/settings | while read opt targets ; do
|
|
|
|
if [ "${targets}" = "${ALL_TARGETS}" ] ; then
|
|
|
|
echo "WITHOUT_${opt}"
|
|
|
|
elif [ -z "${targets}" ] ; then
|
|
|
|
echo "WITH_${opt}"
|
|
|
|
else
|
|
|
|
echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}")
|
|
|
|
echo "WITH_${opt} ${targets}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# usage: show { settings | with | without } ...
|
2006-03-21 09:05:42 +00:00
|
|
|
#
|
|
|
|
show()
|
|
|
|
{
|
|
|
|
|
2011-05-10 11:14:40 +00:00
|
|
|
mode=$1 ; shift
|
2006-03-21 09:05:42 +00:00
|
|
|
case ${mode} in
|
|
|
|
settings)
|
|
|
|
yes_prefix=WITH
|
|
|
|
no_prefix=WITHOUT
|
|
|
|
;;
|
2011-05-10 11:14:40 +00:00
|
|
|
with)
|
|
|
|
yes_prefix=WITH
|
2006-03-21 09:05:42 +00:00
|
|
|
no_prefix=WITH
|
|
|
|
;;
|
2011-05-10 11:14:40 +00:00
|
|
|
without)
|
|
|
|
yes_prefix=WITHOUT
|
|
|
|
no_prefix=WITHOUT
|
|
|
|
;;
|
2006-03-21 09:05:42 +00:00
|
|
|
*)
|
2011-05-10 11:14:40 +00:00
|
|
|
echo 'internal error' >&2
|
2006-03-21 09:05:42 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2011-05-10 11:14:40 +00:00
|
|
|
make -C ../../.. "$@" showconfig __MAKE_CONF=/dev/null |
|
|
|
|
while read var _ val ; do
|
2006-03-21 09:05:42 +00:00
|
|
|
opt=${var#MK_}
|
|
|
|
case ${val} in
|
|
|
|
yes)
|
|
|
|
echo ${yes_prefix}_${opt}
|
|
|
|
;;
|
|
|
|
no)
|
|
|
|
echo ${no_prefix}_${opt}
|
|
|
|
;;
|
|
|
|
*)
|
2011-05-10 11:14:40 +00:00
|
|
|
echo 'make showconfig broken' >&2
|
2006-03-21 09:05:42 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
|
|
|
|
ident=${ident#$}
|
|
|
|
ident=${ident% $}
|
2006-03-21 09:08:45 +00:00
|
|
|
fbsdid='$'FreeBSD'$'
|
2006-03-21 09:05:42 +00:00
|
|
|
cat <<EOF
|
|
|
|
.\" DO NOT EDIT-- this file is automatically generated.
|
|
|
|
.\" from ${ident}
|
|
|
|
.\" ${fbsdid}
|
2011-05-10 11:14:40 +00:00
|
|
|
.Dd $(echo $(LC_TIME=C date +'%B %e, %Y'))
|
2006-03-21 09:05:42 +00:00
|
|
|
.Dt SRC.CONF 5
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm src.conf
|
2006-05-16 18:59:00 +00:00
|
|
|
.Nd "source build options"
|
2006-03-21 09:05:42 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
file contains settings that will apply to every build involving the
|
|
|
|
.Fx
|
|
|
|
source tree; see
|
|
|
|
.Xr build 7 .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
file uses the standard makefile syntax.
|
|
|
|
However,
|
|
|
|
.Nm
|
|
|
|
should not specify any dependencies to
|
|
|
|
.Xr make 1 .
|
|
|
|
Instead,
|
|
|
|
.Nm
|
|
|
|
is to set
|
|
|
|
.Xr make 1
|
|
|
|
variables that control the aspects of how the system builds.
|
|
|
|
.Pp
|
|
|
|
The default location of
|
|
|
|
.Nm
|
|
|
|
is
|
|
|
|
.Pa /etc/src.conf ,
|
|
|
|
though an alternative location can be specified in the
|
|
|
|
.Xr make 1
|
|
|
|
variable
|
|
|
|
.Va SRCCONF .
|
|
|
|
Overriding the location of
|
|
|
|
.Nm
|
2007-11-06 23:12:53 +00:00
|
|
|
may be necessary if the system-wide settings are not suitable
|
2006-03-21 09:05:42 +00:00
|
|
|
for a particular build.
|
|
|
|
For instance, setting
|
|
|
|
.Va SRCCONF
|
|
|
|
to
|
|
|
|
.Pa /dev/null
|
|
|
|
effectively resets all build controls to their defaults.
|
|
|
|
.Pp
|
|
|
|
The only purpose of
|
|
|
|
.Nm
|
|
|
|
is to control the compilation of the
|
|
|
|
.Fx
|
2006-05-16 18:59:00 +00:00
|
|
|
source code, which is usually located in
|
2006-03-21 09:05:42 +00:00
|
|
|
.Pa /usr/src .
|
|
|
|
As a rule, the system administrator creates
|
|
|
|
.Nm
|
|
|
|
when the values of certain control variables need to be changed
|
|
|
|
from their defaults.
|
|
|
|
.Pp
|
|
|
|
In addition, control variables can be specified
|
|
|
|
for a particular build via the
|
|
|
|
.Fl D
|
|
|
|
option of
|
|
|
|
.Xr make 1
|
2009-02-20 11:09:55 +00:00
|
|
|
or in its environment; see
|
2006-03-21 09:05:42 +00:00
|
|
|
.Xr environ 7 .
|
|
|
|
.Pp
|
2006-05-20 04:32:10 +00:00
|
|
|
The values of variables are ignored regardless of their setting;
|
2006-05-16 18:59:00 +00:00
|
|
|
even if they would be set to
|
2006-03-21 09:05:42 +00:00
|
|
|
.Dq Li FALSE
|
|
|
|
or
|
2006-05-16 18:59:00 +00:00
|
|
|
.Dq Li NO .
|
|
|
|
Just the existence of an option will cause
|
|
|
|
it to be honoured by
|
|
|
|
.Xr make 1 .
|
2006-03-21 09:05:42 +00:00
|
|
|
.Pp
|
|
|
|
The following list provides a name and short description for variables
|
|
|
|
that can be used for source builds.
|
|
|
|
.Bl -tag -width indent
|
|
|
|
EOF
|
2011-05-10 11:14:40 +00:00
|
|
|
show settings SRCCONF=/dev/null | sort > $t/config_default
|
2013-06-10 13:55:03 +00:00
|
|
|
# Work around WITH_LDNS_UTILS forcing BIND_UTILS off by parsing the
|
|
|
|
# actual config that results from enabling every WITH_ option. This
|
|
|
|
# can be reverted if/when we no longer have options that disable
|
|
|
|
# others.
|
|
|
|
show with SRCCONF=/dev/null | sort | sed 's/$/=/' > $t/src.conf
|
|
|
|
show settings SRCCONF=$t/src.conf | sort > $t/config_WITH_ALL
|
2011-05-10 11:14:40 +00:00
|
|
|
show without SRCCONF=/dev/null | sort > $t/config_WITHOUT_ALL
|
|
|
|
|
|
|
|
show_options |
|
|
|
|
while read opt targets ; do
|
|
|
|
if [ ! -f ${opt} ] ; then
|
|
|
|
echo "no description found for ${opt}, skipping" >&2
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2011-05-10 12:57:39 +00:00
|
|
|
echo ".It Va ${opt}"
|
|
|
|
sed -e's/\$\(FreeBSD: .*\) \$/from \1/' ${opt}
|
|
|
|
if [ -n "${targets}" ] ; then
|
|
|
|
echo '.Pp'
|
|
|
|
echo 'It is a default setting on'
|
|
|
|
echo $(echo ${targets} | sed -e's/ /, /g' -e's/\(.*\), /\1 and /').
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${opt%%_*}" = 'WITHOUT' ] ; then
|
2011-05-10 11:14:40 +00:00
|
|
|
sed -n "/^WITH_${opt#WITHOUT_}$/!s/$/=/p" $t/config_WITH_ALL > $t/src.conf
|
|
|
|
show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITH_ALL_${opt}
|
|
|
|
comm -13 $t/config_WITH_ALL $t/config_WITH_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps
|
2011-05-10 12:57:39 +00:00
|
|
|
elif [ "${opt%%_*}" = 'WITH' ] ; then
|
2011-05-10 11:14:40 +00:00
|
|
|
sed -n "/^WITHOUT${opt#WITH}$/!s/$/=/p" $t/config_WITHOUT_ALL > $t/src.conf
|
|
|
|
show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITHOUT_ALL_${opt}
|
|
|
|
comm -13 $t/config_WITHOUT_ALL $t/config_WITHOUT_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps
|
2006-03-21 09:05:42 +00:00
|
|
|
else
|
2011-05-10 11:14:40 +00:00
|
|
|
echo 'internal error' >&2
|
|
|
|
exit 1
|
2006-03-21 09:05:42 +00:00
|
|
|
fi
|
2011-05-10 11:14:40 +00:00
|
|
|
|
2013-06-10 13:55:03 +00:00
|
|
|
show settings SRCCONF=/dev/null -D${opt} | sort > $t/config_${opt}
|
|
|
|
comm -13 $t/config_default $t/config_${opt} | sed -n "/^${opt}$/!p" |
|
|
|
|
comm -13 $t/deps - > $t/deps2
|
|
|
|
|
|
|
|
# Work around BIND_UTILS=no being the default when every WITH_
|
|
|
|
# option is enabled.
|
|
|
|
if [ "$(cat $t/deps2)" == WITHOUT_BIND_UTILS ]; then
|
|
|
|
sort $t/deps $t/deps2 > $t/_deps
|
|
|
|
mv $t/_deps $t/deps
|
|
|
|
:> $t/deps2
|
|
|
|
fi
|
|
|
|
|
2011-05-10 11:14:40 +00:00
|
|
|
if [ -s $t/deps ] ; then
|
|
|
|
echo 'When set, it also enforces the following options:'
|
|
|
|
echo '.Pp'
|
|
|
|
echo '.Bl -item -compact'
|
|
|
|
cat $t/deps | while read opt2 ; do
|
|
|
|
echo '.It'
|
|
|
|
echo ".Va ${opt2}"
|
2006-03-21 09:05:42 +00:00
|
|
|
done
|
2011-05-10 11:14:40 +00:00
|
|
|
echo '.El'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -s $t/deps2 ] ; then
|
|
|
|
if [ -s $t/deps ] ; then
|
|
|
|
echo '.Pp'
|
|
|
|
fi
|
|
|
|
echo 'When set, the following options are also in effect:'
|
|
|
|
echo '.Pp'
|
|
|
|
echo '.Bl -inset -compact'
|
|
|
|
cat $t/deps2 | while read opt2 ; do
|
|
|
|
echo ".It Va ${opt2}"
|
|
|
|
noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/')
|
|
|
|
echo '(unless'
|
|
|
|
echo ".Va ${noopt}"
|
|
|
|
echo 'is set explicitly)'
|
|
|
|
done
|
|
|
|
echo '.El'
|
2006-03-21 09:05:42 +00:00
|
|
|
fi
|
2011-05-10 13:01:11 +00:00
|
|
|
twiddle >&2
|
2006-03-21 09:05:42 +00:00
|
|
|
done
|
|
|
|
cat <<EOF
|
|
|
|
.El
|
|
|
|
.Sh FILES
|
2012-05-30 02:37:20 +00:00
|
|
|
.Bl -tag -compact -width Pa
|
2006-03-21 09:05:42 +00:00
|
|
|
.It Pa /etc/src.conf
|
|
|
|
.It Pa /usr/share/mk/bsd.own.mk
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr make 1 ,
|
|
|
|
.Xr make.conf 5 ,
|
|
|
|
.Xr build 7 ,
|
|
|
|
.Xr ports 7
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
file appeared in
|
|
|
|
.Fx 7.0 .
|
|
|
|
.Sh AUTHORS
|
|
|
|
This manual page was autogenerated.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2011-05-10 13:01:11 +00:00
|
|
|
twiddle_pos=0
|
|
|
|
twiddle()
|
|
|
|
{
|
|
|
|
local c0='|' c1='/' c2='-' c3='\'
|
|
|
|
|
|
|
|
eval printf '%c\\b' '$c'${twiddle_pos}
|
|
|
|
twiddle_pos=$(((twiddle_pos+1)%4))
|
|
|
|
}
|
|
|
|
|
2006-03-21 09:05:42 +00:00
|
|
|
main
|