1c5922fbfSRuslan Ermilov#!/bin/sh 2c5922fbfSRuslan Ermilov# 3c5922fbfSRuslan Ermilov# This file is in the public domain. 4c5922fbfSRuslan Ermilov 52701a1b7SRuslan Ermilovset -o errexit 62701a1b7SRuslan Ermilov 7c5922fbfSRuslan Ermilovident='$FreeBSD$' 8c5922fbfSRuslan Ermilov 92701a1b7SRuslan Ermilovt=$(mktemp -d -t makeman) 102701a1b7SRuslan Ermilovtrap 'test -d $t && rm -rf $t' exit 112701a1b7SRuslan Ermilov 12c5922fbfSRuslan Ermilov# 132701a1b7SRuslan Ermilov# usage: no_targets all_targets yes_targets 142701a1b7SRuslan Ermilov# 152701a1b7SRuslan Ermilovno_targets() 162701a1b7SRuslan Ermilov{ 172701a1b7SRuslan Ermilov for t1 in $1 ; do 182701a1b7SRuslan Ermilov for t2 in $2 ; do 192701a1b7SRuslan Ermilov if [ "${t1}" = "${t2}" ] ; then 202701a1b7SRuslan Ermilov continue 2 212701a1b7SRuslan Ermilov fi 222701a1b7SRuslan Ermilov done 232701a1b7SRuslan Ermilov echo ${t1} 242701a1b7SRuslan Ermilov done 252701a1b7SRuslan Ermilov} 262701a1b7SRuslan Ermilov 272701a1b7SRuslan Ermilovshow_options() 282701a1b7SRuslan Ermilov{ 292701a1b7SRuslan Ermilov ALL_TARGETS=$(echo $(make -C ../../.. targets | tail -n +2)) 302701a1b7SRuslan Ermilov rm -f $t/settings 312701a1b7SRuslan Ermilov for target in ${ALL_TARGETS} ; do 322701a1b7SRuslan Ermilov make -C ../../.. showconfig \ 332701a1b7SRuslan Ermilov SRCCONF=/dev/null __MAKE_CONF=/dev/null \ 342701a1b7SRuslan Ermilov TARGET_ARCH=${target#*/} TARGET=${target%/*} | 352701a1b7SRuslan Ermilov while read var _ val ; do 362701a1b7SRuslan Ermilov opt=${var#MK_} 372701a1b7SRuslan Ermilov case ${val} in 382701a1b7SRuslan Ermilov yes) 392701a1b7SRuslan Ermilov echo ${opt} ${target} 402701a1b7SRuslan Ermilov ;; 412701a1b7SRuslan Ermilov no) 422701a1b7SRuslan Ermilov echo ${opt} 432701a1b7SRuslan Ermilov ;; 442701a1b7SRuslan Ermilov *) 452701a1b7SRuslan Ermilov echo 'make showconfig broken' >&2 462701a1b7SRuslan Ermilov exit 1 472701a1b7SRuslan Ermilov ;; 482701a1b7SRuslan Ermilov esac 492701a1b7SRuslan Ermilov done > $t/settings.target 502701a1b7SRuslan Ermilov if [ -r $t/settings ] ; then 512701a1b7SRuslan Ermilov join -t\ $t/settings $t/settings.target > $t/settings.new 522701a1b7SRuslan Ermilov mv $t/settings.new $t/settings 532701a1b7SRuslan Ermilov else 542701a1b7SRuslan Ermilov mv $t/settings.target $t/settings 552701a1b7SRuslan Ermilov fi 562701a1b7SRuslan Ermilov done 572701a1b7SRuslan Ermilov 582701a1b7SRuslan Ermilov cat $t/settings | while read opt targets ; do 592701a1b7SRuslan Ermilov if [ "${targets}" = "${ALL_TARGETS}" ] ; then 602701a1b7SRuslan Ermilov echo "WITHOUT_${opt}" 612701a1b7SRuslan Ermilov elif [ -z "${targets}" ] ; then 622701a1b7SRuslan Ermilov echo "WITH_${opt}" 632701a1b7SRuslan Ermilov else 642701a1b7SRuslan Ermilov echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}") 652701a1b7SRuslan Ermilov echo "WITH_${opt} ${targets}" 662701a1b7SRuslan Ermilov fi 672701a1b7SRuslan Ermilov done 682701a1b7SRuslan Ermilov} 692701a1b7SRuslan Ermilov 702701a1b7SRuslan Ermilov# 712701a1b7SRuslan Ermilov# usage: show { settings | with | without } ... 72c5922fbfSRuslan Ermilov# 73c5922fbfSRuslan Ermilovshow() 74c5922fbfSRuslan Ermilov{ 75c5922fbfSRuslan Ermilov 76c5922fbfSRuslan Ermilov mode=$1 ; shift 77c5922fbfSRuslan Ermilov case ${mode} in 78c5922fbfSRuslan Ermilov settings) 79c5922fbfSRuslan Ermilov yes_prefix=WITH 80c5922fbfSRuslan Ermilov no_prefix=WITHOUT 81c5922fbfSRuslan Ermilov ;; 822701a1b7SRuslan Ermilov with) 832701a1b7SRuslan Ermilov yes_prefix=WITH 84c5922fbfSRuslan Ermilov no_prefix=WITH 85c5922fbfSRuslan Ermilov ;; 862701a1b7SRuslan Ermilov without) 872701a1b7SRuslan Ermilov yes_prefix=WITHOUT 882701a1b7SRuslan Ermilov no_prefix=WITHOUT 892701a1b7SRuslan Ermilov ;; 90c5922fbfSRuslan Ermilov *) 912701a1b7SRuslan Ermilov echo 'internal error' >&2 92c5922fbfSRuslan Ermilov exit 1 93c5922fbfSRuslan Ermilov ;; 94c5922fbfSRuslan Ermilov esac 952701a1b7SRuslan Ermilov make -C ../../.. "$@" showconfig __MAKE_CONF=/dev/null | 96c5922fbfSRuslan Ermilov while read var _ val ; do 97c5922fbfSRuslan Ermilov opt=${var#MK_} 98c5922fbfSRuslan Ermilov case ${val} in 99c5922fbfSRuslan Ermilov yes) 100c5922fbfSRuslan Ermilov echo ${yes_prefix}_${opt} 101c5922fbfSRuslan Ermilov ;; 102c5922fbfSRuslan Ermilov no) 103c5922fbfSRuslan Ermilov echo ${no_prefix}_${opt} 104c5922fbfSRuslan Ermilov ;; 105c5922fbfSRuslan Ermilov *) 1062701a1b7SRuslan Ermilov echo 'make showconfig broken' >&2 107c5922fbfSRuslan Ermilov exit 1 108c5922fbfSRuslan Ermilov ;; 109c5922fbfSRuslan Ermilov esac 110c5922fbfSRuslan Ermilov done 111c5922fbfSRuslan Ermilov} 112c5922fbfSRuslan Ermilov 113c5922fbfSRuslan Ermilovmain() 114c5922fbfSRuslan Ermilov{ 115c5922fbfSRuslan Ermilov 116c5922fbfSRuslan Ermilov ident=${ident#$} 117c5922fbfSRuslan Ermilov ident=${ident% $} 11841c8ddc3SRuslan Ermilov fbsdid='$'FreeBSD'$' 119c5922fbfSRuslan Ermilov cat <<EOF 120c5922fbfSRuslan Ermilov.\" DO NOT EDIT-- this file is automatically generated. 121c5922fbfSRuslan Ermilov.\" from ${ident} 122c5922fbfSRuslan Ermilov.\" ${fbsdid} 1232701a1b7SRuslan Ermilov.Dd $(echo $(LC_TIME=C date +'%B %e, %Y')) 124c5922fbfSRuslan Ermilov.Dt SRC.CONF 5 125c5922fbfSRuslan Ermilov.Os 126c5922fbfSRuslan Ermilov.Sh NAME 127c5922fbfSRuslan Ermilov.Nm src.conf 12857caf3d6STom Rhodes.Nd "source build options" 129c5922fbfSRuslan Ermilov.Sh DESCRIPTION 130c5922fbfSRuslan ErmilovThe 131c5922fbfSRuslan Ermilov.Nm 132c5922fbfSRuslan Ermilovfile contains settings that will apply to every build involving the 133c5922fbfSRuslan Ermilov.Fx 134c5922fbfSRuslan Ermilovsource tree; see 135c5922fbfSRuslan Ermilov.Xr build 7 . 136c5922fbfSRuslan Ermilov.Pp 137c5922fbfSRuslan ErmilovThe 138c5922fbfSRuslan Ermilov.Nm 139c5922fbfSRuslan Ermilovfile uses the standard makefile syntax. 140c5922fbfSRuslan ErmilovHowever, 141c5922fbfSRuslan Ermilov.Nm 142c5922fbfSRuslan Ermilovshould not specify any dependencies to 143c5922fbfSRuslan Ermilov.Xr make 1 . 144c5922fbfSRuslan ErmilovInstead, 145c5922fbfSRuslan Ermilov.Nm 146c5922fbfSRuslan Ermilovis to set 147c5922fbfSRuslan Ermilov.Xr make 1 148c5922fbfSRuslan Ermilovvariables that control the aspects of how the system builds. 149c5922fbfSRuslan Ermilov.Pp 150c5922fbfSRuslan ErmilovThe default location of 151c5922fbfSRuslan Ermilov.Nm 152c5922fbfSRuslan Ermilovis 153c5922fbfSRuslan Ermilov.Pa /etc/src.conf , 154c5922fbfSRuslan Ermilovthough an alternative location can be specified in the 155c5922fbfSRuslan Ermilov.Xr make 1 156c5922fbfSRuslan Ermilovvariable 157c5922fbfSRuslan Ermilov.Va SRCCONF . 158c5922fbfSRuslan ErmilovOverriding the location of 159c5922fbfSRuslan Ermilov.Nm 160c5922fbfSRuslan Ermilovmay be necessary if the system-wide settings are not suitable 161c5922fbfSRuslan Ermilovfor a particular build. 162c5922fbfSRuslan ErmilovFor instance, setting 163c5922fbfSRuslan Ermilov.Va SRCCONF 164c5922fbfSRuslan Ermilovto 165c5922fbfSRuslan Ermilov.Pa /dev/null 166c5922fbfSRuslan Ermiloveffectively resets all build controls to their defaults. 167c5922fbfSRuslan Ermilov.Pp 168c5922fbfSRuslan ErmilovThe only purpose of 169c5922fbfSRuslan Ermilov.Nm 170c5922fbfSRuslan Ermilovis to control the compilation of the 171c5922fbfSRuslan Ermilov.Fx 17257caf3d6STom Rhodessource code, which is usually located in 173c5922fbfSRuslan Ermilov.Pa /usr/src . 174c5922fbfSRuslan ErmilovAs a rule, the system administrator creates 175c5922fbfSRuslan Ermilov.Nm 176c5922fbfSRuslan Ermilovwhen the values of certain control variables need to be changed 177c5922fbfSRuslan Ermilovfrom their defaults. 178c5922fbfSRuslan Ermilov.Pp 179c5922fbfSRuslan ErmilovIn addition, control variables can be specified 180c5922fbfSRuslan Ermilovfor a particular build via the 181c5922fbfSRuslan Ermilov.Fl D 182c5922fbfSRuslan Ermilovoption of 183c5922fbfSRuslan Ermilov.Xr make 1 1843d919b75SMike Makonnenor in its environment; see 185c5922fbfSRuslan Ermilov.Xr environ 7 . 186c5922fbfSRuslan Ermilov.Pp 18707b7d7fbSTom RhodesThe values of variables are ignored regardless of their setting; 18857caf3d6STom Rhodeseven if they would be set to 189c5922fbfSRuslan Ermilov.Dq Li FALSE 190c5922fbfSRuslan Ermilovor 19157caf3d6STom Rhodes.Dq Li NO . 19257caf3d6STom RhodesJust the existence of an option will cause 19357caf3d6STom Rhodesit to be honoured by 19457caf3d6STom Rhodes.Xr make 1 . 195c5922fbfSRuslan Ermilov.Pp 196c5922fbfSRuslan ErmilovThe following list provides a name and short description for variables 197c5922fbfSRuslan Ermilovthat can be used for source builds. 198c5922fbfSRuslan Ermilov.Bl -tag -width indent 199c5922fbfSRuslan ErmilovEOF 2002701a1b7SRuslan Ermilov show settings SRCCONF=/dev/null | sort > $t/config_default 201*f506e293SEd Maste # Work around WITH_LDNS_UTILS forcing BIND_UTILS off by parsing the 202*f506e293SEd Maste # actual config that results from enabling every WITH_ option. This 203*f506e293SEd Maste # can be reverted if/when we no longer have options that disable 204*f506e293SEd Maste # others. 205*f506e293SEd Maste show with SRCCONF=/dev/null | sort | sed 's/$/=/' > $t/src.conf 206*f506e293SEd Maste show settings SRCCONF=$t/src.conf | sort > $t/config_WITH_ALL 2072701a1b7SRuslan Ermilov show without SRCCONF=/dev/null | sort > $t/config_WITHOUT_ALL 2082701a1b7SRuslan Ermilov 2092701a1b7SRuslan Ermilov show_options | 2102701a1b7SRuslan Ermilov while read opt targets ; do 2112701a1b7SRuslan Ermilov if [ ! -f ${opt} ] ; then 2122701a1b7SRuslan Ermilov echo "no description found for ${opt}, skipping" >&2 213c3b08cc6SYaroslav Tykhiy continue 214cae68befSRuslan Ermilov fi 215cae68befSRuslan Ermilov 2162701a1b7SRuslan Ermilov echo ".It Va ${opt}" 2172701a1b7SRuslan Ermilov sed -e's/\$\(FreeBSD: .*\) \$/from \1/' ${opt} 2182701a1b7SRuslan Ermilov if [ -n "${targets}" ] ; then 2192701a1b7SRuslan Ermilov echo '.Pp' 2202701a1b7SRuslan Ermilov echo 'It is a default setting on' 2212701a1b7SRuslan Ermilov echo $(echo ${targets} | sed -e's/ /, /g' -e's/\(.*\), /\1 and /'). 222c5922fbfSRuslan Ermilov fi 2232701a1b7SRuslan Ermilov 224cae68befSRuslan Ermilov if [ "${opt%%_*}" = 'WITHOUT' ] ; then 2252701a1b7SRuslan Ermilov sed -n "/^WITH_${opt#WITHOUT_}$/!s/$/=/p" $t/config_WITH_ALL > $t/src.conf 2262701a1b7SRuslan Ermilov show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITH_ALL_${opt} 2272701a1b7SRuslan Ermilov comm -13 $t/config_WITH_ALL $t/config_WITH_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps 228cae68befSRuslan Ermilov elif [ "${opt%%_*}" = 'WITH' ] ; then 2292701a1b7SRuslan Ermilov sed -n "/^WITHOUT${opt#WITH}$/!s/$/=/p" $t/config_WITHOUT_ALL > $t/src.conf 2302701a1b7SRuslan Ermilov show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITHOUT_ALL_${opt} 2312701a1b7SRuslan Ermilov comm -13 $t/config_WITHOUT_ALL $t/config_WITHOUT_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps 2322701a1b7SRuslan Ermilov else 2332701a1b7SRuslan Ermilov echo 'internal error' >&2 2342701a1b7SRuslan Ermilov exit 1 2352701a1b7SRuslan Ermilov fi 2362701a1b7SRuslan Ermilov 237*f506e293SEd Maste show settings SRCCONF=/dev/null -D${opt} | sort > $t/config_${opt} 238*f506e293SEd Maste comm -13 $t/config_default $t/config_${opt} | sed -n "/^${opt}$/!p" | 239*f506e293SEd Maste comm -13 $t/deps - > $t/deps2 240*f506e293SEd Maste 241*f506e293SEd Maste # Work around BIND_UTILS=no being the default when every WITH_ 242*f506e293SEd Maste # option is enabled. 243*f506e293SEd Maste if [ "$(cat $t/deps2)" == WITHOUT_BIND_UTILS ]; then 244*f506e293SEd Maste sort $t/deps $t/deps2 > $t/_deps 245*f506e293SEd Maste mv $t/_deps $t/deps 246*f506e293SEd Maste :> $t/deps2 247*f506e293SEd Maste fi 248*f506e293SEd Maste 2492701a1b7SRuslan Ermilov if [ -s $t/deps ] ; then 2502701a1b7SRuslan Ermilov echo 'When set, it also enforces the following options:' 2512701a1b7SRuslan Ermilov echo '.Pp' 2522701a1b7SRuslan Ermilov echo '.Bl -item -compact' 2532701a1b7SRuslan Ermilov cat $t/deps | while read opt2 ; do 2542701a1b7SRuslan Ermilov echo '.It' 2552701a1b7SRuslan Ermilov echo ".Va ${opt2}" 256c5922fbfSRuslan Ermilov done 2572701a1b7SRuslan Ermilov echo '.El' 2582701a1b7SRuslan Ermilov fi 2592701a1b7SRuslan Ermilov 2602701a1b7SRuslan Ermilov if [ -s $t/deps2 ] ; then 2612701a1b7SRuslan Ermilov if [ -s $t/deps ] ; then 2622701a1b7SRuslan Ermilov echo '.Pp' 2632701a1b7SRuslan Ermilov fi 2642701a1b7SRuslan Ermilov echo 'When set, the following options are also in effect:' 2652701a1b7SRuslan Ermilov echo '.Pp' 2662701a1b7SRuslan Ermilov echo '.Bl -inset -compact' 2672701a1b7SRuslan Ermilov cat $t/deps2 | while read opt2 ; do 2682701a1b7SRuslan Ermilov echo ".It Va ${opt2}" 2692701a1b7SRuslan Ermilov noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/') 2702701a1b7SRuslan Ermilov echo '(unless' 2712701a1b7SRuslan Ermilov echo ".Va ${noopt}" 2722701a1b7SRuslan Ermilov echo 'is set explicitly)' 2732701a1b7SRuslan Ermilov done 2742701a1b7SRuslan Ermilov echo '.El' 275c5922fbfSRuslan Ermilov fi 276e6a714e7SRuslan Ermilov twiddle >&2 277c5922fbfSRuslan Ermilov done 278c5922fbfSRuslan Ermilov cat <<EOF 279c5922fbfSRuslan Ermilov.El 280c5922fbfSRuslan Ermilov.Sh FILES 281691b39b5SGlen Barber.Bl -tag -compact -width Pa 282c5922fbfSRuslan Ermilov.It Pa /etc/src.conf 283c5922fbfSRuslan Ermilov.It Pa /usr/share/mk/bsd.own.mk 284c5922fbfSRuslan Ermilov.El 285c5922fbfSRuslan Ermilov.Sh SEE ALSO 286c5922fbfSRuslan Ermilov.Xr make 1 , 287c5922fbfSRuslan Ermilov.Xr make.conf 5 , 288c5922fbfSRuslan Ermilov.Xr build 7 , 289c5922fbfSRuslan Ermilov.Xr ports 7 290c5922fbfSRuslan Ermilov.Sh HISTORY 291c5922fbfSRuslan ErmilovThe 292c5922fbfSRuslan Ermilov.Nm 293c5922fbfSRuslan Ermilovfile appeared in 294c5922fbfSRuslan Ermilov.Fx 7.0 . 295c5922fbfSRuslan Ermilov.Sh AUTHORS 296c5922fbfSRuslan ErmilovThis manual page was autogenerated. 297c5922fbfSRuslan ErmilovEOF 298c5922fbfSRuslan Ermilov} 299c5922fbfSRuslan Ermilov 300e6a714e7SRuslan Ermilovtwiddle_pos=0 301e6a714e7SRuslan Ermilovtwiddle() 302e6a714e7SRuslan Ermilov{ 303e6a714e7SRuslan Ermilov local c0='|' c1='/' c2='-' c3='\' 304e6a714e7SRuslan Ermilov 305e6a714e7SRuslan Ermilov eval printf '%c\\b' '$c'${twiddle_pos} 306e6a714e7SRuslan Ermilov twiddle_pos=$(((twiddle_pos+1)%4)) 307e6a714e7SRuslan Ermilov} 308e6a714e7SRuslan Ermilov 309c5922fbfSRuslan Ermilovmain 310