From Fedora Project Wiki

m (Jzeleny moved page User:Jzeleny/FFD/SimpleRPMBuild to User:Jzeleny/FFD/Simple RPM Build: Make the title more readable)
Line 1: Line 1:


== Simple RPM builds - command sequence ==
== 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:
You can use following simple command sequence run by root to build your RPM package from spec file on your system:
Line 7: Line 10:
# su - <user>
# su - <user>
$ rpmdev-setuptree
$ rpmdev-setuptree
$ mc                                                # now copy package's files where necessary
$ cp <sources> ~/rpmbuild/SOURCES
$ cd ~/rpmbuild/SPECS
$ cd ~/rpmbuild/SPECS
$ rpmbuild -bs package.spec
$ sudo yum-builddep <package>.spec
$ cd ~/rpmbuild/SRPMS
$ rpmbuild -ba <package>.spec                         # now your rpms are in ../RPMS and src.rpm in ../SRPMS
$ yum-builddep package.srpm
$ cd - && rpmbuild -ba package.spec                 # now your rpms are in ../RPMS
</pre>
</pre>


== Simple RPM builds - commands' description ==
== Simple RPM builds - commands' description ==

Revision as of 14:21, 1 February 2013

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 will install two packages which are necessary for the following work. rpmdevtools contains rpmdev-setuptree script and yum-utils contains yum-builddep.


$ rpmdev-setuptree

This will create a directory tree necessary to build packages in your home directory. For more details on the tree structure, please see How_to_create_an_RPM_package.

$ mc                                                 # now copy package's files where necessary

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
$ rpmbuild -bs package.spec

This will create srpm package. That is necessary for the next step. If you are sure all build dependencies of the package are installed, you can skip these two steps.

$ cd ~/rpmbuild/SRPMS
$ yum-builddep package.srpm

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 -bb package.spec

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