* updated mtools (4.0.34 -> 4.0.35)
[t2-trunk.git] / scripts / config.in
blob4a0bad5879c6afcbc72a1fb6de8d64be5c926865
1 #!/bin/bash
2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: scripts/config.in
4 # Copyright (C) 2004 - 2021 The T2 SDE Project
5 # Copyright (C) 1998 - 2003 ROCK Linux Project
6 #
7 # This Copyright note is generated by scripts/Create-CopyPatch,
8 # more information can be found in the files COPYING and README.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 # Main config script
18 # Execution of sub-scripts:
20 # - architecture/*/preconfig.in
21 # - kernel/*/preconfig.in
23 # - misc/*/preconfig.in
24 # - target/*/preconfig.in
25 # - package/*/*/preconfig.in
27 # * Selecting Target
28 # * target/$SDECFG_TARGET/config.in
29 # - target/$SDECFG_TARGET/inconfig.in
31 # * Selecting Architecture
32 # * architecture/$SDECFG_ARCH/config.in
34 # * Selecting Kernel
35 # * kernel/$SDECFG_KERNEL/config.in
37 # - target/$SDECFG_TARGET/pkgsel{,.sed,.awk,.in}
39 # * {package/*,misc}/*/config-n.in (n<500)
41 # * {package/*,misc}/*/config{,-n}.in (n>=500)
42 # * Various common build options
44 # - package/*/*/postconfig.in
45 # - misc/*/postconfig.in
46 # - architecture/$SDECFG_ARCH/postconfig.in
47 # - kernel/$SDECFG_KERNEL/postconfig.in
48 # - target/$SDECFG_TARGET/postconfig.in
50 # Only procedures marked with '*' might interact with the user.
52 # Naming-scheme for extening config variables:
54 # Core: SDECFG_*
55 # Archs: SDECFG_ARCH_<Arch-Name>_*
56 # Kernels: SDECFG_KERNEL_<Kernel-Name>_*
57 # Targets: SDECFG_TRG_<Target-Name>_*
58 # Packages: SDECFG_PKG_<Pkg-Name>_*
60 # Config-Internal Variables:
62 # Core: CFGTEMP_*
63 # Archs: CFGTEMP_ARCH_<Arch-Name>_*
64 # Kernels: CFGTEMP_Kernel_<Kernel-Name>_*
65 # Targets: CFGTEMP_TRG_<Target-Name>_*
66 # Packages: CFGTEMP_PKG_<Pkg-Name>_*
68 # Config Presets: SDECFGSET_*
71 CFGTEMP_ARCHLIST=""
72 CFGTEMP_KERNELLIST=""
73 CFGTEMP_TARGETLIST=""
74 CFGTEMP_IMAGELIST=""
76 . $cfgtmpdir/misc-preconfig.in
77 . $cfgtmpdir/target-preconfig.in
78 . $cfgtmpdir/package-preconfig.in
80 comment_id '- Target Distribution' COMMENT_TARGET
82 block_begin 7
83 choice SDECFG_TARGET generic $CFGTEMP_TARGETLIST
84 SDECFG_ID="$SDECFG_ID-$SDECFG_TARGET"
86 # detect the target chain
87 targetchain="$SDECFG_TARGET"; x="$SDECFG_TARGET"
88 while [ -f "target/$x/extends" ]; do
89 x="$(< target/$x/extends)"
90 targetchain="$targetchain $x"
91 done
93 # config.in it foreward order
94 for target in $targetchain; do
95 if [ -f target/$target/config.in ]
96 then . target/$target/config.in; fi
97 done
99 for target in $( get_reverted $targetchain ); do
100 if [ -f target/$target/inconfig.in ]
101 then . target/$target/inconfig.in; fi
102 done
104 if [ "$CFGTEMP_IMAGELIST" ]; then
105 choice SDECFG_IMAGE install $CFGTEMP_IMAGELIST
106 if [ -f target/share/$SDECFG_IMAGE/config.in ]
107 then . target/share/$SDECFG_IMAGE/config.in; fi
109 block_end
111 . $cfgtmpdir/architecture-preconfig.in
112 . $cfgtmpdir/kernel-preconfig.in
114 comment ' '
115 comment_id '- Architecture, CPU and Optimization' COMMENT_ARCHCPUOPT
116 block_begin 7
117 choice SDECFG_ARCH "$SDECFG_ARCH" $CFGTEMP_ARCHLIST
118 SDECFG_ID="$SDECFG_ID-$SDECFG_ARCH"
120 if [ -f architecture/$SDECFG_ARCH/config.in ]
121 then . architecture/$SDECFG_ARCH/config.in; fi
122 bool 'Enable software floating point' SDECFG_SOFTFLOAT 0
123 bool 'Enable LTO (Link Time Optimisations)' SDECFG_LTO 0
124 bool 'This is a cross-build between architectures' SDECFG_CROSSBUILD 0
125 if [ "$SDECFG_CROSSBUILD" = 1 ]; then
126 # enable cross toolchain ? for stage 0 and 1
127 # enable all packages flagged CROSS for stage 2,
128 # and wipe all other stage marks
129 pkgfilter sed 's,^\(. \)?,\10, ; s,^\(. .\)?,\11, ;
130 / CROSS /s/^\(. .-\)./\12/ ;
131 s,^\(. ...\)[^ ]*,\1-------, ;
132 s,^X ----------,O ----------,'
133 SDECFG_ID="$SDECFG_ID-cross"; SDECFGSET_USE_CROSSCC=1
136 comment ' '
137 choice SDECFG_OPT speed \
138 none 'Disable optimization (debugging fastest build)' \
139 debug 'Optimize debugging experience' \
140 lazy 'Lazy optimization (debugging and fast building)' \
141 size 'Optimise for size (sometimes faster)' \
142 size-vect 'Optimise for size with vectorization' \
143 speed 'Optimise for speed (recommended)' \
144 speed-vect 'Optimize for speed with vectorization' \
145 fast 'Optimise for more speed' \
146 smart 'Smart optimization using a profile database' \
147 smarter 'Smarter optimization using a profile database'
149 choice SDECFG_DEBUG 0 \
150 0 'Create binaries without debug symbols' \
151 1 'Create binaries with built-in debug symbols' \
152 2 'Create binaries with separate debug symbols'
154 [ "$SDECFG_DEBUG" == 2 ] &&
155 text 'Path for storing debugging files' SDECFG_DEBUG_PATH "debug"
156 block_end
158 comment ' '
159 comment_id '- Kernel, Operating System' COMMENT_KERNELOS
160 block_begin 7
161 choice SDECFG_KERNEL "$SDECFG_KERNEL" $CFGTEMP_KERNELLIST
162 SDECFG_ID="$SDECFG_ID-$SDECFG_KERNEL"
164 if [ -f kernel/$SDECFG_KERNEL/config.in ]
165 then . kernel/$SDECFG_KERNEL/config.in; fi
166 block_end
168 block_begin 7
169 # pkgsel in backward order
170 for target in $( get_reverted $targetchain ); do
171 [ -f target/$target/pkgsel ] &&
172 pkgsel_parse target/$target/pkgsel
173 [ -f target/$target/pkgsel.awk ] &&
174 pkgfilter awk -f target/$target/pkgsel.awk
175 [ -f target/$target/pkgsel.sed ] &&
176 pkgfilter sed -f target/$target/pkgsel.sed
177 [ -f target/$target/pkgsel.in ] &&
178 . target/$target/pkgsel.in
180 [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
181 done
183 block_end
185 if test -f config/$config/license-issue.ask; then
186 comment ' '
187 comment_id '- Licensing issues' COMMENT_LICENSE
189 block_begin 7
190 if [ "$SDECFG_LICENSE_ISSUE" != 1 ]; then
191 comment ' This distribution may contain software that is not publicly'
192 comment ' distributable. Please check the following to testify that you'
193 comment ' are aware of this fact.'
194 comment ' '
195 comment ' The following packages may contain such restrictive licenses:'
197 for i in $(< config/$config/license-issue.ask); do
198 comment " $i"
199 done
201 comment ' '
205 bool 'I have read and understood the licensing issues.' SDECFG_LICENSE_ISSUE 0
206 block_end
209 comment ' '
210 comment_id '- Build System Configuration' COMMENT_BUILD_SYS_CONF
211 block_begin 3
212 choice SDECFG_CONTINUE_ON_ERROR_AFTER 4 \
213 0 'Continue on package error after stage 0 (toolchain)' \
214 1 'Continue on package error after stage 1 (cross)' \
215 2 'Continue on package error after stage 2' \
216 3 'Continue on package error after stage 3' \
217 4 'Continue on package error after stage 4' \
218 5 'Continue on package error after stage 5' \
219 6 'Continue on package error after stage 6' \
220 7 'Continue on package error after stage 7' \
221 8 'Continue on package error after stage 8' \
222 9 'Always abort on package error'
224 bool 'Retry building broken packages' SDECFG_RETRY_BROKEN 0
225 bool 'Do not try building packages if deps failed' \
226 SDECFG_NOBROKENDEPS 0
227 choice SDECFG_KEEP_SRC 1 \
228 0 'Never keep src dirs (even not on build error)' \
229 1 'Keep src dirs on build errors' \
230 2 'Keep src dirs for packages from a list' \
231 3 'Keep src dirs for packages from a list and on error'
233 case "$SDECFG_KEEP_SRC" in
234 2|3) text 'Packages to keep the src dirs for' SDECFG_KEEP_SRC_LIST ''
236 esac
238 bool 'Create debug information (xtrace) for builds' SDECFG_XTRACE 0
240 bool 'Use TMPFS for building packages' SDECFG_SRC_TMPFS 0
241 if [ "$SDECFG_SRC_TMPFS" = 1 ]; then
242 block_begin
243 comment 'WARNING: This can hang your system, if you do not have enough memory!'
244 text 'TMPFS mount options' SDECFG_SRC_TMPFS_OPT \
245 'size=16G,nr_inodes=2M'
246 bool 'Do not unmount build-dir tmpfs on pkg build error' \
247 SDECFG_SRC_TMPFS_KEEP_ON_ERROR 0
248 bool 'Write tmpfs log to var/adm/t2-debug/tmpfslog.txt' \
249 SDECFG_SRC_TMPFS_LOG 0
250 block_end
252 block_end
254 # Apply custom package selection
255 if [ "$SDECFG_PKGSEL" = 1 -a -f config/$config/pkgsel ]; then
256 # Active error checking: explicitly show an annoying popup
257 filter=`printf "^[-xXoO=][ \t]\+[a-zA-Z0-9_/*+.-]"`
258 if grep -lvq "$filter" config/$config/pkgsel 2> /dev/null; then
259 if [ -n "$oldconfig" ]; then
260 echo "Invalid line(s) in package rule set will be removed"
261 grep -nv "$filter" config/$config/pkgsel
263 grep "$filter" config/$config/pkgsel \
264 > $cfgtmpdir/pkgsel.new
265 mv $cfgtmpdir/pkgsel.new config/$config/pkgsel
266 elif ./src/confdialog.bin --title "Build Config" --yesno \
267 "Invalid line(s) in package rule set. Remove?" 5 50
268 then
269 grep "$filter" config/$config/pkgsel \
270 > $cfgtmpdir/pkgsel.new
271 mv $cfgtmpdir/pkgsel.new config/$config/pkgsel
274 unset filter
276 pkgsel_parse config/$config/pkgsel
279 comment ' '
280 if [ -d /sys/devices/ ]; then
281 cpus=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`
282 else
283 cpus=`grep '^processor[[:blank:]]:' /proc/cpuinfo | wc -l`
285 cpus=${cpus:-1}
286 SDECFG_PARALLEL_MAX="`echo $SDECFG_PARALLEL_MAX | sed 's,[^0-9],,g'`"
287 text 'Maximum number of jobs to be executed in parallel' \
288 SDECFG_PARALLEL_MAX $cpus
289 unset cpus
291 comment ' '
292 block_begin 3
293 # this is warranted to exist
294 . $cfgtmpdir/noexpert-config.in
295 block_end
297 comment ' '
298 block_begin 3
299 bool 'Show expert and experimental options' SDECFG_EXPERT 0
300 block_end
302 expert_begin
304 comment ' '
305 comment '- Binary package format'
306 block_begin 3
307 choice SDECFG_PKGFILE_TYPE tar.zst \
308 tar.bz2 'Create tar.bz2 binary packages' \
309 tar.gz 'Create tar.gz binary packages' \
310 tar.lzo 'Create tar.lzo binary packages' \
311 tar.lzma 'Create tar.lzma binary packages' \
312 tar.xz 'Create tar.xz binary packages' \
313 tar.zst 'Create tar.zst binary packages' \
314 gem 'Create gem binary packages' \
315 none 'Create no binary packages'
316 bool 'Append version number to package files' SDECFG_PKGFILE_VER 1
317 block_end
319 comment ' '
320 comment '- Additional Package Selection'
321 block_begin 3
322 bool 'Custom package selection' SDECFG_PKGSEL 0
323 if [ "$SDECFG_PKGSEL" = 1 ]; then
324 menu_begin MENU_PKGSEL_RULES 'Edit package selection rules'
325 editfile SDECFG_PKGSEL_FILE config/$config/pkgsel \
326 'Package selection rules'
328 if [ "$CFGTEMP_PKGSEL_ERROR" = 1 ]; then
329 comment '---- Syntax error(s) in rule set!'
332 [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
333 menu_end
334 else
335 rm -f config/$config/pkgsel $cfgtmpdir/pkgsel.awk
337 startprog SDECFG_SHOW_PKGLIST 'Show the current package list' \
338 "./src/confdialog.bin --title 'T2 Config - Package List' \
339 --backtitle 'T2 $sdever Configuration' \
340 --textbox $cfgtmpdir/packages.txt \
341 $(( $lines - 4 )) $(( $columns - 5 ))"
342 block_end
344 comment ' '
346 # this is warranted to exist
347 . $cfgtmpdir/expert-config.in
349 comment ' '
350 comment '- Additional GNU Configure Options'
351 block_begin 5
352 editfile SDECFG_CONFOPT_FILE config/$config/confopt \
353 'GNU Configure Options'
354 if [ -f config/$config/confopt ]; then
355 const SDECFG_CONFIGURE_OPTS "`tr '\n' ' ' \
356 < config/$config/confopt`"
357 else
358 const SDECFG_CONFIGURE_OPTS ""
360 for option in $SDECFG_CONFIGURE_OPTS; do
361 if [ "${option#--with-}" = "$option" -a \
362 "${option#--without-}" = "$option" ]
363 then
364 comment '---- Warning! The custom options may
365 break packages!'
366 break
368 done
369 block_end
371 comment ' '
372 text 'Additional compiler flags' SDECFG_C_FLAGS ""
374 comment ' '
375 comment_id '- Flist detection technique' COMMENT_FLIST
376 block_begin 5
377 choice SDECFG_FLIST flwrapper \
378 flwrapper 'Use the flist wrapper library for flist creation' \
379 strace 'Use strace to get the file list' \
380 find 'Use find on timestamp-file for flist creation'
381 block_end
383 comment ' '
384 comment '- Various Options'
385 block_begin 5
386 bool 'Bootstrap a new, clean and up-to-date toolchain' SDECFG_USE_CROSSCC 1
387 bool 'Make rebuild stage (stage 9)' SDECFG_DO_REBUILD_STAGE 0
389 if [ $SDECFG_CROSSBUILD != 1 ]; then
390 bool 'Run a check/test for packages with support' SDECFG_DO_CHECK 0
393 if [ $SDECFG_USE_CROSSCC != 1 ]; then
394 pkgfilter sed 's,^\([XO] \)0,\1-,'
397 if [ $SDECFG_DO_REBUILD_STAGE != 1 ]; then
398 pkgfilter sed 's,^\([XO] [0-8?-]*\)9 ,\1- ,'
401 bool 'Create statically linked binaries' SDECFG_STATIC 0
402 bool 'Move static libraries from /lib* to /usr/lib*' SDECFG_STATIC_IN_USR 0
403 bool 'Enable ld --as-needed' SDECFG_LD_AS_NEEDED 0
404 bool 'Enable PIE (Position Independent Code)' SDECFG_PIE 0
406 bool 'Disable exceptions and rtti in C++' SDECFG_LIMITCXX 0
407 bool 'Enable c-compiler multilib support' SDECFG_MULTILIB 0
409 bool 'Disable National Language Support' SDECFG_DISABLE_NLS 0
411 bool 'Automatic documentation creation' SDECFG_CREATE_DOCS 0
413 bool 'Create cache files after packages have been built' \
414 SDECFG_CREATE_CACHE 1
416 bool 'Run Paranoia Checks in Build-Target and Build-Pkg' \
417 SDECFG_PARANOIA_CHECK 1
419 bool 'Abbreviate Config ID with checksum' SDECFG_IDCKSUM 0
420 block_end
421 expert_end
423 . $cfgtmpdir/package-postconfig.in
424 . $cfgtmpdir/misc-postconfig.in
425 . $cfgtmpdir/architecture-postconfig.in
426 . $cfgtmpdir/target-postconfig.in
428 # discard unselected, and set conditional stage 0 ? accordingly
429 pkgfilter sed '/^[XO] --* / d; s/^X ?1/X 01/; s/^X ?-/X --/'
431 [ $SDECFG_EXPERT = 1 ] ||
432 SDECFG_ID="`echo $SDECFG_ID | sed 's,-noexpert.*,,'`"
434 [ "$SDECFG_IDCKSUM" = 1 ] &&
435 SDECFG_ID="`echo $SDECFG_ID | cksum | cut -f1 -d' '`"
437 const SDECFG_SHORTID "$SDECFG_ID"
438 SDECFG_ID="$config-$SDECFG_ID"