frace / kodi-overlay

Unofficial portage overlay for Gentoo Linux providing modified and unofficial ebuilds for a KODI appliance.
https://github.com/frace/kodi-overlay
Other
9 stars 4 forks source link

media-tv/xbmc-9999: Make ccache optional? #2

Closed frace closed 10 years ago

frace commented 10 years ago

@anthonyryan1 Since you were asking about ccache performance improvements in your pull request - we could make ccache optional by adding a useflag. What do you think about that?

anthonyryan1 commented 10 years ago

That does seem like a decent idea, and also something we could potentially submit to the upstream for inclusion (I'm sure a lot of people running XBMC would appreciate faster compile times. Pull request inbound.

frace commented 10 years ago

Continued from #3

Obviously it looks like ccache is getting enabled by configure automatically - but only if the flag option for ccache is not set explicitly (--disable-ccache or --enable-ccache). Basically it detects if ccache is available.

checking for ccache... /usr/bin/ccache

So we would need to detect if FEATURES=ccache is set and then could set the ccache make option dynamically. But I don't know if this is possible at all.

frace commented 10 years ago

Quote from flameeye's blog - Debunking ccache myths redux: «Okay now there are some cases where you might care about ccache because you are rebuilding the same package; that includes patch-testing and live ebuilds. In these cases you should not simply set FEATURES=ccache, but you can instead make use of the per-package environment files. You can then choose two options: you can do what Portage does (setting PATH so that the ccache wrappers are found before the compilers themselves) or you can simply re-set the CC variable, such as export CC="ccache gcc". Just set it in /etc/portage/env/$CATEGORY/$PN and you’re done.»

According to Diego's post and bug report we should

Thus I created /etc/portage/env/xbmc-ccache.conf in order to play with a couple of things. Based on the default econf setup --disable-ccache and without having set ccache in make.conf FEATURES I tried the following:

  1. Tried what was suggested in Diego's post
  2. FEATURES="${FEATURES} ccache"

Unfortunately neither of the above enabled ccache properly. What worked was setting environment variables:

    FEATURES="${FEATURES} ccache"
    EXTRA_ECONF="--enable-ccache"

As EXTRA_ECONF appends a string to the existing environment variable it will override the first ccache flag (--disable-ccache).

What we could do now is:

  1. Let the ebuild use its default --disable-ccache flag and re-enable it explicitly on a per package setup.
  2. Since configure detects ccache automatically shouldn't it be safe to remove the ccache option from the live ebuild econf section completly? According to Diego's post it rather makes sense to use ccache on live ebuilds. Thus we could let configure detect ccache. If it is desireable to not use ccache then disable it manually in /etc/portage/env/media-tv/xbmc by setting EXTRA_ECONF="--disable-ccache".

If we assume that a sane recommendation is to use ccache on a per package basis then it makes no difference for the user's effort if the ebuild enables or disables ccache as an econf flag. In the end one has to configure the FEATURES variable inside /etc/portage/env anyway.

Thus I changed the ebuild to upstream's defaults in order to live with solution (1). See commit 5ed3260.


I measured the time needed to build XBMC with and without ccache being enabled on an Intel Atom 330 CPU:

ccache enabled first run: real 19m21.031s user 48m39.776s sys 7m48.243s

ccache enabled second run: real 12m50.387s user 28m0.620s sys 3m37.310s

ccache disabled: real 54m3.894s user 182m44.999s sys 9m19.147s


References: