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.

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