# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" inherit eutils # Made in France, (remove this notice as needed) # on the basis of the rainlendar-lite-2.3 ebuild found on Sunrise # Name of the ebuild changed because of the following : # The archive's name contains "Lite" but "Pro" uses the same binary MY_PN="Rainlendar-Lite" MY_P=${MY_PN}-${PV} DESCRIPTION="Feature rich calendar application that is easy to use and doesn't take much space on your desktop." HOMEPAGE="http://www.rainlendar.net" LICENSE="as-is" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="doc shadow4-langpack" SRC_URI="http://www.rainlendar.net/download/${MY_P}-i386.tar.bz2 shadow4-langpack? ( http://www.rainlendar.net/download/Shadow4-Languages.r2skin-addon ) doc? ( http://www.rainlendar.net/download/pdf/UserGuide.pdf http://www.rainlendar.net/download/pdf/ApiReference.pdf http://www.rainlendar.net/download/pdf/SkinReference.pdf )" # # LNG_IDS list is up-to-date as of 23th April, 2010 # * 1st field is the language (name of the folder inside the ZIP) # (used to remove installed languages on USE change) # * 2nd field is the language, as defined by gentoo # (using 2-letters codes where possible) # * 3rd field is the 'magic' number used to build the URL # # Some languages rainlendar2 supports are not supported by gentoo. # In this case, the 2nd field equals the 1st : # chr - Cherokee locale # cv_RU - Chuvash locale # de_AU - German (Austrian) locale # de_DE2 - German (Sonnabend) locale # fil - Filipino locale # l33t - Leet-Speak virtual locale # LNG_URI="http://www.rainlendar.net/cms/index.php?option=com_rny_localization&id=" LNG_IDS="ar:ar:327 ast_ES:ast:287 be_BY:be:305 bg_BG:bg:946 br:br:4 bs:bs:944 ca_ES:ca:991 chr:chr:311 cs_CZ:cs:967 cv_RU:cv_RU:599 da_DK:da:986 de_AU:de_AU:997 de_DE:de:928 de_DE2:de_DE2:929 el_GR:el:447 es_ES:es:952 et_EE:et:1013 eu_ES:eu:451 fi_FI:fi:961 fil:fil:507 fr_FR:fr:963 ga_IE:ga:517 gl_ES:gl:569 he_IL:he:394 hi_IN:hi:813 hr_HR:hr:959 hu_HU:hu:931 id_ID:id:681 is_IS:is:636 it_IT:it:1008 ja_JP:ja:788 km:km:1027 ko_KR:ko:940 l33t:l33t:342 lt_LT:lt:631 lv_LV:lv:956 mk_MK:mk:1011 nb_NO:nb_NO:918 nn_NO:nn_NO:323 nl_NL:nl:920 pl_PL:pl:993 pt_PT:pt:955 pt_BR:pt_BR:1014 ro_RO:ro:998 ru_RU:ru:960 sk_SK:sk:968 sl_SI:sl:819 sq_AL:sq:27 sr_SR:sr:932 sv_SE:sv:1030 ta:ta:897 th_TH:th:979 tr_TR:tr:1012 uk_UA:uk:981 vi_VN:vi:990 zh_CN:zh_CN:1007 zh_TW:zh_TW:1029 " # zip & unzip needed only to deal with additional content : # zip already depends on unzip # rainlendar-lite (old) ebuild should be gracefully # uninstalled whithout configuration looses. DEPEND="!app-misc/rainlendar-lite shadow4-langpack? ( app-arch/zip )" for triplet in ${LNG_IDS} ; do # get gentoo's lang name from LNG_IDS lingua="$(cut -d: -f2 <<< ${triplet})" # populate IUSE and DEPEND accordingly IUSE="${IUSE} linguas_${lingua}" DEPEND="${DEPEND} linguas_${lingua}? ( app-arch/zip )" done RDEPEND="amd64? ( app-emulation/emul-linux-x86-gtklibs app-emulation/emul-linux-x86-xlibs ) x86? ( x11-libs/gtk+:2[xinerama] )" RESTRICT="mirror strip" QA_EXECSTACK="opt/rainlendar2/rainlendar2" src_unpack() { # other files are not to be handled by 'unpack' unpack ${MY_P}-i386.tar.bz2 S=${WORKDIR}/rainlendar2 cd "${S}" # Update the skin archive : if use shadow4-langpack ; then einfo "Updating Shadow4 skin..." mkdir -p skins/Shadow4 if ! unzip -q "${DISTDIR}"/Shadow4-Languages.r2skin-addon -d skins/Shadow4 ; then ewarn "Failed to unzip Shadow4 addon !" # don't break here, optional feature else mv skins/Shadow4.{r2skin,zip} pushd skins/Shadow4 if ! zip -q -r ../Shadow4.zip . ; then ewarn "Failed to re-zip Shadow4 skin !" # don't break here, optional feature fi popd mv skins/Shadow4.{zip,r2skin} fi rm -rf skins/Shadow4 fi } rainlendar_install_locales() { # there's a 'domo' helper, but rainlendar isn't looking in /usr/share/locale [[ $# -ne 2 || ! -d "$1" || ! -d "$2" ]] && die "Self-check failed." # $1 -> place to save downloaded files # $2 -> place to unzip/install locales # Translation support : for triplet in ${LNG_IDS} ; do # 1::[ $lname -> rainlendar's name for a locale ] # :2:[ $lingua -> gentoo's name for a locale ] # ::3[ $lcode -> file ID on rainlendar.net ] lname="$(cut -d: -f1 <<< ${triplet})" lingua="$(cut -d: -f2 <<< ${triplet})" lcode="$(cut -d: -f3 <<< ${triplet})" # *.r2lang archives are named after rainlendar's specs # to be consistent with the (imposed) dir name r2lang="$1/${lname}.r2lang" locdir="$2/${lname}" if use linguas_${lingua} ; then einfo "Installing translation: ${lingua}..." # download up-to-date additional content : [[ -e "${r2lang}" ]] && rm "${r2lang}" if ! wget -nv -O "${r2lang}" "${LNG_URI}${lcode}" ; then ewarn "wget failed ! ; skipping..." continue fi # unzip to locale dir : [[ -e "${locdir}" ]] && rm -rf "${locdir}" if ! unzip -q "${r2lang}" -d "$2" ; then ewarn "unzip failed ! ; skipping..." continue fi # remove linguas no more in USE : # this is valid when called from pkg_config() elif [[ -e "${locdir}" ]] ; then einfo "Uninstalling translation: ${lingua}..." rm -rf "${locdir}" fi done # little "debug" code for the curious : # (shows the locales as per rainlendar's specs) # result="" # for lng in "$2"/* ; do result="${result} $(basename ${lng})" ; done # einfo "Installed locale(s): ${result}." # don't break here, optional feature } src_prepare() { # Sandbox disallow saving into ${DISTDIR} rainlendar_install_locales "${T}" "${S}/locale" # make an autostart entry. Who has an icon for it ? cat <rainlendar2.desktop [Desktop Entry] Type=Application Name=Rainlendar2 Comment=Feature-Rich Desktop Calendar Exec=/opt/rainlendar2/rainlendar2 StartupNotify=false Terminal=false Hidden=false EoF } src_install() { # this is removing executable bit on *.so files # works for now, but may be a problem in the future (or not) insinto /opt/rainlendar2 doins -r locale plugins resources scripts skins lfs.so rainlendar2.htb # the executable searches in . for the dirs above exeinto /opt/rainlendar2 doexe rainlendar2 dosym /opt/rainlendar2/rainlendar2 /usr/bin/rainlendar2 dodoc Changes.txt use doc && dodoc "${DISTDIR}"/{UserGuide,ApiReference,SkinReference}.pdf # install the autostart insinto /etc/xdg/autostart doins rainlendar2.desktop } pkg_postinst() { einfo "Some translations are incomplete, see homepage for details." einfo "You may update all installed languages at any time with :" einfo " # emerge --config ${CATEGORY}/${PN}" einfo "If you bought Rainlendar Pro, you should copy" einfo "its license file to '~/.config/.rainlendar2/'." einfo "An autostart entry should be available in your DE settings." } pkg_config() { # downloaded files will be kept, but overwritten on next # emerge --config. dunno if ${T} works here. rainlendar_install_locales "${DISTDIR}" "/opt/rainlendar2/locale" }