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.

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