The basic procedure to build an RPM is as follows:
Get the source code you are building the RPM for to build on your system.
Make a patch of any changes you had to make to the sources to get them to build properly.
Under normal operation, RPM builds both binary and source packages.
Here is a small spec file (eject-2.0.2-1.spec):
Summary: A program that ejects removable media using software control. Name: eject Version: 2.0.2 Release: 3 Copyright: GPL Group: System Environment/Base Source: http://metalab.unc.edu/pub/Linux/utils/disk-management/eject-2.0.2.tar.gz Patch: eject-2.0.2-buildroot.patch BuildRoot: /var/tmp/%{name}-buildroot %description The eject program allows the user to eject removable media (typically CD-ROMs, floppy disks or Iomega Jaz or Zip disks) using software control. Eject can also control some multi- disk CD changers and even some devices' auto-eject features. Install eject if you'd like to eject removable media using software control. %prep %setup -q %patch -p1 -b .buildroot %build make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/usr/bin mkdir -p $RPM_BUILD_ROOT/usr/man/man1 install -s -m 755 eject $RPM_BUILD_ROOT/usr/bin/eject install -m 644 eject.1 $RPM_BUILD_ROOT/usr/man/man1/eject.1 %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc README TODO COPYING ChangeLog /usr/bin/eject /usr/man/man1/eject.1 %changelog * Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> - auto rebuild in the new build environment (release 3) * Wed Feb 24 1999 Preston Brown <pbrown@redhat.com> - Injected new description and group. [ Some changelog entries trimmed for brevity. -Editor. ] |
Name: This must be the name string from the rpm filename you plan to use.
Version: This must be the version string from the rpm filename you plan to use.
Source0: blah-0.tar.gz Source1: blah-1.tar.gz Source2: fooblah.tar.gz |
Patch0: blah-0.patch Patch1: blah-1.patch Patch2: fooblah.patch |
Amusements/Games Amusements/Graphics Applications/Archiving Applications/Communications Applications/Databases Applications/Editors Applications/Emulators Applications/Engineering Applications/File Applications/Internet Applications/Multimedia Applications/Productivity Applications/Publishing Applications/System Applications/Text Development/Debuggers Development/Languages Development/Libraries Development/System Development/Tools Documentation System Environment/Base System Environment/Daemons System Environment/Kernel System Environment/Libraries System Environment/Shells User Interface/Desktops User Interface/X User Interface/X Hardware Support |
![]() | Your current working directory is reset in each of these sections to the toplevel of the source directory, so keep that in mind. You can cd into subdirectories if necessary. |