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