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.

414 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. ( echo "# created from 'target-pkgsel'"
  120. pkgsel_init
  121. pkgsel_parse < target/$target/pkgsel
  122. pkgsel_finish
  123. ) > $cfgtmpdir/pkgsel.$target.awk
  124. fi
  125. if [ -s $cfgtmpdir/pkgsel.$target.awk ]; then
  126. pkgfilter awk -f $cfgtmpdir/pkgsel.$target.awk
  127. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  128. else
  129. comment 'WARNING! something went wrong with target-pkgsel'
  130. fi
  131. elif [ -f target/$target/pkgsel.awk ]; then
  132. pkgfilter awk -f target/$target/pkgsel.awk
  133. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  134. elif [ -f target/$target/pkgsel.sed ]; then
  135. pkgfilter sed -f target/$target/pkgsel.sed
  136. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  137. elif [ -f target/$target/pkgsel.in ]; then
  138. . target/$target/pkgsel.in
  139. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  140. fi
  141. done
  142. block_end
  143. if test -f $cfgtmpdir/license-issue.ask; then
  144. comment ' '
  145. comment_id '- Licensing issues' COMMENT_LICENSE
  146. block_begin 7
  147. if [ "$SDECFG_LICENSE_ISSUE" != 1 ]; then
  148. comment ' This distribution may contain software that is not publicly'
  149. comment ' distributable. Please check the following to testify that you'
  150. comment ' are aware of this fact.'
  151. comment ' '
  152. comment ' The following packages may contain such restrictive licenses:'
  153. for i in `cat $cfgtmpdir/license-issue.ask`; do
  154. comment " $i"
  155. done
  156. comment ' '
  157. fi
  158. bool 'I have read and understood the licensing issues.' SDECFG_LICENSE_ISSUE 0
  159. block_end
  160. fi
  161. comment ' '
  162. comment_id '- Build System Configuration' COMMENT_BUILD_SYS_CONF
  163. block_begin 3
  164. choice SDECFG_ABORT_ON_ERROR_AFTER 4 \
  165. 0 'Continue if package-build fails after toolchain (native)' \
  166. 1 'Continue if package-build fails after toolchain (cross)' \
  167. 2 'Continue if package-build fails after stage 2' \
  168. 3 'Continue if package-build fails after stage 3' \
  169. 4 'Continue if package-build fails after stage 4' \
  170. 5 'Continue if package-build fails after stage 5' \
  171. 6 'Continue if package-build fails after stage 6' \
  172. 7 'Continue if package-build fails after stage 7' \
  173. 8 'Continue if package-build fails on rebuild stage' \
  174. 9 'Always abort if package-build fails'
  175. bool 'Retry building broken packages' SDECFG_RETRY_BROKEN 0
  176. bool 'Do not try building packages if deps failed' \
  177. SDECFG_NOBROKENDEPS 0
  178. bool 'Always clean up src dirs (even on pkg fail)' \
  179. SDECFG_ALWAYS_CLEAN 0
  180. bool 'Create debug information (xtrace) for builds' SDECFG_XTRACE 0
  181. bool 'Use TMPFS for building packages' SDECFG_SRC_TMPFS 0
  182. if [ "$SDECFG_SRC_TMPFS" = 1 ] ; then
  183. block_begin
  184. comment '! WARNING: This feature can hang your system, if'
  185. comment '! you do not have enough virtual memory!'
  186. text 'TMPFS mount options' SDECFG_SRC_TMPFS_OPT \
  187. 'size=800M,nr_inodes=100k'
  188. bool 'Write tmpfs log to var/adm/sde-debug/tmpfslog.txt' \
  189. SDECFG_SRC_TMPFS_LOG 0
  190. block_end
  191. fi
  192. block_end
  193. # Apply custom package selection
  194. if [ "$SDECFG_PKGSEL" = 1 -a -f $cfgtmpdir/config/pkgsel ] ; then
  195. # Active error checking: explicitly show an annoying popup
  196. filter=`printf "^[-xXoO][ \t]\+[a-zA-Z0-9_/*+.-]"`
  197. if grep -lvq "$filter" $cfgtmpdir/config/pkgsel 2> /dev/null; then
  198. if [ -n "$oldconfig" ]; then
  199. echo "Invalid line(s) in package rule set will be removed"
  200. grep -nv "$filter" $cfgtmpdir/config/pkgsel
  201. grep "$filter" $cfgtmpdir/config/pkgsel \
  202. > $cfgtmpdir/pkgsel.new
  203. mv $cfgtmpdir/pkgsel.new $cfgtmpdir/config/pkgsel
  204. elif ./tmp/confdialog.bin --title "Build Config" --yesno \
  205. "Invalid line(s) in package rule set. Remove?" 5 50
  206. then
  207. grep "$filter" $cfgtmpdir/config/pkgsel \
  208. > $cfgtmpdir/pkgsel.new
  209. mv $cfgtmpdir/pkgsel.new $cfgtmpdir/config/pkgsel
  210. fi
  211. fi
  212. unset filter
  213. ( echo "# created from 'pkgsel'"
  214. pkgsel_init
  215. pkgsel_parse < $cfgtmpdir/config/pkgsel
  216. pkgsel_finish
  217. ) > $cfgtmpdir/pkgsel.awk
  218. pkgout
  219. gawk -f $cfgtmpdir/pkgsel.awk < $cfgtmpdir/config/packages \
  220. > $cfgtmpdir/packages.new 2> /dev/null
  221. if [ -s $cfgtmpdir/packages.new ] ; then
  222. mv $cfgtmpdir/packages.new $cfgtmpdir/config/packages
  223. else
  224. rm -f $cfgtmpdir/packages.new
  225. CFGTEMP_PKSEL_ERROR=1
  226. fi
  227. pkgin
  228. fi
  229. comment ' '
  230. if [ -d /sys/devices/ ]; then
  231. cpus=`ls -1d /sys/devices/system/cpu/*/ | wc -l`
  232. else
  233. cpus=`grep '^processor[[:blank:]]:' /proc/cpuinfo | wc -l`
  234. fi
  235. cpus=${cpus:-1}
  236. SDECFG_PARALLEL_MAX="`echo $SDECFG_PARALLEL_MAX | sed 's,[^0-9],,g'`"
  237. text "Maximum number of jobs to be executed in parallel ($cpus CPUs)" \
  238. SDECFG_PARALLEL_MAX $( expr $cpus \* 2 )
  239. unset cpus
  240. comment ' '
  241. block_begin 3
  242. # this is warranted to exist
  243. . $cfgtmpdir/noexpert-config.in
  244. block_end
  245. comment ' '
  246. block_begin 3
  247. bool 'Show expert and experimental options' SDECFG_EXPERT 0
  248. block_end
  249. expert_begin
  250. . $cfgtmpdir/cache_pkgfile_type.in
  251. comment ' '
  252. comment '- Additional Package Selection'
  253. block_begin 3
  254. bool 'Custom package selection' SDECFG_PKGSEL 0
  255. if [ "$SDECFG_PKGSEL" = 1 ] ; then
  256. menu_begin MENU_PKGSEL_RULES 'Edit package selection rules'
  257. editfile SDECFG_PKGSEL_FILE $cfgtmpdir/config/pkgsel \
  258. 'Package selection rules'
  259. if [ "$CFGTEMP_PKGSEL_ERROR" = 1 ]; then
  260. comment '---- Syntax error(s) in rule set!'
  261. fi
  262. [ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
  263. menu_end
  264. else
  265. rm -f $cfgtmpdir/config/pkgsel $cfgtmpdir/pkgsel.awk
  266. fi
  267. startprog SDECFG_SHOW_PKGLIST 'Show the current package list' \
  268. "./tmp/confdialog.bin --title 'T2 Config - Package List' \
  269. --backtitle 'T2 $sdever Configuration' \
  270. --textbox $cfgtmpdir/packages.txt \
  271. $(( $lines - 4 )) $(( $columns - 5 ))"
  272. block_end
  273. comment ' '
  274. # this is warranted to exist
  275. . $cfgtmpdir/expert-config.in
  276. comment ' '
  277. comment '- Additional GNU Configure Options'
  278. block_begin 5
  279. editfile SDECFG_CONFOPT_FILE $cfgtmpdir/config/confopt \
  280. 'GNU Configure Options'
  281. if [ -f $cfgtmpdir/config/confopt ] ; then
  282. const SDECFG_CONFIGURE_OPTS "`tr '\n' ' ' \
  283. < $cfgtmpdir/config/confopt`"
  284. else
  285. const SDECFG_CONFIGURE_OPTS ""
  286. fi
  287. for option in $SDECFG_CONFIGURE_OPTS ; do
  288. if [ "${option#--with-}" = "$option" -a \
  289. "${option#--without-}" = "$option" ]
  290. then
  291. comment '---- Warning! The custom options may
  292. break packages!'
  293. break
  294. fi
  295. done
  296. block_end
  297. comment ' '
  298. text 'Additional compiler flags' SDECFG_C_FLAGS ""
  299. comment ' '
  300. comment_id '- Flist detection technique' COMMENT_FLIST
  301. block_begin 5
  302. choice SDECFG_FLIST flwrapper \
  303. flwrapper 'Use the flist wrapper library for flist creation' \
  304. strace 'Use strace to get the file list' \
  305. find 'Use find on timestamp-file for flist creation'
  306. block_end
  307. comment ' '
  308. comment '- Various Options'
  309. block_begin 5
  310. bool 'Bootstrap a new, clean and up-to-date toolchain' SDECFG_USE_CROSSCC 1
  311. bool 'Make rebuild stage (stage 9)' SDECFG_DO_REBUILD_STAGE 0
  312. if [ $SDECFG_CROSSBUILD != 1 ]; then
  313. bool 'Run a check/test for packages with support' SDECFG_DO_CHECK 0
  314. fi
  315. if [ $SDECFG_USE_CROSSCC != 1 ]; then
  316. pkgfilter sed 's,^\([XO] \)0,\1-,'
  317. fi
  318. if [ $SDECFG_DO_REBUILD_STAGE != 1 ]; then
  319. pkgfilter sed 's,^\([XO] [0-8-]*\)9 ,\1- ,'
  320. fi
  321. choice SDECFG_OPT speed \
  322. speed 'Hard optimise for speed (recommended)' \
  323. size 'Hard optimise for size (sometimes faster)' \
  324. lazy 'Lazy optimisation (debugging and fast building)' \
  325. smart 'Smart optimisation using a profile database'
  326. bool 'Create binaries with debug symbols' SDECFG_DEBUG 0
  327. bool 'Create statically linked binaries' SDECFG_STATIC 0
  328. bool 'Enable ld --as-needed' SDECFG_LD_AS_NEEDED 0
  329. bool 'Enable PIE (Position Independent Code)' SDECFG_PIE 0
  330. bool 'Disable exceptions and rtti in C++' SDECFG_LIMITCXX 0
  331. bool 'Enable c-compiler multilib support' SDECFG_MULTILIB 0
  332. bool 'Disable National Language Support' SDECFG_DISABLE_NLS 0
  333. if [ "$SDECFG_DISABLE_NLS" = 1 ] ; then
  334. pkgremove gettext
  335. fi
  336. bool 'Automatic documentation creation' SDECFG_CREATE_DOCS 0
  337. bool 'Create cache files after packages have been built' \
  338. SDECFG_CREATE_CACHE 1
  339. bool 'Run Paranoia Checks in Build-Target and Build-Pkg' \
  340. SDECFG_PARANOIA_CHECK 1
  341. bool 'Abbreviate Config ID with checksum' SDECFG_IDCKSUM 0
  342. block_end
  343. expert_end
  344. . $cfgtmpdir/package-postconfig.in
  345. . $cfgtmpdir/misc-postconfig.in
  346. . $cfgtmpdir/lib-postconfig.in
  347. . $cfgtmpdir/architecture-postconfig.in
  348. . $cfgtmpdir/target-postconfig.in
  349. pkgfilter sed '/^[XO] --* / d;'
  350. [ $SDECFG_EXPERT = 1 ] ||
  351. SDECFG_ID="`echo $SDECFG_ID | sed 's,-noexpert.*,,'`"
  352. [ "$SDECFG_IDCKSUM" = 1 ] &&
  353. SDECFG_ID="`echo $SDECFG_ID | cksum | cut -f1 -d' '`"
  354. const SDECFG_SHORTID "$SDECFG_ID"
  355. SDECFG_ID="$config-$SDECFG_ID"