Downloading Audacity’s SRPM
Before we go any further, in order to avoid conflicts, let’s make sure that you do not have any version of audacity already installed:
# dnf -y remove audacity audacity-freeworld
Good. You can finally download Audacity’s SRPM and start trying to add MP3 support to it. Switch to the new build user:
# su - mockbuild
The whole process of building a RPM package is driven by a SPEC file that is present in every SRPM package, so that is where you should look for dependencies and configuration parameters (e.g. MP3 support). Installing the SRPM extracts the SPEC file:
$ dnf download --source audacity $ rpm -ivh audacity-2.1.2-3.fc23.src.rpm
Note: your version of Audacity might be different than mine, but the process described here is exactly the same.
This saves the SPEC file (audacity.spec
) inside the ~/rpmbuild/SPECS
directory (it also extracts the pristine sources and saves them inside the ~/rpmbuild/SOURCES
directory, but leave them there untouched!).
Let’s examine the SPEC file and try to find something useful in it. Since it is a text file, you can use whatever pager or text editor you like (e.g. less
, gedit
, etc.).
Building Audacity’s RPM with MP3 support
The first step is to discover the dependencies and be sure that you have all the necessary software to build Audacity’s RPM installed. Just search for lines that contain the word BuildRequires
inside the SPEC file.
Once you have identified all the dependencies, switch back to root
and install them:
$ exit # dnf -y install alsa-lib-devel desktop-file-utils expat-devel flac-devel gettext jack-audio-connection-kit-devel ladspa-devel libid3tag-devel taglib-devel libogg-devel libsndfile-devel libvorbis-devel portaudio-devel soundtouch-devel soxr-devel vamp-plugin-sdk-devel zip zlib-devel wxGTK3-devel libappstream-glib
If you carefully looked inside the SPEC file then you likely noticed the following line as well:
%{?_with_mp3:BuildRequires: libmad-devel twolame-devel}
This line contains a RPM conditional macro that means “if the with_mp3
symbol is defined then add an extra dependency on libmad-devel
and twolame-devel
“. That’s very useful information, because it gives you two extra dependencies if you want to enable support for MP3, which is exactly what you are trying to do.
A quick research online can tell you that MAD decodes (i.e. opens) MP3 files, and TwoLAME encodes (i.e. saves) MP2 files – which you don’t really care but without it you can’t rebuild Audacity.
If you try to install libmad-devel
and twolame-devel
you will quickly realize that they are not in Fedora’s repositories, they are in RPM Fusion’s free repositories. No worries, just follow the quick instructions in the following webpage and come back here when you are done: http://rpmfusion.org/Configuration.
With RPM Fusion’s free repositories configured on your computer, let’s install the two extra dependencies and go back to our build user:
# dnf -y install libmad-devel twolame-devel # su - mockbuild
At this point you might be wondering how to encode (i.e. save) MP3 files. The answer is LAME. If you want to open AND save MP3 files then make sure the lame-libs
package is also installed (the lame-libs
package is only needed during runtime, not during the build, so you can install it later).
Back to the build user, now with all necessary packages installed, you are finally ready to build Audacity’s RPM, but that conditional macro above also tells you that you must define the with_mp3
symbol to have MP3 support compiled in. This can be done by passing the “--with mp3
” command line switch to rpmbuild
:
$ cd ~/rpmbuild/SPECS $ rpmbuild -bb --with mp3 audacity.spec
The command above will build Audacity’s RPM and leave it inside the ~/rpmbuild/RPMS/x86_64
directory. This might take several minutes depending on your computer’s processing power… be patient.
MP3 is free to use so no need to pay royalties anymore.
Almost. It seems there is still one patent (US5703999) that will expire only on December 30, 2017.
After that yes, it should be ok to consider MP3 public domain. 🙂
Thank you so much. Your instructions are clear and concise. Nice job!
This was so useful! Thank you so much.
Thank you very much, this was really helpful for me.
Thank you! Worked perfectly with new version on Fedora 25…
Thanks so much!
It all works!
Though it was different version and different folder for me and required some more libs, but with common logic it all worked)
Command
dnf -y install ~mockbuild/rpmbuild/RPMS/x86_64/audacity-2.1.2-4
didn’t work as the filename was not complete CDing to that directory & ls gave the full name, then
dnf -y install ./audacity-2.1.2-4.fc24.x86_64.rpm
succeeded and audacity with mp3 access now works fine.
Thanks
The command in this article is:
dnf -y install ~mockbuild/rpmbuild/RPMS/x86_64/audacity-2.1.2-3.fc23.x86_64.rpm
Not sure why it was truncated for you.
Excellent! It worked first time.