Changes between Version 1 and Version 2 of RPMBuilding
- Timestamp:
- Aug 3, 2010 1:29:43 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RPMBuilding
v1 v2 1 1 = Getting started with RPM Building = 2 2 3 ow to get started with building RPMS - in particular how to setup your build environment and the basics of spec file writing.3 How to get started with building RPMS - in particular how to setup your build environment and the basics of spec file writing. 4 4 Getting Started 5 5 … … 7 7 To 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 8 8 9 {{{ 10 #!sh 9 11 [joe@host ~] cat .rpmmacros 10 12 %_topdir $HOME/src 11 13 }}} 12 14 You'll need to create /home/$USER/src as well, with the following subdir's: SRPMS SPECS BUILD SOURCES RPMS 13 15 {{{ 16 #!sh 14 17 [joe@host ~] cd 15 18 [joe@host ~] mkdir -p src/SRPMS src/SPECS src/BUILD src/SOURCES src/RPMS 16 19 }}} 17 20 to 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 19 23 [joe@host ~] rpm -Uvh packagex.src.rpm 20 24 }}} 21 25 This 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. 22 26 To build this rpm using that spec: 23 27 {{{ 28 #!sh 24 29 [joe@host ~] rpmbuild -ba packagex.spec 25 30 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.55587 … … 31 36 Wrote: NaVclean): /bin/sh -e /var/tmp/rpm-tmp.90228 32 37 + umask 022 + cd %_topdir/BUILD + cd packagex + rm -rf /tmp/packagex-1.2.5-2.PU_IAS.1-root + exit 0 33 38 }}} 34 39 If 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 :(. 35 40 36 Writing your own Spec Files 41 === Writing your own Spec Files === 37 42 38 43 Typical spec file … … 40 45 A typical rpm spec file contains a header section, description, prep, build, install, files, and script sections. 41 46 42 Header 47 ==== Header ==== 43 48 44 49 Mandatory headers are listed below in italics, there are many other optional fields, included here are 45 50 some common ones. 46 51 {{{ 52 #!sh 47 53 Summary: Example spec file for a typical rpm package 48 54 Name: example … … 120 126 rm -rf $RPM_BUILD_ROOT 121 127 122 == Changelog ==123 124 {{{125 128 %changelog 126 129 * Tue Dec 11 2001 Josko Plazonic <plazonic@....> 0.11-1