| 1 |
scarabeus |
1.29 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
azarah |
1.1 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
zmedico |
1.31 |
# $Header: /var/cvsroot/gentoo-x86/eclass/nsplugins.eclass,v 1.30 2012/06/02 19:16:31 zmedico Exp $ |
| 4 |
vapier |
1.8 |
# |
| 5 |
anarchy |
1.27 |
# @ECLASS: nsplugins.eclass |
| 6 |
|
|
# @MAINTAINER: |
| 7 |
|
|
# Mozilla Team <mozilla@gentoo.org> |
| 8 |
|
|
# @AUTHOR: |
| 9 |
|
|
# Original Author: Martin Schlemmer <azarah@gentoo.org> |
| 10 |
|
|
# @BLURB: reusable functions for netscape/moz plugin sharing |
| 11 |
|
|
# @DESCRIPTION: |
| 12 |
|
|
# Reusable functions that promote sharing of netscape/moz plugins, also provides |
| 13 |
|
|
# share_plugins_dir function for mozilla applications. |
| 14 |
azarah |
1.1 |
|
| 15 |
zmedico |
1.30 |
inherit eutils multilib |
| 16 |
eradicator |
1.15 |
|
| 17 |
azarah |
1.1 |
PLUGINS_DIR="nsbrowser/plugins" |
| 18 |
|
|
|
| 19 |
|
|
# This function move the plugin dir in src_install() to |
| 20 |
eradicator |
1.15 |
# ${D}/usr/$(get_libdir)/${PLUGIN_DIR}. First argument should be |
| 21 |
azarah |
1.1 |
# the full path (without $D) to old plugin dir. |
| 22 |
|
|
src_mv_plugins() { |
| 23 |
darkside |
1.25 |
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" |
| 24 |
azarah |
1.1 |
|
| 25 |
azarah |
1.7 |
# Move plugins dir. We use keepdir so that it might not be unmerged |
| 26 |
|
|
# by mistake ... |
| 27 |
eradicator |
1.15 |
keepdir /usr/$(get_libdir)/${PLUGINS_DIR} |
| 28 |
darkside |
1.25 |
cp -a "${ED}"/$1/* "${ED}"/usr/$(get_libdir)/${PLUGINS_DIR} |
| 29 |
|
|
rm -rf "${ED}"/$1 |
| 30 |
eradicator |
1.15 |
dosym /usr/$(get_libdir)/${PLUGINS_DIR} $1 |
| 31 |
azarah |
1.1 |
} |
| 32 |
|
|
|
| 33 |
swegener |
1.19 |
# This function move plugins in pkg_preinst() in old dir to |
| 34 |
eradicator |
1.15 |
# ${ROOT}/usr/$(get_libdir)/${PLUGIN_DIR}. First argument should be |
| 35 |
azarah |
1.3 |
# the full path (without $ROOT) to old plugin dir. |
| 36 |
azarah |
1.1 |
pkg_mv_plugins() { |
| 37 |
darkside |
1.25 |
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${ROOT}" |
| 38 |
azarah |
1.1 |
|
| 39 |
|
|
# Move old plugins dir |
| 40 |
nirbheek |
1.24 |
if [ -d "${ROOT}/$1" -a ! -L "${ROOT}/$1" ] |
| 41 |
azarah |
1.1 |
then |
| 42 |
darkside |
1.25 |
mkdir -p "${EROOT}"/usr/$(get_libdir)/${PLUGINS_DIR} |
| 43 |
|
|
cp -a "${EROOT}"/$1/* "${EROOT}"/usr/$(get_libdir)/${PLUGINS_DIR} |
| 44 |
|
|
rm -rf "${EROOT}"/$1 |
| 45 |
azarah |
1.1 |
fi |
| 46 |
|
|
} |
| 47 |
|
|
|
| 48 |
phoenix |
1.4 |
# This function installs a plugin with dosym to PLUGINS_DIR. |
| 49 |
|
|
# First argument should be the plugin file. |
| 50 |
|
|
inst_plugin() { |
| 51 |
scarabeus |
1.29 |
if [[ -z "${1}" ]]; then |
| 52 |
|
|
eerror "The plugin file \"${1}\" does not exist." |
| 53 |
|
|
die "No such file or directory." |
| 54 |
|
|
fi |
| 55 |
|
|
|
| 56 |
genstef |
1.16 |
dodir /usr/$(get_libdir)/${PLUGINS_DIR} |
| 57 |
scarabeus |
1.26 |
dosym ${1} /usr/$(get_libdir)/${PLUGINS_DIR}/$(basename ${1}) |
| 58 |
phoenix |
1.4 |
} |
| 59 |
anarchy |
1.27 |
|
| 60 |
|
|
# This function ensures we use proper plugin path for Gentoo. |
| 61 |
|
|
# This should only be used by mozilla packages. |
| 62 |
|
|
# ${MOZILLA_FIVE_HOME} must be defined in src_install to support |
| 63 |
|
|
share_plugins_dir() { |
| 64 |
|
|
if [[ ${PN} == seamonkey ]] ; then |
| 65 |
|
|
rm -rf "${D}"${MOZILLA_FIVE_HOME}/plugins \ |
| 66 |
|
|
|| die "failed to remove existing plugins dir" |
| 67 |
|
|
fi |
| 68 |
|
|
|
| 69 |
|
|
if [[ ${PN} == *-bin ]] ; then |
| 70 |
|
|
PLUGIN_BASE_PATH="/usr/$(get_libdir)" |
| 71 |
|
|
else |
| 72 |
|
|
PLUGIN_BASE_PATH=".." |
| 73 |
|
|
fi |
| 74 |
|
|
|
| 75 |
|
|
dosym "${PLUGIN_BASE_PATH}/nsbrowser/plugins" "${MOZILLA_FIVE_HOME}/plugins" |
| 76 |
|
|
} |