User:Jzeleny/FFD/Simple RPM Build

From FedoraProject

Jump to: navigation, search

Simple RPM builds from source files - command sequence

This tutorial assumes you have a tarball, (optionally) set of patches you want to be applied on top of content of that tarball and a spec file describing how to build that tarball.


You can use following simple command sequence run by root to build your RPM package from spec file on your system:

# yum install rpmdevtools yum-utils
# su - <user>
$ rpmdev-setuptree
$ cp <sources> ~/rpmbuild/SOURCES
$ cd ~/rpmbuild/SPECS
$ sudo yum-builddep <package>.spec
$ rpmbuild -ba <package>.spec                          # now your rpms are in ../RPMS and src.rpm in ../SRPMS

Simple RPM builds - commands' description

Now let's take a look at the thing above, one command at a time.

# yum install rpmdevtools yum-utils

This is a one-time action, which will prepare your system - it will install two packages which are necessary for the following work. rpmdevtools contains rpmdev-setuptree script and yum-utils contains yum-builddep. You don't have to install rpmdevtools if you already have your rpm build tree (if you, for example, built some packages before).


$ rpmdev-setuptree

This will create a directory tree necessary to build packages in your home directory. If you already have the tree, you can skip this step. For more details on the tree structure, please see How_to_create_an_RPM_package.

$ cp <sources> ~/rpmbuild/SOURCES

The important thing to know is that you should copy your spec file into SPECS and all other source files into SOURCES directory.

$ cd ~/rpmbuild/SPECS
$ yum-builddep package.spec

This will try to download and install all built-time dependencies of desired package. Unfortunatelly rpmbuild can't do that on its own.

$ cd -
$ rpmbuild -ba package.spec

This will build your rpm and srpm packages. If any errors occur, you will see them on terminal. Otherwise look for your packages in ../RPMS and ../SRPMS respectively.