| 1 | # Copyright 2004 Gentoo Foundation |
1 | # Copyright 2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License, v2 or later |
2 | # Distributed under the terms of the GNU General Public License, v2 or later |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/gdesklets.eclass,v 1.1.1.1 2005/11/30 09:59:28 chriswhite Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/gdesklets.eclass,v 1.11 2006/01/16 18:14:47 nixphoeni Exp $ |
| 4 | # |
4 | # |
| 5 | # Authors: Joe Sapp <nixphoeni@gentoo.org> |
5 | # Authors: Joe Sapp <nixphoeni@gentoo.org> |
| 6 | # Mike Gardiner <obz@gentoo.org> |
6 | # Mike Gardiner <obz@gentoo.org> |
| 7 | # |
7 | # |
| 8 | # Usage: |
8 | # Usage: |
| … | |
… | |
| 25 | SRC_URI="http://gdesklets.gnomedesktop.org/files/${MY_P}.tar.gz" |
25 | SRC_URI="http://gdesklets.gnomedesktop.org/files/${MY_P}.tar.gz" |
| 26 | |
26 | |
| 27 | # Ebuild writer shouldn't need to touch these (except maybe $RDEPEND) |
27 | # Ebuild writer shouldn't need to touch these (except maybe $RDEPEND) |
| 28 | SLOT="0" |
28 | SLOT="0" |
| 29 | IUSE="" |
29 | IUSE="" |
| 30 | RDEPEND=">=gnome-extra/gdesklets-core-0.34.3" |
30 | RDEPEND=">=gnome-extra/gdesklets-core-0.34.3-r1" |
| 31 | |
31 | |
| 32 | GDESKLETS_INST_DIR="/usr/$(get_libdir)/gdesklets" |
32 | GDESKLETS_INST_DIR="/usr/$(get_libdir)/gdesklets" |
| 33 | |
33 | |
| 34 | gdesklets_src_install() { |
34 | gdesklets_src_install() { |
| 35 | |
35 | |
| … | |
… | |
| 51 | # gdesklets-control-getid script to run without |
51 | # gdesklets-control-getid script to run without |
| 52 | # error |
52 | # error |
| 53 | [ -z "${DISPLAY}" ] && DISPLAY="" |
53 | [ -z "${DISPLAY}" ] && DISPLAY="" |
| 54 | export DISPLAY |
54 | export DISPLAY |
| 55 | |
55 | |
|
|
56 | debug-print-section sensor_install |
| 56 | # First, install the Sensor (if there is one) |
57 | # First, install the Sensor (if there is one) |
| 57 | if [[ -n "${SENSOR_NAME}" ]]; then |
58 | if [[ -n "${SENSOR_NAME}" ]]; then |
| 58 | for SENS in ${SENSOR_NAME[@]}; do |
59 | for SENS in ${SENSOR_NAME[@]}; do |
| 59 | einfo "Installing Sensor ${SENS}" |
60 | einfo "Installing Sensor ${SENS}" |
| 60 | /usr/bin/python "Install_${SENS}_Sensor.bin" \ |
61 | /usr/bin/python "Install_${SENS}_Sensor.bin" \ |
| … | |
… | |
| 63 | |
64 | |
| 64 | chown -R root:0 ${D}${GDESKLETS_INST_DIR}/Sensors/${SENSOR_NAME} |
65 | chown -R root:0 ${D}${GDESKLETS_INST_DIR}/Sensors/${SENSOR_NAME} |
| 65 | done # for in ${SENSOR_NAME} |
66 | done # for in ${SENSOR_NAME} |
| 66 | fi # if -n "${SENSOR_NAME}" |
67 | fi # if -n "${SENSOR_NAME}" |
| 67 | |
68 | |
|
|
69 | debug-print-section display_install |
| 68 | # This finds the Displays |
70 | # This finds the Displays |
| 69 | DISPLAY_FILES=(`find . -iname "*.display"`) |
71 | DISPLAY_FILES=(`find . -iname "*.display"`) |
| 70 | |
72 | |
| 71 | GD_INSDIR="" |
73 | DESKLET_INSDIR="" |
| 72 | |
74 | |
| 73 | # There is more than likely only one display per package |
75 | # There is most likely only one display per package |
| 74 | if [[ -n "${DISPLAY_FILES[@]}" ]]; then |
76 | if [[ -n "${DISPLAY_FILES[@]}" ]]; then |
| 75 | # Base installation directory for displays |
77 | # Base installation directory for displays from this desklet |
| 76 | GD_INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}" |
78 | DESKLET_INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}" |
| 77 | |
79 | |
| 78 | # This creates the subdirectory of ${DESKLET_NAME} |
80 | # This creates the subdirectory of ${DESKLET_NAME} |
| 79 | # in the global Displays directory |
81 | # in the global Displays directory |
| 80 | [[ -d ${GD_INSDIR} ]] || \ |
82 | [[ -d ${DESKLET_INSDIR} ]] || \ |
| 81 | dodir ${GD_INSDIR} |
83 | dodir ${DESKLET_INSDIR} |
| 82 | |
84 | |
| 83 | # For each of the Display files, there may be |
85 | # For each of the Display files, there may be |
| 84 | # scripts included inline which don't necessarily |
86 | # scripts included inline which don't necessarily |
| 85 | # follow any naming scheme. |
87 | # follow any naming scheme. |
| 86 | # So for each of them, determine what those scripts are |
88 | # So for each of them, determine what those scripts are |
| 87 | # and install them. |
89 | # and install them. |
| 88 | for DSP in ${DISPLAY_FILES[@]}; do |
90 | for DSP in ${DISPLAY_FILES[@]}; do |
| 89 | |
91 | |
|
|
92 | cd `dirname ${DSP}` |
| 90 | einfo "Installing Display `basename ${DSP} .display`" |
93 | einfo "Installing Display `basename ${DSP} .display`" |
|
|
94 | debug-print "Installing ${DSP} into ${DESKLET_INSDIR}" |
|
|
95 | DSP=`basename ${DSP}` |
| 91 | insinto ${GD_INSDIR} |
96 | insinto ${DESKLET_INSDIR} |
| 92 | doins ${DSP} |
97 | doins ${DSP} |
| 93 | |
98 | |
| 94 | SCRIPTS=$(grep "script .*uri" ${DSP} | \ |
99 | SCRIPTS=$(grep "script .*uri" ${DSP} | \ |
| 95 | sed -e 's:.*<script .*uri=": :g' -e 's:"/>.*: :g') |
100 | sed -e 's:.*<script .*uri=": :g' -e 's:"/>.*: :g') |
| 96 | |
101 | |
| … | |
… | |
| 98 | # base directory and change the install location |
103 | # base directory and change the install location |
| 99 | # so it gets installed at the proper place |
104 | # so it gets installed at the proper place |
| 100 | # relative to the display. |
105 | # relative to the display. |
| 101 | for SCR in ${SCRIPTS[@]}; do |
106 | for SCR in ${SCRIPTS[@]}; do |
| 102 | |
107 | |
| 103 | cd `dirname ${DSP}`/`dirname ${SCR}` |
108 | cd `dirname ${SCR}` |
| 104 | |
109 | |
| 105 | insinto ${GD_INSDIR}/`dirname ${SCR}` |
110 | insinto ${DESKLET_INSDIR}/`dirname ${SCR}` |
| 106 | doins `basename ${SCR}` |
111 | doins `basename ${SCR}` |
|
|
112 | debug-print "Installed `basename ${SCR}` into ${DESKLET_INSDIR}/`dirname ${SCR}`" |
| 107 | |
113 | |
| 108 | cd ${S}/`dirname ${DSP}` |
114 | cd ${S}/`dirname ${DSP}` |
| 109 | |
115 | |
| 110 | done # for in ${SCRIPTS} |
116 | done # for in ${SCRIPTS} |
| 111 | |
117 | |
| … | |
… | |
| 119 | -o -iname "*.jpg" -o -iname "*.gif" \ |
125 | -o -iname "*.jpg" -o -iname "*.gif" \ |
| 120 | -o -iname "*.xcf"`) |
126 | -o -iname "*.xcf"`) |
| 121 | |
127 | |
| 122 | for G in ${GFX[@]}; do |
128 | for G in ${GFX[@]}; do |
| 123 | |
129 | |
| 124 | insinto ${GD_INSDIR}/`dirname ${G}` |
130 | insinto ${DESKLET_INSDIR}/`dirname ${G}` |
| 125 | doins ${G} |
131 | doins ${G} |
|
|
132 | debug-print "Installed ${G} into ${DESKLET_INSDIR}/`dirname ${G}`" |
| 126 | |
133 | |
| 127 | done # for in ${GFX} |
134 | done # for in ${GFX} |
| 128 | |
135 | |
| 129 | cd ${S} |
136 | cd ${S} |
| 130 | |
137 | |
| 131 | done # for in ${DISPLAY_FILES} |
138 | done # for in ${DISPLAY_FILES} |
| 132 | |
139 | |
| 133 | fi |
140 | fi |
| 134 | |
141 | |
|
|
142 | debug-print-section control_install |
|
|
143 | |
|
|
144 | CONTROL_INSDIR="" |
|
|
145 | |
| 135 | # Make sure that it only finds Controls and not Sensors |
146 | # Make sure that it only finds Controls and not Sensors |
| 136 | # If it uses a Sensor, it shouldn't use a Control (since |
147 | # If it uses a Sensor, it shouldn't use a Control (since |
| 137 | # Sensors are deprecated). |
148 | # Sensors are deprecated). |
| 138 | if [[ -z "${SENSOR_NAME}" ]]; then |
149 | if [[ -z "${SENSOR_NAME}" ]]; then |
| 139 | |
150 | |
| 140 | # Base installation directory for Controls |
151 | # Base installation directory for Controls |
| 141 | GD_INSDIR="${GDESKLETS_INST_DIR}/Controls" |
152 | CONTROL_INSDIR="${GDESKLETS_INST_DIR}/Controls" |
| 142 | |
153 | |
| 143 | CONTROL_INITS=$(find . -iname "__init__.py" | grep [Cc]ontrols) |
154 | CONTROL_INITS=$(find . -iname "__init__.py" | grep [Cc]ontrols) |
| 144 | |
155 | |
| 145 | # There are possibly multiple Controls packaged with the display. |
156 | # There are possibly multiple Controls packaged with the display. |
| 146 | # For each __init__.py found, there must be a Control associated with it. |
157 | # For each __init__.py found, there must be a Control associated with it. |
| … | |
… | |
| 149 | cd `dirname ${CTRL}` |
160 | cd `dirname ${CTRL}` |
| 150 | CTRL_NAME=$( PYTHON_DONTCOMPILE=1 ${GDESKLETS_INST_DIR}/gdesklets-control-getid `pwd` ) |
161 | CTRL_NAME=$( PYTHON_DONTCOMPILE=1 ${GDESKLETS_INST_DIR}/gdesklets-control-getid `pwd` ) |
| 151 | einfo "Installing Control ${CTRL_NAME}" |
162 | einfo "Installing Control ${CTRL_NAME}" |
| 152 | # This creates the subdirectory of ${CTRL_NAME} |
163 | # This creates the subdirectory of ${CTRL_NAME} |
| 153 | # in the global Controls directory |
164 | # in the global Controls directory |
| 154 | [[ -d ${GD_INSDIR}/${CTRL_NAME} ]] || \ |
165 | [[ -d ${CONTROL_INSDIR}/${CTRL_NAME} ]] || \ |
| 155 | dodir ${GD_INSDIR}/${CTRL_NAME} |
166 | dodir ${CONTROL_INSDIR}/${CTRL_NAME} |
| 156 | |
167 | |
| 157 | insinto ${GD_INSDIR}/${CTRL_NAME} |
168 | insinto ${CONTROL_INSDIR}/${CTRL_NAME} |
| 158 | |
169 | |
| 159 | doins -r * |
170 | doins -r * |
| 160 | |
171 | |
| 161 | cd ${S} |
172 | cd ${S} |
| 162 | |
173 | |
| … | |
… | |
| 171 | -iname "*.png" -o -iname "*.svg" \ |
182 | -iname "*.png" -o -iname "*.svg" \ |
| 172 | -o -iname "*.jpg" -o -iname "*.gif" \ |
183 | -o -iname "*.jpg" -o -iname "*.gif" \ |
| 173 | -o -iname "*.xcf") |
184 | -o -iname "*.xcf") |
| 174 | |
185 | |
| 175 | if [[ -n "${GFX}" ]]; then |
186 | if [[ -n "${GFX}" ]]; then |
|
|
187 | |
| 176 | # Install to the Displays directory of the Desklet |
188 | # Install to the Displays directory of the Desklet |
| 177 | insinto ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME} |
189 | insinto ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME} |
| 178 | doins ${GFX} |
190 | doins ${GFX} |
|
|
191 | debug-print "Installed ${GFX} into ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}" |
|
|
192 | |
| 179 | fi # if -n "${GFX}" |
193 | fi # if -n "${GFX}" |
| 180 | |
194 | |
| 181 | # Install some docs if so requested |
195 | # Install some docs if so requested |
| 182 | [[ -n "${DOCS}" ]] && dodoc ${DOCS} |
196 | [[ -n "${DOCS}" ]] && dodoc ${DOCS} |
|
|
197 | debug-print "Installed ${DOCS}" |
| 183 | |
198 | |
| 184 | } |
199 | } |
| 185 | |
200 | |
| 186 | |
201 | |
| 187 | EXPORT_FUNCTIONS src_install |
202 | EXPORT_FUNCTIONS src_install |