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.

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