# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" # Made in France inherit eutils versionator # example file name on servers : "rainlendar2-lite_2.7.b91-1_i386.deb" MY_PV="$(replace_version_separator 2 '.b' $(replace_version_separator 3 '-'))" # download the 'pro' package if ebuild name ends with 'pro' : if [[ "${PN%pro}" == "${PN}" ]]; then MY_PN="rainlendar2-lite" else MY_PN="rainlendar2-pro" fi DESCRIPTION="Feature-Rich Desktop Calendar" HOMEPAGE="http://www.rainlendar.net" LICENSE="as-is" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="doc shadow4-langpack" DEPEND="${DEPEND} !app-misc/rainlendar-lite shadow4-langpack? ( app-arch/zip )" SRC_URI="x86? ( http://www.rainlendar.net/download/${MY_PN}_${MY_PV}_i386.deb ) amd64? ( http://www.rainlendar.net/download/${MY_PN}_${MY_PV}_amd64.deb ) 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 2010-08-10 # * 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 # (this number is modified on languages updates) # # 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:1073 cv_RU:cv_RU:599 da_DK:da:986 de_AU:de_AU:997 de_DE:de:1063 de_DE2:de_DE2:929 el_GR:el:447 es_ES:es:1081 et_EE:et:1013 eu_ES:eu:451 fi_FI:fi:1071 fil:fil:507 fr_FR:fr:1069 ga_IE:ga:1088 gl_ES:gl:569 he_IL:he:394 hi_IN:hi:813 hr_HR:hr:1043 hu_HU:hu:1053 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:1042 lv_LV:lv:956 mk_MK:mk:1011 nb_NO:nb_NO:1065 nn_NO:nn_NO:323 nl_NL:nl:1072 pl_PL:pl:1080 pt_PT:pt:1036 pt_BR:pt_BR:1091 ro_RO:ro:998 ru_RU:ru:960 sk_SK:sk:968 sl_SI:sl:819 sq_AL:sq:27 sr_SR:sr:1083 sv_SE:sv:1087 ta:ta:897 th_TH:th:1039 tr_TR:tr:1047 uk_UA:uk:981 vi_VN:vi:990 zh_CN:zh_CN:1082 zh_TW:zh_TW:1085 " 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 CMS ] lname="$(cut -d: -f1 <<< ${triplet})" lingua="$(cut -d: -f2 <<< ${triplet})" lcode="$(cut -d: -f3 <<< ${triplet})" # populate IUSE, DEPEND and SRC_URI accordingly IUSE="${IUSE} linguas_${lingua}" DEPEND="${DEPEND} linguas_${lingua}? ( app-arch/zip )" SRC_URI="${SRC_URI} linguas_${lingua}? ( ${LNG_URI}${lcode} -> ${lname}.r2lang )" done # that long DEPs list comes from the Debian "control" file RDEPEND="amd64? ( app-emulation/emul-linux-x86-gtklibs app-emulation/emul-linux-x86-xlibs ) x86? ( >=x11-libs/gtk+-2.12:2[xinerama] ) >=net-misc/curl-7.16 >=dev-libs/atk-1.20 >=sys-libs/glibc-2.6.1:2.2 >=x11-libs/cairo-1.4.10 >=media-libs/fontconfig-2.4:1.0 >=media-libs/freetype-2.3.5:2 >=dev-libs/glib-2.14:2 >=x11-libs/pango-1.16.2 media-libs/libpng:1.2 dev-libs/expat x11-libs/libX11 x11-libs/libXinerama app-text/tofrodos " RESTRICT="mirror strip" QA_EXECSTACK="opt/rainlendar2/rainlendar2" src_unpack() { use x86 && unpack "${MY_PN}_${MY_PV}_i386.deb" use amd64 && unpack "${MY_PN}_${MY_PV}_amd64.deb" tar xzf data.tar.gz cd usr/share/rainlendar2 S=$(pwd) # Update the skin archive : if use shadow4-langpack ; then einfo "Updating Shadow4 skin..." mkdir -p skins/Shadow4 unzip -q "${DISTDIR}"/Shadow4-Languages.r2skin-addon -d skins/Shadow4 || die "Failed to unzip Shadow4 addon !" mv skins/Shadow4.{r2skin,zip} pushd skins/Shadow4 zip -q -r ../Shadow4.zip . || die "Failed to re-zip Shadow4 skin !" popd mv skins/Shadow4.{zip,r2skin} rm -rf skins/Shadow4 fi } src_prepare() { # Translation support : for r2lang in "${DISTDIR}"/*.r2lang ; do short=$(basename ${r2lang} .r2lang) einfo "Installing translation: ${short}..." # unzip to locale dir : unzip -q "${r2lang}" -d "locale" || die "Failed to unzip translation !" done # prepare the autostart entry cat <<-EOF >rainlendar2.desktop [Desktop Entry] Type=Application Name=Rainlendar2 Comment=${DESCRIPTION} Exec=rainlendar2 Icon=rainlendar2 Categories=Office;Calendar; StartupNotify=true Terminal=false Hidden=false EOF } src_install() { # doins removes executable bit on *.so files 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 ../doc/rainlendar2/{copyright,license.txt} "${DISTDIR}"/{UserGuide,{Api,Skin}Reference}.pdf # install the menu and autostart entries insinto /etc/xdg/autostart doins rainlendar2.desktop doicon ../pixmaps/rainlendar2.png make_desktop_entry "rainlendar2" "Rainlendar2" "rainlendar2" "Office;Calendar;" } pkg_postinst() { einfo "Some translations are incomplete, see homepage for details." if [[ "${PN%pro}" != "${PN}" ]]; then einfo "Your license file for Rainendar2 Pro should" einfo "be copied to '~/.config/.rainlendar2/'." fi einfo "An autostart entry should be available in your DE settings." }