1 |
hasufell 12/06/05 17:40:12 |
2 |
|
3 |
Modified: ChangeLog eutils.eclass |
4 |
Log: |
5 |
enhanced functionality of doicon/newicon in eutils.eclass |
6 |
|
7 |
Revision Changes Path |
8 |
1.289 eclass/ChangeLog |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.289&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.289&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.288&r2=1.289 |
13 |
|
14 |
Index: ChangeLog |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
17 |
retrieving revision 1.288 |
18 |
retrieving revision 1.289 |
19 |
diff -u -r1.288 -r1.289 |
20 |
--- ChangeLog 5 Jun 2012 10:21:35 -0000 1.288 |
21 |
+++ ChangeLog 5 Jun 2012 17:40:12 -0000 1.289 |
22 |
@@ -1,6 +1,9 @@ |
23 |
# ChangeLog for eclass directory |
24 |
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.288 2012/06/05 10:21:35 pacho Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.289 2012/06/05 17:40:12 hasufell Exp $ |
27 |
+ |
28 |
+ 05 Jun 2012; Julian Ospald <hasufell@g.o> eutils.eclass: |
29 |
+ enhanced functionality of doicon/newicon in eutils.eclass |
30 |
|
31 |
05 Jun 2012; Pacho Ramos <pacho@g.o> stardict.eclass: |
32 |
Allow more providers for stardict, bug #413093 by tot-to and qt team. |
33 |
|
34 |
|
35 |
|
36 |
1.394 eclass/eutils.eclass |
37 |
|
38 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/eutils.eclass?rev=1.394&view=markup |
39 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/eutils.eclass?rev=1.394&content-type=text/plain |
40 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/eutils.eclass?r1=1.393&r2=1.394 |
41 |
|
42 |
Index: eutils.eclass |
43 |
=================================================================== |
44 |
RCS file: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v |
45 |
retrieving revision 1.393 |
46 |
retrieving revision 1.394 |
47 |
diff -u -r1.393 -r1.394 |
48 |
--- eutils.eclass 28 May 2012 16:45:57 -0000 1.393 |
49 |
+++ eutils.eclass 5 Jun 2012 17:40:12 -0000 1.394 |
50 |
@@ -1,6 +1,6 @@ |
51 |
# Copyright 1999-2012 Gentoo Foundation |
52 |
# Distributed under the terms of the GNU General Public License v2 |
53 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.393 2012/05/28 16:45:57 phajdan.jr Exp $ |
54 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.394 2012/06/05 17:40:12 hasufell Exp $ |
55 |
|
56 |
# @ECLASS: eutils.eclass |
57 |
# @MAINTAINER: |
58 |
@@ -944,45 +944,122 @@ |
59 |
) |
60 |
} |
61 |
|
62 |
-# @FUNCTION: doicon |
63 |
-# @USAGE: <list of icons> |
64 |
+# @FUNCTION: _iconins |
65 |
+# @INTERNAL |
66 |
# @DESCRIPTION: |
67 |
-# Install the list of icons into the icon directory (/usr/share/pixmaps). |
68 |
-# This is useful in conjunction with creating desktop/menu files. |
69 |
-doicon() { |
70 |
+# function for use in doicon and newicon |
71 |
+_iconins() { |
72 |
( |
73 |
# wrap the env here so that the 'insinto' call |
74 |
# doesn't corrupt the env of the caller |
75 |
- local i j ret |
76 |
- insinto /usr/share/pixmaps |
77 |
- for i in "$@" ; do |
78 |
- if [[ -f ${i} ]] ; then |
79 |
- doins "${i}" |
80 |
- ((ret+=$?)) |
81 |
- elif [[ -d ${i} ]] ; then |
82 |
- for j in "${i}"/*.png ; do |
83 |
- doins "${j}" |
84 |
- ((ret+=$?)) |
85 |
- done |
86 |
- else |
87 |
- ((++ret)) |
88 |
- fi |
89 |
+ local funcname=$1; shift |
90 |
+ local size dir |
91 |
+ local context=apps |
92 |
+ local theme=hicolor |
93 |
+ |
94 |
+ while [[ $# -gt 0 ]] ; do |
95 |
+ case $1 in |
96 |
+ -s|--size) |
97 |
+ if [[ ${2%%x*}x${2%%x*} == "$2" ]] ; then |
98 |
+ size=${2%%x*} |
99 |
+ else |
100 |
+ size=${2} |
101 |
+ fi |
102 |
+ case ${size} in |
103 |
+ 16|22|24|32|36|48|64|72|96|128|192|256) |
104 |
+ size=${size}x${size};; |
105 |
+ scalable) |
106 |
+ ;; |
107 |
+ *) |
108 |
+ eerror "${size} is an unsupported icon size!" |
109 |
+ exit 1;; |
110 |
+ esac |
111 |
+ shift 2;; |
112 |
+ -t|--theme) |
113 |
+ theme=${2} |
114 |
+ shift 2;; |
115 |
+ -c|--context) |
116 |
+ context=${2} |
117 |
+ shift 2;; |
118 |
+ *) |
119 |
+ if [[ -z ${size} ]] ; then |
120 |
+ insinto /usr/share/pixmaps |
121 |
+ else |
122 |
+ insinto /usr/share/icons/${theme}/${size}/${context} |
123 |
+ fi |
124 |
+ |
125 |
+ if [[ ${funcname} == doicon ]] ; then |
126 |
+ if [[ -f $1 ]] ; then |
127 |
+ doins "${1}" |
128 |
+ elif [[ -d $1 ]] ; then |
129 |
+ shopt -s nullglob |
130 |
+ doins "${1}"/*.{png,svg} |
131 |
+ shopt -u nullglob |
132 |
+ else |
133 |
+ eerror "${1} is not a valid file/directory!" |
134 |
+ exit 1 |
135 |
+ fi |
136 |
+ else |
137 |
+ break |
138 |
+ fi |
139 |
+ shift 1;; |
140 |
+ esac |
141 |
done |
142 |
- exit ${ret} |
143 |
- ) |
144 |
+ if [[ ${funcname} == newicon ]] ; then |
145 |
+ newins "$@" |
146 |
+ fi |
147 |
+ ) || die |
148 |
+} |
149 |
+ |
150 |
+# @FUNCTION: doicon |
151 |
+# @USAGE: [options] <icons> |
152 |
+# @DESCRIPTION: |
153 |
+# Install icon into the icon directory /usr/share/icons or into |
154 |
+# /usr/share/pixmaps if "--size" is not set. |
155 |
+# This is useful in conjunction with creating desktop/menu files. |
156 |
+# |
157 |
+# @CODE |
158 |
+# options: |
159 |
+# -s, --size |
160 |
+# !!! must specify to install into /usr/share/icons/... !!! |
161 |
+# size of the icon, like 48 or 48x48 |
162 |
+# supported icon sizes are: |
163 |
+# 16 22 24 32 36 48 64 72 96 128 192 256 scalable |
164 |
+# -c, --context |
165 |
+# defaults to "apps" |
166 |
+# -t, --theme |
167 |
+# defaults to "hicolor" |
168 |
+# |
169 |
+# icons: list of icons |
170 |
+# |
171 |
+# example 1: doicon foobar.png fuqbar.svg |
172 |
+# results in: insinto /usr/share/pixmaps |
173 |
+# doins foobar.png fuqbar.svg |
174 |
+# |
175 |
+# example 2: doicon -s 48 foobar.png fuqbar.png |
176 |
+# results in: insinto /usr/share/icons/hicolor/48x48/apps |
177 |
+# doins foobar.png fuqbar.png |
178 |
+# @CODE |
179 |
+doicon() { |
180 |
+ _iconins ${FUNCNAME} "$@" |
181 |
} |
182 |
|
183 |
# @FUNCTION: newicon |
184 |
-# @USAGE: <icon> <newname> |
185 |
+# @USAGE: [options] <icon> <newname> |
186 |
# @DESCRIPTION: |
187 |
-# Like all other new* functions, install the specified icon as newname. |
188 |
+# Like doicon, install the specified icon as newname. |
189 |
+# |
190 |
+# @CODE |
191 |
+# example 1: newicon foobar.png NEWNAME.png |
192 |
+# results in: insinto /usr/share/pixmaps |
193 |
+# newins foobar.png NEWNAME.png |
194 |
+# |
195 |
+# example 2: newicon -s 48 foobar.png NEWNAME.png |
196 |
+# results in: insinto /usr/share/icons/hicolor/48x48/apps |
197 |
+# newins foobar.png NEWNAME.png |
198 |
+# @CODE |
199 |
newicon() { |
200 |
- ( |
201 |
- # wrap the env here so that the 'insinto' call |
202 |
- # doesn't corrupt the env of the caller |
203 |
- insinto /usr/share/pixmaps |
204 |
- newins "$@" |
205 |
- ) |
206 |
+ _iconins ${FUNCNAME} "$@" |
207 |
} |
208 |
|
209 |
# @FUNCTION: strip-linguas |