1 To build RPM you will need several other packages:
2 --------------------------------------------------
4 The zlib library for compression support. You might also need/want
5 the zip executable for java jar dependency analysis. All available from
6 http://www.gzip.org/zlib/
8 The libmagic (aka file) library for file type detection (used by rpmbuild).
9 The source for the file utility + library is available from
10 ftp://ftp.astron.com/pub/file/
12 The NSS library for encryption. This is available from
13 http://www.mozilla.org/projects/security/pki/nss/
15 The Berkeley DB >= 4.3.x (4.5.x or newer recommended) is required for the
16 default database backend. BDB can be downloaded from
17 http://www.oracle.com/technology/software/products/berkeley-db/index.html
19 RPM supports two different ways to include it, both methods have their
20 distinct advantages and disadvantages:
22 1) Building and using an internal copy of BDB
24 This is the "safe" way: upgrades to system BDB can not affect your
25 rpmdb integrity and you have full control over how BDB is configured.
26 On the other hand, any updates (security or bugfix) to BDB will require
29 To use this method, download a recent version of BDB from the URL above,
30 expand the tarball into rpm source directory root and create "db" symlink
32 $ wget http://download.oracle.com/berkeley-db/db-4.5.20.tar.gz
33 $ tar xzf db-4.5.20.tar.gz
35 $ ./configure [other options...]
37 2) Linking to external (system) BDB
39 If you can control when and how system BDB is upgraded, this option
40 saves space, removes the need to rebuild RPM in case of security etc
41 updates to BDB and also makes build rpm itself much faster. On the other
42 hand, major BDB upgrades can be disruptive, especially if
43 the on-disk format changes somehow.
45 To use this method, simply pass in --with-external-db to ./configure
46 script. If the system BDB is installed outside compiler + linker default
47 paths, you can use CPPFLAGS and LDFLAGS to tell configure where to look,
50 $ ./configure --with-external-db CPPFLAGS=-I/usr/include/db45
52 Minimal instructions for building BDB are
54 ../dist/configure --with-posixmutexes
58 If you want to use the alternative SQLite backend for RPM database instead
59 of the default Berkeley DB, it can be enabled with --enable-sqlite3 option
60 to configure. Note that the SQLite backend is not as tested as BDB.
61 SQLite >= 3.x is required and is available from
62 http://www.sqlite.org/
64 If SELinux support is desired, it can be enabled with --with-selinux option
65 to configure and libselinux development environment installed. SELinux
67 http://www.nsa.gov/selinux/
69 It may be desired to install bzip2 and gzip so that RPM can use these
70 formats. Gzip, is necessary to build packages that contain compressed
71 tar balls, these are quite common on the Internet.
72 These are availible from
76 If you want to build the Python bindings to RPM library, it can be enabled
77 with --enable-python option to configure. You'll need to have Python (>= 2.3)
78 runtime and C API development environment installed, this is available from
79 http://www.python.org/
81 For best results you should compile with GCC and GNU Make. Users have
82 reported difficulty with other build tools (any patches to lift these
83 dependencies are welcome). Both GCC and GNU Make available from
86 If National Language Support (NLS) is desired you will need gnu
87 gettext (currently this is required to build rpm but we hope to
88 lift this requirement soon), available from
91 If you are going to hack the sources (or compile from source repository)
92 you will need most of the GNU development tools including:
93 autoconf, automake, gettext, libtool, makeinfo, perl, GNU m4, GNU tar
97 If you want to build RPM API documentation, use --enable-apidocs configure
98 option. Doxygen is needed for this, it's available at
99 http://www.stack.nl/~dimitri/doxygen/
101 If you plan on using cryptographic signatures you will need a version
102 of GPG, available from
103 http://www.gnupg.org/
108 RPM uses a small shell script to run: libtool, autoconf,
109 automake. This step should not be necessary if you are running a
110 released version of rpm, however if you have gotten the rpm sources
111 directly from the source code repository, you need to generate
112 intermediate files by running the autogen.sh script.
114 The autogen.sh script checks that the required tools are installed.
115 The autogen.sh script also runs configure for you and passes the command line
116 arguments to configure. To run it without configure type:
118 ./autogen.sh --noconfigure
120 If your libraries are not in a standard place you will need to change
121 configures environment. These options can be passed directly to
122 configure or to autogen.sh which will pass them through to configure.
125 LIBS='-L/opt/libz/ -L/opt/BerkeleyDB/lib/' \
126 CPPFLAGS='-I/opt/libz/ -I/opt/BerkeleyDB/include' \
129 If you have build tools stored in non standard places you should check
130 the resulting Makefile to be sure that the tools you wish to use have
131 been correctly identified. The configure script will modify your path
132 before looking for the build tools and it may find versions of these
133 tools that you do not want. It uses the following search path
135 MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/opt/gnu/bin"
137 now build the system with:
141 and then install with:
145 If you wish to make a tarfile of the binaries so that you may easily
146 install on machines with OS package managers other then rpm (ed note:
147 what about putting gzip and bzip2 in the tar, modifying the
152 when installing. If you do install from a tarball, you will need to do
158 to initialize your rpm database.
160 Finally, if you wish to prepare an rpm source tar ball, you should do
167 After RPM has been installed you can run rpm to build an rpm package.
168 Edit the rpm.spec file to mirror any special steps you needed to
169 follow to make rpm compile and change the specfile to match your
170 taste. You will need to put the rpm source tar file into the
171 SOURCES directory and we suggest putting the specfile in the
172 SPECS directory, then run rpmbuild -ba rpm.spec. You will end up
173 with two rpms which can be found in RPMS and SRPMS.
175 If you are going to install rpm on machines with OS package managers
176 other then rpm, you may choose to install the base rpm package via a
177 cpio instead of a tar file. Instead of running "make tar" during the
178 build process, as discribed above, use the base rpm packages to create
179 a cpio. After the rpms have been created run rpm2cpio on the base rpm
180 package, this will give you a cpio package which can then use to
181 install rpm on a new system.
183 rpm2cpio rpm-4.0-1.solaris2.6-sparc.rpm > rpm-4.0-1.solaris2.6-sparc.cpio
186 Non Linux Configuration Issues:
187 ------------------------------
193 Under RPM based Linux distributions all libraries (in fact all files
194 distributed with the OS) are under RPM control and this section is not
197 RPM will need to be informed of all the dependencies which were
198 satisfied before RPM was installed. Typically this only refers to
199 libraries that are installed by the OS, but may include other
200 libraries and packages which are availible at the time RPM is
201 installed and will not under RPM control. Another common example of
202 libraries which may need dependency provisions are precompiled
203 libraries which are installed by the OS package manager during system
204 build time. The list of dependencies you will wish to load into RPM
205 will depend on exactly how you bootstrap RPM onto your system and what
206 parts of the sytem you put into packages as well as on the specific OS
209 The script vpkg-provides.sh can be used to generate a package which
210 will satisfy the dependencies on your system. To run it you will need
211 to create a specfile header for this empty package and run the progam
214 --spec_header '/path/to/os-base-header.spec
216 and if you wish to ensure that some directories are not traversed you
219 --ignore_dirs 'egrep|pattern|of|paths|to|ignore
221 By default the generated rpm will include a %verifyscript to verify
222 checksum of all files traversed has not changed. This additional
223 check can be surpressed with:
227 The result of running the script will be a specfile which will create
228 a package continging all the dependencies found on the system. There
229 will be one provides line for each depednecy. The package will contain
230 none of the actual OS library files as it is assumed they are already
231 on your system and managed by other means. Here is a example
232 (truncated) of the provides lines used by one user of Digital Unix. (I
233 have put several provides on the same line for brevity)
235 provides: /bin/sh /usr/bin/ksh /usr/bin/csh
236 provides: libc.so.osf.1 libm.so.osf.1 libcurses.so.xpg4 libdb.so.osf.1
237 provides: libX11.so libXaw.so.6.0 libXext.so libXm.so.motif1.2 libXmu.so
238 provides: libdnet_stub.so.osf.1 libsecurity.so.osf.1 libpthread.so.osf.1
239 provides: libexc.so.osf.1 libmach.so.osf.1 libdps.so libdpstk.so
242 The script vpkg-provides2.sh is underdevelopment as a more advanced
243 version of vpkg-provides.sh which is aware of many different unix
244 vendor packaging schemes. It will create one "dependency package" for
245 each unix package your OS vendor installed.
251 If you plan on packaging for more then one OS you may want to edit
252 /etc/macros or /usr/lib/rpm/macros and change the line which has
253 rpmfilename to something which include both the %{_target_os} and
254 %{_target_cpu}. This will cause the name of the generated rpm files
255 to the operating system name as well as the architecture which the rpm
256 runs under. The line to change looks like:
258 %_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
260 you may wish to include both the %{_target_os} and %{_target_cpu} in
261 the final base name, so that it's easier to distinguish between what
262 package is appropriate for a particular arch-os-version combo. We
265 %_rpmfilename %%{_target_platform/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{_target_platform}.rpm
267 There is no %{_target_os_version} tag, so if you need to also
268 distinguish between RPMs for certain versions of the OS, you can
269 hard-code the version in the rpmrc on the build machine, so that .rpm
270 files are generated with the version as part of the filename.
272 For example when one user builds RPMs for Digital Unix 4.0b and 4.0d,
273 optimization is important and he will build one set of RPMs for the
274 EV4 processor and another set for the EV56 processor. He specifies
275 both the OS version (if it's important, as it is for a few packages)
276 and the processor version by default by setting a special rpmfilename:
277 on the particular build machine.
279 The "rpmfilename: "tag on one machine (Digital Unix 4.0d, EV56 PWS 433)
282 rpmfilename: %{_target_os}/4.0d/%{_target_cpu}/%{name}-%{version}-%{release}.%{_target_os}-%{_target_cpu}ev56.rpm
284 For package `foo-1.1', at build time that would translate into:
286 osf1/4.0d/alpha/foo-1.1-1.osf1-alphaev56.rpm
288 The hyphen between the %{_target_cpu} and ev56 is left out for compatibility
289 with GNU Config.guess and because `alphaev56' looks more "normal" to
290 people with an alpha than alpha-ev56 for someone on an Intel Pentium
291 Pro would want `i586pro' over `i586-pro', but it does make parsing
292 this filename by other programs a bit more difficult.
298 To use the signing features of rpm, you will need to configure certain
299 rpm macros in ~/.rpmmacros:
303 %_gpg_path %(echo $HOME)/.gnupg