OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

418 lines
12 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: lib/sde-config/main.in
  5. # Copyright (C) 2006 - 2007 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 1998 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. #
  17. # Main config script
  18. #
  19. # Execution of sub-scripts:
  20. #
  21. # - architecture/*/preconfig.in
  22. #
  23. # - misc/*/preconfig.in
  24. # - lib/*/preconfig.in
  25. # - target/*/preconfig.in
  26. # - package/*/*/preconfig.in
  27. #
  28. # * Selecting Target
  29. # * target/$SDECFG_TARGET/config.in
  30. # - target/$SDECFG_TARGET/inconfig.in
  31. #
  32. # * Selecting Architecture
  33. # * architecture/$SDECFG_ARCH/config.in
  34. #
  35. # - target/$SDECFG_TARGET/pkgsel{,.sed,.awk,.in}
  36. #
  37. # * {package/*,misc,lib}/*/config-n.in (n<500)
  38. #
  39. # * {package/*,misc,lib}/*/config{,-n}.in (n>=500)
  40. # * Various common build options
  41. #
  42. # - package/*/*/postconfig.in
  43. # - misc/*/postconfig.in
  44. # - lib/*/postconfig.in
  45. # - architecture/$SDECFG_ARCH/postconfig.in
  46. # - target/$SDECFG_TARGET/postconfig.in
  47. #
  48. # Only procedures marked with '*' might interact with the user.
  49. #
  50. # Naming-scheme for extening config variables:
  51. #
  52. # Core: SDECFG_*
  53. # Archs: SDECFG_ARCH_<Arch-Name>_*
  54. # Targets: SDECFG_TRG_<Target-Name>_*
  55. # Packages: SDECFG_PKG_<Pkg-Name>_*
  56. #
  57. # Config-Internal Variables:
  58. #
  59. # Core: CFGTEMP_*
  60. # Archs: CFGTEMP_ARCH_<Arch-Name>_*
  61. # Targets: CFGTEMP_TRG_<Target-Name>_*
  62. # Packages: CFGTEMP_PKG_<Pkg-Name>_*
  63. #
  64. # Config Presets: SDECFGSET_*
  65. #
  66. CFGTEMP_ARCHLIST=
  67. CFGTEMP_TARGETLIST=
  68. CFGTEMP_IMAGELIST=
  69. . $cfgtmpdir/misc-preconfig.in
  70. . $cfgtmpdir/lib-preconfig.in
  71. . $cfgtmpdir/target-preconfig.in
  72. . $cfgtmpdir/package-preconfig.in
  73. comment_id '- Target Distribution' COMMENT_TARGET
  74. block_begin 7
  75. choice SDECFG_TARGET generic $CFGTEMP_TARGETLIST
  76. SDECFG_ID="$SDECFG_ID-$SDECFG_TARGET"
  77. # detect the target chain
  78. targetchain="$SDECFG_TARGET"; x="$SDECFG_TARGET"
  79. while [ -f "target/$x/extends" ]; do
  80. x="`cat target/$x/extends`"
  81. targetchain="$targetchain $x"
  82. done
  83. # config.in it foreward order
  84. for target in $targetchain; do
  85. if [ -f target/$target/config.in ]
  86. then . target/$target/config.in ; fi
  87. done
  88. for target in $( get_reverted $targetchain ); do
  89. if [ -f target/$target/inconfig.in ]
  90. then . target/$target/inconfig.in ; fi
  91. done
  92. if [ "$CFGTEMP_IMAGELIST" ]; then
  93. choice SDECFG_IMAGE install $CFGTEMP_IMAGELIST
  94. if [ -f target/share/$SDECFG_IMAGE/config.in ]; then
  95. . target/share/$SDECFG_IMAGE/config.in
  96. fi
  97. fi
  98. block_end
  99. . $cfgtmpdir/architecture-preconfig.in
  100. comment ' '
  101. comment_id '- Architecture, CPU and Optimization' COMMENT_ARCHCPUOPT
  102. block_begin 7
  103. choice SDECFG_ARCH $SDECFG_ARCH $CFGTEMP_ARCHLIST
  104. SDECFG_ID="$SDECFG_ID-$SDECFG_ARCH"
  105. if [ -f architecture/$SDECFG_ARCH/config.in ]
  106. then . architecture/$SDECFG_ARCH/config.in ; fi
  107. bool 'This is a cross-build between architectures' SDECFG_CROSSBUILD 0
  108. if [ "$SDECFG_CROSSBUILD" = 1 ] ; then
  109. pkgfilter sed -e 's,^\(. ..\)[^ ]*,\1--------,'
  110. SDECFG_ID="$SDECFG_ID-cross" ; SDECFGSET_USE_CROSSCC=1
  111. fi
  112. block_end
  113. block_begin 7
  114. # pkgsel in backward order
  115. for target in $( get_reverted $targetchain ); do
  116. if [ -f target/$target/pkgsel ]; then
  117. if [ target/$target/pkgsel -nt $cfgtmpdir/pkgsel.$target.awk ]
  118. then
  119. cat <<-EOT > $cfgtmpdir/pkgsel.$target.awk
  120. # created from target/$target/pkgsel
  121. #
  122. EOT
  123. lib/sde-config/pkgsel2awk.sh \
  124. target/$target/pkgsel >> $cfgtmpdir/pkgsel.$target.awk
  125. fi
  126. if [ -s $cfgtmpdir/pkgsel.$target.awk ]; then
  127. pkgfilter awk -f $cfgtmpdir/pkgsel.$target.awk
  128. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  129. else
  130. comment 'WARNING! something went wrong with target-pkgsel'
  131. fi
  132. elif [ -f target/$target/pkgsel.awk ]; then
  133. pkgfilter awk -f target/$target/pkgsel.awk
  134. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  135. elif [ -f target/$target/pkgsel.sed ]; then
  136. pkgfilter sed -f target/$target/pkgsel.sed
  137. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  138. elif [ -f target/$target/pkgsel.in ]; then
  139. . target/$target/pkgsel.in
  140. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  141. fi
  142. done
  143. block_end
  144. if test -f $cfgtmpdir/license-issue.ask; then
  145. comment ' '
  146. comment_id '- Licensing issues' COMMENT_LICENSE
  147. block_begin 7
  148. if [ "$SDECFG_LICENSE_ISSUE" != 1 ]; then
  149. comment ' This distribution may contain software that is not publicly'
  150. comment ' distributable. Please check the following to testify that you'
  151. comment ' are aware of this fact.'
  152. comment ' '
  153. comment ' The following packages may contain such restrictive licenses:'
  154. for i in `cat $cfgtmpdir/license-issue.ask`; do
  155. comment " $i"
  156. done
  157. comment ' '
  158. fi
  159. bool 'I have read and understood the licensing issues.' SDECFG_LICENSE_ISSUE 0
  160. block_end
  161. fi
  162. comment ' '
  163. comment_id '- Build System Configuration' COMMENT_BUILD_SYS_CONF
  164. block_begin 3
  165. choice SDECFG_ABORT_ON_ERROR_AFTER 4 \
  166. 0 'Continue if package-build fails after toolchain (native)' \
  167. 1 'Continue if package-build fails after toolchain (cross)' \
  168. 2 'Continue if package-build fails after stage 2' \
  169. 3 'Continue if package-build fails after stage 3' \
  170. 4 'Continue if package-build fails after stage 4' \
  171. 5 'Continue if package-build fails after stage 5' \
  172. 6 'Continue if package-build fails after stage 6' \
  173. 7 'Continue if package-build fails after stage 7' \
  174. 8 'Continue if package-build fails on rebuild stage' \
  175. 9 'Always abort if package-build fails'
  176. bool 'Retry building broken packages' SDECFG_RETRY_BROKEN 0
  177. bool 'Do not try building packages if deps failed' \
  178. SDECFG_NOBROKENDEPS 0
  179. bool 'Always clean up src dirs (even on pkg fail)' \
  180. SDECFG_ALWAYS_CLEAN 0
  181. bool 'Create debug information (xtrace) for builds' SDECFG_XTRACE 0
  182. bool 'Use TMPFS for building packages' SDECFG_SRC_TMPFS 0
  183. if [ "$SDECFG_SRC_TMPFS" = 1 ] ; then
  184. block_begin
  185. comment '! WARNING: This feature can hang your system, if'
  186. comment '! you do not have enough virtual memory!'
  187. text 'TMPFS mount options' SDECFG_SRC_TMPFS_OPT \
  188. 'size=800M,nr_inodes=100k'
  189. bool 'Write tmpfs log to var/adm/sde-debug/tmpfslog.txt' \
  190. SDECFG_SRC_TMPFS_LOG 0
  191. block_end
  192. fi
  193. block_end
  194. # Apply custom package selection
  195. if [ "$SDECFG_PKGSEL" = 1 -a -f $cfgtmpdir/config/pkgsel ] ; then
  196. # Active error checking: explicitly show an annoying popup
  197. filter=`printf "^[-xXoO][ \t]\+[a-zA-Z0-9_/*+.-]"`
  198. if grep -lvq "$filter" $cfgtmpdir/config/pkgsel 2> /dev/null; then
  199. if [ -n "$oldconfig" ]; then
  200. echo "Invalid line(s) in package rule set will be removed"
  201. grep -nv "$filter" $cfgtmpdir/config/pkgsel
  202. grep "$filter" $cfgtmpdir/config/pkgsel \
  203. > $cfgtmpdir/pkgsel.new
  204. mv $cfgtmpdir/pkgsel.new $cfgtmpdir/config/pkgsel
  205. elif ./tmp/confdialog.bin --title "Build Config" --yesno \
  206. "Invalid line(s) in package rule set. Remove?" 5 50
  207. then
  208. grep "$filter" $cfgtmpdir/config/pkgsel \
  209. > $cfgtmpdir/pkgsel.new
  210. mv $cfgtmpdir/pkgsel.new $cfgtmpdir/config/pkgsel
  211. fi
  212. fi
  213. unset filter
  214. cat <<-EOT > $cfgtmpdir/pkgsel.awk
  215. # created from config/$config/pkgsel
  216. #
  217. EOT
  218. lib/sde-config/pkgsel2awk.sh \
  219. $cfgtmpdir/config/pkgsel >> $cfgtmpdir/pkgsel.$target.awk
  220. pkgout
  221. gawk -f $cfgtmpdir/pkgsel.awk < $cfgtmpdir/config/packages \
  222. > $cfgtmpdir/packages.new 2> /dev/null
  223. if [ -s $cfgtmpdir/packages.new ] ; then
  224. mv $cfgtmpdir/packages.new $cfgtmpdir/config/packages
  225. else
  226. rm -f $cfgtmpdir/packages.new
  227. CFGTEMP_PKSEL_ERROR=1
  228. fi
  229. pkgin
  230. fi
  231. comment ' '
  232. if [ -d /sys/devices/ ]; then
  233. cpus=`ls -1d /sys/devices/system/cpu/*/ | wc -l`
  234. else
  235. cpus=`grep '^processor[[:blank:]]:' /proc/cpuinfo | wc -l`
  236. fi
  237. cpus=${cpus:-1}
  238. SDECFG_PARALLEL_MAX="`echo $SDECFG_PARALLEL_MAX | sed 's,[^0-9],,g'`"
  239. text "Maximum number of jobs to be executed in parallel ($cpus CPUs)" \
  240. SDECFG_PARALLEL_MAX $( expr $cpus \* 2 )
  241. unset cpus
  242. comment ' '
  243. block_begin 3
  244. # this is warranted to exist
  245. . $cfgtmpdir/noexpert-config.in
  246. block_end
  247. comment ' '
  248. block_begin 3
  249. bool 'Show expert and experimental options' SDECFG_EXPERT 0
  250. block_end
  251. expert_begin
  252. . $cfgtmpdir/cache_pkgfile_type.in
  253. comment ' '
  254. comment '- Additional Package Selection'
  255. block_begin 3
  256. bool 'Custom package selection' SDECFG_PKGSEL 0
  257. if [ "$SDECFG_PKGSEL" = 1 ] ; then
  258. menu_begin MENU_PKGSEL_RULES 'Edit package selection rules'
  259. editfile SDECFG_PKGSEL_FILE $cfgtmpdir/config/pkgsel \
  260. 'Package selection rules'
  261. if [ "$CFGTEMP_PKGSEL_ERROR" = 1 ]; then
  262. comment '---- Syntax error(s) in rule set!'
  263. fi
  264. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  265. menu_end
  266. else
  267. rm -f $cfgtmpdir/config/pkgsel $cfgtmpdir/pkgsel.awk
  268. fi
  269. startprog SDECFG_SHOW_PKGLIST 'Show the current package list' \
  270. "./tmp/confdialog.bin --title 'T2 Config - Package List' \
  271. --backtitle 'T2 $sdever Configuration' \
  272. --textbox $cfgtmpdir/packages.txt \
  273. $(( $lines - 4 )) $(( $columns - 5 ))"
  274. block_end
  275. comment ' '
  276. # this is warranted to exist
  277. . $cfgtmpdir/expert-config.in
  278. comment ' '
  279. comment '- Additional GNU Configure Options'
  280. block_begin 5
  281. editfile SDECFG_CONFOPT_FILE $cfgtmpdir/config/confopt \
  282. 'GNU Configure Options'
  283. if [ -f $cfgtmpdir/config/confopt ] ; then
  284. const SDECFG_CONFIGURE_OPTS "`tr '\n' ' ' \
  285. < $cfgtmpdir/config/confopt`"
  286. else
  287. const SDECFG_CONFIGURE_OPTS ""
  288. fi
  289. for option in $SDECFG_CONFIGURE_OPTS ; do
  290. if [ "${option#--with-}" = "$option" -a \
  291. "${option#--without-}" = "$option" ]
  292. then
  293. comment '---- Warning! The custom options may
  294. break packages!'
  295. break
  296. fi
  297. done
  298. block_end
  299. comment ' '
  300. text 'Additional compiler flags' SDECFG_C_FLAGS ""
  301. comment ' '
  302. comment_id '- Flist detection technique' COMMENT_FLIST
  303. block_begin 5
  304. choice SDECFG_FLIST flwrapper \
  305. flwrapper 'Use the flist wrapper library for flist creation' \
  306. strace 'Use strace to get the file list' \
  307. find 'Use find on timestamp-file for flist creation'
  308. block_end
  309. comment ' '
  310. comment '- Various Options'
  311. block_begin 5
  312. bool 'Bootstrap a new, clean and up-to-date toolchain' SDECFG_USE_CROSSCC 1
  313. bool 'Make rebuild stage (stage 9)' SDECFG_DO_REBUILD_STAGE 0
  314. if [ $SDECFG_CROSSBUILD != 1 ]; then
  315. bool 'Run a check/test for packages with support' SDECFG_DO_CHECK 0
  316. fi
  317. if [ $SDECFG_USE_CROSSCC != 1 ]; then
  318. pkgfilter sed 's,^\([XO] \)0,\1-,'
  319. fi
  320. if [ $SDECFG_DO_REBUILD_STAGE != 1 ]; then
  321. pkgfilter sed 's,^\([XO] [0-8-]*\)9 ,\1- ,'
  322. fi
  323. choice SDECFG_OPT speed \
  324. speed 'Hard optimise for speed (recommended)' \
  325. size 'Hard optimise for size (sometimes faster)' \
  326. lazy 'Lazy optimisation (debugging and fast building)' \
  327. smart 'Smart optimisation using a profile database'
  328. bool 'Create binaries with debug symbols' SDECFG_DEBUG 0
  329. bool 'Create statically linked binaries' SDECFG_STATIC 0
  330. bool 'Enable ld --as-needed' SDECFG_LD_AS_NEEDED 0
  331. bool 'Enable PIE (Position Independent Code)' SDECFG_PIE 0
  332. bool 'Disable exceptions and rtti in C++' SDECFG_LIMITCXX 0
  333. bool 'Enable c-compiler multilib support' SDECFG_MULTILIB 0
  334. bool 'Disable National Language Support' SDECFG_DISABLE_NLS 0
  335. if [ "$SDECFG_DISABLE_NLS" = 1 ] ; then
  336. pkgremove gettext
  337. fi
  338. bool 'Automatic documentation creation' SDECFG_CREATE_DOCS 0
  339. bool 'Create cache files after packages have been built' \
  340. SDECFG_CREATE_CACHE 1
  341. bool 'Run Paranoia Checks in Build-Target and Build-Pkg' \
  342. SDECFG_PARANOIA_CHECK 1
  343. bool 'Abbreviate Config ID with checksum' SDECFG_IDCKSUM 0
  344. block_end
  345. expert_end
  346. . $cfgtmpdir/package-postconfig.in
  347. . $cfgtmpdir/misc-postconfig.in
  348. . $cfgtmpdir/lib-postconfig.in
  349. . $cfgtmpdir/architecture-postconfig.in
  350. . $cfgtmpdir/target-postconfig.in
  351. pkgfilter sed '/^[XO] --* / d;'
  352. [ $SDECFG_EXPERT = 1 ] ||
  353. SDECFG_ID="`echo $SDECFG_ID | sed 's,-noexpert.*,,'`"
  354. [ "$SDECFG_IDCKSUM" = 1 ] &&
  355. SDECFG_ID="`echo $SDECFG_ID | cksum | cut -f1 -d' '`"
  356. const SDECFG_SHORTID "$SDECFG_ID"
  357. SDECFG_ID="$config-$SDECFG_ID"