Creating RPMS from source without Makefile

Michael Schwendt mschwendt at
Mon Oct 15 22:57:00 UTC 2007

On 15/10/2007, Mertens, Bram <mertensb at> wrote:
> Hi,
> For several applications/tools I'd like to create an RPM to make
> maintenance easier.  However some of these come without a Makefile
> (usually just untar in the correct directory).  For others I'd like to
> add some additional (configuration) files and such.
> According to the maximum rpm book it is recommended to keep patches and
> such separate from the original sources (pristine sources).  But so far
> I've been unable to find an explanation on how exactly to set this up.
> I've download the httpd source rpm and noticed that it contains some
> additional files in the SOURCES directory which have been added as
> additional "SourceX" lines in the spec file.  These are installed by
> additional "install" commands in the spec file.
> Is this the recommended approach?  Is there a way to group these files
> somehow?  After installing the httpd source rpm the SOURCE dir was
> filled with files with no way to determin which were related to the
> httpd package wand which not.

That is only due to your particular [default] RPM setup, where all
SourceX files are stored in the same directory. However, it is not
like that when you customise RPM in your $HOME/.rpmmacros file. For
example, you can override the default locations like this

%_topdir     %(echo $HOME)/rpm
%_sourcedir     %{_topdir}/SOURCES/%{name}-%{version}
%_specdir       %{_sourcedir}

and get a separate directory for each package/version. A very few
packages may break since they make poor assumptions about your RPM
build tree.

Of course, you can also tar your set of patches and additional source
files, put it into a single SourceX tag, untar it in %setup and access
the files via $RPM_BUILD_DIR. It is much less convenient, though.

More information about the redhat-list mailing list