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