Changes between Version 1 and Version 2 of RPMBuilding


Ignore:
Timestamp:
Aug 3, 2010 1:29:43 PM (11 years ago)
Author:
thomas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RPMBuilding

    v1 v2  
    11= Getting started with RPM Building =
    22
    3 ow to get started with building RPMS - in particular how to setup your build environment and the basics of spec file writing.
     3How to get started with building RPMS - in particular how to setup your build environment and the basics of spec file writing.
    44Getting Started
    55
     
    77To build rpms you need to have a .rpmmacros file in your home directory which configures your build tree location. The minimum you'll need is the location of your top directory for building
    88
     9{{{
     10#!sh
    911[joe@host ~] cat .rpmmacros
    1012%_topdir $HOME/src
    11 
     13}}}
    1214You'll need to create /home/$USER/src as well, with the following subdir's: SRPMS SPECS BUILD SOURCES RPMS
    13 
     15{{{
     16#!sh
    1417[joe@host ~] cd
    1518[joe@host ~] mkdir -p src/SRPMS src/SPECS src/BUILD src/SOURCES src/RPMS
    16 
     19}}}
    1720to build your first rpm, start simple. Download a known to be good source rpm of something small, tar is a good first package since it is small and quick to build. Install the src rpm using
    18 
     21{{{
     22#!sh
    1923[joe@host ~] rpm -Uvh packagex.src.rpm
    20 
     24}}}
    2125This will install the packagex.spec file in your SPECS directory and the source files (usually a tarball, eg package-version.release.tar.gz) in your SOURCES directory.
    2226To build this rpm using that spec:
    23 
     27{{{
     28#!sh
    2429[joe@host ~] rpmbuild -ba packagex.spec
    2530Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.55587
     
    3136Wrote: NaVclean): /bin/sh -e /var/tmp/rpm-tmp.90228
    3237+ umask 022 + cd %_topdir/BUILD + cd packagex + rm -rf /tmp/packagex-1.2.5-2.PU_IAS.1-root + exit 0
    33 
     38}}}
    3439If all goes well you've built your first rpm :). If your package built successfully, you will see lines like those shown above "Wrote: package", if your build fails you will not see these lines and the exit status will not be 0 :(.
    3540
    36 Writing your own Spec Files
     41=== Writing your own Spec Files ===
    3742
    3843Typical spec file
     
    4045A typical rpm spec file contains a header section, description, prep, build, install, files, and script sections.
    4146
    42 Header
     47==== Header ====
    4348
    4449Mandatory headers are listed below in italics, there are many other optional fields, included here are
    4550some common ones.
    46 
     51{{{
     52#!sh
    4753Summary: Example spec file for a typical rpm package
    4854Name: example
     
    120126rm -rf $RPM_BUILD_ROOT
    121127
    122 == Changelog ==
    123 
    124 {{{
    125128%changelog
    126129* Tue Dec 11 2001 Josko Plazonic <plazonic@....> 0.11-1