1 |
commit: fd401af5991a7915f014fb1a2b7b3a4e3f7d3f30 |
2 |
Author: Davide Pesavento <davidepesa <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Apr 5 13:36:10 2012 +0000 |
4 |
Commit: Davide Pesavento <pesa <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 5 13:36:10 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=commit;h=fd401af5 |
7 |
|
8 |
[qt4-r2.eclass] Move some code around, no functional changes. |
9 |
|
10 |
--- |
11 |
eclass/qt4-r2.eclass | 108 ++++++++++++++++++++++++------------------------- |
12 |
1 files changed, 53 insertions(+), 55 deletions(-) |
13 |
|
14 |
diff --git a/eclass/qt4-r2.eclass b/eclass/qt4-r2.eclass |
15 |
index 09adfd8..c8b007d 100644 |
16 |
--- a/eclass/qt4-r2.eclass |
17 |
+++ b/eclass/qt4-r2.eclass |
18 |
@@ -142,41 +142,11 @@ qt4-r2_src_install() { |
19 |
dodoc "${dir}/${doc}" || die "dodoc failed" |
20 |
done |
21 |
|
22 |
- # install translations # hwoarang: Is this valid for every package??? |
23 |
+ # install translations |
24 |
# need to have specified LANGS or LANGSLONG for this to work |
25 |
[[ -n ${LANGS} || -n ${LANGSLONG} ]] && prepare_translations |
26 |
} |
27 |
|
28 |
-# Internal function, used by eqmake4 and qt4-r2_src_configure |
29 |
-# Look for project files: |
30 |
-# 0 *.pro files found - output null string |
31 |
-# 1 *.pro file found - output its name |
32 |
-# 2 or more *.pro files found - if ${PN}.pro or $(basename ${S}).pro |
33 |
-# are there, output any of them |
34 |
-# Outputs a project file argument used by eqmake4. Sets nullglob locally |
35 |
-# to avoid expanding *.pro as "*.pro" when there are no matching files. |
36 |
-_find_project_file() { |
37 |
- local dir_name=$(basename "${S}") |
38 |
- |
39 |
- eshopts_push -s nullglob |
40 |
- local pro_files=(*.pro) |
41 |
- eshopts_pop |
42 |
- |
43 |
- case ${#pro_files[@]} in |
44 |
- 1) |
45 |
- echo "${pro_files[0]}" |
46 |
- ;; |
47 |
- *) |
48 |
- for pro_file in "${pro_files[@]}"; do |
49 |
- if [[ ${pro_file} == "${dir_name}.pro" || ${pro_file} == "${PN}.pro" ]]; then |
50 |
- echo "${pro_file}" |
51 |
- break |
52 |
- fi |
53 |
- done |
54 |
- ;; |
55 |
- esac |
56 |
-} |
57 |
- |
58 |
# @FUNCTION: eqmake4 |
59 |
# @USAGE: [project_file] [parameters to qmake] |
60 |
# @DESCRIPTION: |
61 |
@@ -295,27 +265,34 @@ eqmake4() { |
62 |
return 0 |
63 |
} |
64 |
|
65 |
-# Internal function |
66 |
-_do_qm() { |
67 |
- debug-print-function $FUNCNAME "$@" |
68 |
- [[ $# -ne 2 ]] && die "$FUNCNAME requires exactly 2 arguments!" |
69 |
+# Internal function, used by eqmake4 and qt4-r2_src_configure. |
70 |
+# Outputs a project file name that can be passed to eqmake4. Sets nullglob |
71 |
+# locally to avoid expanding *.pro as "*.pro" when there are no matching files. |
72 |
+# 0 *.pro files found --> outputs null string |
73 |
+# 1 *.pro file found --> outputs its name |
74 |
+# 2 or more *.pro files found --> if ${PN}.pro or $(basename ${S}).pro |
75 |
+# are there, outputs any of them |
76 |
+_find_project_file() { |
77 |
+ local dir_name=$(basename "${S}") |
78 |
|
79 |
- local transfile="$(find "${1}" -type f -name "*${2}".qm)" |
80 |
- if [[ -f ${transfile} ]]; then |
81 |
- ( |
82 |
- insinto /usr/share/${PN}/"${1#${S}}" |
83 |
- doins "${transfile}" |
84 |
- ) || die "failed to install ${2} translation" |
85 |
- else |
86 |
- eerror |
87 |
- eerror "Failed to install ${2} translation: file not found." |
88 |
- eerror |
89 |
- die "failed to install ${2} translation" |
90 |
- fi |
91 |
-} |
92 |
+ eshopts_push -s nullglob |
93 |
+ local pro_files=(*.pro) |
94 |
+ eshopts_pop |
95 |
|
96 |
-# @VARIABLE: TRANSLATIONSDIR |
97 |
-# @DESCRIPTION: Translations directory. If not set, ${S} will be used |
98 |
+ case ${#pro_files[@]} in |
99 |
+ 1) |
100 |
+ echo "${pro_files[0]}" |
101 |
+ ;; |
102 |
+ *) |
103 |
+ for pro_file in "${pro_files[@]}"; do |
104 |
+ if [[ ${pro_file} == "${dir_name}.pro" || ${pro_file} == "${PN}.pro" ]]; then |
105 |
+ echo "${pro_file}" |
106 |
+ break |
107 |
+ fi |
108 |
+ done |
109 |
+ ;; |
110 |
+ esac |
111 |
+} |
112 |
|
113 |
# @FUNCTION: prepare_translations |
114 |
# @DESCRIPTION: |
115 |
@@ -324,22 +301,43 @@ _do_qm() { |
116 |
prepare_translations() { |
117 |
debug-print-function $FUNCNAME "$@" |
118 |
|
119 |
+ # @VARIABLE: TRANSLATIONSDIR |
120 |
+ # @DESCRIPTION: Translations directory, defaults to ${S}. |
121 |
+ local roottrdir=${TRANSLATIONSDIR:-${S}} |
122 |
+ local trdir=. |
123 |
# Find translations directory |
124 |
- # Changed default to . - crazy upstreams :) |
125 |
- local roottrdir="${TRANSLATIONSDIR:-${S}}" trdir=. |
126 |
for dir in lang langs translations; do |
127 |
- [[ -d ${roottrdir}/${dir} ]] && trdir="${roottrdir}/${dir}" |
128 |
+ [[ -d ${roottrdir}/${dir} ]] && trdir=${roottrdir}/${dir} |
129 |
done |
130 |
|
131 |
local lang= |
132 |
for lang in ${LINGUAS}; do |
133 |
for x in ${LANGS}; do |
134 |
- [[ ${lang} == ${x%_*} ]] && _do_qm "${trdir}" ${x} |
135 |
+ [[ ${lang} == ${x%_*} ]] && _do_qm "${trdir}" "${x}" |
136 |
done |
137 |
for x in ${LANGSLONG}; do |
138 |
- [[ ${lang} == ${x} ]] && _do_qm "${trdir}" ${x} |
139 |
+ [[ ${lang} == ${x} ]] && _do_qm "${trdir}" "${x}" |
140 |
done |
141 |
done |
142 |
} |
143 |
|
144 |
+# Internal function |
145 |
+_do_qm() { |
146 |
+ debug-print-function $FUNCNAME "$@" |
147 |
+ [[ $# -ne 2 ]] && die "$FUNCNAME() requires exactly 2 arguments!" |
148 |
+ |
149 |
+ local transfile="$(find "${1}" -type f -name "*${2}".qm)" |
150 |
+ if [[ -f ${transfile} ]]; then |
151 |
+ ( |
152 |
+ insinto /usr/share/${PN}/"${1#${S}}" |
153 |
+ doins "${transfile}" |
154 |
+ ) || die "failed to install ${2} translation" |
155 |
+ else |
156 |
+ eerror |
157 |
+ eerror "Failed to install ${2} translation: file not found." |
158 |
+ eerror |
159 |
+ die "failed to install ${2} translation" |
160 |
+ fi |
161 |
+} |
162 |
+ |
163 |
EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install |