Building RPMS from Source

From MythTV Official Wiki
Revision as of 02:28, 20 July 2012 by Monkeypet (Talk | contribs)

Jump to: navigation, search

BUILDING RPMS FROM SOURCE

If you usually use the atrpms repositories to obtain mythtv rpm files, but need to make some changes to one or a few files, it is not difficult to amend and re-create an rpm.

You will need the rpm-build utilities, the source rpm for the package you wish to revise, the specific directory layout used by rpm and Axel Thimm's rpmmacros installed.

1. yum install rpm-build

       yum install atrpms-rpm-config-185-2.noarch.rpm
  The latter may not install cleanly, and you may have to search for it under the 'common' files section, save it on your computer and install it from the command line.

2. Download the source SRPM to your computer. Use a browser to find it at atrpms or rpmfusion and 'save as' to your computer at, say /tmp


3. Create a build tree in a user home directory:

       cd /home/mythtv
       mkdir rpm
       cd rpm
       mkdir SOURCES SPECS BUILD SRPMS RPMS
       mkdir -p RPMS/i386 RPMS/athlon RPMS/i586 RPMS/i686 RPMS/noarch


4. Create an rpm-macro to point to this spot, whichever login user you are:

       echo  "%_topdir /home/mythtv/rpm" > /home/mythtv/.rpmmacros
    or 
       echo  "%_topdir /home/mythtv/rpm" > /root/.rpmmacros
   (The latter will fail if you are not root, of course.)

5. Cd to whereever the source rpm is:

       cd /tmp

6. Install the source rpm.

       rpm -i mythtv-0.22-224.src.rpm

6. Install dependencies.

       yum-builddep mythtv

7. This is where you will make your edits. You will open the tar-ball, edit, and re-tar the files. See notes below.

       cd to /home/mythtv/rpm/SOURCES
       tar -xjvf mythtv-0.22.tar.bz2
       cd mythtv-0.22
   Make the required edits.
       tar -cjf mythtv-0.22.tar.bz2 mythtv-0.22


8. cd /home/mythtv/rpm/SPECS

9. Build the revised rpm

       rpmbuild -bb mythtv.spec
   If you get dependency errors at this point, you will have to find and install the missing packages.
   An easy way is to run 'yum-builddep mythtv' which will pull in all of the dependencies, (provided you have installed the atrpms-rpm-config-185-2.noarch.rpm).
   Add '--target=i686', or the architecture you are building.

10. Change to the correct architecture folder.

       cd ../RPMS/i386

11. Install the revised rpm.

       rpm -Uvh *rpm

12. Random notes for rpmfusion

   # Location of src packages
   http://download1.rpmfusion.org/free/fedora/updates/17/SRPMS/repoview/mythtv.html
   http://download1.rpmfusion.org/free/fedora/updates/17/SRPMS/repoview/mythweb.html
   This files are downloaded from github, here are the base URL https://github.com/MythTV/mythtv/tags click on download tar.gz
   MythTV-mythtv-v0.25.1-0-gc2c276d.tar.gz
   MythTV-mythweb-v0.25.1-0-g89a347c.tar.gz
  After getting the base tarball.  Next apply the fixes ontop of it.  Clone a git repository, then use 'git diff -p --stat v0.25.1 > mythtv-fixes.patch'
  Edit you githashes accordingly.