mirror of the now-defunct rocklinux.org
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.

381 lines
11 KiB

  1. #
  2. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  3. #
  4. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  5. # Please add additional copyright information _after_ the line containing
  6. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  7. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  8. #
  9. # ROCK Linux: rock-src/scripts/config.in
  10. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License, or
  15. # (at your option) any later version. A copy of the GNU General Public
  16. # License can be found at Documentation/COPYING.
  17. #
  18. # Many people helped and are helping developing ROCK Linux. Please
  19. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  20. # file for details.
  21. #
  22. # --- ROCK-COPYRIGHT-NOTE-END ---
  23. #
  24. # Main config script
  25. #
  26. # Execution of sub-scripts:
  27. #
  28. # - architecture/*/preconfig.in
  29. #
  30. # * Selecting Architecture
  31. # * architecture/$ROCKCFG_ARCH/config.in
  32. #
  33. # - misc/*/preconfig.in
  34. # - target/*/preconfig.in
  35. # - package/*/*/preconfig.in
  36. #
  37. # * Selecting Target
  38. # * target/$ROCKCFG_TARGET/config.in
  39. #
  40. # * misc/*/noexpertconfig.in
  41. #
  42. # * {package/*,misc}/*/config-*.in
  43. # * {package/*,misc}/*/config.in
  44. # * Various common build options
  45. #
  46. # - package/*/*/postconfig.in
  47. # - misc/*/postconfig.in
  48. # - architecture/$ROCKCFG_ARCH/postconfig.in
  49. # - target/$ROCKCFG_TARGET/postconfig.in
  50. #
  51. # Only procedures marked with '*' might interact with the user.
  52. #
  53. # Naming-scheme for extening config variables:
  54. #
  55. # Core: ROCKCFG_*
  56. # Archs: ROCKCFG_ARCH_<Arch-Name>_*
  57. # Targets: ROCKCFG_TRG_<Target-Name>_*
  58. # Packages: ROCKCFG_PKG_<Pkg-Name>_*
  59. #
  60. # Config-Internal Variables:
  61. #
  62. # Core: CFGTEMP_*
  63. # Archs: CFGTEMP_ARCH_<Arch-Name>_*
  64. # Targets: CFGTEMP_TRG_<Target-Name>_*
  65. # Packages: CFGTEMP_PKG_<Pkg-Name>_*
  66. #
  67. # Config Presets: ROCKCFGSET_*
  68. #
  69. # This function appends or inserts values to a variable:
  70. #
  71. # var_append PATH ":" "$HOME/bin"
  72. # var_insert PATH ":" "$HOME/bin"
  73. #
  74. var_append() {
  75. eval "[ \"\$$1\" ] && $1=\"\${$1}$2\""
  76. eval "$1=\"\${$1}$3\""
  77. }
  78. var_insert() {
  79. eval "[ \"\$$1\" ] && $1=\"$2\$$1\""
  80. eval "$1=\"$3\$$1\""
  81. }
  82. # Functions for working with config/$config/packages
  83. #
  84. # pkgenable package-list
  85. # pkgdisable package-list
  86. # pkgremove package-list
  87. # pkgcheck pattern [XO]
  88. # pkgfilter cmd arg1 ...
  89. #
  90. pkgfilter() {
  91. "$@" < config/$config/packages > config/$config/packages.new
  92. mv config/$config/packages.new config/$config/packages
  93. }
  94. pkgenable() {
  95. local pattern patterns
  96. for pattern; do
  97. patterns="$patterns -e '/ $pattern / s/^./X/'"
  98. done
  99. if [ "$patterns" ]; then
  100. eval "pkgfilter sed $patterns"
  101. fi
  102. }
  103. pkgdisable() {
  104. local pattern patterns
  105. for pattern; do
  106. patterns="$patterns -e '/ $pattern / s/^./O/'"
  107. done
  108. if [ "$patterns" ]; then
  109. eval "pkgfilter sed $patterns"
  110. fi
  111. }
  112. pkgremove() {
  113. local pattern patterns
  114. if [ "$1" ]; then
  115. patterns=" $1 "; shift
  116. for pattern; do
  117. patterns="$patterns| $pattern "
  118. done
  119. pkgfilter egrep -v "$patterns"
  120. fi
  121. }
  122. pkgcheck() {
  123. egrep -q "^$2.* ($1) " config/$config/packages
  124. }
  125. CFGTEMP_ARCHLIST=""
  126. CFGTEMP_TARGETLIST=""
  127. %include architecture/*/preconfig.in
  128. comment_id '- Architecture, CPU and Optimization' COMMENT_ARCHCPUOPT
  129. block_begin 7
  130. choice ROCKCFG_ARCH $ROCKCFG_ARCH $CFGTEMP_ARCHLIST
  131. ROCKCFG_ID="$ROCKCFG_ID-$ROCKCFG_ARCH"
  132. if [ -f architecture/$ROCKCFG_ARCH/config.in ]
  133. then . architecture/$ROCKCFG_ARCH/config.in ; fi
  134. bool 'This is a cross-build between architectures' ROCKCFG_CROSSBUILD 0
  135. if [ "$ROCKCFG_CROSSBUILD" = 1 ] ; then
  136. sed 's,^\(. ..\)[^ ]*,\1--------,' < config/$config/packages |
  137. grep -vx '. --* .*' > config/$config/packages.new
  138. mv config/$config/packages.new config/$config/packages
  139. ROCKCFG_ID="$ROCKCFG_ID-cross" ; ROCKCFGSET_USE_CROSSCC=1
  140. fi
  141. block_end
  142. %include misc/*/preconfig.in
  143. %include target/*/preconfig.in
  144. %include package/*/*/preconfig.in
  145. comment ' '
  146. comment_id '- Target Distribution' COMMENT_TARGET
  147. block_begin 7
  148. choice ROCKCFG_TARGET generic $CFGTEMP_TARGETLIST
  149. ROCKCFG_ID="$ROCKCFG_ID-$ROCKCFG_TARGET"
  150. if [ -f target/$ROCKCFG_TARGET/config.in ]
  151. then . target/$ROCKCFG_TARGET/config.in ; fi
  152. block_end
  153. comment ' '
  154. comment_id '- Build System Configuration' COMMENT_BUILD_SYS_CONF
  155. block_begin 3
  156. bool 'Make a parallel (cluster) build' ROCKCFG_PARALLEL 0
  157. if [ "$ROCKCFG_PARALLEL" = 1 ] ; then
  158. block_begin 10
  159. ROCKCFG_PARALLEL_MAX="`echo $ROCKCFG_PARALLEL_MAX |
  160. sed 's,[^0-9],,g'`"
  161. text 'Maximum size of job queue' ROCKCFG_PARALLEL_MAX 10
  162. text 'Command for adding jobs' ROCKCFG_PARALLEL_ADDJOB ''
  163. block_end
  164. else
  165. bool 'Abort when a package-build fails' \
  166. ROCKCFG_ABORT_ON_ERROR 0
  167. fi
  168. bool 'Retry building broken packages' ROCKCFG_RETRY_BROKEN 0
  169. bool 'Disable packages which are marked as broken' \
  170. ROCKCFG_DISABLE_BROKEN 0
  171. bool 'Always clean up src dirs (even on pkg fail)' \
  172. ROCKCFG_ALWAYS_CLEAN 0
  173. bool 'Create debug information (xtrace) for builds' ROCKCFG_XTRACE 0
  174. bool 'Use TMPFS for building packages' ROCKCFG_SRC_TMPFS 0
  175. if [ "$ROCKCFG_SRC_TMPFS" = 1 ] ; then
  176. block_begin
  177. comment '! WARNING: This feature can hang your system, if'
  178. comment '! you do not have enough virtual memory!'
  179. text 'TMPFS mount options' ROCKCFG_SRC_TMPFS_OPT \
  180. 'size=800M,nr_inodes=100k'
  181. bool 'Write tmpfs log to var/adm/rock-debug/tmpfslog.txt' \
  182. ROCKCFG_SRC_TMPFS_LOG 0
  183. block_end
  184. fi
  185. block_end
  186. %include misc/*/noexpertconfig.in
  187. comment ' '
  188. block_begin 3
  189. bool 'Show expert-only and experimental options' ROCKCFG_EXPERT 0
  190. block_end
  191. if [ $ROCKCFG_EXPERT = 1 ] ; then ROCKCFG_ID="$ROCKCFG_ID-expert"
  192. else ROCKCFG_ID="$ROCKCFG_ID-noexpert" ; fi
  193. expert_begin
  194. comment ' '
  195. comment '- Binary package format'
  196. block_begin 3
  197. bool 'Create *.tar.bz2 binary packages' ROCKCFG_CREATE_TARBZ2 0
  198. bool 'Create *.gem binary packages' ROCKCFG_CREATE_GEM 1
  199. bool 'Append version number to package files' ROCKCFG_PKGFILE_VER 1
  200. block_end
  201. comment ' '
  202. comment '- Additional Package Selection'
  203. block_begin 3
  204. bool 'Custom package selection' ROCKCFG_PKGSEL 0
  205. if [ "$ROCKCFG_PKGSEL" = 1 ] ; then
  206. block_begin 3
  207. # Active error checking: explicitly show an annoying popup
  208. filter=`printf "^[-xXoO][ \t]\+[a-zA-Z0-9_/*+.-]"`
  209. if grep -lvq "$filter" config/$config/pkgsel 2> /dev/null && \
  210. ./src/rockdialog.bin --title "Build Config" --yesno \
  211. "Invalid line(s) in package rule set. Remove?" 5 50
  212. then
  213. grep "$filter" < config/$config/pkgsel \
  214. > config/$config/pkgsel.new
  215. mv config/$config/pkgsel.new config/$config/pkgsel
  216. fi
  217. unset filter
  218. editfile ROCKCFG_PKGSEL_FILE config/$config/pkgsel \
  219. 'Package selection rules'
  220. echo "# created from 'pkgsel'" > config/$config/pkgsel.awk
  221. while read action patternlist ; do
  222. case "$action" in
  223. [xX])
  224. action='$1="X"' ;;
  225. [oO])
  226. action='$1="O"' ;;
  227. -)
  228. action='next' ;;
  229. *)
  230. echo '{ exit; }'
  231. continue ;;
  232. esac
  233. address="" ; first="(" ; others="&&"
  234. while read pattern ; do
  235. if [ -z "$address" ] && \
  236. [ "$pattern" = "!" ] ; then
  237. address="! " ; others="||"
  238. else
  239. pattern="$( echo "$pattern" | sed \
  240. -e 's,[^a-zA-Z0-9_/\*+\.-],,g' \
  241. -e 's,[/\.\+],\\&,g' \
  242. -e 's,\*,[^ ]*,g' )"
  243. [ "$pattern" ] || continue
  244. address="$address$first"
  245. address="$address / $pattern /"
  246. first=" $others"
  247. fi
  248. done < <( echo "$patternlist" | tr '\t ' '\n\n' )
  249. echo "$address ) { $action; }"
  250. done < config/$config/pkgsel >> config/$config/pkgsel.awk
  251. echo '{ print; }' >> config/$config/pkgsel.awk
  252. gawk -f config/$config/pkgsel.awk < config/$config/packages \
  253. > config/$config/packages.new 2> /dev/null
  254. if [ -s config/$config/packages.new ] ; then
  255. mv config/$config/packages.new config/$config/packages
  256. else
  257. rm -f config/$config/packages.new
  258. comment '---- Syntax error(s) in rule set!'
  259. fi
  260. block_end
  261. else
  262. rm -f config/$config/pkgsel
  263. rm -f config/$config/pkgsel.awk
  264. fi
  265. startprog ROCKCFG_SHOW_PKGLIST 'Show the current package list' \
  266. "./src/rockdialog.bin --title 'ROCK Linux Config - Package List' \
  267. --backtitle 'ROCK Linux $rockver Configuration' \
  268. --textbox config/$config/packages.txt \
  269. $(( $lines - 4 )) $(( $columns - 5 ))"
  270. block_end
  271. comment ' '
  272. %include $( ls {package/*,misc}/*/config{,-*}.in 2>/dev/null | sed 's,\(.*/\)\([^/]*\),\2 \1\2,' | sort | cut -f2 -d' ' )
  273. comment ' '
  274. comment '- Additional GNU Configure Options'
  275. block_begin 5
  276. editfile ROCKCFG_CONFOPT_FILE config/$config/confopt \
  277. 'GNU Configure Options'
  278. if [ -f config/$config/confopt ] ; then
  279. const ROCKCFG_CONFIGURE_OPTS "`tr '\n' ' ' \
  280. < config/$config/confopt`"
  281. else
  282. const ROCKCFG_CONFIGURE_OPTS ""
  283. fi
  284. for option in $ROCKCFG_CONFIGURE_OPTS ; do
  285. if [ "${option#--with-}" = "$option" -a \
  286. "${option#--without-}" = "$option" ]
  287. then
  288. comment '---- Warning! The custom options may
  289. break packages!'
  290. break
  291. fi
  292. done
  293. block_end
  294. comment ' '
  295. comment_id '- Flist detection technique' COMMENT_FLIST
  296. block_begin 5
  297. choice ROCKCFG_FLIST flwrapper \
  298. flwrapper 'Use the flist wrapper library for flist creation' \
  299. strace 'Use strace to get the file list' \
  300. find 'Use find on timestamp-file for flist creation'
  301. block_end
  302. comment ' '
  303. comment '- Various Options'
  304. block_begin 5
  305. bool 'Build and use a (pseudo-)cross compiler' ROCKCFG_USE_CROSSCC 1
  306. bool 'Make rebuild stage (stage 9)' ROCKCFG_DO_REBUILD_STAGE 1
  307. if [ $ROCKCFG_USE_CROSSCC != 1 ]; then
  308. pkgfilter sed 's,^\([XO] \)0,\1-,'
  309. fi
  310. if [ $ROCKCFG_DO_REBUILD_STAGE != 1 ]; then
  311. pkgfilter sed 's,^\([XO] [0-8-]*\)9 ,\1- ,'
  312. fi
  313. bool 'Optimise all binaries and libraries' ROCKCFG_OPT 1
  314. if [ $ROCKCFG_OPT = 1 ] ; then
  315. bool 'Optimise for size and not for speed' ROCKCFG_OPTSIZE 0
  316. fi
  317. bool 'Disable exceptions and rtti in C++' ROCKCFG_LIMITCXX 0
  318. bool 'Enable c-compiler multilib support' ROCKCFG_MULTILIB 0
  319. bool 'Disable National Language Support' ROCKCFG_DISABLE_NLS 0
  320. if [ "$ROCKCFG_DISABLE_NLS" = 1 ] ; then
  321. pkgremove ' gettext '
  322. fi
  323. bool 'Automatic documentation creation' ROCKCFG_CREATE_DOCS 1
  324. bool 'Create cache files after packages have been built' \
  325. ROCKCFG_CREATE_CACHE 1
  326. bool 'Run Paranoia Checks in Build-Target and Build-Pkg' \
  327. ROCKCFG_PARANOIA_CHECK 1
  328. bool 'Abbreviate ROCK Config ID with checksum' ROCKCFG_IDCKSUM 0
  329. block_end
  330. expert_end
  331. %include package/*/*/postconfig.in
  332. %include misc/*/postconfig.in
  333. %include architecture/*/postconfig.in
  334. %include target/*/postconfig.in
  335. pkgfilter sed '/^[XO] --* / d;'
  336. [ $ROCKCFG_EXPERT = 1 ] ||
  337. ROCKCFG_ID="`echo $ROCKCFG_ID | sed 's,-noexpert.*,,'`"
  338. [ "$ROCKCFG_IDCKSUM" = 1 ] &&
  339. ROCKCFG_ID="`echo $ROCKCFG_ID | cksum | cut -f1 -d' '`"
  340. const ROCKCFG_SHORTID "$ROCKCFG_ID"
  341. ROCKCFG_ID="$config-$ROCKCFG_ID"