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.

983 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. 'spar', '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', 'rene', '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 'generic' target, build 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/base/linux24/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.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/1.7.0-DEV-intel-generic/root
  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 extra2 ; patch -p1 < cksum.patch
  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 extra2
  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 > update.patch << 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. The resulting update.patch file should be checked manually before being
  308. applied with 'patch -p1 < update.patch'.
  309. 2.4.10. ./scripts/Create-ErrList
  310. --------------------------------
  311. Outputs the list of packages which failed to build (including the stage
  312. numbers) in the right order.
  313. 2.4.11. ./scripts/Create-UpdList
  314. --------------------------------
  315. Create a list of packages which are active in the current configuration and
  316. have changed since the binaries installed on the local system have been
  317. generated. The compare is done using the package source checksums stored
  318. in /var/adm/packages/<package-name>.
  319. 2.4.12. ./scripts/Update-System
  320. -------------------------------
  321. Update (re-build) all packages on the local system for which newer versions
  322. are available. Create-UpdList is used to generate the list of packages which
  323. do need an update.
  324. 2.4.14. ./scripts/Help
  325. ----------------------
  326. This script expects the filename of a script in ./scripts/ and jumps to
  327. the right position in this document. It's a very simple wrapper for 'less'.
  328. 2.4.15. ./scripts/Internal
  329. --------------------------
  330. This script is used by Clifford Wolf to release snapshots and to keep the
  331. FTP Mirrors up-to-date.
  332. 2.5. Scripts for doing checks
  333. =============================
  334. 2.5.1. ./scripts/Check-PkgVersion
  335. ---------------------------------
  336. This script is used by the ROCK Linux developers to check for new package
  337. versions. The results of the last run are always stored in a directory called
  338. checkver/ and if there is a difference in the current run, a *.msg file will
  339. be written to checkver/. (read the script for details)
  340. E.g.: ./scripts/Check-PkgVersion -repository base
  341. for x in checkver/*.new ; do mv -f $x ${x%.new}.txt ; done
  342. cat checkver/*.msg > todo.txt
  343. Note: An old *.msg file will automatically removed when you run
  344. Check-PkgVersion the next time.
  345. 2.5.2. ./scripts/Check-PkgFormat
  346. --------------------------------
  347. This script does a few very simple tests to auto-detect errors in the package
  348. *.desc and *.conf files.
  349. E.g.: ./scripts/Check-PkgFormat -repository extra1
  350. 2.5.3. ./scripts/Check-System
  351. -----------------------------
  352. This script does a very simple tests to auto-detect possible problems
  353. with the host linux system.
  354. 2.5.4. ./scripts/Check-Deps
  355. ---------------------------
  356. This command checks if the current package build order is ok for solving all
  357. package dependencies.
  358. 2.6. Scripts for updating the source tree
  359. =========================================
  360. 2.6.1. ./scripts/Update-Src
  361. ---------------------------
  362. Update the source tree with rsync from www.rocklinux.org.
  363. Warning: This will remove the changes you have made to the source tree.
  364. 3. Configuration System
  365. =======================
  366. 3.1. Fundamentals
  367. =================
  368. The configuration script ./scripts/Config generates the files in the
  369. config/${config}/ directory:
  370. config the configuration options
  371. packages the packages which are build in this configuration
  372. ./scripts/Config defines some special shell functions and contains the
  373. main-loop of the configuration program. The structure of the config menus
  374. is stored in scripts/config.in (and other config.in files included by it).
  375. Have a look at scripts/config.in for more information on which file is
  376. including which other files.
  377. 3.2. Special Commands
  378. =====================
  379. Whenever the menu is displayed (i.e. after starting ./scripts/Config and
  380. whenever a change has been made), scripts/config.in is executed and is using
  381. the following special commands to write the 'config' file and add items to the
  382. menu.
  383. 3.2.1. comment 'Description' ["Help"]
  384. -------------------------------------
  385. Add a comment to the config menu (and item without any function). E.g.:
  386. comment '- Architecture, CPU and Optimisation' "
  387. Select which CPU optimalization is right for your machine."
  388. <Description> Title of the item in the config menu (comment text)
  389. <Help> This is an optional field where you can add a longer comment
  390. that will be displayed when you highlight this comment line
  391. and hit the Help button
  392. 3.2.2. comment_id 'Description' 'ID' ["Help"]
  393. ---------------------------------------------
  394. Add a comment to the config menu (and item without any function). E.g.:
  395. comment '- Architecture, CPU and Optimisation' COMMENT_ARCH_CPU_OPT "
  396. Select which CPU optimalization is right for your machine."
  397. <Description> Title of the item in the config menu (comment text)
  398. <ID> ID which will be used to identify a comment. It is
  399. useful when you use config.hlp files to store help
  400. <Help> This is an optional field where you can add a longer comment
  401. that will be displayed when you highlight this comment line
  402. and hit the Help button
  403. 3.2.3. bool 'Description' Variable Default ["Help"]
  404. ---------------------------------------------------
  405. Add a bool (on/off) menu item. E.g.:
  406. bool 'Abort when a package-build fails' ROCKCFG_ABORT_ON_ERROR 1 "
  407. When you select this option Build-Target will abort when a packet
  408. fails to compile"
  409. <Description> Title of the item in the config menu
  410. <Variable> Name of the config variable triggered by this menu item
  411. <Default> '1' = On, '0' = Off
  412. <Help> This is an optional field where you can add a longer comment
  413. that will be displayed when you highlight this item line
  414. and hit the Help button
  415. The variable will be set to '1' or '0'.
  416. 3.2.4. text 'Description' Variable Default ["Help"]
  417. ---------------------------------------------------
  418. Add a text menu item. If the text must fit a special pattern, modify the
  419. config variable _before_ calling the text function. E.g.:
  420. ROCKCFG_MAKE_JOBS="`echo $ROCKCFG_MAKE_JOBS | sed 's,[^0-9],,g'`"
  421. text 'Number of parallel make jobs (make -j)' ROCKCFG_MAKE_JOBS 1
  422. <Description> Title of the item in the config menu
  423. <Variable> Name of the config variable triggered by this menu item
  424. <Default> Default value
  425. <Help> This is an optional field where you can add a longer comment
  426. that will be displayed when you highlight this item line
  427. and hit the Help button
  428. 3.2.5. choice Variable Default Value1 'Description1' [ ... ]
  429. ------------------------------------------------------------
  430. Add a multiple-choice menu item. E.g.:
  431. choice ROCKCFG_INTEL_OPT generic \
  432. generic "No special optimisation" \
  433. i386 "Optimised for Intel 386" \
  434. i486 "Optimised for Intel 486" \
  435. i586 "Optimised for Intel Pentium" \
  436. i686 "Optimised for Intel Pentium-Pro" \
  437. k6 "Optimised for AMD K-6" \
  438. k7 "Optimised for AMD Athlon"
  439. <Variable> Name of the config variable triggered by this menu item
  440. <Default> Default value
  441. <ValueN> Value for option N
  442. <DescriptionN> Title of the item in the config menu if option N is active
  443. 3.2.6. const Variable Default
  444. -----------------------------
  445. Sets the given variable to the given default value without displaying any
  446. menu item.
  447. 3.2.7. block_begin and block_end
  448. --------------------------------
  449. A set of menu items which belongs together should be surrounded with
  450. block_begin and block_end. block_begin expects a numeric parameter which
  451. specifies the number of characters the menu item titles should be shifted
  452. to the right. E.g.:
  453. comment '--- Default compiler for building (almost) everything'
  454. block_begin 5
  455. choice ROCKCFG_PKG_GCC_DEFAULT_CC gcc2 $list
  456. if [ $ROCKCFG_PKG_GCC_DEFAULT_CC = 'gcc2' ] ; then
  457. bool 'Use GCC Stack-Smashing Protector' ROCKCFG_PKG_GCC_STACKPRO 0
  458. [ $ROCKCFG_PKG_GCC_STACKPRO = 1 ] &&
  459. ROCKCFG_ID="$ROCKCFG_ID-stackprotector"
  460. else
  461. ROCKCFG_ID="$ROCKCFG_ID-$ROCKCFG_PKG_GCC_DEFAULT_CC"
  462. fi
  463. block_end
  464. 3.2.8. expert_begin and expert_end
  465. ----------------------------------
  466. Options which should only be displayed if the 'expert mode' is active should be
  467. surrounded with expert_begin and expert_end.
  468. 3.3. Special Variables
  469. ======================
  470. 3.3.1. ROCKCFG_*
  471. ----------------
  472. All Configuration variables should start with "ROCKCFG_". Non-core variables
  473. have extended prefixes:
  474. Arches: ROCKCFG_ARCH_<Arch-Name>_*
  475. Targets: ROCKCFG_TRG_<Target-Name>_*
  476. Packages: ROCKCFG_PKG_<Pkg-Name>_*
  477. Some variables are handled by ./scripts/Config in a special way:
  478. ROCKCFG_ID Is the short-description of the configuration. Important
  479. config options should append something to this variable.
  480. ROCKCFG_EXPERT If set to '0', config items between expert_begin and
  481. expert_end will not be displayed and the default values
  482. for those options will be used.
  483. 3.3.2. ROCKCFGSET_*
  484. -------------------
  485. The ROCKCFGSET_* variables can be used to preset an option (e.g. in a target).
  486. If e.g. ROCKCFGSET_STRIP is set to 1, ROCKCFG_STRIP will have the value 1 and
  487. the user will not be able to change this setting.
  488. 3.3.3. CFGTEMP_*
  489. ----------------
  490. This variables can be used for data-exchange between the various config.in
  491. files. Non-core variables have extended prefixes:
  492. Arches: CFGTEMP_ARCH_<Arch-Name>_*
  493. Targets: CFGTEMP_TRG_<Target-Name>_*
  494. Packages: CFGTEMP_PKG_<Pkg-Name>_*
  495. E.g. dynamic creation of a multiple-choice option:
  496. architecture/intel/preconfig.in:
  497. CFGTEMP_ARCHLIST="$CFGTEMP_ARCHLIST intel IBM_PCs_and_compatible"
  498. architecture/powerpc/preconfig.in:
  499. CFGTEMP_ARCHLIST="$CFGTEMP_ARCHLIST powerpc PowerPC_Workstations"
  500. scripts/config.in:
  501. choice ROCKCFG_ARCH $ROCKCFG_ARCH $CFGTEMP_ARCHLIST
  502. 3.4. Config.in call-tree
  503. ========================
  504. All config.in files are executed from scripts/config.in the the following
  505. order:
  506. - architecture/*/preconfig.in
  507. * Selecting Architecture
  508. * architecture/$ROCKCFG_ARCH/config.in
  509. - target/*/preconfig.in
  510. - package/*/*/preconfig.in
  511. * Selecting Target
  512. * target/$ROCKCFG_TARGET/config.in
  513. * package/*/*/config.in
  514. * Various common build options
  515. - package/*/*/postconfig.in
  516. - architecture/$ROCKCFG_ARCH/postconfig.in
  517. - target/$ROCKCFG_TARGET/postconfig.in
  518. Only scripts marked with '*' might interact with the user (create menu
  519. items). The others might only set and modify various variables.
  520. 3.5. Creation of the Packages file
  521. ==================================
  522. The ./scripts/Config script creates a 'packages' file with all packages
  523. available for the selected architecture before calling scripts/config.in.
  524. Every config.in file might now modify this Packages file by creating a
  525. Packages.new file and renaming it to Packages. E.g.:
  526. if [ $ROCKCFG_TRG_GENERIC_BUILDSF != 1 ] ; then
  527. awk '$4 != "sourceforge" { print }' \
  528. < config/$config.$swpid/packages \
  529. > config/$config.$swpid/packages.new
  530. mv config/$config.$swpid/packages.new config/$config.$swpid/packages
  531. fi
  532. The packages file is blank-separated and easy to parse with grep, sed and awk.
  533. The fields are:
  534. X/O 'X' = packages is active, 'O' = package is not active
  535. If you don't want another config.in to re-activate a package you might
  536. also simply remove the line from the file.
  537. Stages Stage levels as specified in the packages [P] tag (see next chapter)
  538. Pri. Priority as specified in the packages [P] tag (sort-key for the file)
  539. Resp. Repository name where the package is found
  540. Name Package Name
  541. Ver. Package Version
  542. Prefix Package prefix (with leading '/')
  543. Cat. Package categories (always lower case, contain at least one /)
  544. Flags Package flags (always upper case)
  545. Counter Simply ignore that field
  546. Because of the 'counter' field, categories and flags are always pre- and
  547. postfixed with a ' '. So you can e.g. easy remove all not dietlibc-ready
  548. packages with a command like:
  549. grep ' DIETLIBC ' < config/$config.$swpid/packages \
  550. > config/$config.$swpid/packages.new
  551. Read the existing config.in files for details.
  552. 4. Packages
  553. ===========
  554. 4.1. Fundamentals
  555. =================
  556. Every package has it's own subdirectory in package/<repository>/. The
  557. repositories are organisational units to group packages. Every repository
  558. belongs to one ROCK Linux developer or developer group. The per-package
  559. directory must have the same name as the package.
  560. The Package name is 2-25 characters long and must match the regular expression:
  561. /^[a-z0-9][a-z0-9\.\+_-]*[a-z0-9\+]$/
  562. (Minimum of 2 characters. First one: lower case letter or number. Last
  563. one: lower case letter, number or '+'. Rest: lower case letter, number
  564. or one of '.', '+', '_' or '-'.)
  565. A package name must not be used in more than one repository.
  566. Other (non-package) subdirectories are allowed, if they don't begin with
  567. a lower case letter or number (so e.g. "CVS" subdirectories are ok) and
  568. do not contain any *.desc files.
  569. This per-package directory contains all information needed to download and
  570. build a package.
  571. 4.2. The *.desc files
  572. =====================
  573. Every Package _must_ have a <packagename>.desc file. It contains all the
  574. meta-information for the package. Have a look at the PKG-DESC-FORMAT file
  575. for a description of the available tags. The more complex ones are described
  576. in detail in this howto.
  577. 4.2.1. Package Priority
  578. -----------------------
  579. The [P] tag is used to set the "package priority". The [P] tag has three
  580. fields:
  581. [P] X --3-----9 010.066
  582. The first field ('X' or 'O') specifies if this package should be built per
  583. default (X) or not (O). This is 'X' for almost all packages. This flag might
  584. be overwritten by the configuration (see chapter 3).
  585. The 2nd field lists the stages in which the package should be built. There
  586. are 10 stages (0-9). Build-Target will start with building stage one, then
  587. stage 2 and so on. Stage 9 is only built if 'Make rebuild stage (stage 9)'
  588. is activated in the configuration. Stages 0 and 1 are cross-build stages and
  589. should only contain packages which can be cross-built. So, the stages can be
  590. used to specify the build order (e.g. stage 3 is built before stage 5) and
  591. to re-build a package multiple times.
  592. The 3rd field is used to specify the build order within the stages. It's
  593. simply text-sorted.
  594. 4.2.2. Download URLs
  595. --------------------
  596. Usually a package must download one or more original source file. This files
  597. are downloaded using the ./scripts/Download script and stored in the
  598. directory 'download/<repository-name>/<package-name>/'.
  599. Every file which should be downloaded has it's own [D] tag in the package
  600. *.desc file. The [D] tag has three fields:
  601. [D] 354985877 gcc-2.95.3.tar.gz ftp://ftp.gnu.org/pub/gnu/gcc/
  602. The first field is the checksum for this file. Those checksums are created
  603. with e.g.:
  604. ./scripts/Download -mk-cksum download/base/gcc2/gcc-2.95.3.tar.bz2
  605. If the checksum is simply '0', this means that no checksum has been created so
  606. far. The script ./scripts/Create-CkSumPatch can be used for creating a patch
  607. which fills in those checksums.
  608. For files which should not have a checksum for one or another reason (e.g.
  609. because the content on the original site is changing often), a checksum-string
  610. consisting of only 'X' characters can be used. E.g.:
  611. [D] XXXXXXXXXX RFCs3001-latest.tar.gz ftp://ftp.rfc-editor.org/in-notes/tar/
  612. The 2nd field is the filename. Files with the postfix *.gz or *.tgz are
  613. automatically converted to *.bz2 or *.tbz2 files by the ./scripts/Download
  614. script.
  615. The 3rd parameter is the download URL without the filename part. If the local
  616. filename differs from the remote filename, the URL must be prefixed with a '!'
  617. character. E.g.:
  618. [D] 2447691734 services.txt !http://www.graffiti.com/services
  619. The ./scripts/Check-PkgVersion script is also using this [D] tags for checking
  620. for new package versions. The ./scripts/Check-PkgVersion can also be directly
  621. configured using the tags [CV-URL], [CV-PAT] and [CV-DEL].
  622. 4.3. The *.conf files
  623. =====================
  624. ./scripts/Build-Pkg has a semi-intelligent code for building and installing a
  625. package. It's the build_this_package() shell function which can be found in
  626. ./scripts/functions. This script is configured using various variables
  627. which can be set or modified in the *.conf file. A list of those variables
  628. can be found in the PKG-BUILD-VARS file in this directory. Read the existing
  629. *.conf files for examples.
  630. 4.3.1. FIXME
  631. ------------
  632. 4.4. The *.patch files
  633. ======================
  634. All *.patch files in the package directory are automatically applied after the
  635. package source tar file has been extracted. The *.patch.<architecture> patch
  636. files are only applied when building for the specified architecture.
  637. 4.5. The *.doc files
  638. ====================
  639. All *.doc files in the package directory are automatically copied to the
  640. package documentation directory (e.g. /usr/share/doc/$pkg) without the ".doc"
  641. postfix.
  642. 4.6. The *.init files
  643. =====================
  644. Init scripts are installed using the shell function install_init. This function
  645. is converting a *.init file into a SysV Init Script. Have a look at
  646. package/base/devfsd/devfsd.conf and
  647. package/base/devfsd/devfsd.init
  648. or
  649. package/base/sysklogd/sysklogd.conf and
  650. package/base/sysklogd/sysklogd.init
  651. for small examples. The conversion from *.init files to SysV Init Scripts is
  652. done using m4 and the macro file 'package/base/sysvinit/init_macros.m4'.
  653. 5. Targets
  654. ==========
  655. A ROCK Linux target is a distribution based on ROCK Linux. It can alter the
  656. package selection, force some special configuration to be used, supply
  657. additional patches to each package, modify any build aspect of a package and
  658. more.
  659. The most important file of a target is the 'preconfig.in' file where the
  660. target needs to register itself via:
  661. CFGTEMP_TARGETLIST="$CFGTEMP_TARGETLIST target_name Long_Visible_Name"
  662. When a target is selected the file 'config.in' is evaluated. Here options
  663. can be forced to be set/unset and new options can be introduced.
  664. The file build.sh is executed for the build of the target. If the target is
  665. a straight-forward build only the ROCK Linux auto-build-system needs to be
  666. called:
  667. pkgloop
  668. or to also generate some database files for the install-cd the generic
  669. build.sh can be reused:
  670. . target/generic/build.sh
  671. A target specific .conf file or patch for a package may easily be added
  672. by placing it under the name pkg_$pkg.conf or pkg_$pkg.patch in the target's
  673. directory. Where $pkg is the name of the respective package.
  674. Some packages might have target specific hooks, like the linux* package which
  675. uses a kernel.conf.sh in the target's directory to perform additional config
  676. work on the kernel's .config file.
  677. 6. Architectures
  678. ================
  679. Aside from the fact that each architecture needs at least to register itself
  680. to the ROCK Linux build system, it might provide patches and kernel
  681. configuration to work properly.
  682. The registering works via the preconfig.in file - just like for the targets:
  683. CFGTEMP_ARCHLIST="$CFGTEMP_ARCHLIST arch_name4 Long_Visible_Name"
  684. The usual config.in can be used to force options to be set/unset or to
  685. introduce new options (just like the config.in in several other places).
  686. The file gcc-options controls additional options passed to GCC.
  687. The files kernel{$treever,}.conf{m4,sh,} and kernel-disable{treever,}.lst
  688. are used to control the options used for the linux kernel build.
  689. As already mentioned in the explanation of packages, architecture specific
  690. patches are added to the respective package with a patch.$arch suffix.
  691. A archtest.out or archtest.sh file should be present to define some constants
  692. like:
  693. arch_sizeof_short=2
  694. arch_sizeof_int=4
  695. arch_sizeof_long=4
  696. arch_sizeof_long_long=8
  697. arch_sizeof_char_p=4
  698. arch_bigendian=yes
  699. arch_machine=powerpc
  700. arch_target=powerpc-unknown-linux-gnu