Is there an option for yum to compile from source instead of installing pre-compiled binaries?

2

1

I've recently switched to Fedora.

I'm looking for an equivalent of the procedure described here but in yum, so I can take advantage both of compiler optimization in heavily used software that prebuild binaries can't offer and the virtues of having a package manager manage your installed packages.

The word "source" is not even mentioned in the yum man page. Maybe rpm offers a way to do this?

Thank you for your time!

Nirro

Posted 2014-05-07T23:52:38.140

Reputation: 158

1Precompiled binaries are carefully optimized. In any case, given that today's CPUs are memory-bound, any minor time gained by shorter/less instructions executed will most probably be swamped by the time loading into memory, cache effects, ... Yes, everybody knows Gentoo runs twice as fast once everything is self-compiled. But that is just a "I worked so hard, it is just impossible I have nothing to show for it" effect. – vonbrand – 2014-05-08T00:42:49.633

Answers

3

You can download the SRPM (source RPM) packages and compile it yourself.

To download SRPM:

yumdownloader --source SOME_PACKAGE_NAME

If the yumdownloader app is not installed, install the yum-utils package.

To install necessary dependencies for compilation:

yum-builddep SOME_PACKAGE_NAME

To "install" SRPM package (actually unpacking the source and spec files):

rpm -iv somepackage-x.y.z-v.dist.src.rpm (replace with the SRPM path)

Now you have the source files populating your ~/rpmbuild/ directory. You can make the necessary hacks and recompile (packages rpm-build, rpmdevtools and optionally rpm-sign are needed to rebuild from the spec file, see their man pages). RPM packaging is rather a rich topic and the margins here are too small ... ;)

Fedora-specific notes

You may be interested in mock, the packaging and testing suite recommended by Fedora.

user319088

Posted 2014-05-07T23:52:38.140

Reputation: