1 |
# Copyright 1999-2012 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/www-client/seamonkey-bin/seamonkey-bin-2.5.ebuild,v 1.5 2012/01/26 15:30:23 nirbheek Exp $ |
4 |
|
5 |
EAPI="4" |
6 |
|
7 |
inherit eutils multilib mozextension pax-utils nsplugins fdo-mime gnome2-utils |
8 |
|
9 |
LANGS=(be ca cs de en-GB en-US es-AR es-ES fi fr gl hu it |
10 |
ja lt nb-NO nl pl pt-PT ru sk sv-SE tr zh-CN) |
11 |
|
12 |
MY_PV="${PV/_alpha/a}" |
13 |
MY_P="${PN}-${MY_PV}" |
14 |
MY_PN="${PN/-bin}" |
15 |
|
16 |
DESCRIPTION="Mozilla Application Suite - web browser, email, HTML editor, IRC" |
17 |
FTP_URI="ftp://ftp.mozilla.org/pub/mozilla.org/${MY_PN}/releases/" |
18 |
SRC_URI=" |
19 |
amd64? ( ${FTP_URI}/${MY_PV}/contrib/seamonkey-${MY_PV}.en-US.linux-x86_64.tar.bz2 -> ${PN}_x86_64-${PV}.tar.bz2 ) |
20 |
x86? ( ${FTP_URI}/${MY_PV}/linux-i686/en-US/seamonkey-${MY_PV}.tar.bz2 -> ${PN}_i686-${PV}.tar.bz2 )" |
21 |
HOMEPAGE="http://www.seamonkey-project.org/" |
22 |
RESTRICT="strip" |
23 |
QA_EXECSTACK="opt/seamonkey/*" |
24 |
|
25 |
KEYWORDS="-* ~amd64 ~x86" |
26 |
SLOT="0" |
27 |
LICENSE="|| ( MPL-1.1 GPL-2 LGPL-2.1 )" |
28 |
IUSE="startup-notification" |
29 |
|
30 |
DEPEND="app-arch/unzip" |
31 |
RDEPEND="dev-libs/dbus-glib |
32 |
>=media-libs/alsa-lib-1.0.16 |
33 |
>=x11-libs/gtk+-2.10:2 |
34 |
x11-libs/libXrender |
35 |
x11-libs/libXt |
36 |
x11-libs/libXmu |
37 |
!<www-client/seamonkey-bin-2" |
38 |
|
39 |
S="${WORKDIR}/seamonkey" |
40 |
|
41 |
for X in "${LANGS[@]}" ; do |
42 |
# en and en_US are handled internally |
43 |
if [[ ${X} != en ]] && [[ ${X} != en-US ]]; then |
44 |
SRC_URI="${SRC_URI} |
45 |
linguas_${X/-/_}? ( |
46 |
${FTP_URI}/${MY_PV}/langpack/seamonkey-${MY_PV}.${X}.langpack.xpi -> ${P/-bin/}-${X}.xpi )" |
47 |
fi |
48 |
IUSE="${IUSE} linguas_${X/-/_}" |
49 |
# Install all the specific locale xpis if there's no generic locale xpi |
50 |
# Example: there's no pt.xpi, so install all pt-*.xpi |
51 |
if ! has ${X%%-*} "${LANGS[@]}"; then |
52 |
SRC_URI="${SRC_URI} |
53 |
linguas_${X%%-*}? ( |
54 |
${FTP_URI}/${MY_PV}/langpack/seamonkey-${MY_PV}.${X}.langpack.xpi -> ${P/-bin/}-${X}.xpi )" |
55 |
IUSE="${IUSE} linguas_${X%%-*}" |
56 |
fi |
57 |
done |
58 |
|
59 |
linguas() { |
60 |
# Generate the list of language packs called "linguas" |
61 |
# This list is used to install the xpi language packs |
62 |
local LINGUA |
63 |
for LINGUA in ${LINGUAS}; do |
64 |
if has ${LINGUA} en en_US; then |
65 |
# For mozilla products, en and en_US are handled internally |
66 |
continue |
67 |
# If this language is supported by ${P}, |
68 |
elif has ${LINGUA} "${LANGS[@]//-/_}"; then |
69 |
# Add the language to linguas, if it isn't already there |
70 |
has ${LINGUA//_/-} "${linguas[@]}" || linguas+=(${LINGUA//_/-}) |
71 |
continue |
72 |
# For each short LINGUA that isn't in LANGS, |
73 |
# add *all* long LANGS to the linguas list |
74 |
elif ! has ${LINGUA%%-*} "${LANGS[@]}"; then |
75 |
for LANG in "${LANGS[@]}"; do |
76 |
if [[ ${LANG} == ${LINGUA}-* ]]; then |
77 |
has ${LANG} "${linguas[@]}" || linguas+=(${LANG}) |
78 |
continue 2 |
79 |
fi |
80 |
done |
81 |
fi |
82 |
ewarn "Sorry, but ${P} does not support the ${LINGUA} locale" |
83 |
done |
84 |
} |
85 |
|
86 |
src_unpack() { |
87 |
unpack ${A} |
88 |
|
89 |
linguas |
90 |
for X in "${linguas[@]}"; do |
91 |
# FIXME: Add support for unpacking xpis to portage |
92 |
[[ ${X} != "en" ]] && xpi_unpack "${P/-bin/}-${X}.xpi" |
93 |
done |
94 |
if [[ "${linguas[*]}" != "" && "${linguas[*]}" != "en" ]]; then |
95 |
einfo "Selected language packs (first will be default): ${linguas[*]}" |
96 |
fi |
97 |
} |
98 |
|
99 |
src_install() { |
100 |
declare MOZILLA_FIVE_HOME=/opt/seamonkey |
101 |
|
102 |
# Install seamonkey in /opt |
103 |
dodir ${MOZILLA_FIVE_HOME%/*} |
104 |
mv "${S}" "${D}${MOZILLA_FIVE_HOME}" |
105 |
|
106 |
linguas |
107 |
for X in "${linguas[@]}"; do |
108 |
[[ ${X} != "en" ]] && xpi_install "${WORKDIR}"/"${P/-bin/}-${X}" |
109 |
done |
110 |
|
111 |
local LANG=${linguas%% *} |
112 |
if [[ -n ${LANG} && ${LANG} != "en" ]]; then |
113 |
elog "Setting default locale to ${LANG}" |
114 |
echo "pref(\"general.useragent.locale\", \"${LANG}\");" \ |
115 |
>> "${D}${MOZILLA_FIVE_HOME}"/defaults/pref/${PN}-prefs.js || \ |
116 |
die "sed failed to change locale" |
117 |
fi |
118 |
|
119 |
# Create /usr/bin/seamonkey-bin |
120 |
dodir /usr/bin/ |
121 |
cat <<EOF >"${D}"/usr/bin/seamonkey-bin |
122 |
#!/bin/sh |
123 |
unset LD_PRELOAD |
124 |
exec /opt/seamonkey/seamonkey "\$@" |
125 |
EOF |
126 |
fperms 0755 /usr/bin/seamonkey-bin |
127 |
|
128 |
# Install icon and .desktop for menu entry |
129 |
doicon "${FILESDIR}/icon/${PN}.png" |
130 |
domenu "${FILESDIR}/icon/${PN}.desktop" |
131 |
|
132 |
if use startup-notification; then |
133 |
echo "StartupNotify=true" >> "${D}"/usr/share/applications/${PN}.desktop |
134 |
fi |
135 |
|
136 |
# revdep-rebuild entry |
137 |
insinto /etc/revdep-rebuild |
138 |
doins "${FILESDIR}"/10${PN} || die |
139 |
|
140 |
# Handle plugins dir through nsplugins.eclass |
141 |
share_plugins_dir |
142 |
|
143 |
# Required in order to use plugins and even run seamonkey on hardened. |
144 |
pax-mark m "${ED}"/${MOZILLA_FIVE_HOME}/{seamonkey,seamonkey-bin,plugin-container} |
145 |
} |
146 |
|
147 |
pkg_preinst() { |
148 |
gnome2_icon_savelist |
149 |
} |
150 |
|
151 |
pkg_postinst() { |
152 |
# Update mimedb for the new .desktop file |
153 |
fdo-mime_desktop_database_update |
154 |
gnome2_icon_cache_update |
155 |
} |
156 |
|
157 |
pkg_postrm() { |
158 |
gnome2_icon_cache_update |
159 |
} |