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.

985 lines
32 KiB

  1. The ROCK Linux Hacking Howto
  2. ============================
  3. Written by Clifford Wolf
  4. ~~~~~~~~~~~~~~~~~~~~~~~~
  5. The Jargon File defines a "Hacker" as:
  6. # hacker n.
  7. #
  8. # [originally, someone who makes furniture with an axe] 1. A person
  9. # who enjoys exploring the details of programmable systems and
  10. # how to stretch their capabilities, as opposed to most users, who
  11. # prefer to learn only the minimum necessary. 2. One who programs
  12. # enthusiastically (even obsessively) or who enjoys programming
  13. # rather than just theorising about programming. 3. A person capable
  14. # of appreciating hack value. 4. A person who is good at programming
  15. # quickly. 5. An expert at a particular program, or one who frequently
  16. # does work using it or on it; as in `a Unix hacker'. (Definitions 1
  17. # through 5 are correlated, and people who fit them congregate.) 6. An
  18. # expert or enthusiast of any kind. One might be an astronomy hacker,
  19. # for example. 7. One who enjoys the intellectual challenge of
  20. # creatively overcoming or circumventing limitations. 8. [deprecated]
  21. # A malicious meddler who tries to discover sensitive information
  22. # by poking around. Hence `password hacker', `network hacker'. The
  23. # correct term for this sense is cracker.
  24. So this "ROCK Linux Hacking Howto" has nothing to do with host- or
  25. network-security.
  26. Table of Contents
  27. =================
  28. 0. Preface
  29. 1. ROCK Linux directory tree
  30. 1.1. Documentation/
  31. 1.2. scripts/
  32. 1.3. package/
  33. 1.3.1. package/base/
  34. 1.3.2. package/x11/
  35. 1.3.3. package/<architecture>/
  36. 1.3.4. package/<person>/
  37. 1.4. misc/
  38. 1.5. target/
  39. 1.6. architecture/
  40. 1.7. download/
  41. 1.8. src*/ and build/
  42. 1.9. config/*
  43. 2. Build- and other scripts
  44. 2.1. ./scripts/Config
  45. 2.2. ./scripts/Download
  46. 2.3. Scripts for building stuff
  47. 2.3.1. ./scripts/Build-Target
  48. 2.3.2. ./scripts/Build-Pkg
  49. 2.3.3. ./scripts/Build-TarBz2
  50. 2.3.4. ./scripts/Build-Tools
  51. 2.3.5. ./scripts/Build-CrossCC
  52. 2.3.6. ./scripts/Build-Job
  53. 2.4. Various small Helpers
  54. 2.4.1. ./scripts/Cleanup
  55. 2.4.2. ./scripts/Create-Links
  56. 2.4.3. ./scripts/Create-PkgList
  57. 2.4.4. ./scripts/Create-PkgQueue
  58. 2.4.5. ./scripts/Create-SrcTar
  59. 2.4.6. ./scripts/Create-Diff
  60. 2.4.7. ./scripts/Create-CkSumPatch
  61. 2.4.8. ./scripts/Create-DescPatch
  62. 2.4.9. ./scripts/Create-PkgUpdPatch
  63. 2.4.10. ./scripts/Create-ErrList
  64. 2.4.11. ./scripts/Create-UpdList
  65. 2.4.12. ./scripts/Update-System
  66. 2.4.13. ./scripts/Puzzle
  67. 2.4.14. ./scripts/Help
  68. 2.4.15. ./scripts/Internal
  69. 2.5. Scripts for doing checks
  70. 2.5.1. ./scripts/Check-PkgVersion
  71. 2.5.2. ./scripts/Check-PkgFormat
  72. 2.5.3. ./scripts/Check-System
  73. 2.5.4. ./scripts/Check-Deps
  74. 2.6. Scripts for updating the source tree
  75. 2.6.1. ./scripts/Update-Src
  76. 3. Configuration System
  77. 3.1. Fundamentals
  78. 3.2. Special Commands
  79. 3.2.1. comment 'Description' ["Help"]
  80. 3.2.2. comment_id 'Description' 'ID' ["Help"]
  81. 3.2.3. bool 'Description' Variable Default ["Help"]
  82. 3.2.4. text 'Description' Variable Default ["Help"]
  83. 3.2.5. choice Variable Default Value1 'Description1' [ ... ]
  84. 3.2.6. const Variable Default
  85. 3.2.7. block_begin and block_end
  86. 3.2.8. expert_begin and expert_end
  87. 3.3. Special Variables
  88. 3.3.1. ROCKCFG_*
  89. 3.3.2. ROCKCFGSET_*
  90. 3.3.3. CFGTEMP_*
  91. 3.4. Config.in call-tree
  92. 3.5. Creation of the Packages file
  93. 4. Packages
  94. 4.1. Fundamentals
  95. 4.2. The *.desc files
  96. 4.2.1. Package Priority
  97. 4.2.2. Download URLs
  98. 4.3. The *.conf files
  99. 4.3.1. FIXME
  100. 4.4. The *.patch files
  101. 4.5. The *.doc files
  102. 4.6. The *.init files
  103. 5. Targets
  104. 6. Architectures
  105. ( created with >> perl -pe '$_="" unless /^\t?[0-9]/; s/^\t/\n/;' << )
  106. 0. Preface
  107. ==========
  108. This document describes how to extend and modify the ROCK Linux Build Scripts.
  109. You need to know shell scripting well to understand the techniques described
  110. in this document. Some practise with building and installing software on UNIX
  111. systems might also help.
  112. Use the existing code (packages, targets, etc.) as examples. The explanations
  113. given here are often very brief and looking at the code might help you to
  114. understand.
  115. Corrections, etc. are always welcome (unified diffs preferred).
  116. - Clifford wolf <clifford@clifford.at>
  117. 1. ROCK Linux directory tree
  118. ============================
  119. 1.1. Documentation/
  120. ===================
  121. The ROCK Linux Documentation. Read everything - if you can! You should also
  122. visit our homepage at www.rocklinux.org and subscribe to the mailing list.
  123. 1.2. scripts/
  124. =============
  125. All the build and helper scripts can be found here. A detailed description of
  126. them can be found in chapter 2.
  127. Make sure to always call them from the base directory (like "./scripts/Config")
  128. and _do_not_ change into scripts/ and execute the script there!
  129. 1.3. package/
  130. =============
  131. The ROCK Linux specific part of the package sources are stored in this tree.
  132. This is for every package at least a ".desc" file (read chapter 4 for more
  133. details about the package format).
  134. Within the package/ directory, every "package repository" has it's own
  135. subdirectory. A "package repository" is an organisational unit to group
  136. packages together. All packages with a repository do belong to the same
  137. maintainer or maintainer-team.
  138. Within the repository-directory, every package has it's own subdirectory.
  139. E.g. the 'gcc' package can be found in "package/base/gcc/".
  140. 1.3.1. package/base/
  141. --------------------
  142. The "base" repository contains the most important core-packages. Stuff like
  143. the compiler, the kernel and the standard unix command-packages (coreutils, ..).
  144. The "base" packages are maintained by Clifford Wolf <clifford@rocklinux.org>.
  145. 1.3.2. package/x11/
  146. -------------------
  147. The "x11" repository contains the basic X11 packages. Everything you need
  148. to set up a graphical workstation including the most important tools.
  149. The "x11" packages are maintained by Rene Rebe <rene@rocklinux.org>.
  150. 1.3.3. package/<architecture>/
  151. ----------------------
  152. There are some architecture specific repositories like 'alpha', 'powerpc',
  153. 'spar', 'x86', ... They contain packages that are only useful on this one
  154. architecture.
  155. 1.3.4. package/<person>/
  156. ----------------------
  157. Other packages are grouped together into repositories named by the maintainer.
  158. Those are e.g. 'clifford', 'rene', 'esden', ... and many more.
  159. But functional grouping like kde and gnome repositories are also possible.
  160. 1.4. misc/
  161. ==========
  162. Various stuff which doesn't fit elsewhere can be found here.
  163. 1.5. target/
  164. ============
  165. A 'target' is a ROCK Linux based distribution. The 'normal ROCK Linux' is
  166. the 'generic' target, build with the default settings.
  167. Every target has it's own subdirectory in this tree.
  168. 1.6. architecture/
  169. ==================
  170. Every architecture supported by ROCK Linux has it's own subdirectory in this
  171. tree.
  172. 1.7. download/
  173. ==============
  174. The original package tar files are downloaded to that directory by the
  175. ./scripts/Download script. Only the files required for building the selected
  176. target will be downloaded.
  177. 1.8. src*/ and build/
  178. =====================
  179. This directories are created by the Build-Scripts. They can be easily removed
  180. using './scripts/Cleanup'.
  181. 1.9. config/*
  182. =============
  183. The build configurations (created with './scripts/Config') are stored in
  184. the config/ tree. Every configuration has it's own subdirectory there.
  185. 2. Build- and other scripts
  186. ===========================
  187. Most scripts print a help text, containing a description of syntax and
  188. options, when started with the '-help' option.
  189. 2.1. ./scripts/Config
  190. =====================
  191. ./scripts/Config is the main configuration script. If no configuration name
  192. is specified via the option -cfg <config-name> the name 'default' is used.
  193. It parses the metaconfig files described in chapter 3 and creates the files
  194. in config/<config-name>/. If a config-name is specified it also has to
  195. be passed to the other scripts, too.
  196. 2.2. ./scripts/Download
  197. =======================
  198. The ./scripts/Download script is the tool for downloading the package sources.
  199. Calling the script without any parameters prints out the help message.
  200. You can download single files:
  201. ./scripts/Download download/base/linux24/linux-2.4.18.tar.bz2
  202. All files for a single package:
  203. ./scripts/Download -package linux24
  204. All files required for building the configured target:
  205. ./scripts/Download -required
  206. Or simply everything:
  207. ./scripts/Download -all
  208. If you don't specify a mirror using the -mirror option, the script will
  209. contact www.rocklinux.org and auto-detect the best mirror.
  210. Downloading all files required from a local (mounted) cdrom:
  211. ./scripts/Download -mirror file:///mnt/cdrom/ -required
  212. 2.3. Scripts for building stuff
  213. ===============================
  214. 2.3.1. ./scripts/Build-Target
  215. -----------------------------
  216. Builds the configured target. Depending on your hardware and the configuration
  217. made with ./scripts/Config this may take a few days (or a week or even longer)
  218. to complete.
  219. 2.3.2. ./scripts/Build-Pkg
  220. --------------------------
  221. Builds a single package. Calling this script without any option prints
  222. out a usage message. In most cases the options are only needed by Build-Target
  223. when building the entire distribution.
  224. Building a single package:
  225. ./scripts/Build-Pkg gawk
  226. Warning: Re-building a package might overwrite or remove config files - using
  227. the option -update backups modified files and restores them after the package
  228. build.
  229. 2.3.4. ./scripts/Build-Tools
  230. ----------------------------
  231. This script creates the 'build.xxxxxx.tools' directory (where 'xxxxxx' is the
  232. config id) which contains various helper applications needed by Build-Pkg and
  233. other scripts.
  234. When the script is called with the -cleanup option, a rebuild of the files in
  235. the tools directory is forced. In most cases this script will be called by
  236. other scripts (and not by the user).
  237. 2.3.5. ./scripts/Build-CrossCC
  238. ------------------------------
  239. For cross-building ROCK Linux you need a cross-compiler. This script creates
  240. the cross-compiler for you. The cross-compiler and cross-binutils will be
  241. installed in the build/ tree where the Build-Pkg script expects them to be.
  242. 2.3.6. ./scripts/Build-Job
  243. --------------------------
  244. This script is the client when you run ./scripts/Target in parallel
  245. build (cluster) mode.
  246. 2.4. Various small Helpers
  247. ==========================
  248. 2.4.1. ./scripts/Cleanup
  249. ------------------------
  250. The Cleanup script can be used to remove the src* and build* directories which
  251. are created by the build scripts. Never remove these directories manually!!!
  252. On default ./scripts/Cleanup only removes the src* directories. the build*
  253. directories are only removed when the -full option is passed.
  254. 2.4.2. ./scripts/Create-Links
  255. -----------------------------
  256. This very simple script creates symlinks from you ROCK Linux base directory
  257. to another directory. This can be useful if you have the ROCK Linux sources
  258. on one harddisk (NFS Share, etc) and want to build somewhere else:
  259. /disks/raid/archive/os/rock# mkdir -p /disks/fast/rock
  260. /disks/raid/archive/os/rock# ./scripts/Create-Links /disks/fast/rock
  261. 2.4.3. ./scripts/Create-PkgList
  262. -------------------------------
  263. Creates a list of all packages available. If an architecture name is passed
  264. as parameter, only the packages available on that architecture are listed.
  265. This script is used by ./scripts/Config in the process of creating the
  266. packages file.
  267. 2.4.4. ./scripts/Create-PkgQueue
  268. --------------------------------
  269. Creates a list of packages which could be built next. The first parameter is
  270. the maximum number of packages to print (0=no limit) and the 2nd parameter is
  271. the root directory where the script can find the /var/adm/... information it
  272. needs. E.g.:
  273. # ./scripts/Create-PkgQueue 3 build/1.7.0-DEV-intel-generic/root
  274. 2 X --2------9 010.050 base strace 4.4 / development/tool 159
  275. 2 X --2------9 010.052 base ltrace 0.3.10 / development/tool 85
  276. 2 X --2-4----9 010.055 base perl5 5.6.1 / development/interpreter 125
  277. The script is primarily used by ./scripts/Build-Target.
  278. 2.4.5. ./scripts/Create-SrcTar
  279. ------------------------------
  280. Creates a .tar.bz2 file containing the ROCK Linux sources. This script is
  281. used by the ROCK Linux core developers when releasing snapshots or releases.
  282. 2.4.6. ./scripts/Create-Diff
  283. ----------------------------
  284. This script is the recommended tool for creating diff patches. (When you
  285. made a change to the ROCK Linux sources and want to share your work).
  286. E.g.: ./scripts/Create-Diff ../rock-src.orig . > mychanges.diff
  287. 2.4.7. ./scripts/Create-CkSumPatch
  288. ----------------------------------
  289. This script can be used by ROCK Linux developers to automatically create the
  290. download checksums in the .desc files in one or more package repositories.
  291. E.g.: ./scripts/Create-CkSumPatch extra2 ; patch -p1 < cksum.patch
  292. 2.4.8. ./scripts/Create-DescPatch
  293. ---------------------------------
  294. This script can be used by ROCK Linux developers to automatically adopt the
  295. format of the package .desc files.
  296. E.g.: ./scripts/Create-DescPatch -repository extra2
  297. 2.4.9. ./scripts/Create-PkgUpdPatch
  298. -----------------------------------
  299. This script can be used by ROCK Linux developers to automatically create
  300. package update patches (after evaluating the output of the
  301. ./scripts/Check-PkgVersion script). E.g.:
  302. ./scripts/Create-PkgUpdPatch > update.patch << EOT
  303. automake-1.6.1, bin86-0.16.3, bison-1.35, curl-7.9.6,
  304. diffutils-2.8.1, dump-0.4b28, ifhp-3.5.7, net-snmp-4.2.4,
  305. ntp-4.1.1, pciutils-2.1.10, sendmail.8.12.3, silo-1.2.5,
  306. tree-1.4b2, util-linux-2.11q, whois_4.5.25
  307. EOT
  308. The resulting update.patch file should be checked manually before being
  309. applied with 'patch -p1 < update.patch'.
  310. 2.4.10. ./scripts/Create-ErrList
  311. --------------------------------
  312. Outputs the list of packages which failed to build (including the stage
  313. numbers) in the right order.
  314. 2.4.11. ./scripts/Create-UpdList
  315. --------------------------------
  316. Create a list of packages which are active in the current configuration and
  317. have changed since the binaries installed on the local system have been
  318. generated. The compare is done using the package source checksums stored
  319. in /var/adm/packages/<package-name>.
  320. 2.4.12. ./scripts/Update-System
  321. -------------------------------
  322. Update (re-build) all packages on the local system for which newer versions
  323. are available. Create-UpdList is used to generate the list of packages which
  324. do need an update.
  325. 2.4.14. ./scripts/Help
  326. ----------------------
  327. This script expects the filename of a script in ./scripts/ and jumps to
  328. the right position in this document. It's a very simple wrapper for 'less'.
  329. 2.4.15. ./scripts/Internal
  330. --------------------------
  331. This script is used by Clifford Wolf to release snapshots and to keep the
  332. FTP Mirrors up-to-date.
  333. 2.5. Scripts for doing checks
  334. =============================
  335. 2.5.1. ./scripts/Check-PkgVersion
  336. ---------------------------------
  337. This script is used by the ROCK Linux developers to check for new package
  338. versions. The results of the last run are always stored in a directory called
  339. checkver/ and if there is a difference in the current run, a *.msg file will
  340. be written to checkver/. (read the script for details)
  341. E.g.: ./scripts/Check-PkgVersion -repository base
  342. for x in checkver/*.new ; do mv -f $x ${x%.new}.txt ; done
  343. cat checkver/*.msg > todo.txt
  344. Note: An old *.msg file will automatically removed when you run
  345. Check-PkgVersion the next time.
  346. 2.5.2. ./scripts/Check-PkgFormat
  347. --------------------------------
  348. This script does a few very simple tests to auto-detect errors in the package
  349. *.desc and *.conf files.
  350. E.g.: ./scripts/Check-PkgFormat -repository extra1
  351. 2.5.3. ./scripts/Check-System
  352. -----------------------------
  353. This script does a very simple tests to auto-detect possible problems
  354. with the host linux system.
  355. 2.5.4. ./scripts/Check-Deps
  356. ---------------------------
  357. This command checks if the current package build order is ok for solving all
  358. package dependencies.
  359. 2.6. Scripts for updating the source tree
  360. =========================================
  361. 2.6.1. ./scripts/Update-Src
  362. ---------------------------
  363. Update the source tree with rsync from www.rocklinux.org.
  364. Warning: This will remove the changes you have made to the source tree.
  365. 3. Configuration System
  366. =======================
  367. 3.1. Fundamentals
  368. =================
  369. The configuration script ./scripts/Config generates the files in the
  370. config/${config}/ directory:
  371. config the configuration options
  372. packages the packages which are build in this configuration
  373. ./scripts/Config defines some special shell functions and contains the
  374. main-loop of the configuration program. The structure of the config menus
  375. is stored in scripts/config.in (and other config.in files included by it).
  376. Have a look at scripts/config.in for more information on which file is
  377. including which other files.
  378. 3.2. Special Commands
  379. =====================
  380. Whenever the menu is displayed (i.e. after starting ./scripts/Config and
  381. whenever a change has been made), scripts/config.in is executed and is using
  382. the following special commands to write the 'config' file and add items to the
  383. menu.
  384. 3.2.1. comment 'Description' ["Help"]
  385. -------------------------------------
  386. Add a comment to the config menu (and item without any function). E.g.:
  387. comment '- Architecture, CPU and Optimisation' "
  388. Select which CPU optimalization is right for your machine."
  389. <Description> Title of the item in the config menu (comment text)
  390. <Help> This is an optional field where you can add a longer comment
  391. that will be displayed when you highlight this comment line
  392. and hit the Help button
  393. 3.2.2. comment_id 'Description' 'ID' ["Help"]
  394. ---------------------------------------------
  395. Add a comment to the config menu (and item without any function). E.g.:
  396. comment '- Architecture, CPU and Optimisation' COMMENT_ARCH_CPU_OPT "
  397. Select which CPU optimalization is right for your machine."
  398. <Description> Title of the item in the config menu (comment text)
  399. <ID> ID which will be used to identify a comment. It is
  400. useful when you use config.hlp files to store help
  401. <Help> This is an optional field where you can add a longer comment
  402. that will be displayed when you highlight this comment line
  403. and hit the Help button
  404. 3.2.3. bool 'Description' Variable Default ["Help"]
  405. ---------------------------------------------------
  406. Add a bool (on/off) menu item. E.g.:
  407. bool 'Abort when a package-build fails' ROCKCFG_ABORT_ON_ERROR 1 "
  408. When you select this option Build-Target will abort when a packet
  409. fails to compile"
  410. <Description> Title of the item in the config menu
  411. <Variable> Name of the config variable triggered by this menu item
  412. <Default> '1' = On, '0' = Off
  413. <Help> This is an optional field where you can add a longer comment
  414. that will be displayed when you highlight this item line
  415. and hit the Help button
  416. The variable will be set to '1' or '0'.
  417. 3.2.4. text 'Description' Variable Default ["Help"]
  418. ---------------------------------------------------
  419. Add a text menu item. If the text must fit a special pattern, modify the
  420. config variable _before_ calling the text function. E.g.:
  421. ROCKCFG_MAKE_JOBS="`echo $ROCKCFG_MAKE_JOBS | sed 's,[^0-9],,g'`"
  422. text 'Number of parallel make jobs (make -j)' ROCKCFG_MAKE_JOBS 1
  423. <Description> Title of the item in the config menu
  424. <Variable> Name of the config variable triggered by this menu item
  425. <Default> Default value
  426. <Help> This is an optional field where you can add a longer comment
  427. that will be displayed when you highlight this item line
  428. and hit the Help button
  429. 3.2.5. choice Variable Default Value1 'Description1' [ ... ]
  430. ------------------------------------------------------------
  431. Add a multiple-choice menu item. E.g.:
  432. choice ROCKCFG_INTEL_OPT generic \
  433. generic "No special optimisation" \
  434. i386 "Optimised for Intel 386" \
  435. i486 "Optimised for Intel 486" \
  436. i586 "Optimised for Intel Pentium" \
  437. i686 "Optimised for Intel Pentium-Pro" \
  438. k6 "Optimised for AMD K-6" \
  439. k7 "Optimised for AMD Athlon"
  440. <Variable> Name of the config variable triggered by this menu item
  441. <Default> Default value
  442. <ValueN> Value for option N
  443. <DescriptionN> Title of the item in the config menu if option N is active
  444. 3.2.6. const Variable Default
  445. -----------------------------
  446. Sets the given variable to the given default value without displaying any
  447. menu item.
  448. 3.2.7. block_begin and block_end
  449. --------------------------------
  450. A set of menu items which belongs together should be surrounded with
  451. block_begin and block_end. block_begin expects a numeric parameter which
  452. specifies the number of characters the menu item titles should be shifted
  453. to the right. E.g.:
  454. comment '--- Default compiler for building (almost) everything'
  455. block_begin 5
  456. choice ROCKCFG_PKG_GCC_DEFAULT_CC gcc2 $list
  457. if [ $ROCKCFG_PKG_GCC_DEFAULT_CC = 'gcc2' ] ; then
  458. bool 'Use GCC Stack-Smashing Protector' ROCKCFG_PKG_GCC_STACKPRO 0
  459. [ $ROCKCFG_PKG_GCC_STACKPRO = 1 ] &&
  460. ROCKCFG_ID="$ROCKCFG_ID-stackprotector"
  461. else
  462. ROCKCFG_ID="$ROCKCFG_ID-$ROCKCFG_PKG_GCC_DEFAULT_CC"
  463. fi
  464. block_end
  465. 3.2.8. expert_begin and expert_end
  466. ----------------------------------
  467. Options which should only be displayed if the 'expert mode' is active should be
  468. surrounded with expert_begin and expert_end.
  469. 3.3. Special Variables
  470. ======================
  471. 3.3.1. ROCKCFG_*
  472. ----------------
  473. All Configuration variables should start with "ROCKCFG_". Non-core variables
  474. have extended prefixes:
  475. Arches: ROCKCFG_ARCH_<Arch-Name>_*
  476. Targets: ROCKCFG_TRG_<Target-Name>_*
  477. Packages: ROCKCFG_PKG_<Pkg-Name>_*
  478. Some variables are handled by ./scripts/Config in a special way:
  479. ROCKCFG_ID Is the short-description of the configuration. Important
  480. config options should append something to this variable.
  481. ROCKCFG_EXPERT If set to '0', config items between expert_begin and
  482. expert_end will not be displayed and the default values
  483. for those options will be used.
  484. 3.3.2. ROCKCFGSET_*
  485. -------------------
  486. The ROCKCFGSET_* variables can be used to preset an option (e.g. in a target).
  487. If e.g. ROCKCFGSET_STRIP is set to 1, ROCKCFG_STRIP will have the value 1 and
  488. the user will not be able to change this setting.
  489. 3.3.3. CFGTEMP_*
  490. ----------------
  491. This variables can be used for data-exchange between the various config.in
  492. files. Non-core variables have extended prefixes:
  493. Arches: CFGTEMP_ARCH_<Arch-Name>_*
  494. Targets: CFGTEMP_TRG_<Target-Name>_*
  495. Packages: CFGTEMP_PKG_<Pkg-Name>_*
  496. E.g. dynamic creation of a multiple-choice option:
  497. architecture/intel/preconfig.in:
  498. CFGTEMP_ARCHLIST="$CFGTEMP_ARCHLIST intel IBM_PCs_and_compatible"
  499. architecture/powerpc/preconfig.in:
  500. CFGTEMP_ARCHLIST="$CFGTEMP_ARCHLIST powerpc PowerPC_Workstations"
  501. scripts/config.in:
  502. choice ROCKCFG_ARCH $ROCKCFG_ARCH $CFGTEMP_ARCHLIST
  503. 3.4. Config.in call-tree
  504. ========================
  505. All config.in files are executed from scripts/config.in the the following
  506. order:
  507. - architecture/*/preconfig.in
  508. * Selecting Architecture
  509. * architecture/$ROCKCFG_ARCH/config.in
  510. - target/*/preconfig.in
  511. - package/*/*/preconfig.in
  512. * Selecting Target
  513. * target/$ROCKCFG_TARGET/config.in
  514. * package/*/*/config.in
  515. * Various common build options
  516. - package/*/*/postconfig.in
  517. - architecture/$ROCKCFG_ARCH/postconfig.in
  518. - target/$ROCKCFG_TARGET/postconfig.in
  519. Only scripts marked with '*' might interact with the user (create menu
  520. items). The others might only set and modify various variables.
  521. 3.5. Creation of the Packages file
  522. ==================================
  523. The ./scripts/Config script creates a 'packages' file with all packages
  524. available for the selected architecture before calling scripts/config.in.
  525. Every config.in file might now modify this Packages file by creating a
  526. Packages.new file and renaming it to Packages. E.g.:
  527. if [ $ROCKCFG_TRG_GENERIC_BUILDSF != 1 ] ; then
  528. awk '$4 != "sourceforge" { print }' \
  529. < config/$config/packages \
  530. > config/$config/packages.new
  531. mv config/$config/packages.new config/$config/packages
  532. fi
  533. The packages file is blank-separated and easy to parse with grep, sed and awk.
  534. The fields are:
  535. X/O 'X' = packages is active, 'O' = package is not active
  536. If you don't want another config.in to re-activate a package you might
  537. also simply remove the line from the file.
  538. Stages Stage levels as specified in the packages [P] tag (see next chapter)
  539. Pri. Priority as specified in the packages [P] tag (sort-key for the file)
  540. Resp. Repository name where the package is found
  541. Name Package Name
  542. Ver. Package Version
  543. Prefix Package prefix (with leading '/')
  544. Cat. Package categories (always lower case, contain at least one /)
  545. Flags Package flags (always upper case)
  546. Counter Simply ignore that field
  547. Because of the 'counter' field, categories and flags are always pre- and
  548. postfixed with a ' '. So you can e.g. easy remove all not dietlibc-ready
  549. packages with a command like:
  550. grep ' DIETLIBC ' < config/$config/packages \
  551. > config/$config/packages.new
  552. Read the existing config.in files for details.
  553. 4. Packages
  554. ===========
  555. 4.1. Fundamentals
  556. =================
  557. Every package has it's own subdirectory in package/<repository>/. The
  558. repositories are organisational units to group packages. Every repository
  559. belongs to one ROCK Linux developer or developer group. The per-package
  560. directory must have the same name as the package.
  561. The Package name is 2-25 characters long and must match the regular expression:
  562. /^[a-z0-9][a-z0-9\.\+_-]*[a-z0-9\+]$/
  563. (Minimum of 2 characters. First one: lower case letter or number. Last
  564. one: lower case letter, number or '+'. Rest: lower case letter, number
  565. or one of '.', '+', '_' or '-'.)
  566. A package name must not be used in more than one repository.
  567. Other (non-package) subdirectories are allowed, if they don't begin with
  568. a lower case letter or number (so e.g. "CVS" subdirectories are ok) and
  569. do not contain any *.desc files.
  570. This per-package directory contains all information needed to download and
  571. build a package.
  572. 4.2. The *.desc files
  573. =====================
  574. Every Package _must_ have a <packagename>.desc file. It contains all the
  575. meta-information for the package. Have a look at the PKG-DESC-FORMAT file
  576. for a description of the available tags. The more complex ones are described
  577. in detail in this howto.
  578. 4.2.1. Package Priority
  579. -----------------------
  580. The [P] tag is used to set the "package priority". The [P] tag has three
  581. fields:
  582. [P] X --3-----9 010.066
  583. The first field ('X' or 'O') specifies if this package should be built per
  584. default (X) or not (O). This is 'X' for almost all packages. This flag might
  585. be overwritten by the configuration (see chapter 3).
  586. The 2nd field lists the stages in which the package should be built. There
  587. are 10 stages (0-9). Build-Target will start with building stage one, then
  588. stage 2 and so on. Stage 9 is only built if 'Make rebuild stage (stage 9)'
  589. is activated in the configuration. Stages 0 and 1 are cross-build stages and
  590. should only contain packages which can be cross-built. So, the stages can be
  591. used to specify the build order (e.g. stage 3 is built before stage 5) and
  592. to re-build a package multiple times.
  593. The 3rd field is used to specify the build order within the stages. It's
  594. simply text-sorted.
  595. 4.2.2. Download URLs
  596. --------------------
  597. Usually a package must download one or more original source file. This files
  598. are downloaded using the ./scripts/Download script and stored in the
  599. directory 'download/<repository-name>/<package-name>/'.
  600. Every file which should be downloaded has it's own [D] tag in the package
  601. *.desc file. The [D] tag has three fields:
  602. [D] 354985877 gcc-2.95.3.tar.gz ftp://ftp.gnu.org/pub/gnu/gcc/
  603. The first field is the checksum for this file. Those checksums are created
  604. with e.g.:
  605. ./scripts/Download -mk-cksum download/base/gcc2/gcc-2.95.3.tar.bz2
  606. If the checksum is simply '0', this means that no checksum has been created so
  607. far. The script ./scripts/Create-CkSumPatch can be used for creating a patch
  608. which fills in those checksums.
  609. For files which should not have a checksum for one or another reason (e.g.
  610. because the content on the original site is changing often), a checksum-string
  611. consisting of only 'X' characters can be used. E.g.:
  612. [D] XXXXXXXXXX RFCs3001-latest.tar.gz ftp://ftp.rfc-editor.org/in-notes/tar/
  613. The 2nd field is the filename. Files with the postfix *.gz or *.tgz are
  614. automatically converted to *.bz2 or *.tbz2 files by the ./scripts/Download
  615. script.
  616. The 3rd parameter is the download URL without the filename part. If the local
  617. filename differs from the remote filename, the URL must be prefixed with a '!'
  618. character. E.g.:
  619. [D] 2447691734 services.txt !http://www.graffiti.com/services
  620. The ./scripts/Check-PkgVersion script is also using this [D] tags for checking
  621. for new package versions. The ./scripts/Check-PkgVersion can also be directly
  622. configured using the tags [CV-URL], [CV-PAT] and [CV-DEL].
  623. 4.3. The *.conf files
  624. =====================
  625. ./scripts/Build-Pkg has a semi-intelligent code for building and installing a
  626. package. It's the build_this_package() shell function which can be found in
  627. ./scripts/functions. This script is configured using various variables
  628. which can be set or modified in the *.conf file. A list of those variables
  629. can be found in the PKG-BUILD-VARS file in this directory. Read the existing
  630. *.conf files for examples.
  631. 4.3.1. FIXME
  632. ------------
  633. 4.4. The *.patch files
  634. ======================
  635. All *.patch files in the package directory are automatically applied after the
  636. package source tar file has been extracted. The *.patch.<architecture> patch
  637. files are only applied when building for the specified architecture.
  638. 4.5. The *.doc files
  639. ====================
  640. All *.doc files in the package directory are automatically copied to the
  641. package documentation directory (e.g. /usr/share/doc/$pkg) without the ".doc"
  642. postfix.
  643. 4.6. The *.init files
  644. =====================
  645. Init scripts are installed using the shell function install_init. This function
  646. is converting a *.init file into a SysV Init Script. Have a look at
  647. package/base/devfsd/devfsd.conf and
  648. package/base/devfsd/devfsd.init
  649. or
  650. package/base/sysklogd/sysklogd.conf and
  651. package/base/sysklogd/sysklogd.init
  652. for small examples. The conversion from *.init files to SysV Init Scripts is
  653. done using m4 and the macro file 'package/base/sysvinit/init_macros.m4'.
  654. 5. Targets
  655. ==========
  656. A ROCK Linux target is a distribution based on ROCK Linux. It can alter the
  657. package selection, force some special configuration to be used, supply
  658. additional patches to each package, modify any build aspect of a package and
  659. more.
  660. The most important file of a target is the 'preconfig.in' file where the
  661. target needs to register itself via:
  662. CFGTEMP_TARGETLIST="$CFGTEMP_TARGETLIST target_name Long_Visible_Name"
  663. When a target is selected the file 'config.in' is evaluated. Here options
  664. can be forced to be set/unset and new options can be introduced.
  665. The file build.sh is executed for the build of the target. If the target is
  666. a straight-forward build only the ROCK Linux auto-build-system needs to be
  667. called:
  668. pkgloop
  669. or to also generate some database files for the install-cd the generic
  670. build.sh can be reused:
  671. . target/generic/build.sh
  672. A target specific .conf file or patch for a package may easily be added
  673. by placing it under the name pkg_$pkg.conf or pkg_$pkg.patch in the target's
  674. directory. Where $pkg is the name of the respective package.
  675. Some packages might have target specific hooks, like the linux* package which
  676. uses a kernel.conf.sh in the target's directory to perform additional config
  677. work on the kernel's .config file.
  678. 6. Architectures
  679. ================
  680. Aside from the fact that each architecture needs at least to register itself
  681. to the ROCK Linux build system, it might provide patches and kernel
  682. configuration to work properly.
  683. The registering works via the preconfig.in file - just like for the targets:
  684. CFGTEMP_ARCHLIST="$CFGTEMP_ARCHLIST arch_name4 Long_Visible_Name"
  685. The usual config.in can be used to force options to be set/unset or to
  686. introduce new options (just like the config.in in several other places).
  687. The file gcc-options controls additional options passed to GCC.
  688. The files kernel{$treever,}.conf{m4,sh,} and kernel-disable{treever,}.lst
  689. are used to control the options used for the linux kernel build.
  690. As already mentioned in the explanation of packages, architecture specific
  691. patches are added to the respective package with a patch.$arch suffix.
  692. A archtest.out or archtest.sh file should be present to define some constants
  693. like:
  694. arch_sizeof_short=2
  695. arch_sizeof_int=4
  696. arch_sizeof_long=4
  697. arch_sizeof_long_long=8
  698. arch_sizeof_char_p=4
  699. arch_bigendian=yes
  700. arch_machine=powerpc
  701. arch_target=powerpc-unknown-linux-gnu