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.

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