1#!/bin/sh 2# 3# This file is in the public domain. 4 5set -o errexit 6 7ident='$FreeBSD$' 8 9t=$(mktemp -d -t makeman) 10trap 'test -d $t && rm -rf $t' exit 11 12# 13# usage: no_targets all_targets yes_targets 14# 15no_targets() 16{ 17 for t1 in $1 ; do 18 for t2 in $2 ; do 19 if [ "${t1}" = "${t2}" ] ; then 20 continue 2 21 fi 22 done 23 echo ${t1} 24 done 25} 26 27show_options() 28{ 29 ALL_TARGETS=$(echo $(make -C ../../.. targets | tail -n +2)) 30 rm -f $t/settings 31 for target in ${ALL_TARGETS} ; do 32 make -C ../../.. showconfig \ 33 SRCCONF=/dev/null __MAKE_CONF=/dev/null \ 34 TARGET_ARCH=${target#*/} TARGET=${target%/*} | 35 while read var _ val ; do 36 opt=${var#MK_} 37 case ${val} in 38 yes) 39 echo ${opt} ${target} 40 ;; 41 no) 42 echo ${opt} 43 ;; 44 *) 45 echo 'make showconfig broken' >&2 46 exit 1 47 ;; 48 esac 49 done > $t/settings.target 50 if [ -r $t/settings ] ; then 51 join -t\ $t/settings $t/settings.target > $t/settings.new 52 mv $t/settings.new $t/settings 53 else 54 mv $t/settings.target $t/settings 55 fi 56 done 57 58 cat $t/settings | while read opt targets ; do 59 if [ "${targets}" = "${ALL_TARGETS}" ] ; then 60 echo "WITHOUT_${opt}" 61 elif [ -z "${targets}" ] ; then 62 echo "WITH_${opt}" 63 else 64 echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}") 65 echo "WITH_${opt} ${targets}" 66 fi 67 done 68} 69 70# 71# usage: show { settings | with | without } ... 72# 73show() 74{ 75 76 mode=$1 ; shift 77 case ${mode} in 78 settings) 79 yes_prefix=WITH 80 no_prefix=WITHOUT 81 ;; 82 with) 83 yes_prefix=WITH 84 no_prefix=WITH 85 ;; 86 without) 87 yes_prefix=WITHOUT 88 no_prefix=WITHOUT 89 ;; 90 *) 91 echo 'internal error' >&2 92 exit 1 93 ;; 94 esac 95 make -C ../../.. "$@" showconfig __MAKE_CONF=/dev/null | 96 while read var _ val ; do 97 opt=${var#MK_} 98 case ${val} in 99 yes) 100 echo ${yes_prefix}_${opt} 101 ;; 102 no) 103 echo ${no_prefix}_${opt} 104 ;; 105 *) 106 echo 'make showconfig broken' >&2 107 exit 1 108 ;; 109 esac 110 done 111} 112 113main() 114{ 115 116 ident=${ident#$} 117 ident=${ident% $} 118 fbsdid='$'FreeBSD'$' 119 cat <<EOF 120.\" DO NOT EDIT-- this file is automatically generated. 121.\" from ${ident} 122.\" ${fbsdid} 123.Dd $(echo $(LC_TIME=C date +'%B %e, %Y')) 124.Dt SRC.CONF 5 125.Os 126.Sh NAME 127.Nm src.conf 128.Nd "source build options" 129.Sh DESCRIPTION 130The 131.Nm 132file contains settings that will apply to every build involving the 133.Fx 134source tree; see 135.Xr build 7 . 136.Pp 137The 138.Nm 139file uses the standard makefile syntax. 140However, 141.Nm 142should not specify any dependencies to 143.Xr make 1 . 144Instead, 145.Nm 146is to set 147.Xr make 1 148variables that control the aspects of how the system builds. 149.Pp 150The default location of 151.Nm 152is 153.Pa /etc/src.conf , 154though an alternative location can be specified in the 155.Xr make 1 156variable 157.Va SRCCONF . 158Overriding the location of 159.Nm 160may be necessary if the system-wide settings are not suitable 161for a particular build. 162For instance, setting 163.Va SRCCONF 164to 165.Pa /dev/null 166effectively resets all build controls to their defaults. 167.Pp 168The only purpose of 169.Nm 170is to control the compilation of the 171.Fx 172source code, which is usually located in 173.Pa /usr/src . 174As a rule, the system administrator creates 175.Nm 176when the values of certain control variables need to be changed 177from their defaults. 178.Pp 179In addition, control variables can be specified 180for a particular build via the 181.Fl D 182option of 183.Xr make 1 184or in its environment; see 185.Xr environ 7 . 186.Pp 187The values of variables are ignored regardless of their setting; 188even if they would be set to 189.Dq Li FALSE 190or 191.Dq Li NO . 192Just the existence of an option will cause 193it to be honoured by 194.Xr make 1 . 195.Pp 196The following list provides a name and short description for variables 197that can be used for source builds. 198.Bl -tag -width indent 199EOF 200 show settings SRCCONF=/dev/null | sort > $t/config_default 201 # Work around WITH_LDNS_UTILS forcing BIND_UTILS off by parsing the 202 # actual config that results from enabling every WITH_ option. This 203 # can be reverted if/when we no longer have options that disable 204 # others. 205 show with SRCCONF=/dev/null | sort | sed 's/$/=/' > $t/src.conf 206 show settings SRCCONF=$t/src.conf | sort > $t/config_WITH_ALL 207 show without SRCCONF=/dev/null | sort > $t/config_WITHOUT_ALL 208 209 show_options | 210 while read opt targets ; do 211 if [ ! -f ${opt} ] ; then 212 echo "no description found for ${opt}, skipping" >&2 213 continue 214 fi 215 216 echo ".It Va ${opt}" 217 sed -e's/\$\(FreeBSD: .*\) \$/from \1/' ${opt} 218 if [ -n "${targets}" ] ; then 219 echo '.Pp' 220 echo 'It is a default setting on' 221 echo $(echo ${targets} | sed -e's/ /, /g' -e's/\(.*\), /\1 and /'). 222 fi 223 224 if [ "${opt%%_*}" = 'WITHOUT' ] ; then 225 sed -n "/^WITH_${opt#WITHOUT_}$/!s/$/=/p" $t/config_WITH_ALL > $t/src.conf 226 show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITH_ALL_${opt} 227 comm -13 $t/config_WITH_ALL $t/config_WITH_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps 228 elif [ "${opt%%_*}" = 'WITH' ] ; then 229 sed -n "/^WITHOUT${opt#WITH}$/!s/$/=/p" $t/config_WITHOUT_ALL > $t/src.conf 230 show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITHOUT_ALL_${opt} 231 comm -13 $t/config_WITHOUT_ALL $t/config_WITHOUT_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps 232 else 233 echo 'internal error' >&2 234 exit 1 235 fi 236 237 show settings SRCCONF=/dev/null -D${opt} | sort > $t/config_${opt} 238 comm -13 $t/config_default $t/config_${opt} | sed -n "/^${opt}$/!p" | 239 comm -13 $t/deps - > $t/deps2 240 241 # Work around BIND_UTILS=no being the default when every WITH_ 242 # option is enabled. 243 if [ "$(cat $t/deps2)" = WITHOUT_BIND_UTILS ]; then 244 sort $t/deps $t/deps2 > $t/_deps 245 mv $t/_deps $t/deps 246 :> $t/deps2 247 fi 248 249 if [ -s $t/deps ] ; then 250 echo 'When set, it also enforces the following options:' 251 echo '.Pp' 252 echo '.Bl -item -compact' 253 cat $t/deps | while read opt2 ; do 254 echo '.It' 255 echo ".Va ${opt2}" 256 done 257 echo '.El' 258 fi 259 260 if [ -s $t/deps2 ] ; then 261 if [ -s $t/deps ] ; then 262 echo '.Pp' 263 fi 264 echo 'When set, the following options are also in effect:' 265 echo '.Pp' 266 echo '.Bl -inset -compact' 267 cat $t/deps2 | while read opt2 ; do 268 echo ".It Va ${opt2}" 269 noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/') 270 echo '(unless' 271 echo ".Va ${noopt}" 272 echo 'is set explicitly)' 273 done 274 echo '.El' 275 fi 276 twiddle >&2 277 done 278 cat <<EOF 279.El 280.Sh FILES 281.Bl -tag -compact -width Pa 282.It Pa /etc/src.conf 283.It Pa /usr/share/mk/bsd.own.mk 284.El 285.Sh SEE ALSO 286.Xr make 1 , 287.Xr make.conf 5 , 288.Xr build 7 , 289.Xr ports 7 290.Sh HISTORY 291The 292.Nm 293file appeared in 294.Fx 7.0 . 295.Sh AUTHORS 296This manual page was autogenerated. 297EOF 298} 299 300twiddle_pos=0 301twiddle() 302{ 303 local c0='|' c1='/' c2='-' c3='\' 304 305 eval printf '%c\\b' '$c'${twiddle_pos} 306 twiddle_pos=$(((twiddle_pos+1)%4)) 307} 308 309main 310