Changes between Version 5 and Version 6 of RpmHowToPackagers
- Timestamp:
- Sep 9, 2010, 11:37:28 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RpmHowToPackagers
v5 v6 5 5 == Introduction == 6 6 RPM uses a special file to compile source code, prepare installation and create .rpm files: it is a .spec file, which is just a bunch of shell commands to prepare, build, install, check and clean the setup. 7 7 8 Instead of writing a .spec file from scratch, you can get an existing one: a good source for them is the [http://www.rpmfind.net RPM find service]. Enter the name of your package, and choose a distribution. Usually packages for Fedora or OpenSUSE 11.3 are good. Select your package from the left link, you will get a page with all details; one of them is the .src.rpm package, it contains the spec file, platform specific patches, package sources (in .tar.gz, .tar.bz2, .tar.xz format). Use unrpm.cmd (check bootstrap directory) to extract all files to a temporary location. 8 9 … … 16 17 17 18 Basic RPM tags: 18 ''name:''19 ''version:''20 ''license:''21 ''source:''22 ''source1:''23 ''patch0:''24 ''patch1:''19 * ''name:'' 20 * ''version:'' 21 * ''license:'' 22 * ''source:'' 23 * ''source1:'' 24 * ''patch0:'' 25 * ''patch1:'' 25 26 26 27 == Prepare source code == 27 28 This is done in the ''%prep'' section. Here the ''%setup'' macro will expand your source package (the one in the ''Source:'' line) and write the files by default in the %HOME%\rpmbuild\BUILD\{name}- 28 29 {version} directory. You can change this with ''-n'' parameter for %setup macro. 30 29 31 If you need to extract more source files, use the ''-a'' parameter. 30 To apply first patch add ''patch0 -p1 -b .my_suffix''; the second will use ''patch1...' and so on. 32 33 To apply first patch add ''patch0 -p1 -b .my_suffix''; the second will use ''patch1...'' and so on. 31 34 Example: 32 35 {{{ … … 57 60 58 61 In this case, ''%configure'' is another macro, and it will be expanded to add proper paths for common variables, like prefix, exec_prefix and others. Keep in mind that rpmbuild will use /@unixroot/usr as prefix, so all built software will go to the same tree layout. Also programs will be able to be executed from other drives. 62 59 63 Most of the times, the CONFIG_SHELL variable is required, otherwise bash shell will be selected if available: bash does not work very well, ash is more compatible. 60 64 CFLAGS will be added by rpm. … … 95 99 * -bl check file list only and stop. 96 100 97 Since -bc, -bi, -bl are performing also previous steps, you can add the special option ''--short-circuit' : this will skip all previous steps (rpmbuild will assume they are already ok), and do only the selected task.101 Since -bc, -bi, -bl are performing also previous steps, you can add the special option ''--short-circuit'': this will skip all previous steps (rpmbuild will assume they are already ok), and do only the selected task.