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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Jun 17 23:34:55 2005 UTC (8 years, 10 months ago) by nixphoeni
Branch: MAIN
Changes since 1.4: +8 -1 lines
Forced DISPLAY to be set - gdesklets-control-id doesn't work if it isn\'t

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

  ViewVC Help
Powered by ViewVC 1.1.20