1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: scripts/config.in
3 # Copyright (C) 2004 - 2024 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 Link Time Optimisations (LTO)' 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 smartly \
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' \
139 speed 'Optimise for speed' \
140 fast 'Optimise for more speed' \
141 faster 'Optimise for even more speed' \
142 smartly 'Smartly optimization using a profile DB (Ox/O2)' \
143 smart 'Smart optimization using a profile DB (Ox/O2, C++ more)' \
144 smarter 'Smarter optimization using a profile DB (Ox/O3)' \
145 smartest 'Smartest optimization using a profile DB (Ox/Ofast)'
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"
155 bool 'Enable Position Independent Code (PIE)' SDECFG_PIE 1
156 bool 'Enable Stack Smashing Protector (SSP)' SDECFG_SSP 1
157 bool 'Initialize automatic variables (with zero)' SDECFG_AUTO_VAR_INIT 0
161 comment_id '- Kernel, Operating System' COMMENT_KERNELOS
163 choice SDECFG_KERNEL "$SDECFG_KERNEL" $CFGTEMP_KERNELLIST
164 SDECFG_ID="$SDECFG_ID-$SDECFG_KERNEL"
166 if [ -f kernel/$SDECFG_KERNEL/config.in ]
167 then . kernel/$SDECFG_KERNEL/config.in; fi
171 # pkgsel in backward order
172 for target in $(get_reverted $targetchain); do
173 [ -f target/$target/pkgsel ] &&
174 pkgsel_parse target/$target/pkgsel
175 [ -f target/$target/pkgsel.awk ] &&
176 pkgfilter gawk -f target/$target/pkgsel.awk
177 [ -f target/$target/pkgsel.sed ] &&
178 pkgfilter sed -f target/$target/pkgsel.sed
179 [ -f target/$target/pkgsel.in ] &&
180 . target/$target/pkgsel.in
182 [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
187 if test -f config/$config/license-issue.ask; then
189 comment_id '- Licensing issues' COMMENT_LICENSE
192 if [ "$SDECFG_LICENSE_ISSUE" != 1 ]; then
193 comment ' This distribution may contain software that is not publicly'
194 comment ' distributable. Please check the following to testify that you'
195 comment ' are aware of this fact.'
197 comment ' The following packages may contain such restrictive licenses:'
199 for i in $(< config/$config/license-issue.ask); do
207 bool 'I have read and understood the licensing issues.' SDECFG_LICENSE_ISSUE 0
212 comment_id '- Build System Configuration' COMMENT_BUILD_SYS_CONF
214 choice SDECFG_CONTINUE_ON_ERROR_AFTER 4 \
215 0 'Continue on package error after stage 0 (toolchain)' \
216 1 'Continue on package error after stage 1 (cross)' \
217 2 'Continue on package error after stage 2' \
218 3 'Continue on package error after stage 3' \
219 4 'Continue on package error after stage 4' \
220 5 'Continue on package error after stage 5' \
221 6 'Continue on package error after stage 6' \
222 7 'Continue on package error after stage 7' \
223 8 'Continue on package error after stage 8' \
224 9 'Always abort on package error'
226 bool 'Retry building broken packages' SDECFG_RETRY_BROKEN 0
227 bool 'Do not try building packages if deps failed' \
228 SDECFG_NOBROKENDEPS 0
229 choice SDECFG_KEEP_SRC 2 \
230 0 'Never keep src dirs' \
231 1 'Always keep src dirs' \
232 2 'Keep src dirs on build errors' \
233 3 'Keep src dirs for packages from a list' \
234 4 'Keep src dirs for packages from a list and on error'
236 case "$SDECFG_KEEP_SRC" in
237 3|4) text 'Packages to keep the src dirs for' SDECFG_KEEP_SRC_LIST ''
241 bool 'Create debug information (xtrace) for builds' SDECFG_XTRACE 0
243 bool 'Use TmpFS for building packages' SDECFG_SRC_TMPFS 0
244 if [ "$SDECFG_SRC_TMPFS" = 1 ]; then
246 comment 'WARNING: This may deadlock your system, if you overcommit memory!'
247 text 'TmpFS mount options' SDECFG_SRC_TMPFS_OPT 'size=66%'
248 text 'Max compressed package source size in MB for using TmpFS' \
249 SDECFG_SRC_TMPFS_MAX_SIZE 32
250 bool 'Do not unmount build-dir TmpFS on pkg build error' \
251 SDECFG_SRC_TMPFS_KEEP_ON_ERROR 1
256 # Apply custom package selection
257 if [ "$SDECFG_PKGSEL" = 1 -a -f config/$config/pkgsel ]; then
258 # Active error checking: explicitly show an annoying popup
259 filter=`printf "^[-xXoO=][ \t]\+[a-zA-Z0-9_/*+.-]"`
260 if grep -lvq "$filter" config/$config/pkgsel 2> /dev/null; then
261 if [ -n "$oldconfig" ]; then
262 echo "Invalid line(s) in package rule set will be removed"
263 grep -nv "$filter" config/$config/pkgsel
265 grep "$filter" config/$config/pkgsel \
266 > $cfgtmpdir/pkgsel.new
267 mv $cfgtmpdir/pkgsel.new config/$config/pkgsel
268 elif src/confdialog.bin --title "Build Config" --yesno \
269 "Invalid line(s) in package rule set. Remove?" 5 50
271 grep "$filter" config/$config/pkgsel \
272 > $cfgtmpdir/pkgsel.new
273 mv $cfgtmpdir/pkgsel.new config/$config/pkgsel
278 pkgsel_parse config/$config/pkgsel
282 SDECFG_PARALLEL_MAX="`echo $SDECFG_PARALLEL_MAX | grep -o -e '[0-9]*' -e 'auto'`"
283 text 'Maximum number of jobs to be executed in parallel' \
284 SDECFG_PARALLEL_MAX auto
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.br 'Create tar.br binary packages' \
304 tar.bz2 'Create tar.bz2 binary packages' \
305 tar.gz 'Create tar.gz binary packages' \
306 tar.lzo 'Create tar.lzo binary packages' \
307 tar.lzma 'Create tar.lzma binary packages' \
308 tar.xz 'Create tar.xz binary packages' \
309 tar.zst 'Create tar.zst binary packages' \
310 gem 'Create gem binary packages' \
311 none 'Create no binary packages'
312 bool 'Append version number to package files' SDECFG_PKGFILE_VER 1
316 comment '- Additional Package Selection'
318 bool 'Custom package selection' SDECFG_PKGSEL 0
319 if [ "$SDECFG_PKGSEL" = 1 ]; then
320 menu_begin MENU_PKGSEL_RULES 'Edit package selection rules'
321 editfile SDECFG_PKGSEL_FILE config/$config/pkgsel \
322 'Package selection rules'
324 if [ "$CFGTEMP_PKGSEL_ERROR" = 1 ]; then
325 comment '---- Syntax error(s) in rule set!'
328 [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
331 rm -f config/$config/pkgsel $cfgtmpdir/pkgsel.awk
333 startprog SDECFG_SHOW_PKGLIST 'Show the current package list' \
334 "src/confdialog.bin --title 'T2 Config - Package List' \
335 --backtitle 'T2 $sdever Configuration' \
336 --textbox $cfgtmpdir/packages.txt \
337 $(($lines - 4)) $(($columns - 5))"
342 # this is warranted to exist
343 . $cfgtmpdir/expert-config.in
346 comment '- Additional GNU Configure Options'
348 editfile SDECFG_CONFOPT_FILE config/$config/confopt \
349 'GNU Configure Options'
350 if [ -f config/$config/confopt ]; then
351 const SDECFG_CONFIGURE_OPTS "`tr '\n' ' ' \
352 < config/$config/confopt`"
354 const SDECFG_CONFIGURE_OPTS ""
356 for option in $SDECFG_CONFIGURE_OPTS; do
357 if [ "${option#--with-}" = "$option" -a \
358 "${option#--without-}" = "$option" ]
360 comment '---- Warning! The custom options may
368 text 'Additional compiler flags' SDECFG_C_FLAGS ""
371 comment_id '- Flist detection technique' COMMENT_FLIST
373 choice SDECFG_FLIST flwrapper \
374 flwrapper 'Use the flist wrapper library for flist creation' \
375 strace 'Use strace to get the file list' \
376 find 'Use find on timestamp-file for flist creation'
380 comment '- Various Options'
382 bool 'Bootstrap a new, clean and up-to-date toolchain' SDECFG_USE_CROSSCC 1
383 bool 'Make rebuild stage (stage 9)' SDECFG_DO_REBUILD_STAGE 0
385 if [ $SDECFG_CROSSBUILD != 1 ]; then
386 bool 'Run a check/test for packages with support' SDECFG_DO_CHECK 0
389 if [ $SDECFG_USE_CROSSCC != 1 ]; then
390 pkgfilter sed 's,^\([XO] \)0,\1-,'
393 if [ $SDECFG_DO_REBUILD_STAGE != 1 ]; then
394 pkgfilter sed 's,^\([XO] [0-8?-]*\)9 ,\1- ,'
397 bool 'Create statically linked binaries' SDECFG_STATIC 0
398 bool 'Move static libraries from /lib* to /usr/lib*' SDECFG_STATIC_IN_USR 0
399 bool 'Enable ld --as-needed' SDECFG_LD_AS_NEEDED 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"