Rebuilding rpms

Michael A. Peters mpeters at mac.com
Mon May 15 10:09:05 UTC 2006


On Mon, 2006-05-15 at 09:10 +0200, Przemyslaw Gawronski wrote:
> Hi, on some servers I need to have proftpd (and postfix) with mysql
> suport. What I usually do is compile them from source with these
> options.  But wouldn't it be more 'correct with art' sort of speak
> rebuilding the source rpm's ? If so I would be very thank full for some
> tips on how to manage it.

I think the postfix src.rpm has an option in it to make it cake to
rebuild with mysql support. Not sure about proftpd.

-=-

Anyway yes - it is relatively easy to rebuild custom RPMs.

install this package:

fedora-rpmdevtools (it is in extras)

Then run (as a regular non root user) :

fedora-buildrpmtree

This will create an rpm build tree structure in ~/rpmbuild

Grab the src.rpm you want to build and install it as your regular user.
Look in updates first so you know you have the latest.

cd ~/rpmbuild/SPECS/

and the spec file will be there.

There are a couple things you want to modify:

1) The release tag
This you modify so it looks newer than the existing rpm.
I usually just append .something

IE - rebuilding sox with lame/libmad support, I append .mp3 to the end.

2) BuildRequires

add the devel packages that you need - IE for sox with lame/libmad
support - I add

BuildRequires: lame-devel libmad-devel

(that isn't 100% necessary, it is just cleaner - and needed if you are
going to rebuild in a clean chroot via mock or mach)

3) in %build - you may (or may not, but probably for postfix/proftpd)
add the flags to the configure switch.

IE change

%configure

to

%configure --with-foo

Then - to a test build:

rpmbuild -bi package.spec

It's possible that your new configuration switches will result in
additional files that need to be added to %files section. If it
complains about unpackaged files, add them to %files section.

When the -bi works, you can build your modified rpms with

rpmbuild -ba package.spec

Install your new package and enjoy.

To prevent your modified package from being replaced, add

exclude=package

to fedora-base.repo and fedora-updates.repo
or (if it is an extras package) fedora-extras.repo

but watch for updates (you'll want to rebuild again if there was a
security patch)




More information about the fedora-list mailing list