Restoring KDE MP3 Support in Redhat or Fedora Systems

Hugh Sparks
Version 1.4, January 14, 2006

Introduction

This page will show you how to restore mp3 playback support in Redhat or Fedora by rebuilding the Redhat-censored kdemultimedia package.

No doubt, similar procedures could be used to restore mp3 playback for Gnome users. If you decide to fix Gnome, I'd like to have a link to your site on this page.

UPDATE

It appears my work here has become obsolete. The folks at Livna now distribute a package kdemultimedia-extras-nonfree that will repair the stock kdemultimedia package so all dependent kde packages will work with mp3 files. This is clearly a superior solution because nothing needs to be rebuilt. Consequently, there will be no further updates to this page. Thanks to all those who contributed ideas and encouragement over the past 5 years!

Are you too damn lazy to do all this stuff?

Ok.
Here are several versions of kdemultimedia already rebuilt to support mp3:

To install one of the rpms listed above, you will first need to remove your existing kdemultimedia package. If you have installed any dependents, they must be removed first. Now you can install the new kdemultimedia and reinstall the dependents. Of course, by taking this route, you will miss out on hours of fun.

Alternatives

Before you embark on building this package, there are some new developments on the web to consider:

Max Kanat-Alexander's Unofficial Fedora FAQ now distributes a package "kdemultimedia-extras." You can install this package on top of your off-the-shell Redhat or Fedora installation and it will re-enable mp3 support in all the standard KDE multimedia applications. I have tried this package on a new Fedora installation and it works perfectly. This is a nifty idea and if he keeps it up to date religiously, I may give up maintaining this page!

Adrian Holovaty has posted a concise article on rebuilding kdemultimedia for the Unofficial Fedora FAQ. The article is actually on his site at: Playing MP3s in KDE. The current version of the article is missing the optional libmad dependency. A more serious problem is the omission of editing the patched-apidocs (see below) in the SPEC file. This will cause the binary rpm build process to fail. I do like his naming convention for the repaired rpm files and I borrowed this idea for the most recent update of this site.

The KDE-Redhat Sourceforge Project has a set of pre-built rpms that includes a fixed kdemultimedia. They were a bit behind the times (as in years) the last time I checked, but sometimes I get behind as well, so check with them if you want to simply download a binary rpm that is more recent than the ones provided here.

Preparation

You will need to remove kdemultimedia and all dependant rpms so keep track of what you remove for re-installation later.

Obtain the authentic kde package

Visit one of the kde.org mirrors and download the kdemultimedia tar.bz2 file. DO NOT try to use any rpm files you find on the site. Redhat has persuaded kde.org to distribute censored copies of their own software.

To make things concrete, I'll assume you're using kde version X, which I will use the the subsequent sections for the kde version string you want to repair. (For example, X might stand for "3.5.0" as of this writing.

Once you have kdemultimedia-X.tar.bz2, you can compile and install it without rpm. The drawback of this method is that none of the dependant rpms can be installed. The alternative described here is to recreate and install a non-defective binary rpm.

Install packages required for building kdemultimedia

Update your yum configuration

You need quite a few packages to build kdemultimedia. A rather painless way to get them is by using yum. Unfortunately, the default yum configuration will not find all the packages we need.

To fix your yum configuration so it will automatically and quickly obtain all the required packages, use the following commands:

Install the FedoraFAQ configuration to greatly speed up package downloads:

	cd /etc
	mv -f yum.conf yum.conf.backup
	wget http://www.fedorafaq.org/samples/yum.conf
	rpm -Uvh http://www.fedorafaq.org/yum 

Install the Livna yum configuration to get packages not provided by Fedora. We are using Livna to get the lame, taglib, and mad packages.

	rpm -ivh http://rpm.livna.org/livna-release4.rpm
	cd /etc
	mv -f yum.conf yum.conf.backup
	wget http://www.fedorafaq.org/samples/yum.conf
	rpm -Uvh http://www.fedorafaq.org/yum  

Obtain the build support packages

Now you are ready to install everything at once:

	yum install \
		alsa-lib-devel \
		arts-devel \
		audiofile-devel \
		cdparanoia-devel \
		desktop-file-utils \
		esound-devel \
		flac-devel \
		fontconfig-devel \
		freetype-devel \
		glib2-devel \
		gstreamer-devel \
		kdebase-devel \
		kdelibs-devel \
		lame \
		lame-devel \
		libart_lgpl-devel \
		libjpeg-devel \
		libpng-devel \
		libselinux-devel \
		libmad \
		libmad-devel \
		libmng-devel \
		libmusicbrainz-devel \
		pkgconfig \
		qt-devel \
		xorg-x11-devel 

Install the Redhat/Fedora source rpm

Download and install the kdemultimedia-X-src.rpm from your favorite mirror. You want the standard version corrupted by Redhat that matches your existing kde installion.

	rpm -i kdemultimedia-X.src.rpm 

Fix the Redhat/Fedora source rpm

Prepare the undamaged distribution

When RPM was first being touted as the answer to all software packaging problems, Redhat advanced the idea that RPM packages should contain copies of the unmodified "pristine" source code together with whatever patches are required to make it fit into the Redhat distribution.

You will notice /usr/src/redhat/SOURCES contains several patch files. It would be natural to assume that one of these patches must be the infernal mp3 sabotage patch. If that were true, it would be very easy to restore mp3 playback by removing the patch from the .spec file.

With the advent of the mp3 debacle, Redhat clearly abandoned the pristine source concept. The sources to kdemultimedia have already been hacked to remove mp3 support before any of the documented redhat patches are applied.

In the /usr/src/redhat/SOURCES directory you will find the file:

	/usr/src/redhat/SOURCES/kdemultimedia-X-patched.tar.bz2

Although there is no need to delete this file, you may want to remove it now to keep from being confused later.

Copy the real kdemultimedia-X.tar.bz2 you downloaded from the kde site into place:

	cp kdemultimedia-X.tar.bz2 /usr/src/redhat/SOURCES 

Edit the spec file

Edit the .spec file:

	/usr/src/redhat/SPECS/kdemultimedia.spec 

Change the value of build_mpeglib

	%define build_mpeglib 0 

So it reads

	%define build_mpeglib 1 

Find the Release line

	Release: X 

And change it to show the mp3 fix

	Release: X.mp3 

Find the Epoch line (your number will likely be different)

	Epoch: 6 

And change it by bumping up the number

	Epoch: 7 

Find the line that references patched-apidocs

	%doc %{_docdir}/HTML/en/kdemultimedia-patched-apidocs 

And remove the '-patched' so it reads

	%doc %{_docdir}/HTML/en/kdemultimedia-apidocs 
	
	Now exit the editor saving all changes to the .spec file. 

Build and install the repaired rpm

Rebuild the source rpm

	rpmbuild -bs /usr/src/redhat/SPECS/kdemultimedia.spec 

Build the binary rpm

	rpmbuild --rebuild /usr/src/redhat/SRPMS/kdemultimedia-X.mp3.src.rpm 

The final result (it takes quite a while) will be in:

	/usr/src/redhat/RPMS/i386/kdemultimedia-X.mp3.i386.rpm

Wrapping up

Install the binary rpm, kdeaddons and any other dependants. You are done!

Complaints and suggestions

Hugh Sparks

My other projects