| 1 |
# Copyright 1999-2007 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-office/mozilla-sunbird/mozilla-sunbird-0.3.1.ebuild,v 1.10 2007/06/13 13:15:46 armin76 Exp $
|
| 4 |
|
| 5 |
WANT_AUTOCONF="2.1"
|
| 6 |
|
| 7 |
inherit flag-o-matic toolchain-funcs eutils mozconfig-2 mozilla-launcher makeedit multilib fdo-mime mozextension autotools
|
| 8 |
|
| 9 |
PATCH="${P}-patches-0.3"
|
| 10 |
LANGS="ca cs da de es-ES eu fr hu it mn nl pl ru sk sl"
|
| 11 |
|
| 12 |
MY_PN="${PN/mozilla-}"
|
| 13 |
MY_P="${MY_PN}-${PV}"
|
| 14 |
DESCRIPTION="The Mozilla Sunbird Calendar"
|
| 15 |
HOMEPAGE="http://www.mozilla.org/projects/calendar/sunbird.html"
|
| 16 |
IUSE="bindist"
|
| 17 |
SRC_URI="http://releases.mozilla.org/pub/mozilla.org/calendar/${MY_PN}/releases/${PV}/source/${MY_P}.source.tar.bz2
|
| 18 |
mirror://gentoo/${PATCH}.tar.bz2"
|
| 19 |
|
| 20 |
for X in ${LANGS} ; do
|
| 21 |
SRC_URI="${SRC_URI}
|
| 22 |
linguas_${X/-/_}? ( http://releases.mozilla.org/pub/mozilla.org/calendar/${MY_PN}/releases/${PV}/langpacks/${MY_PN}-${PV}.${X}.langpack.xpi )"
|
| 23 |
IUSE="${IUSE} linguas_${X/-/_}"
|
| 24 |
# english is handled internally
|
| 25 |
done
|
| 26 |
|
| 27 |
KEYWORDS="-* ~amd64 ~ppc64 ~x86"
|
| 28 |
SLOT="0"
|
| 29 |
LICENSE="MPL-1.1 GPL-2 LGPL-2.1"
|
| 30 |
|
| 31 |
RDEPEND=">=www-client/mozilla-launcher-1.44
|
| 32 |
>=dev-libs/nss-3.11.3"
|
| 33 |
|
| 34 |
S="${WORKDIR}/mozilla"
|
| 35 |
|
| 36 |
# Needed by src_compile() and src_install().
|
| 37 |
# Would do in pkg_setup but that loses the export attribute, they
|
| 38 |
# become pure shell variables.
|
| 39 |
export MOZ_CO_PROJECT=calendar
|
| 40 |
export BUILD_OFFICIAL=1
|
| 41 |
export MOZILLA_OFFICIAL=1
|
| 42 |
|
| 43 |
|
| 44 |
linguas() {
|
| 45 |
local LANG SLANG
|
| 46 |
for LANG in ${LINGUAS}; do
|
| 47 |
if has ${LANG} en en_US; then
|
| 48 |
has en ${linguas} || linguas="${linguas:+"${linguas} "}en"
|
| 49 |
continue
|
| 50 |
elif has ${LANG} ${LANGS//-/_}; then
|
| 51 |
has ${LANG//_/-} ${linguas} || linguas="${linguas:+"${linguas} "}${LANG//_/-}"
|
| 52 |
continue
|
| 53 |
elif [[ " ${LANGS} " == *" ${LANG}-"* ]]; then
|
| 54 |
for X in ${LANGS}; do
|
| 55 |
if [[ "${X}" == "${LANG}-"* ]] && != *" ${X} "* ]]; then
|
| 56 |
has ${X} ${linguas} || linguas="${linguas:+"${linguas} "}${X}"
|
| 57 |
continue 2
|
| 58 |
fi
|
| 59 |
done
|
| 60 |
fi
|
| 61 |
ewarn "Sorry, but ${PN} does not support the ${LANG} LINGUA"
|
| 62 |
done
|
| 63 |
}
|
| 64 |
|
| 65 |
pkg_setup(){
|
| 66 |
if ! built_with_use x11-libs/cairo X; then
|
| 67 |
eerror "Cairo is not built with X useflag."
|
| 68 |
eerror "Please add 'X' to your USE flags, and re-emerge cairo."
|
| 69 |
die "Cairo needs X"
|
| 70 |
fi
|
| 71 |
|
| 72 |
if ! use bindist; then
|
| 73 |
elog "You are enabling official branding. You may not redistribute this build"
|
| 74 |
elog "to any users on your network or the internet. Doing so puts yourself into"
|
| 75 |
elog "a legal problem with mozilla foundation"
|
| 76 |
fi
|
| 77 |
|
| 78 |
use moznopango && warn_mozilla_launcher_stub
|
| 79 |
}
|
| 80 |
|
| 81 |
src_unpack() {
|
| 82 |
unpack ${A%bz2*}bz2
|
| 83 |
|
| 84 |
linguas
|
| 85 |
for X in ${linguas}; do
|
| 86 |
[[ ${X} != "en" ]] && xpi_unpack "${MY_PN}-${PV}.${X}.langpack.xpi"
|
| 87 |
done
|
| 88 |
if [[ ${linguas} != "" ]]; then
|
| 89 |
elog "Selected language packs (first will be default): ${linguas}"
|
| 90 |
fi
|
| 91 |
|
| 92 |
# Apply our patches
|
| 93 |
cd "${S}" || die "cd failed"
|
| 94 |
EPATCH_SUFFIX="patch" \
|
| 95 |
EPATCH_FORCE="yes" \
|
| 96 |
epatch "${WORKDIR}"/patch
|
| 97 |
|
| 98 |
eautoreconf
|
| 99 |
}
|
| 100 |
|
| 101 |
src_compile() {
|
| 102 |
declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
|
| 103 |
|
| 104 |
####################################
|
| 105 |
#
|
| 106 |
# mozconfig, CFLAGS and CXXFLAGS setup
|
| 107 |
#
|
| 108 |
####################################
|
| 109 |
|
| 110 |
mozconfig_init
|
| 111 |
mozconfig_config
|
| 112 |
|
| 113 |
mozconfig_annotate '' --enable-application=calendar
|
| 114 |
mozconfig_annotate '' --enable-extensions=default
|
| 115 |
mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
|
| 116 |
mozconfig_annotate '' --with-system-nss
|
| 117 |
mozconfig_annotate '' --with-system-nspr
|
| 118 |
|
| 119 |
if ! use bindist; then
|
| 120 |
mozconfig_annotate '' --enable-official-branding
|
| 121 |
fi
|
| 122 |
|
| 123 |
# Finalize and report settings
|
| 124 |
mozconfig_final
|
| 125 |
|
| 126 |
# hardened GCC uses -fstack-protector-all by default, which breaks us
|
| 127 |
gcc-specs-ssp && append-flags -fno-stack-protector-all
|
| 128 |
replace-flags -fstack-protector-all -fstack-protector
|
| 129 |
|
| 130 |
####################################
|
| 131 |
#
|
| 132 |
# Configure and build
|
| 133 |
#
|
| 134 |
####################################
|
| 135 |
|
| 136 |
CPPFLAGS="${CPPFLAGS} -DARON_WAS_HERE" \
|
| 137 |
CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
|
| 138 |
econf || die
|
| 139 |
|
| 140 |
# It would be great if we could pass these in via CPPFLAGS or CFLAGS prior
|
| 141 |
# to econf, but the quotes cause configure to fail.
|
| 142 |
sed -i -e \
|
| 143 |
's|-DARON_WAS_HERE|-DGENTOO_NSPLUGINS_DIR=\\\"/usr/'"$(get_libdir)"'/nsplugins\\\" -DGENTOO_NSBROWSER_PLUGINS_DIR=\\\"/usr/'"$(get_libdir)"'/nsbrowser/plugins\\\"|' \
|
| 144 |
${S}/config/autoconf.mk \
|
| 145 |
${S}/nsprpub/config/autoconf.mk \
|
| 146 |
${S}/xpfe/global/buildconfig.html
|
| 147 |
|
| 148 |
# This removes extraneous CFLAGS from the Makefiles to reduce RAM
|
| 149 |
# requirements while compiling
|
| 150 |
edit_makefiles
|
| 151 |
|
| 152 |
emake || die
|
| 153 |
}
|
| 154 |
|
| 155 |
pkg_preinst() {
|
| 156 |
declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
|
| 157 |
|
| 158 |
einfo "Removing old installs though some really ugly code. It potentially"
|
| 159 |
einfo "eliminates any problems during the install, however suggestions to"
|
| 160 |
einfo "replace this are highly welcome. Send comments and suggestions to"
|
| 161 |
einfo "mozilla@gentoo.org."
|
| 162 |
rm -rf "${ROOT}"/"${MOZILLA_FIVE_HOME}"
|
| 163 |
}
|
| 164 |
|
| 165 |
src_install() {
|
| 166 |
declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
|
| 167 |
|
| 168 |
# Most of the installation happens here
|
| 169 |
dodir "${MOZILLA_FIVE_HOME}"
|
| 170 |
cp -RL "${S}/dist/bin/"* "${D}${MOZILLA_FIVE_HOME}" || die "Copy of files failed"
|
| 171 |
|
| 172 |
linguas
|
| 173 |
for X in ${linguas}; do
|
| 174 |
[[ ${X} != "en" ]] && xpi_install "${WORKDIR}"/"${MY_PN}-${PV}.${X}.langpack"
|
| 175 |
done
|
| 176 |
|
| 177 |
local LANG=${linguas%% *}
|
| 178 |
if [[ -n ${LANG} && ${LANG} != "en" ]]; then
|
| 179 |
einfo "Setting default locale to ${LANG}"
|
| 180 |
dosed -e "s:general.useragent.locale\", \"en-US\":general.useragent.locale\", \"${LANG}\":" \
|
| 181 |
"${MOZILLA_FIVE_HOME}"/defaults/pref/sunbird.js \
|
| 182 |
"${MOZILLA_FIVE_HOME}"/defaults/pref/sunbird-l10n.js || \
|
| 183 |
die "sed failed to change locale"
|
| 184 |
fi
|
| 185 |
|
| 186 |
# Create /usr/bin/sunbird
|
| 187 |
install_mozilla_launcher_stub sunbird "${MOZILLA_FIVE_HOME}"
|
| 188 |
|
| 189 |
# Install icon and .desktop for menu entry
|
| 190 |
if ! use bindist; then
|
| 191 |
doicon "${FILESDIR}"/icon/${PN}-icon.png
|
| 192 |
domenu "${FILESDIR}"/icon/${PN}.desktop
|
| 193 |
else
|
| 194 |
doicon "${FILESDIR}"/icon/${PN}-unbranded-icon.png
|
| 195 |
newmenu "${FILESDIR}"/icon/${PN}-unbranded.desktop \
|
| 196 |
${PN}.desktop
|
| 197 |
|
| 198 |
fi
|
| 199 |
}
|
| 200 |
|
| 201 |
pkg_postinst() {
|
| 202 |
declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
|
| 203 |
|
| 204 |
# This should be called in the postinst and postrm of all the
|
| 205 |
# mozilla, mozilla-bin, firefox, firefox-bin, thunderbird and
|
| 206 |
# thunderbird-bin ebuilds.
|
| 207 |
update_mozilla_launcher_symlinks
|
| 208 |
}
|
| 209 |
|
| 210 |
pkg_postrm() {
|
| 211 |
declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
|
| 212 |
|
| 213 |
update_mozilla_launcher_symlinks
|
| 214 |
}
|