/[gentoo-x86]/eclass/gdesklets.eclass
Gentoo

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Wed Jul 6 20:20:03 2005 UTC (9 years, 1 month ago) by agriffis
Branch: MAIN
Changes since 1.5: +1 -2 lines
Remove ECLASS= and INHERITED= which haven't been necessary for a long time now

1 obz 1.1 # Copyright 2004 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License, v2 or later
3 agriffis 1.6 # $Header: /var/cvsroot/gentoo-x86/eclass/gdesklets.eclass,v 1.5 2005/06/17 23:34:55 nixphoeni Exp $
4 obz 1.1 #
5     # Authors: Joe Sapp <nixphoeni@gentoo.org>
6     # Mike Gardiner <obz@gentoo.org>
7     #
8     # Usage:
9     # As a writer for an ebuild for gDesklets, you should set a few things:
10     #
11     # DESKLET_NAME: The name of the desklet.
12     # DOCS: Anything (like a README) that should be dodoc'd.
13     # S: *Optional* The package's base directory.
14     # Usually ${WORKDIR}/${DESKLET_NAME} if it was packaged
15     # correctly (hence, this is the default).
16     # RDEPEND: *Optional* Set if the desklet requires a minimum version
17     # of gDesklets greater than 0.34 or other packages.
18    
19 nixphoeni 1.5 inherit eutils multilib
20    
21 obz 1.1 INHERITED="$INHERITED $ECLASS"
22    
23     MY_P="${DESKLET_NAME}-${PV}"
24     S=${WORKDIR}/${DESKLET_NAME}
25    
26     SRC_URI="http://gdesklets.gnomedesktop.org/files/${MY_P}.tar.gz"
27    
28     # Ebuild writer shouldn't need to touch these (except maybe $RDEPEND)
29     SLOT="0"
30     IUSE=""
31     RDEPEND="${RDEPEND} >=gnome-extra/gdesklets-core-0.34.3"
32    
33     GDESKLETS_INST_DIR="/usr/$(get_libdir)/gdesklets"
34    
35     gdesklets_src_install() {
36    
37     debug-print-function $FUNCNAME $*
38    
39     has_version ">=gnome-extra/gdesklets-core-0.33.1" || \
40     GDESKLETS_INST_DIR="/usr/share/gdesklets"
41    
42     # This should be done by the gdesklets-core ebuild
43     # It makes the Displays or Controls directory in the
44     # global installation directory if it doesn't exist
45     [[ -d ${GDESKLETS_INST_DIR}/Displays ]] || \
46     dodir ${GDESKLETS_INST_DIR}/Displays
47    
48     # The displays only need to be readable
49     insopts -m0744
50    
51 nixphoeni 1.5 # Check to see if DISPLAY is set for the
52     # gdesklets-control-getid script to run without
53     # error
54     [ -z "${DISPLAY}" ] && DISPLAY=""
55     export DISPLAY
56    
57 obz 1.1 # First, install the Sensor (if there is one)
58     if [[ -n "${SENSOR_NAME}" ]]; then
59     for SENS in ${SENSOR_NAME[@]}; do
60     einfo "Installing Sensor ${SENS}"
61     /usr/bin/python "Install_${SENS}_Sensor.bin" \
62     --nomsg ${D}${GDESKLETS_INST_DIR}/Sensors || \
63     die "Couldn't Install Sensor"
64    
65     chown -R root:root ${D}${GDESKLETS_INST_DIR}/Sensors/${SENSOR_NAME}
66     done # for in ${SENSOR_NAME}
67     fi # if -n "${SENSOR_NAME}"
68    
69     # This finds the Displays
70     DISPLAY_FILES=(`find . -iname "*.display"`)
71    
72     GD_INSDIR=""
73    
74     # There is more than likely only one display per package
75     if [[ -n "${DISPLAY_FILES[@]}" ]]; then
76     # Base installation directory for displays
77     GD_INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
78    
79     # This creates the subdirectory of ${DESKLET_NAME}
80     # in the global Displays directory
81     [[ -d ${GD_INSDIR} ]] || \
82     dodir ${GD_INSDIR}
83    
84     # For each of the Display files, there may be
85     # scripts included inline which don't necessarily
86     # follow any naming scheme.
87     # So for each of them, determine what those scripts are
88     # and install them.
89     for DSP in ${DISPLAY_FILES[@]}; do
90    
91     einfo "Installing Display `basename ${DSP} .display`"
92     insinto ${GD_INSDIR}
93     doins ${DSP}
94    
95     SCRIPTS=$(grep "script uri" ${DSP} | \
96     sed -e 's:.*<script uri=": :g' -e 's:"/>.*: :g')
97    
98     # For each one of the scripts, change to its
99     # base directory and change the install location
100     # so it gets installed at the proper place
101     # relative to the display.
102     for SCR in ${SCRIPTS[@]}; do
103    
104     cd `dirname ${DSP}`/`dirname ${SCR}`
105    
106     insinto ${GD_INSDIR}/`dirname ${SCR}`
107     doins `basename ${SCR}`
108    
109     cd ${S}/`dirname ${DSP}`
110    
111     done # for in ${SCRIPTS}
112    
113     # Install the graphics for this display.
114     # If there are multiple displays in this
115     # directory, this will be done more than
116     # once. It's the only solution I can
117     # come up with for now...
118     GFX=(`find . \
119     -iname "*.png" -o -iname "*.svg" \
120 nixphoeni 1.4 -o -iname "*.jpg" -o -iname "*.gif" \
121     -o -iname "*.xcf"`)
122 obz 1.1
123     for G in ${GFX[@]}; do
124 nixphoeni 1.2
125 obz 1.1 insinto ${GD_INSDIR}/`dirname ${G}`
126     doins ${G}
127 nixphoeni 1.2
128     done # for in ${GFX}
129 obz 1.1
130     cd ${S}
131    
132     done # for in ${DISPLAY_FILES}
133    
134     fi
135    
136     # Make sure that it only finds Controls and not Sensors
137     # If it uses a Sensor, it shouldn't use a Control (since
138     # Sensors are deprecated).
139     if [[ -z "${SENSOR_NAME}" ]]; then
140    
141     # Base installation directory for Controls
142     GD_INSDIR="${GDESKLETS_INST_DIR}/Controls"
143    
144     CONTROL_INITS=$(find . -iname "__init__.py" | grep [Cc]ontrols)
145    
146     # There are possibly multiple Controls packaged with the display.
147     # For each __init__.py found, there must be a Control associated with it.
148     for CTRL in ${CONTROL_INITS[@]}; do
149    
150     cd `dirname ${CTRL}`
151 nixphoeni 1.3 CTRL_NAME=$( PYTHON_DONTCOMPILE=1 ${GDESKLETS_INST_DIR}/gdesklets-control-getid `pwd` )
152 obz 1.1 einfo "Installing Control ${CTRL_NAME}"
153     # This creates the subdirectory of ${CTRL_NAME}
154 nixphoeni 1.2 # in the global Controls directory
155 obz 1.1 [[ -d ${GD_INSDIR}/${CTRL_NAME} ]] || \
156     dodir ${GD_INSDIR}/${CTRL_NAME}
157    
158     insinto ${GD_INSDIR}/${CTRL_NAME}
159    
160     doins -r *
161    
162     cd ${S}
163    
164     done # for in ${CONTROL_INITS}
165    
166     fi # if no Sensors
167    
168     # Install any remaining graphics and other files
169     # that are sitting in ${S}.
170    
171     GFX=$(find . -maxdepth 1 \
172     -iname "*.png" -o -iname "*.svg" \
173 nixphoeni 1.4 -o -iname "*.jpg" -o -iname "*.gif" \
174     -o -iname "*.xcf")
175 obz 1.1
176     if [[ -n "${GFX}" ]]; then
177     # Install to the Displays directory of the Desklet
178     insinto ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}
179     doins ${GFX}
180     fi # if -n "${GFX}"
181    
182     # Install some docs if so requested
183     [[ -n "${DOCS}" ]] && dodoc ${DOCS}
184    
185     }
186    
187    
188     EXPORT_FUNCTIONS src_install

  ViewVC Help
Powered by ViewVC 1.1.20