Search code examples
linuxgentoo

How to write a Gentoo ebuild file , with LINGUAS support


I wanted to write a ebuild for some binary package , it contains a folder for different languages , its structure is:

ls /path/po:

de  fr  ja  zh_CN  zh_TW

I think it's easy to do it , but the document provided by Gentoo is really limited , how can i filter the unnecessary language files ? I shouldn't be copying all those to /usr/share/locale.

==========================================================

@Updates:

I discovered a simple method , which examines ${LANGUAS} variable , like the following code:

insinto /usr/share/locale
for x in "${LANGUAS}";do
  if [[ -d "po/${x}" ]];then
    doins "po/${x}"
  else
    einfo "LANGUAGE $x is not supported by this app"
  fi
done

Just wondering if it's official approach.


Solution

  • There isn't an official approach as it is very package dependent. For example, some packages may require additional parameters to be passed to ./configure while others, like your, require a more manual approach.

    As for your example above, I believe it to be perfectly acceptable. You haven't provided the whole ebuild so just remember that you need to be adding the acceptable languages into the IUSE var.

    e.g.

    LANGS="de fr ja zh_CN zh_TW"
    for X in ${LANGS} ; do
        IUSE="${IUSE} linguas_${X}"
    done
    

    For a more complicated example you could check out the openoffice-bin ebuild