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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Wed Nov 30 09:59:28 2005 UTC (9 years ago) by chriswhite
Changes since 1.1: +66 -59 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.20