| 1 |
vapier |
1.21 |
# Copyright 1999-2011 Gentoo Foundation
|
| 2 |
obz |
1.1 |
# Distributed under the terms of the GNU General Public License, v2 or later
|
| 3 |
vapier |
1.21 |
# $Header: /var/cvsroot/gentoo-x86/eclass/gdesklets.eclass,v 1.20 2010/05/08 22:18:28 nixphoeni Exp $
|
| 4 |
nixphoeni |
1.20 |
|
| 5 |
|
|
# @ECLASS: gdesklets.eclass
|
| 6 |
|
|
# @MAINTAINER:
|
| 7 |
|
|
# gdesklets@gentoo.org
|
| 8 |
vapier |
1.21 |
# @AUTHOR:
|
| 9 |
|
|
# Original author: Joe Sapp <nixphoeni@gentoo.org>
|
| 10 |
|
|
# Original author: Mike Gardiner <obz@gentoo.org>
|
| 11 |
|
|
# @BLURB: Installation functions for Desklets and Controls supported by gDesklets
|
| 12 |
nixphoeni |
1.20 |
# @DESCRIPTION:
|
| 13 |
|
|
# The gdesklets eclass provides a simple way to create ebuilds for
|
| 14 |
|
|
# globally installing desktop applets ("Desklets") and supporting code
|
| 15 |
|
|
# ("Controls") used in the gDesklets framework (provided by
|
| 16 |
|
|
# gnome-extra/gdesklets-core)
|
| 17 |
obz |
1.1 |
#
|
| 18 |
nixphoeni |
1.20 |
# This eclass assumes a package following the instructions at
|
| 19 |
|
|
# http://gdesklets.de/index.php?q=node/2 . Specifically, the package
|
| 20 |
|
|
# should be a Desklet or Control ONLY (and *not* a Sensor). You
|
| 21 |
|
|
# technically could have an ebuild that works around this limitation,
|
| 22 |
|
|
# but no new packages should be added to the tree that do this (mainly
|
| 23 |
|
|
# for ease of maintenance).
|
| 24 |
|
|
|
| 25 |
vapier |
1.21 |
# @ECLASS-VARIABLE: DESKLET_NAME
|
| 26 |
nixphoeni |
1.20 |
# @DESCRIPTION:
|
| 27 |
|
|
# *Optional* The name of the Desklet, if the package is one. The
|
| 28 |
|
|
# default is to assume a Desklet with the name being ${PN} without the
|
| 29 |
|
|
# "desklet-" prefix.
|
| 30 |
|
|
|
| 31 |
vapier |
1.21 |
# @ECLASS-VARIABLE: CONTROL_NAME
|
| 32 |
nixphoeni |
1.20 |
# @DESCRIPTION:
|
| 33 |
|
|
# *Optional* The name of the Control, if the package is one.
|
| 34 |
|
|
|
| 35 |
vapier |
1.21 |
# @ECLASS-VARIABLE: DOCS
|
| 36 |
nixphoeni |
1.20 |
# @DESCRIPTION:
|
| 37 |
|
|
# Anything (like a README) that should be dodoc'd.
|
| 38 |
|
|
|
| 39 |
vapier |
1.21 |
# @ECLASS-VARIABLE: SLOT
|
| 40 |
nixphoeni |
1.20 |
# @DESCRIPTION:
|
| 41 |
|
|
# Set only if the package is a Control and it provides a different
|
| 42 |
|
|
# interface (i.e. expands to a different install directory) than a
|
| 43 |
|
|
# previous version.
|
| 44 |
obz |
1.1 |
|
| 45 |
nixphoeni |
1.13 |
inherit eutils multilib python
|
| 46 |
nixphoeni |
1.5 |
|
| 47 |
nixphoeni |
1.20 |
if [[ -n "${CONTROL_NAME}" ]]; then
|
| 48 |
|
|
debug-print "Looking for a Control named \"${CONTROL_NAME}\""
|
| 49 |
|
|
MY_PN="${CONTROL_NAME}"
|
| 50 |
|
|
SRC_URI="http://gdesklets.de/files/controls/${MY_PN}/${MY_PN}-${PV}.tar.gz"
|
| 51 |
|
|
unset DESKLET_NAME
|
| 52 |
|
|
else # [[ -n "${DESKLET_NAME}" ]]; then
|
| 53 |
|
|
# Assume an unset DESKLET_NAME means the name is ${PN} without
|
| 54 |
|
|
# the "desklet-" prefix
|
| 55 |
|
|
[[ -z "${DESKLET_NAME}" ]] && DESKLET_NAME="${PN#desklet-}"
|
| 56 |
|
|
debug-print "Looking for a Desklet named \"${DESKLET_NAME}\""
|
| 57 |
|
|
MY_PN="${DESKLET_NAME}"
|
| 58 |
|
|
SRC_URI="http://gdesklets.de/files/desklets/${MY_PN}/${MY_PN}-${PV}.tar.gz"
|
| 59 |
|
|
fi
|
| 60 |
obz |
1.1 |
|
| 61 |
nixphoeni |
1.17 |
MY_P="${MY_PN}-${PV}"
|
| 62 |
nixphoeni |
1.20 |
S="${WORKDIR}/${MY_PN}"
|
| 63 |
obz |
1.1 |
|
| 64 |
|
|
SLOT="0"
|
| 65 |
nixphoeni |
1.20 |
# Ebuild writer shouldn't need to touch these (except maybe RDEPEND)
|
| 66 |
obz |
1.1 |
IUSE=""
|
| 67 |
nixphoeni |
1.20 |
RDEPEND=">=gnome-extra/gdesklets-core-0.36.1-r3"
|
| 68 |
obz |
1.1 |
|
| 69 |
nixphoeni |
1.15 |
GDESKLETS_INST_DIR="${ROOT}usr/$(get_libdir)/gdesklets"
|
| 70 |
obz |
1.1 |
|
| 71 |
nixphoeni |
1.20 |
# @FUNCTION: gdesklets_src_install
|
| 72 |
|
|
# @DESCRIPTION:
|
| 73 |
|
|
# Installs a Desklet or Control depending on which is set of
|
| 74 |
|
|
# CONTROL_NAME or DESKLET_NAME
|
| 75 |
obz |
1.1 |
gdesklets_src_install() {
|
| 76 |
swegener |
1.8 |
|
| 77 |
obz |
1.1 |
debug-print-function $FUNCNAME $*
|
| 78 |
swegener |
1.8 |
|
| 79 |
nixphoeni |
1.20 |
# Disable compilation of included python modules (for Controls)
|
| 80 |
nixphoeni |
1.13 |
python_disable_pyc
|
| 81 |
|
|
|
| 82 |
nixphoeni |
1.20 |
# Avoid sandbox violations caused by misbehaving packages (bug #128289)
|
| 83 |
nixphoeni |
1.13 |
addwrite "${ROOT}/root/.gnome2"
|
| 84 |
|
|
|
| 85 |
nixphoeni |
1.20 |
# Both Displays and Controls only need to be readable
|
| 86 |
|
|
insopts -m0744
|
| 87 |
swegener |
1.8 |
|
| 88 |
nixphoeni |
1.20 |
debug-print-section docs_install
|
| 89 |
swegener |
1.8 |
|
| 90 |
nixphoeni |
1.20 |
# Install some docs if so requested (and then delete them so they
|
| 91 |
|
|
# don't get copied into the installation directory)
|
| 92 |
|
|
[[ -n "${DOCS}" ]] && dodoc ${DOCS} && \
|
| 93 |
|
|
rm -f ${DOCS} \
|
| 94 |
|
|
debug-print "Installed and deleted ${DOCS}"
|
| 95 |
|
|
# LICENSE doesn't need to get installed if it exists
|
| 96 |
|
|
find . -name LICENSE -delete
|
| 97 |
swegener |
1.8 |
|
| 98 |
nixphoeni |
1.20 |
if [[ -n "${DESKLET_NAME}" ]]; then
|
| 99 |
swegener |
1.8 |
|
| 100 |
nixphoeni |
1.20 |
debug-print-section display_install
|
| 101 |
swegener |
1.8 |
|
| 102 |
nixphoeni |
1.11 |
# Base installation directory for displays from this desklet
|
| 103 |
nixphoeni |
1.20 |
INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
|
| 104 |
swegener |
1.8 |
|
| 105 |
nixphoeni |
1.20 |
debug-print "Installing into ${INSDIR}"
|
| 106 |
|
|
debug-print "Exiting Display-specific installation code"
|
| 107 |
swegener |
1.8 |
|
| 108 |
nixphoeni |
1.20 |
elif [[ -n "${CONTROL_NAME}" ]]; then
|
| 109 |
swegener |
1.8 |
|
| 110 |
nixphoeni |
1.20 |
debug-print-section control_install
|
| 111 |
swegener |
1.8 |
|
| 112 |
nixphoeni |
1.20 |
# Unique name for this Control and its interface
|
| 113 |
|
|
CTRL_DIRNAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` 2> /dev/null )
|
| 114 |
|
|
einfo "Installing Control ${CTRL_DIRNAME}"
|
| 115 |
swegener |
1.8 |
|
| 116 |
nixphoeni |
1.20 |
# Base installation directory for this Control
|
| 117 |
|
|
INSDIR="${GDESKLETS_INST_DIR}/Controls/${CTRL_DIRNAME}"
|
| 118 |
|
|
debug-print "Installing into ${INSDIR}"
|
| 119 |
swegener |
1.8 |
|
| 120 |
nixphoeni |
1.20 |
# Mercilessly delete all existing compiled code
|
| 121 |
|
|
find . -iname '*.py[co]' -delete
|
| 122 |
swegener |
1.12 |
|
| 123 |
nixphoeni |
1.20 |
debug-print "Exiting Control-specific installation code"
|
| 124 |
swegener |
1.12 |
|
| 125 |
nixphoeni |
1.20 |
else
|
| 126 |
|
|
die "nothing to install, is the ebuild written correctly?"
|
| 127 |
|
|
fi
|
| 128 |
swegener |
1.8 |
|
| 129 |
nixphoeni |
1.20 |
debug-print-section common_install
|
| 130 |
swegener |
1.8 |
|
| 131 |
nixphoeni |
1.20 |
# Create the proper subdirectory in the global Controls or
|
| 132 |
|
|
# Displays directory
|
| 133 |
|
|
dodir "${INSDIR}"
|
| 134 |
|
|
insinto "${INSDIR}"
|
| 135 |
|
|
doins -r *
|
| 136 |
swegener |
1.8 |
|
| 137 |
nixphoeni |
1.20 |
}
|
| 138 |
swegener |
1.8 |
|
| 139 |
nixphoeni |
1.20 |
# @FUNCTION: gdesklets_pkg_postinst
|
| 140 |
|
|
# @DESCRIPTION:
|
| 141 |
|
|
# Marks the Control for rebuilding on Python version change and
|
| 142 |
|
|
# compiles the Python code or display a useful message to the user,
|
| 143 |
|
|
# depending on which of CONTROL_NAME or DESKLET_NAME is set.
|
| 144 |
|
|
gdesklets_pkg_postinst() {
|
| 145 |
|
|
|
| 146 |
|
|
# The only time compilation of python modules should occur is
|
| 147 |
|
|
# for Controls, since Displays are run from inside the sandbox
|
| 148 |
|
|
# (and therefore can't be compiled).
|
| 149 |
|
|
if [[ -n "${CONTROL_NAME}" ]]; then
|
| 150 |
|
|
|
| 151 |
|
|
CTRL_DIRNAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` 2> /dev/null )
|
| 152 |
|
|
python_need_rebuild
|
| 153 |
|
|
python_mod_optimize "${GDESKLETS_INST_DIR}/Controls/${CTRL_DIRNAME}"
|
| 154 |
|
|
|
| 155 |
|
|
else
|
| 156 |
|
|
|
| 157 |
|
|
einfo "Each user can now add this desklet to their desktop through the"
|
| 158 |
|
|
einfo "gDesklets shell or the command line (.display files can be"
|
| 159 |
|
|
einfo "found in ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME})."
|
| 160 |
swegener |
1.8 |
|
| 161 |
nixphoeni |
1.20 |
fi
|
| 162 |
swegener |
1.8 |
|
| 163 |
obz |
1.1 |
}
|
| 164 |
|
|
|
| 165 |
nixphoeni |
1.20 |
EXPORT_FUNCTIONS src_install pkg_postinst
|