Changes between Version 5 and Version 6 of RpmHowToPackagers


Ignore:
Timestamp:
Sep 9, 2010, 11:37:28 PM (14 years ago)
Author:
Yuri Dario
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RpmHowToPackagers

    v5 v6  
    55== Introduction ==
    66RPM 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
    78Instead 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.
    89
     
    1617
    1718Basic 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:''
    2526
    2627== Prepare source code ==
    2728This 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}-
    2829{version} directory. You can change this with ''-n'' parameter for %setup macro.
     30
    2931If 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
     33To apply first patch add ''patch0 -p1 -b .my_suffix''; the second will use ''patch1...'' and so on.
    3134Example:
    3235{{{
     
    5760
    5861In 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
    5963Most 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.
    6064CFLAGS will be added by rpm.
     
    9599 * -bl check file list only and stop.
    96100
    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.
     101Since -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.