1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: scripts/config.in
3 # Copyright (C) 2004 - 2021 The T2 SDE Project
4 # Copyright (C) 1998 - 2003 ROCK Linux Project
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
15 # Execution of sub-scripts:
17 # - architecture/*/preconfig.in
18 # - kernel/*/preconfig.in
20 # - misc/*/preconfig.in
21 # - target/*/preconfig.in
22 # - package/*/*/preconfig.in
25 # * target/$SDECFG_TARGET/config.in
26 # - target/$SDECFG_TARGET/inconfig.in
28 # * Selecting Architecture
29 # * architecture/$SDECFG_ARCH/config.in
32 # * kernel/$SDECFG_KERNEL/config.in
34 # - target/$SDECFG_TARGET/pkgsel{,.sed,.awk,.in}
36 # * {package/*,misc}/*/config-n.in (n<500)
38 # * {package/*,misc}/*/config{,-n}.in (n>=500)
39 # * Various common build options
41 # - package/*/*/postconfig.in
42 # - misc/*/postconfig.in
43 # - architecture/$SDECFG_ARCH/postconfig.in
44 # - kernel/$SDECFG_KERNEL/postconfig.in
45 # - target/$SDECFG_TARGET/postconfig.in
47 # Only procedures marked with '*' might interact with the user.
49 # Naming-scheme for extening config variables:
52 # Archs: SDECFG_ARCH_<Arch-Name>_*
53 # Kernels: SDECFG_KERNEL_<Kernel-Name>_*
54 # Targets: SDECFG_TRG_<Target-Name>_*
55 # Packages: SDECFG_PKG_<Pkg-Name>_*
57 # Config-Internal Variables:
60 # Archs: CFGTEMP_ARCH_<Arch-Name>_*
61 # Kernels: CFGTEMP_Kernel_<Kernel-Name>_*
62 # Targets: CFGTEMP_TRG_<Target-Name>_*
63 # Packages: CFGTEMP_PKG_<Pkg-Name>_*
65 # Config Presets: SDECFGSET_*
73 . $cfgtmpdir/misc-preconfig.in
74 . $cfgtmpdir/target-preconfig.in
75 . $cfgtmpdir/package-preconfig.in
77 comment_id '- Target Distribution' COMMENT_TARGET
80 choice SDECFG_TARGET generic $CFGTEMP_TARGETLIST
81 SDECFG_ID="$SDECFG_ID-$SDECFG_TARGET"
83 # detect the target chain
84 targetchain="$SDECFG_TARGET"; x="$SDECFG_TARGET"
85 while [ -f "target/$x/extends" ]; do
86 x="$(< target/$x/extends)"
87 targetchain="$targetchain $x"
90 # config.in it foreward order
91 for target in $targetchain; do
92 if [ -f target/$target/config.in ]
93 then . target/$target/config.in; fi
96 for target in $( get_reverted $targetchain ); do
97 if [ -f target/$target/inconfig.in ]
98 then . target/$target/inconfig.in; fi
101 if [ "$CFGTEMP_IMAGELIST" ]; then
102 choice SDECFG_IMAGE install $CFGTEMP_IMAGELIST
103 if [ -f target/share/$SDECFG_IMAGE/config.in ]
104 then . target/share/$SDECFG_IMAGE/config.in; fi
108 . $cfgtmpdir/architecture-preconfig.in
109 . $cfgtmpdir/kernel-preconfig.in
112 comment_id '- Architecture, CPU and Optimization' COMMENT_ARCHCPUOPT
114 choice SDECFG_ARCH "$SDECFG_ARCH" $CFGTEMP_ARCHLIST
115 SDECFG_ID="$SDECFG_ID-$SDECFG_ARCH"
117 if [ -f architecture/$SDECFG_ARCH/config.in ]
118 then . architecture/$SDECFG_ARCH/config.in; fi
119 bool 'Enable software floating point' SDECFG_SOFTFLOAT 0
120 bool 'Enable LTO (Link Time Optimisations)' SDECFG_LTO 0
121 bool 'This is a cross-build between architectures' SDECFG_CROSSBUILD 0
122 if [ "$SDECFG_CROSSBUILD" = 1 ]; then
123 # enable cross toolchain ? for stage 0 and 1
124 # enable all packages flagged CROSS for stage 2,
125 # and wipe all other stage marks
126 pkgfilter sed 's,^\(. \)?,\10, ; s,^\(. .\)?,\11, ; s,^\(. ..\)?,\12, ;
127 / CROSS /s/^\(. .-\)./\12/ ;
128 s,^\(. ...\)[^ ]*,\1-------, ;
129 s,^X ----------,O ----------,'
130 SDECFG_ID="$SDECFG_ID-cross"; SDECFGSET_USE_CROSSCC=1
134 choice SDECFG_OPT speed \
135 none 'Disable optimization (debugging fastest build)' \
136 debug 'Optimize debugging experience' \
137 lazy 'Lazy optimization (debugging and fast building)' \
138 size 'Optimise for size (sometimes faster)' \
139 size-vect 'Optimise for size with vectorization' \
140 speed 'Optimise for speed (recommended)' \
141 speed-vect 'Optimize for speed with vectorization' \
142 fast 'Optimise for more speed' \
143 smart 'Smart optimization using a profile database' \
144 smartly 'Smartly optimization using a profile database' \
145 smarter 'Smarter optimization using a profile database'
147 choice SDECFG_DEBUG 0 \
148 0 'Create binaries without debug symbols' \
149 1 'Create binaries with built-in debug symbols' \
150 2 'Create binaries with separate debug symbols'
152 [ "$SDECFG_DEBUG" == 2 ] &&
153 text 'Path for storing debugging files' SDECFG_DEBUG_PATH "debug"
157 comment_id '- Kernel, Operating System' COMMENT_KERNELOS
159 choice SDECFG_KERNEL "$SDECFG_KERNEL" $CFGTEMP_KERNELLIST
160 SDECFG_ID="$SDECFG_ID-$SDECFG_KERNEL"
162 if [ -f kernel/$SDECFG_KERNEL/config.in ]
163 then . kernel/$SDECFG_KERNEL/config.in; fi
167 # pkgsel in backward order
168 for target in $( get_reverted $targetchain ); do
169 [ -f target/$target/pkgsel ] &&
170 pkgsel_parse target/$target/pkgsel
171 [ -f target/$target/pkgsel.awk ] &&
172 pkgfilter awk -f target/$target/pkgsel.awk
173 [ -f target/$target/pkgsel.sed ] &&
174 pkgfilter sed -f target/$target/pkgsel.sed
175 [ -f target/$target/pkgsel.in ] &&
176 . target/$target/pkgsel.in
178 [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
183 if test -f config/$config/license-issue.ask; then
185 comment_id '- Licensing issues' COMMENT_LICENSE
188 if [ "$SDECFG_LICENSE_ISSUE" != 1 ]; then
189 comment ' This distribution may contain software that is not publicly'
190 comment ' distributable. Please check the following to testify that you'
191 comment ' are aware of this fact.'
193 comment ' The following packages may contain such restrictive licenses:'
195 for i in $(< config/$config/license-issue.ask); do
203 bool 'I have read and understood the licensing issues.' SDECFG_LICENSE_ISSUE 0
208 comment_id '- Build System Configuration' COMMENT_BUILD_SYS_CONF
210 choice SDECFG_CONTINUE_ON_ERROR_AFTER 4 \
211 0 'Continue on package error after stage 0 (toolchain)' \
212 1 'Continue on package error after stage 1 (cross)' \
213 2 'Continue on package error after stage 2' \
214 3 'Continue on package error after stage 3' \
215 4 'Continue on package error after stage 4' \
216 5 'Continue on package error after stage 5' \
217 6 'Continue on package error after stage 6' \
218 7 'Continue on package error after stage 7' \
219 8 'Continue on package error after stage 8' \
220 9 'Always abort on package error'
222 bool 'Retry building broken packages' SDECFG_RETRY_BROKEN 0
223 bool 'Do not try building packages if deps failed' \
224 SDECFG_NOBROKENDEPS 0
225 choice SDECFG_KEEP_SRC 1 \
226 0 'Never keep src dirs (even not on build error)' \
227 1 'Keep src dirs on build errors' \
228 2 'Keep src dirs for packages from a list' \
229 3 'Keep src dirs for packages from a list and on error'
231 case "$SDECFG_KEEP_SRC" in
232 2|3) text 'Packages to keep the src dirs for' SDECFG_KEEP_SRC_LIST ''
236 bool 'Create debug information (xtrace) for builds' SDECFG_XTRACE 0
238 bool 'Use TMPFS for building packages' SDECFG_SRC_TMPFS 0
239 if [ "$SDECFG_SRC_TMPFS" = 1 ]; then
241 comment 'WARNING: This may deadlock your system, if you overcommit memory!'
242 text 'TMPFS mount options' SDECFG_SRC_TMPFS_OPT 'size=66%'
243 bool 'Do not unmount build-dir tmpfs on pkg build error' \
244 SDECFG_SRC_TMPFS_KEEP_ON_ERROR 0
249 # Apply custom package selection
250 if [ "$SDECFG_PKGSEL" = 1 -a -f config/$config/pkgsel ]; then
251 # Active error checking: explicitly show an annoying popup
252 filter=`printf "^[-xXoO=][ \t]\+[a-zA-Z0-9_/*+.-]"`
253 if grep -lvq "$filter" config/$config/pkgsel 2> /dev/null; then
254 if [ -n "$oldconfig" ]; then
255 echo "Invalid line(s) in package rule set will be removed"
256 grep -nv "$filter" config/$config/pkgsel
258 grep "$filter" config/$config/pkgsel \
259 > $cfgtmpdir/pkgsel.new
260 mv $cfgtmpdir/pkgsel.new config/$config/pkgsel
261 elif ./src/confdialog.bin --title "Build Config" --yesno \
262 "Invalid line(s) in package rule set. Remove?" 5 50
264 grep "$filter" config/$config/pkgsel \
265 > $cfgtmpdir/pkgsel.new
266 mv $cfgtmpdir/pkgsel.new config/$config/pkgsel
271 pkgsel_parse config/$config/pkgsel
275 if [ -d /sys/devices/ ]; then
276 cpus=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`
278 cpus=`grep '^processor[[:blank:]]:' /proc/cpuinfo | wc -l`
281 SDECFG_PARALLEL_MAX="`echo $SDECFG_PARALLEL_MAX | sed 's,[^0-9],,g'`"
282 text 'Maximum number of jobs to be executed in parallel' \
283 SDECFG_PARALLEL_MAX $cpus
288 # this is warranted to exist
289 . $cfgtmpdir/noexpert-config.in
294 bool 'Show expert and experimental options' SDECFG_EXPERT 0
300 comment '- Binary package format'
302 choice SDECFG_PKGFILE_TYPE tar.zst \
303 tar.bz2 'Create tar.bz2 binary packages' \
304 tar.gz 'Create tar.gz binary packages' \
305 tar.lzo 'Create tar.lzo binary packages' \
306 tar.lzma 'Create tar.lzma binary packages' \
307 tar.xz 'Create tar.xz binary packages' \
308 tar.zst 'Create tar.zst binary packages' \
309 gem 'Create gem binary packages' \
310 none 'Create no binary packages'
311 bool 'Append version number to package files' SDECFG_PKGFILE_VER 1
315 comment '- Additional Package Selection'
317 bool 'Custom package selection' SDECFG_PKGSEL 0
318 if [ "$SDECFG_PKGSEL" = 1 ]; then
319 menu_begin MENU_PKGSEL_RULES 'Edit package selection rules'
320 editfile SDECFG_PKGSEL_FILE config/$config/pkgsel \
321 'Package selection rules'
323 if [ "$CFGTEMP_PKGSEL_ERROR" = 1 ]; then
324 comment '---- Syntax error(s) in rule set!'
327 [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
330 rm -f config/$config/pkgsel $cfgtmpdir/pkgsel.awk
332 startprog SDECFG_SHOW_PKGLIST 'Show the current package list' \
333 "./src/confdialog.bin --title 'T2 Config - Package List' \
334 --backtitle 'T2 $sdever Configuration' \
335 --textbox $cfgtmpdir/packages.txt \
336 $(( $lines - 4 )) $(( $columns - 5 ))"
341 # this is warranted to exist
342 . $cfgtmpdir/expert-config.in
345 comment '- Additional GNU Configure Options'
347 editfile SDECFG_CONFOPT_FILE config/$config/confopt \
348 'GNU Configure Options'
349 if [ -f config/$config/confopt ]; then
350 const SDECFG_CONFIGURE_OPTS "`tr '\n' ' ' \
351 < config/$config/confopt`"
353 const SDECFG_CONFIGURE_OPTS ""
355 for option in $SDECFG_CONFIGURE_OPTS; do
356 if [ "${option#--with-}" = "$option" -a \
357 "${option#--without-}" = "$option" ]
359 comment '---- Warning! The custom options may
367 text 'Additional compiler flags' SDECFG_C_FLAGS ""
370 comment_id '- Flist detection technique' COMMENT_FLIST
372 choice SDECFG_FLIST flwrapper \
373 flwrapper 'Use the flist wrapper library for flist creation' \
374 strace 'Use strace to get the file list' \
375 find 'Use find on timestamp-file for flist creation'
379 comment '- Various Options'
381 bool 'Bootstrap a new, clean and up-to-date toolchain' SDECFG_USE_CROSSCC 1
382 bool 'Make rebuild stage (stage 9)' SDECFG_DO_REBUILD_STAGE 0
384 if [ $SDECFG_CROSSBUILD != 1 ]; then
385 bool 'Run a check/test for packages with support' SDECFG_DO_CHECK 0
388 if [ $SDECFG_USE_CROSSCC != 1 ]; then
389 pkgfilter sed 's,^\([XO] \)0,\1-,'
392 if [ $SDECFG_DO_REBUILD_STAGE != 1 ]; then
393 pkgfilter sed 's,^\([XO] [0-8?-]*\)9 ,\1- ,'
396 bool 'Create statically linked binaries' SDECFG_STATIC 0
397 bool 'Move static libraries from /lib* to /usr/lib*' SDECFG_STATIC_IN_USR 0
398 bool 'Enable ld --as-needed' SDECFG_LD_AS_NEEDED 0
399 bool 'Enable PIE (Position Independent Code)' SDECFG_PIE 0
401 bool 'Disable exceptions and rtti in C++' SDECFG_LIMITCXX 0
402 bool 'Enable c-compiler multilib support' SDECFG_MULTILIB 0
404 bool 'Disable National Language Support' SDECFG_DISABLE_NLS 0
406 bool 'Automatic documentation creation' SDECFG_CREATE_DOCS 0
408 bool 'Create cache files after packages have been built' \
409 SDECFG_CREATE_CACHE 1
411 bool 'Run Paranoia Checks in Build-Target and Build-Pkg' \
412 SDECFG_PARANOIA_CHECK 1
414 bool 'Abbreviate Config ID with checksum' SDECFG_IDCKSUM 0
418 . $cfgtmpdir/package-postconfig.in
419 . $cfgtmpdir/misc-postconfig.in
420 . $cfgtmpdir/architecture-postconfig.in
421 . $cfgtmpdir/target-postconfig.in
423 # discard unselected, and set conditional stage 0 ? accordingly
424 pkgfilter sed '/^[XO] --* / d; s/^X ?1/X 01/; s/^X ?-/X --/'
426 [ $SDECFG_EXPERT = 1 ] ||
427 SDECFG_ID="`echo $SDECFG_ID | sed 's,-noexpert.*,,'`"
429 [ "$SDECFG_IDCKSUM" = 1 ] &&
430 SDECFG_ID="`echo $SDECFG_ID | cksum | cut -f1 -d' '`"
432 const SDECFG_SHORTID "$SDECFG_ID"
433 SDECFG_ID="$config-$SDECFG_ID"