[mythtv-users] Gentoo and CVS (make your own CVS ebuilds)

Jim Kusznir jim at kusznir.net
Fri Jan 7 03:58:09 EST 2005


Jeff Thompson wrote:

> Jim Kusznir wrote:
>
>> Learning a bit about portage and making ebuilds took me about half a 
>> day; but after that I could crank out the ebuilds for each subpart in 
>> about 3 minutes each.  If you're interested, I could send some 
>> instructions.  Keep in mind that I'm still a "gentoo 
>> developer-wannabe" (aka very new to making ebuilds), so this is 
>> basically the minimum required to work; not really the best it can be.
>
>
> Jim, I'd be interested in whatever instructions you could put 
> together... I'm not currently a gentoo user and I've been putting it 
> off since the whole point of gentoo seems to be "build from source" 
> using ebuilds and I don't currently know anything about ebuilds... :)
>
> I suspect that others may be interested as well and I believe it's 
> definitely on topic, since gentoo seems like a reasonably popular 
> platform for mythtv.
>

Ok, here goes:

First, I got my information primarily from:
http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml?part=2&chap=1
and from examining the ebuild from mythtv-0.16.

There's a one-time change you might have to make to /etc/make.conf:
make shure the following line appears somewhere in the file and is 
uncommented:
PORTDIR_OVERLAY=/usr/local/portage

First, you need to choose a version string for this new package.  The 
important things here are that it needs to be between 0.16 and 0.17, and 
ideally make some degree of sence.  According to the ebuild howto sited 
above, there are some version suffixes that can be applied and are 
processed in a specific order.  _alpha[#] is the one I chose.  I chose 
it because I doubted there would be _alpha releases of myth, and it 
would ensure any official releases in the 0.17 tree would take 
presedence over mine (I could automagically update with emerge).

Ok, now that the hard part is done, we can proceed :)

Check out a cvs release of each package you want to use (mythtv, 
mythweb, mythdvd, etc).  Rename the directory to include the version 
suffix, eg, "mythweb" becomes "mythweb-0.17_alpha1".  Make a .tar.bz2 
for each directory. ("tar -cjf mythweb-0.17_alpha1.tar.bz2 
mythweb-0.17_alpha1/").  Copy/move them to /usr/portage/distfiles/.

Ok, source is ready; now lets make the e-builds.

First, find the .ebuiild file for the 0.16 release.  They will be in 
/usr/portage/<catagory>/<package_name>.  You want to make 
/usr/local/portage/<catagory>/<package_name> for each package you're 
interested in, and copy the 0.16.ebuild file into that directory.  If 
you don't know what catagory a package is, you can do an emerge -s 
<package_name>; the package name will have its gatagory in front.  For 
example, the main package (mythtv) is under media-tv/mythtv.  So, we 
create the directory /usr/local/portage/media-tv/mythtv and copy 
/usr/portage/media-tv/mythtv/mythtv-0.16.ebuild to that directory.

Now, rename the .ebuild you just copied to the new version (in my 
example, that would be mythtv-0.17_alpaha1.ebuild).

Almost done.  We need to open the .ebuild in an editor and check for any 
patches and remove them.  To do this, look for lines beginning with 
"epatch" and either comment them out or remove them outright.

I also discovered the hard way that for the main myth build, you need to 
add two lines to the ebuild for the media-tv/mythtv package.

Look for :
        emake -C libs/libmyth || die

Add these two lines immediately before it:
       emake -C libs/libmythsamplerate || die
       emake -C libs/libmythsoundtouch || die

Ok, save the file and exit the editor.  Now, we just need to tell 
portage to calculate the md5 sums:
ebuild ./mythtv-0.17_alpha1.ebuild digest

Now, if you do an emerge -s for mythtv, you'll see it shows a new 
version available for install (0.17_alpha1).  A simple emerge mythtv 
will take care of it.

If you want to update to a new cvs snapshot after you've done all this, 
you need to increment the version number by at least one (0.17_alpah2, 
for example), prepair the source, copy the .ebuild over to the new 
ebuild, and tell portage to digest it (ebuild <blah.ebuild> digest).   
Then you're ready to compile and install the newer version.


As I said in my earlier post, this is my first attempt at messing with 
portage  and creating .ebuilds.  It works pretty well, but I suspect 
there are cleaner ways of doing things.  For example, it occured to me 
after the fact that I could probably have gotten away with a version 
number like 0.16.0501070234 (the date and time of the CVS snapshot).  
Also, I've noticed "CVS" directories in the portage distfile directory; 
perhaps portage has the means for pulling down new CVS snapshots....

Anyway, I intended this message to be more of a learning experience than 
a reusable recipie.  Through this, I learned that portage isn't all that 
difficult to mess with, and I think its well worth the time to install 
packages not already in portage this way rather than the "normal" 
straight compile/install way.

--Jim


More information about the mythtv-users mailing list