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.

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