1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: nsplugins.eclass
7 # Mozilla Team <mozilla@gentoo.org>
9 # Original Author: Martin Schlemmer <azarah@gentoo.org>
10 # @BLURB: reusable functions for netscape/moz plugin sharing
12 # Reusable functions that promote sharing of netscape/moz plugins, also provides
13 # share_plugins_dir function for mozilla applications.
15 inherit eutils multilib versionator mozextension
17 PLUGINS_DIR="nsbrowser/plugins"
19 # This function move the plugin dir in src_install() to
20 # ${D}/usr/$(get_libdir)/${PLUGIN_DIR}. First argument should be
21 # the full path (without $D) to old plugin dir.
23 has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
25 # Move plugins dir. We use keepdir so that it might not be unmerged
27 keepdir /usr/$(get_libdir)/${PLUGINS_DIR}
28 cp -a "${ED}"/$1/* "${ED}"/usr/$(get_libdir)/${PLUGINS_DIR}
30 dosym /usr/$(get_libdir)/${PLUGINS_DIR} $1
33 # This function move plugins in pkg_preinst() in old dir to
34 # ${ROOT}/usr/$(get_libdir)/${PLUGIN_DIR}. First argument should be
35 # the full path (without $ROOT) to old plugin dir.
37 has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${ROOT}"
39 # Move old plugins dir
40 if [ -d "${ROOT}/$1" -a ! -L "${ROOT}/$1" ]
42 mkdir -p "${EROOT}"/usr/$(get_libdir)/${PLUGINS_DIR}
43 cp -a "${EROOT}"/$1/* "${EROOT}"/usr/$(get_libdir)/${PLUGINS_DIR}
48 # This function installs a plugin with dosym to PLUGINS_DIR.
49 # First argument should be the plugin file.
51 if [[ -z "${1}" ]]; then
52 eerror "The plugin file \"${1}\" does not exist."
53 die "No such file or directory."
56 dodir /usr/$(get_libdir)/${PLUGINS_DIR}
57 dosym ${1} /usr/$(get_libdir)/${PLUGINS_DIR}/$(basename ${1})
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
64 if [[ ${PN} == seamonkey ]] ; then
65 rm -rf "${D}"${MOZILLA_FIVE_HOME}/plugins \
66 || die "failed to remove existing plugins dir"
69 if [[ ${PN} == *-bin ]] ; then
70 PLUGIN_BASE_PATH="/usr/$(get_libdir)"
75 if $(mozversion_extension_location) ; then
76 dosym "${PLUGIN_BASE_PATH}/nsbrowser/plugins" "${MOZILLA_FIVE_HOME}/browser/plugins"
78 dosym "${PLUGIN_BASE_PATH}/nsbrowser/plugins" "${MOZILLA_FIVE_HOME}/plugins"