Building RPMS from Source

From MythTV Official Wiki
Revision as of 21:31, 3 March 2014 by Monkeypet (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


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 -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
       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
   This files are downloaded from github, here are the base URL click on download tar.gz
  After getting the base tarball.  Next apply the fixes ontop of it.  
  Clone a git repository:
  git clone -b fixes/0.26 git://
  then use 'git diff -p --stat v0.25.1 > mythtv-fixes.patch'
  Edit you githashes accordingly.

13. Git commands:

This will retrieve a commit and put it into a patch file. After you have the file, copy it to the SOURCES directory, next edit the spec file. The SHA you can obtain from the github while viewing it.

  git format-patch -1 2eb5091b6b2058bf94cb11ef36b5972ef9a18fee

This will cherrypick into the git tree above and if you do the git diff afterwards, it should include your cherrypick.

  git cherry-pick 20f7cd2858e79385ceec07b2c19c7e4f84714e18

Checkout a branch

  git checkout fixes/0.27