1 |
lack 07/11/28 14:20:59 |
2 |
|
3 |
Modified: rox.eclass |
4 |
Log: |
5 |
Minor reorganization, also added support for APPMIME variable in ebuilds to set |
6 |
the MimeType of the created .desktop files. |
7 |
|
8 |
Revision Changes Path |
9 |
1.23 eclass/rox.eclass |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/rox.eclass?rev=1.23&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/rox.eclass?rev=1.23&content-type=text/plain |
13 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/rox.eclass?r1=1.22&r2=1.23 |
14 |
|
15 |
Index: rox.eclass |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo-x86/eclass/rox.eclass,v |
18 |
retrieving revision 1.22 |
19 |
retrieving revision 1.23 |
20 |
diff -u -r1.22 -r1.23 |
21 |
--- rox.eclass 12 Jun 2007 20:15:22 -0000 1.22 |
22 |
+++ rox.eclass 28 Nov 2007 14:20:58 -0000 1.23 |
23 |
@@ -1,13 +1,13 @@ |
24 |
# Copyright 1999-2004 Gentoo Foundation |
25 |
# Distributed under the terms of the GNU General Public License v2 |
26 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/rox.eclass,v 1.22 2007/06/12 20:15:22 lack Exp $ |
27 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/rox.eclass,v 1.23 2007/11/28 14:20:58 lack Exp $ |
28 |
|
29 |
-# ROX eclass Version 2 |
30 |
+# ROX eclass Version 3 |
31 |
|
32 |
# This eclass was created by Sergey Kuleshov (svyatogor@g.o) and |
33 |
# Alexander Simonov (devil@××××××××××.ua) to ease installation of ROX desktop |
34 |
# applications. Enhancements and python additions by Peter Hyman. |
35 |
-# Small fixes and current maintenance by the Rox herd (rox@g.o) |
36 |
+# Small fixes and current maintenance by Jim Ramsay (lack@g.o) |
37 |
|
38 |
# These variables are used in the GLOBAL scope to decide on DEPENDs, so they |
39 |
# must be set BEFORE you 'inherit rox': |
40 |
@@ -16,7 +16,7 @@ |
41 |
# ROX_LIB_VER - version of rox-lib required if any |
42 |
# ROX_CLIB_VER - version of rox-clib required if any |
43 |
# |
44 |
-# These variables are only used in local scopes, and so may be set anywhere in |
45 |
+# These variables are only used inside functions, and so may be set anywhere in |
46 |
# the ebuild: |
47 |
# |
48 |
# APPNAME - the actual name of the application as the app folder is named |
49 |
@@ -31,8 +31,17 @@ |
50 |
# If unset, no .desktop file will be created. For a list of acceptable |
51 |
# category names, see |
52 |
# http://standards.freedesktop.org/menu-spec/latest/apa.html |
53 |
+# APPMIME - the .desktop MimeTypes value to include. This is a |
54 |
+# semicolon-delimited list of mime-types. Any characters in [[:space:]] are |
55 |
+# ignored. If the supported mime-types are dependent upon USE flags, the new |
56 |
+# 'usemime' function may be useful. For example: |
57 |
+# APPMIME="a/foo-1;a/foo-2 |
58 |
+# $(usemime three "a/three") |
59 |
+# text/plain" |
60 |
+# will be expanded to either "a/foo-1;a/foo-2;a/three;text/plain" if USE=three |
61 |
+# or "a/foo-1;a/foo-2;text/plain" if not. |
62 |
# KEEP_SRC - this flag, if set, will not remove the source directory |
63 |
-# but will do a make clean in it. This is useful if users wish to |
64 |
+# but will do a 'make clean' in it. This is useful if users wish to |
65 |
# preserve the source code for some reason |
66 |
|
67 |
# For examples refer to ebuilds in rox-extra/ or rox-base/ |
68 |
@@ -63,16 +72,34 @@ |
69 |
# It is also used for the icon name in /usr/share/pixmaps |
70 |
# |
71 |
# Use rox-${PN} unless ${PN} already starts with 'rox' |
72 |
-a="rox-${PN}" |
73 |
-b=${a/rox-rox*} |
74 |
-WRAPPERNAME=${b:-${PN}} |
75 |
+_a="rox-${PN}" |
76 |
+_b=${_a/rox-rox*} |
77 |
+WRAPPERNAME=${_b:-${PN}} |
78 |
+unset _a _b |
79 |
|
80 |
# This is the location where all applications are installed |
81 |
APPDIR="/usr/$(get_libdir)/rox" |
82 |
LIBDIR="/usr/$(get_libdir)" |
83 |
|
84 |
+# External Functions |
85 |
+ |
86 |
+# Used for assembling APPMIME with USE-dependent parts |
87 |
+usemime() { |
88 |
+ local myuse=$1; shift |
89 |
+ useq $myuse && echo "$@" |
90 |
+} |
91 |
+ |
92 |
# Utility Functions |
93 |
|
94 |
+# Expands APPMIME properly, removing whitespace, newlines, and putting in ';' |
95 |
+# where needed. |
96 |
+expandmime() { |
97 |
+ local old_IFS=$IFS |
98 |
+ IFS=";$' \t\n'" |
99 |
+ echo "$*" |
100 |
+ IFS=$old_IFS |
101 |
+} |
102 |
+ |
103 |
# Creates a .desktop file for this rox application |
104 |
# (Adapted from eutils::make_desktop_entry) |
105 |
# |
106 |
@@ -112,71 +139,20 @@ |
107 |
extra=${1}; shift |
108 |
done |
109 |
|
110 |
+ # Subshell, so as to not pollute the caller's env. |
111 |
( |
112 |
- # wrap the env here so that the 'insinto' call |
113 |
- # doesn't corrupt the env of the caller |
114 |
insinto /usr/share/applications |
115 |
doins "${desktop}" |
116 |
) |
117 |
} |
118 |
|
119 |
-# Exported functions |
120 |
-rox_src_compile() { |
121 |
- cd "${APPNAME}" |
122 |
- #Some packages need to be compiled. |
123 |
- chmod 755 AppRun |
124 |
- if [[ -d src/ ]]; then |
125 |
- # Bug 150303: Check with Rox-Clib will fail if the user has 0install |
126 |
- # installed on their system somewhere, so remove the check for it in the |
127 |
- # configure script, and adjust the path that the 'libdir' program uses |
128 |
- # to search for it: |
129 |
- if [[ -f src/configure.in ]]; then |
130 |
- cd src |
131 |
- sed -i.bak -e 's/ROX_CLIB_0LAUNCH/ROX_CLIB/' configure.in |
132 |
- # TODO: This should really be 'eautoreconf', but that breaks a number |
133 |
- # of packages (such as pager-1.0.1) |
134 |
- eautoconf |
135 |
- cd .. |
136 |
- fi |
137 |
- export LIBDIRPATH="${LIBDIR}" |
138 |
- |
139 |
- # Most rox self-compiles have a 'read' call to wait for the user to |
140 |
- # press return if the compile fails. |
141 |
- # Find and remove this: |
142 |
- sed -i.bak -e 's/\<read\>/#read/' AppRun |
143 |
- |
144 |
- ./AppRun --compile || die "Failed to compile the package" |
145 |
- if [[ -n "${KEEP_SRC}" ]]; then |
146 |
- cd src |
147 |
- make clean |
148 |
- cd .. |
149 |
- else |
150 |
- rm -rf src |
151 |
- fi |
152 |
- if [[ -d build ]]; then |
153 |
- rm -rf build |
154 |
- fi |
155 |
- |
156 |
- # Restore the original AppRun |
157 |
- mv AppRun.bak AppRun |
158 |
- fi |
159 |
-} |
160 |
- |
161 |
-rox_src_install() { |
162 |
- if [[ -d "${APPNAME}/Help/" ]]; then |
163 |
- for i in "${APPNAME}"/Help/*; do |
164 |
- dodoc "${i}" |
165 |
- done |
166 |
- fi |
167 |
- |
168 |
- insinto ${APPDIR} |
169 |
- |
170 |
- # Use 'cp -pPR' and not 'doins -r' here so we don't have to do a flurry of |
171 |
- # 'chmod' calls on the executables in the appdir - Just be sure that all the |
172 |
- # files in the original appdir prior to this step are correct, as they will |
173 |
- # all be preserved. |
174 |
- cp -pPR ${APPNAME} ${D}${APPDIR}/${APPNAME} |
175 |
- |
176 |
+# |
177 |
+# Install the wrapper in /usr/bin for commandline execution |
178 |
+# |
179 |
+# Environment needed: |
180 |
+# WRAPPERNAME, APPDIR, LIBDIR, APPNAME, APPNAME_COLLISION |
181 |
+# |
182 |
+rox_install_wrapper() { |
183 |
if [[ "${WRAPPERNAME}" != "skip" ]]; then |
184 |
#create a script in bin to run the application from command line |
185 |
dodir /usr/bin/ |
186 |
@@ -199,7 +175,7 @@ |
187 |
|
188 |
# Old name of cmdline wrapper: /usr/bin/${APPNAME} |
189 |
if [[ ! "${APPNAME_COLLISION}" ]]; then |
190 |
- ln -s ${WRAPPERNAME} ${D}/usr/bin/${APPNAME} |
191 |
+ ln -s ${WRAPPERNAME} "${D}/usr/bin/${APPNAME}" |
192 |
# TODO: Migrate this away... eventually |
193 |
else |
194 |
ewarn "The wrapper script /usr/bin/${APPNAME} has been removed" |
195 |
@@ -207,7 +183,12 @@ |
196 |
ewarn "/usr/bin/${WRAPPERNAME} instead." |
197 |
fi |
198 |
fi |
199 |
+} |
200 |
|
201 |
+# |
202 |
+# Copy the .DirIcon into the pixmaps dir, and create the .desktop file |
203 |
+# |
204 |
+rox_install_desktop() { |
205 |
# Create a .desktop file if the proper category is supplied |
206 |
if [[ -n "${APPCATEGORY}" ]]; then |
207 |
# Copy the .DirIcon into /usr/share/pixmaps with the proper extension |
208 |
@@ -234,14 +215,80 @@ |
209 |
export APPICON=${WRAPPERNAME} |
210 |
;; |
211 |
esac |
212 |
+ # Subshell, so as to not pollute the caller's env. |
213 |
+ ( |
214 |
insinto /usr/share/pixmaps |
215 |
newins "${APPDIRICON}" "${APPICON}" |
216 |
+ ) |
217 |
fi |
218 |
|
219 |
- rox_desktop_entry "${WRAPPERNAME}" "${APPNAME}" "${APPICON}" "${APPCATEGORY}" |
220 |
+ rox_desktop_entry "${WRAPPERNAME}" "${APPNAME}" "${APPICON}" \ |
221 |
+ "${APPCATEGORY}" "MimeType=$(expandmime $APPMIME)" |
222 |
fi |
223 |
+} |
224 |
+ |
225 |
+# Exported functions |
226 |
+rox_src_compile() { |
227 |
+ cd "${APPNAME}" |
228 |
+ #Some packages need to be compiled. |
229 |
+ chmod 755 AppRun |
230 |
+ if [[ -d src/ ]]; then |
231 |
+ # Bug 150303: Check with Rox-Clib will fail if the user has 0install |
232 |
+ # installed on their system somewhere, so remove the check for it in the |
233 |
+ # configure script, and adjust the path that the 'libdir' program uses |
234 |
+ # to search for it: |
235 |
+ if [[ -f src/configure.in ]]; then |
236 |
+ cd src |
237 |
+ sed -i.bak -e 's/ROX_CLIB_0LAUNCH/ROX_CLIB/' configure.in |
238 |
+ # TODO: This should really be 'eautoreconf', but that breaks |
239 |
+ # some packages (such as rox-base/pager-1.0.1) |
240 |
+ eautoconf |
241 |
+ cd .. |
242 |
+ fi |
243 |
+ export LIBDIRPATH="${LIBDIR}" |
244 |
+ |
245 |
+ # Most rox self-compiles have a 'read' call to wait for the user to |
246 |
+ # press return if the compile fails. |
247 |
+ # Find and remove this: |
248 |
+ sed -i.bak -e 's/\<read\>/#read/' AppRun |
249 |
+ |
250 |
+ ./AppRun --compile || die "Failed to compile the package" |
251 |
+ if [[ -n "${KEEP_SRC}" ]]; then |
252 |
+ emake -C src clean |
253 |
+ else |
254 |
+ rm -rf src |
255 |
+ fi |
256 |
+ if [[ -d build ]]; then |
257 |
+ rm -rf build |
258 |
+ fi |
259 |
+ |
260 |
+ # Restore the original AppRun |
261 |
+ mv AppRun.bak AppRun |
262 |
+ fi |
263 |
+} |
264 |
+ |
265 |
+rox_src_install() { |
266 |
+ if [[ -d "${APPNAME}/Help/" ]]; then |
267 |
+ for i in "${APPNAME}"/Help/*; do |
268 |
+ dodoc "${i}" |
269 |
+ done |
270 |
+ fi |
271 |
+ |
272 |
+ insinto ${APPDIR} |
273 |
+ |
274 |
+ # Use 'cp -pPR' and not 'doins -r' here so we don't have to do a flurry of |
275 |
+ # 'chmod' calls on the executables in the appdir - Just be sure that all the |
276 |
+ # files in the original appdir prior to this step are correct, as they will |
277 |
+ # all be preserved. |
278 |
+ cp -pPR ${APPNAME} "${D}${APPDIR}/${APPNAME}" |
279 |
+ |
280 |
+ # Install the wrapper in /usr/bin |
281 |
+ rox_install_wrapper |
282 |
+ |
283 |
+ # Install the .desktop application file |
284 |
+ rox_install_desktop |
285 |
|
286 |
- #now compile any and all python files |
287 |
+ # Finally, optimize any python files |
288 |
python_mod_optimize "${D}${APPDIR}/${APPNAME}" >/dev/null 2>&1 |
289 |
} |
290 |
|
291 |
|
292 |
|
293 |
|
294 |
-- |
295 |
gentoo-commits@g.o mailing list |