1 |
commit: e95bc6041cf9940cfecef2ffe5ed28dcd988a12c |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 31 20:31:11 2018 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 31 20:31:11 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=e95bc604 |
7 |
|
8 |
qt4*eclass: Import from Gentoo ebuild repository |
9 |
|
10 |
eclass/qt4-build-multilib.eclass | 847 +++++++++++++++++++++++++++++++++++++++ |
11 |
eclass/qt4-r2.eclass | 139 +++++++ |
12 |
2 files changed, 986 insertions(+) |
13 |
|
14 |
diff --git a/eclass/qt4-build-multilib.eclass b/eclass/qt4-build-multilib.eclass |
15 |
new file mode 100644 |
16 |
index 0000000..7666936 |
17 |
--- /dev/null |
18 |
+++ b/eclass/qt4-build-multilib.eclass |
19 |
@@ -0,0 +1,847 @@ |
20 |
+# Copyright 1999-2015 Gentoo Foundation |
21 |
+# Distributed under the terms of the GNU General Public License v2 |
22 |
+ |
23 |
+# @ECLASS: qt4-build-multilib.eclass |
24 |
+# @MAINTAINER: |
25 |
+# qt@g.o |
26 |
+# @AUTHOR: |
27 |
+# Davide Pesavento <pesa@g.o> |
28 |
+# @BLURB: Eclass for Qt4 split ebuilds with multilib support. |
29 |
+# @DESCRIPTION: |
30 |
+# This eclass contains various functions that are used when building Qt4. |
31 |
+# Requires EAPI 5. |
32 |
+ |
33 |
+case ${EAPI} in |
34 |
+ 5) : ;; |
35 |
+ *) die "qt4-build-multilib.eclass: unsupported EAPI=${EAPI:-0}" ;; |
36 |
+esac |
37 |
+ |
38 |
+inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs |
39 |
+ |
40 |
+HOMEPAGE="https://www.qt.io/" |
41 |
+LICENSE="|| ( LGPL-2.1 LGPL-3 GPL-3 ) FDL-1.3" |
42 |
+SLOT="4" |
43 |
+ |
44 |
+case ${PV} in |
45 |
+ 4.?.9999) |
46 |
+ # git stable branch |
47 |
+ QT4_BUILD_TYPE="live" |
48 |
+ EGIT_BRANCH=${PV%.9999} |
49 |
+ ;; |
50 |
+ *) |
51 |
+ # official stable release |
52 |
+ QT4_BUILD_TYPE="release" |
53 |
+ MY_P=qt-everywhere-opensource-src-${PV/_/-} |
54 |
+ SRC_URI="http://download.qt.io/official_releases/qt/${PV%.*}/${PV}/${MY_P}.tar.gz" |
55 |
+ S=${WORKDIR}/${MY_P} |
56 |
+ ;; |
57 |
+esac |
58 |
+ |
59 |
+EGIT_REPO_URI=( |
60 |
+ "git://code.qt.io/qt/qt.git" |
61 |
+ "https://code.qt.io/git/qt/qt.git" |
62 |
+ "https://github.com/qtproject/qt.git" |
63 |
+) |
64 |
+[[ ${QT4_BUILD_TYPE} == live ]] && inherit git-r3 |
65 |
+ |
66 |
+if [[ ${PN} != qttranslations ]]; then |
67 |
+ IUSE="aqua debug pch" |
68 |
+ [[ ${PN} != qtxmlpatterns ]] && IUSE+=" +exceptions" |
69 |
+fi |
70 |
+ |
71 |
+DEPEND=" |
72 |
+ dev-lang/perl |
73 |
+ virtual/pkgconfig[${MULTILIB_USEDEP}] |
74 |
+" |
75 |
+RDEPEND=" |
76 |
+ dev-qt/qtchooser |
77 |
+" |
78 |
+ |
79 |
+ |
80 |
+# src_{configure,compile,test,install} are inherited from multilib-minimal |
81 |
+EXPORT_FUNCTIONS src_unpack src_prepare pkg_postinst pkg_postrm |
82 |
+ |
83 |
+multilib_src_configure() { qt4_multilib_src_configure; } |
84 |
+multilib_src_compile() { qt4_multilib_src_compile; } |
85 |
+multilib_src_test() { qt4_multilib_src_test; } |
86 |
+multilib_src_install() { qt4_multilib_src_install; } |
87 |
+multilib_src_install_all() { qt4_multilib_src_install_all; } |
88 |
+ |
89 |
+ |
90 |
+# @ECLASS-VARIABLE: PATCHES |
91 |
+# @DEFAULT_UNSET |
92 |
+# @DESCRIPTION: |
93 |
+# Array variable containing all the patches to be applied. This variable |
94 |
+# is expected to be defined in the global scope of ebuilds. Make sure to |
95 |
+# specify the full path. This variable is used in src_prepare phase. |
96 |
+# |
97 |
+# Example: |
98 |
+# @CODE |
99 |
+# PATCHES=( |
100 |
+# "${FILESDIR}/mypatch.patch" |
101 |
+# "${FILESDIR}/mypatch2.patch" |
102 |
+# ) |
103 |
+# @CODE |
104 |
+ |
105 |
+# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES |
106 |
+# @DEFAULT_UNSET |
107 |
+# @DESCRIPTION: |
108 |
+# Space-separated list of directories that will be configured, |
109 |
+# compiled, and installed. All paths must be relative to ${S}. |
110 |
+ |
111 |
+# @ECLASS-VARIABLE: QCONFIG_ADD |
112 |
+# @DEFAULT_UNSET |
113 |
+# @DESCRIPTION: |
114 |
+# List of options that must be added to QT_CONFIG in qconfig.pri |
115 |
+ |
116 |
+# @ECLASS-VARIABLE: QCONFIG_REMOVE |
117 |
+# @DEFAULT_UNSET |
118 |
+# @DESCRIPTION: |
119 |
+# List of options that must be removed from QT_CONFIG in qconfig.pri |
120 |
+ |
121 |
+# @ECLASS-VARIABLE: QCONFIG_DEFINE |
122 |
+# @DEFAULT_UNSET |
123 |
+# @DESCRIPTION: |
124 |
+# List of macros that must be defined in QtCore/qconfig.h |
125 |
+ |
126 |
+ |
127 |
+###### Phase functions ###### |
128 |
+ |
129 |
+# @FUNCTION: qt4-build-multilib_src_unpack |
130 |
+# @DESCRIPTION: |
131 |
+# Unpacks the sources. |
132 |
+qt4-build-multilib_src_unpack() { |
133 |
+ if tc-is-gcc; then |
134 |
+ if [[ $(gcc-major-version) -lt 4 ]] || \ |
135 |
+ [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ]]; then |
136 |
+ ewarn |
137 |
+ ewarn "Using a GCC version lower than 4.4 is not supported" |
138 |
+ ewarn |
139 |
+ fi |
140 |
+ fi |
141 |
+ |
142 |
+ if [[ ${PN} == qtwebkit ]]; then |
143 |
+ eshopts_push -s extglob |
144 |
+ if is-flagq '-g?(gdb)?([1-9])'; then |
145 |
+ ewarn |
146 |
+ ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)." |
147 |
+ ewarn "You may experience really long compilation times and/or increased memory usage." |
148 |
+ ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug." |
149 |
+ ewarn "For more info check out https://bugs.gentoo.org/307861" |
150 |
+ ewarn |
151 |
+ fi |
152 |
+ eshopts_pop |
153 |
+ fi |
154 |
+ |
155 |
+ case ${QT4_BUILD_TYPE} in |
156 |
+ live) git-r3_src_unpack ;; |
157 |
+ release) default ;; |
158 |
+ esac |
159 |
+} |
160 |
+ |
161 |
+# @FUNCTION: qt4-build-multilib_src_prepare |
162 |
+# @DESCRIPTION: |
163 |
+# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix |
164 |
+# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in make.conf. |
165 |
+qt4-build-multilib_src_prepare() { |
166 |
+ if [[ ${PN} != qtcore ]]; then |
167 |
+ # avoid unnecessary qmake recompilations |
168 |
+ sed -i -e 's/^if true;/if false;/' configure \ |
169 |
+ || die "sed failed (skip qmake bootstrap)" |
170 |
+ fi |
171 |
+ |
172 |
+ # skip X11 tests in non-gui packages to avoid spurious dependencies |
173 |
+ if has ${PN} qtbearer qtcore qtdbus qtscript qtsql qttest qttranslations qtxmlpatterns; then |
174 |
+ sed -i -e '/^if.*PLATFORM_X11.*CFG_GUI/,/^fi$/d' configure \ |
175 |
+ || die "sed failed (skip X11 tests)" |
176 |
+ fi |
177 |
+ |
178 |
+ # Qt4 is not safe to build with C++14 (the new gcc-6 default). |
179 |
+ # Upstream has addressed this for Qt5, but while we continue to |
180 |
+ # support Qt4, we need to ensure everything is built in C++98 mode. |
181 |
+ # See bugs 582522, 582618, 583662, 583744. |
182 |
+ append-cxxflags -std=gnu++98 |
183 |
+ |
184 |
+ if [[ ${PN} == qtcore ]]; then |
185 |
+ # Bug 373061 |
186 |
+ # qmake bus errors with -O2 or -O3 but -O1 works |
187 |
+ if [[ ${CHOST} == *86*-apple-darwin* ]]; then |
188 |
+ replace-flags -O[23] -O1 |
189 |
+ fi |
190 |
+ |
191 |
+ # Bug 503500 |
192 |
+ # undefined reference with -Os and --as-needed |
193 |
+ if use x86 || use_if_iuse abi_x86_32; then |
194 |
+ replace-flags -Os -O2 |
195 |
+ fi |
196 |
+ fi |
197 |
+ |
198 |
+ if [[ ${PN} == qtdeclarative ]]; then |
199 |
+ # Bug 551560 |
200 |
+ # gcc-4.8 ICE with -Os, fixed in 4.9 |
201 |
+ if use x86 && tc-is-gcc && [[ $(gcc-version) == 4.8 ]]; then |
202 |
+ replace-flags -Os -O2 |
203 |
+ fi |
204 |
+ fi |
205 |
+ |
206 |
+ if [[ ${PN} == qtwebkit ]]; then |
207 |
+ # Bug 550780 |
208 |
+ # various ICEs with graphite-related flags, gcc-5 works |
209 |
+ if [[ $(gcc-major-version) -lt 5 ]]; then |
210 |
+ filter-flags -fgraphite-identity -floop-strip-mine |
211 |
+ fi |
212 |
+ fi |
213 |
+ |
214 |
+ # Bug 261632 |
215 |
+ if use ppc64; then |
216 |
+ append-flags -mminimal-toc |
217 |
+ fi |
218 |
+ |
219 |
+ # Teach configure about gcc-6 and later |
220 |
+ sed -i -e 's:5\*|:[5-9]*|:' \ |
221 |
+ configure || die "sed gcc version failed" |
222 |
+ |
223 |
+ # Read also AR from the environment |
224 |
+ sed -i -e 's/^SYSTEM_VARIABLES="/&AR /' \ |
225 |
+ configure || die "sed SYSTEM_VARIABLES failed" |
226 |
+ |
227 |
+ # Reset QMAKE_*FLAGS_{RELEASE,DEBUG} variables, |
228 |
+ # or they will override the user's flags (via .qmake.cache) |
229 |
+ sed -i -e '/^SYSTEM_VARIABLES=/ i \ |
230 |
+ QMakeVar set QMAKE_CFLAGS_RELEASE\ |
231 |
+ QMakeVar set QMAKE_CFLAGS_DEBUG\ |
232 |
+ QMakeVar set QMAKE_CXXFLAGS_RELEASE\ |
233 |
+ QMakeVar set QMAKE_CXXFLAGS_DEBUG\ |
234 |
+ QMakeVar set QMAKE_LFLAGS_RELEASE\ |
235 |
+ QMakeVar set QMAKE_LFLAGS_DEBUG\n' \ |
236 |
+ configure || die "sed QMAKE_*FLAGS_{RELEASE,DEBUG} failed" |
237 |
+ |
238 |
+ # Drop -nocache from qmake invocation in all configure tests, to ensure that the |
239 |
+ # correct toolchain and build flags are picked up from config.tests/.qmake.cache |
240 |
+ find config.tests/unix -name '*.test' -type f -execdir \ |
241 |
+ sed -i -e '/bin\/qmake/s/-nocache//' '{}' + || die "sed -nocache failed" |
242 |
+ |
243 |
+ # compile.test needs additional patching so that it doesn't create another cache file |
244 |
+ # inside the test subdir, which would incorrectly override config.tests/.qmake.cache |
245 |
+ sed -i -e '/echo.*QT_BUILD_TREE.*\.qmake\.cache/d' \ |
246 |
+ -e '/bin\/qmake/s/ "$SRCDIR/ "QT_BUILD_TREE=$OUTDIR"&/' \ |
247 |
+ config.tests/unix/compile.test || die "sed compile.test failed" |
248 |
+ |
249 |
+ # Delete references to the obsolete /usr/X11R6 directory |
250 |
+ # On prefix, this also prevents looking at non-prefix stuff |
251 |
+ sed -i -re '/^QMAKE_(LIB|INC)DIR(_X11|_OPENGL|)\s+/ s/=.*/=/' \ |
252 |
+ mkspecs/common/linux.conf \ |
253 |
+ mkspecs/$(qt4_get_mkspec)/qmake.conf \ |
254 |
+ || die "sed QMAKE_(LIB|INC)DIR failed" |
255 |
+ |
256 |
+ if use_if_iuse aqua; then |
257 |
+ sed -i \ |
258 |
+ -e '/^CONFIG/s:app_bundle::' \ |
259 |
+ -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \ |
260 |
+ mkspecs/$(qt4_get_mkspec)/qmake.conf \ |
261 |
+ || die "sed failed (aqua)" |
262 |
+ |
263 |
+ # we are crazy and build cocoa + qt3support |
264 |
+ if { ! in_iuse qt3support || use qt3support; } && [[ ${CHOST##*-darwin} -ge 9 ]]; then |
265 |
+ sed -i -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \ |
266 |
+ configure || die "sed failed (cocoa + qt3support)" |
267 |
+ fi |
268 |
+ fi |
269 |
+ |
270 |
+ if [[ ${CHOST} == *-darwin* ]]; then |
271 |
+ # Set FLAGS and remove -arch, since our gcc-apple is multilib crippled (by design) |
272 |
+ sed -i \ |
273 |
+ -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
274 |
+ -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
275 |
+ -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=-headerpad_max_install_names ${LDFLAGS}:" \ |
276 |
+ -e "s:-arch\s\w*::g" \ |
277 |
+ mkspecs/common/g++-macx.conf \ |
278 |
+ || die "sed g++-macx.conf failed" |
279 |
+ |
280 |
+ # Fix configure's -arch settings that appear in qmake/Makefile and also |
281 |
+ # fix arch handling (automagically duplicates our -arch arg and breaks |
282 |
+ # pch). Additionally disable Xarch support. |
283 |
+ sed -i \ |
284 |
+ -e "s:-arch i386::" \ |
285 |
+ -e "s:-arch ppc::" \ |
286 |
+ -e "s:-arch x86_64::" \ |
287 |
+ -e "s:-arch ppc64::" \ |
288 |
+ -e "s:-arch \$i::" \ |
289 |
+ -e "/if \[ ! -z \"\$NATIVE_64_ARCH\" \]; then/,/fi/ d" \ |
290 |
+ -e "s:CFG_MAC_XARCH=yes:CFG_MAC_XARCH=no:g" \ |
291 |
+ -e "s:-Xarch_x86_64::g" \ |
292 |
+ -e "s:-Xarch_ppc64::g" \ |
293 |
+ configure mkspecs/common/gcc-base-macx.conf mkspecs/common/g++-macx.conf \ |
294 |
+ || die "sed -arch/-Xarch failed" |
295 |
+ |
296 |
+ # On Snow Leopard don't fall back to 10.5 deployment target. |
297 |
+ if [[ ${CHOST} == *-apple-darwin10 ]]; then |
298 |
+ sed -i \ |
299 |
+ -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \ |
300 |
+ -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \ |
301 |
+ configure mkspecs/common/g++-macx.conf \ |
302 |
+ || die "sed deployment target failed" |
303 |
+ fi |
304 |
+ fi |
305 |
+ |
306 |
+ if [[ ${CHOST} == *-solaris* ]]; then |
307 |
+ sed -i -e '/^QMAKE_LFLAGS_THREAD/a QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,' \ |
308 |
+ mkspecs/$(qt4_get_mkspec)/qmake.conf || die |
309 |
+ fi |
310 |
+ |
311 |
+ # apply patches |
312 |
+ [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}" |
313 |
+ epatch_user |
314 |
+} |
315 |
+ |
316 |
+qt4_multilib_src_configure() { |
317 |
+ qt4_prepare_env |
318 |
+ |
319 |
+ qt4_symlink_tools_to_build_dir |
320 |
+ |
321 |
+ # toolchain setup ('local -x' because of bug 532510) |
322 |
+ local -x \ |
323 |
+ AR="$(tc-getAR) cqs" \ |
324 |
+ CC=$(tc-getCC) \ |
325 |
+ CXX=$(tc-getCXX) \ |
326 |
+ LD=$(tc-getCXX) \ |
327 |
+ MAKEFLAGS=${MAKEOPTS} \ |
328 |
+ OBJCOPY=$(tc-getOBJCOPY) \ |
329 |
+ OBJDUMP=$(tc-getOBJDUMP) \ |
330 |
+ STRIP=$(tc-getSTRIP) |
331 |
+ |
332 |
+ # convert tc-arch to the values supported by Qt |
333 |
+ local arch=$(tc-arch) |
334 |
+ case ${arch} in |
335 |
+ amd64|x64-*) arch=x86_64 ;; |
336 |
+ arm64|hppa) arch=generic ;; |
337 |
+ ppc*-macos) arch=ppc ;; |
338 |
+ ppc*) arch=powerpc ;; |
339 |
+ sparc*) arch=sparc ;; |
340 |
+ x86-macos) arch=x86 ;; |
341 |
+ x86*) arch=i386 ;; |
342 |
+ esac |
343 |
+ |
344 |
+ # configure arguments |
345 |
+ local conf=( |
346 |
+ # installation paths |
347 |
+ -prefix "${QT4_PREFIX}" |
348 |
+ -bindir "${QT4_BINDIR}" |
349 |
+ -libdir "${QT4_LIBDIR}" |
350 |
+ -docdir "${QT4_DOCDIR}" |
351 |
+ -headerdir "${QT4_HEADERDIR}" |
352 |
+ -plugindir "${QT4_PLUGINDIR}" |
353 |
+ -importdir "${QT4_IMPORTDIR}" |
354 |
+ -datadir "${QT4_DATADIR}" |
355 |
+ -translationdir "${QT4_TRANSLATIONDIR}" |
356 |
+ -sysconfdir "${QT4_SYSCONFDIR}" |
357 |
+ -examplesdir "${QT4_EXAMPLESDIR}" |
358 |
+ -demosdir "${QT4_DEMOSDIR}" |
359 |
+ |
360 |
+ # debug/release |
361 |
+ $(use_if_iuse debug && echo -debug || echo -release) |
362 |
+ -no-separate-debug-info |
363 |
+ |
364 |
+ # licensing stuff |
365 |
+ -opensource -confirm-license |
366 |
+ |
367 |
+ # build shared libraries |
368 |
+ -shared |
369 |
+ |
370 |
+ # skip recursive processing of .pro files at the end of configure |
371 |
+ # (we run qmake by ourselves), thus saving quite a bit of time |
372 |
+ -dont-process |
373 |
+ |
374 |
+ # always enable large file support |
375 |
+ -largefile |
376 |
+ |
377 |
+ # exceptions USE flag |
378 |
+ $(in_iuse exceptions && qt_use exceptions || echo -exceptions) |
379 |
+ |
380 |
+ # build STL support |
381 |
+ -stl |
382 |
+ |
383 |
+ # architecture/platform (mkspec) |
384 |
+ -arch ${arch} |
385 |
+ -platform $(qt4_get_mkspec) |
386 |
+ |
387 |
+ # instruction set support |
388 |
+ $(is-flagq -mno-mmx && echo -no-mmx) |
389 |
+ $(is-flagq -mno-3dnow && echo -no-3dnow) |
390 |
+ $(is-flagq -mno-sse && echo -no-sse) |
391 |
+ $(is-flagq -mno-sse2 && echo -no-sse2) |
392 |
+ $(is-flagq -mno-sse3 && echo -no-sse3) |
393 |
+ $(is-flagq -mno-ssse3 && echo -no-ssse3) |
394 |
+ $(is-flagq -mno-sse4.1 && echo -no-sse4.1) |
395 |
+ $(is-flagq -mno-sse4.2 && echo -no-sse4.2) |
396 |
+ $(is-flagq -mno-avx && echo -no-avx) |
397 |
+ $(is-flagq -mfpu=* && ! is-flagq -mfpu=*neon* && echo -no-neon) |
398 |
+ |
399 |
+ # bug 367045 |
400 |
+ $([[ ${CHOST} == *86*-apple-darwin* ]] && echo -no-ssse3) |
401 |
+ |
402 |
+ # prefer system libraries |
403 |
+ -system-zlib |
404 |
+ |
405 |
+ # exclude examples and demos from default build |
406 |
+ -nomake examples |
407 |
+ -nomake demos |
408 |
+ |
409 |
+ # disable rpath on non-prefix (bugs 380415 and 417169) |
410 |
+ $(usex prefix '' -no-rpath) |
411 |
+ |
412 |
+ # print verbose information about each configure test |
413 |
+ -verbose |
414 |
+ |
415 |
+ # precompiled headers don't work on hardened, where the flag is masked |
416 |
+ $(in_iuse pch && qt_use pch || echo -no-pch) |
417 |
+ |
418 |
+ # enable linker optimizations to reduce relocations, except on Solaris |
419 |
+ # where this flag seems to introduce major breakage to applications, |
420 |
+ # mostly to be seen as a core dump with the message: |
421 |
+ # "QPixmap: Must construct a QApplication before a QPaintDevice" |
422 |
+ $([[ ${CHOST} != *-solaris* ]] && echo -reduce-relocations) |
423 |
+ ) |
424 |
+ |
425 |
+ if use_if_iuse aqua; then |
426 |
+ if [[ ${CHOST##*-darwin} -ge 9 ]]; then |
427 |
+ conf+=( |
428 |
+ # on (snow) leopard use the new (frameworked) cocoa code |
429 |
+ -cocoa -framework |
430 |
+ # add hint for the framework location |
431 |
+ -F"${QT4_LIBDIR}" |
432 |
+ ) |
433 |
+ else |
434 |
+ conf+=(-no-framework) |
435 |
+ fi |
436 |
+ fi |
437 |
+ |
438 |
+ conf+=( |
439 |
+ # module-specific options |
440 |
+ "${myconf[@]}" |
441 |
+ ) |
442 |
+ |
443 |
+ einfo "Configuring with: ${conf[@]}" |
444 |
+ "${S}"/configure "${conf[@]}" || die "configure failed" |
445 |
+ |
446 |
+ # configure is stupid and assigns QMAKE_LFLAGS twice, |
447 |
+ # thus the previous -rpath-link flag gets overwritten |
448 |
+ # and some packages (e.g. qthelp) fail to link |
449 |
+ sed -i -e '/^QMAKE_LFLAGS =/ s:$: $$QMAKE_LFLAGS:' \ |
450 |
+ .qmake.cache || die "sed .qmake.cache failed" |
451 |
+ |
452 |
+ qt4_qmake |
453 |
+ qt4_foreach_target_subdir qt4_qmake |
454 |
+} |
455 |
+ |
456 |
+qt4_multilib_src_compile() { |
457 |
+ qt4_prepare_env |
458 |
+ |
459 |
+ qt4_foreach_target_subdir emake |
460 |
+} |
461 |
+ |
462 |
+qt4_multilib_src_test() { |
463 |
+ qt4_prepare_env |
464 |
+ |
465 |
+ qt4_foreach_target_subdir emake -j1 check |
466 |
+} |
467 |
+ |
468 |
+qt4_multilib_src_install() { |
469 |
+ qt4_prepare_env |
470 |
+ |
471 |
+ qt4_foreach_target_subdir emake INSTALL_ROOT="${D}" install |
472 |
+ |
473 |
+ if [[ ${PN} == qtcore ]]; then |
474 |
+ set -- emake INSTALL_ROOT="${D}" install_{mkspecs,qmake} |
475 |
+ einfo "Running $*" |
476 |
+ "$@" |
477 |
+ |
478 |
+ # install env.d file |
479 |
+ cat > "${T}/44qt4-${CHOST}" <<-_EOF_ |
480 |
+ LDPATH="${QT4_LIBDIR}" |
481 |
+ _EOF_ |
482 |
+ doenvd "${T}/44qt4-${CHOST}" |
483 |
+ |
484 |
+ # install qtchooser configuration file |
485 |
+ cat > "${T}/qt4-${CHOST}.conf" <<-_EOF_ |
486 |
+ ${QT4_BINDIR} |
487 |
+ ${QT4_LIBDIR} |
488 |
+ _EOF_ |
489 |
+ |
490 |
+ ( |
491 |
+ insinto /etc/xdg/qtchooser |
492 |
+ doins "${T}/qt4-${CHOST}.conf" |
493 |
+ ) |
494 |
+ |
495 |
+ if multilib_is_native_abi; then |
496 |
+ # convenience symlinks |
497 |
+ dosym qt4-"${CHOST}".conf /etc/xdg/qtchooser/4.conf |
498 |
+ dosym qt4-"${CHOST}".conf /etc/xdg/qtchooser/qt4.conf |
499 |
+ fi |
500 |
+ fi |
501 |
+ |
502 |
+ # move pkgconfig directory to the correct location |
503 |
+ if [[ -d ${D}${QT4_LIBDIR}/pkgconfig ]]; then |
504 |
+ mv "${D}${QT4_LIBDIR}"/pkgconfig "${ED}usr/$(get_libdir)" || die |
505 |
+ fi |
506 |
+ |
507 |
+ qt4_install_module_qconfigs |
508 |
+ qt4_symlink_framework_headers |
509 |
+} |
510 |
+ |
511 |
+qt4_multilib_src_install_all() { |
512 |
+ if [[ ${PN} == qtcore ]]; then |
513 |
+ # include gentoo-qconfig.h at the beginning of Qt{,Core}/qconfig.h |
514 |
+ if use aqua && [[ ${CHOST#*-darwin} -ge 9 ]]; then |
515 |
+ sed -i -e '1i #include <QtCore/Gentoo/gentoo-qconfig.h>\n' \ |
516 |
+ "${D}${QT4_LIBDIR}"/QtCore.framework/Headers/qconfig.h \ |
517 |
+ || die "sed failed (qconfig.h)" |
518 |
+ dosym "${QT4_HEADERDIR#${EPREFIX}}"/Gentoo \ |
519 |
+ "${QT4_LIBDIR#${EPREFIX}}"/QtCore.framework/Headers/Gentoo |
520 |
+ else |
521 |
+ sed -i -e '1i #include <Gentoo/gentoo-qconfig.h>\n' \ |
522 |
+ "${D}${QT4_HEADERDIR}"/Qt{,Core}/qconfig.h \ |
523 |
+ || die "sed failed (qconfig.h)" |
524 |
+ fi |
525 |
+ |
526 |
+ dodir "${QT4_DATADIR#${EPREFIX}}"/mkspecs/gentoo |
527 |
+ mv "${D}${QT4_DATADIR}"/mkspecs/{qconfig.pri,gentoo/} || die |
528 |
+ fi |
529 |
+ |
530 |
+ # install private headers of a few modules |
531 |
+ if has ${PN} qtcore qtdeclarative qtgui qtscript; then |
532 |
+ local moduledir=${PN#qt} |
533 |
+ local modulename=Qt$(tr 'a-z' 'A-Z' <<< ${moduledir:0:1})${moduledir:1} |
534 |
+ [[ ${moduledir} == core ]] && moduledir=corelib |
535 |
+ |
536 |
+ einfo "Installing private headers into ${QT4_HEADERDIR}/${modulename}/private" |
537 |
+ insinto "${QT4_HEADERDIR#${EPREFIX}}"/${modulename}/private |
538 |
+ find "${S}"/src/${moduledir} -type f -name '*_p.h' -exec doins '{}' + || die |
539 |
+ fi |
540 |
+ |
541 |
+ prune_libtool_files |
542 |
+} |
543 |
+ |
544 |
+# @FUNCTION: qt4-build-multilib_pkg_postinst |
545 |
+# @DESCRIPTION: |
546 |
+# Regenerate configuration after installation or upgrade/downgrade. |
547 |
+qt4-build-multilib_pkg_postinst() { |
548 |
+ qt4_regenerate_global_qconfigs |
549 |
+} |
550 |
+ |
551 |
+# @FUNCTION: qt4-build-multilib_pkg_postrm |
552 |
+# @DESCRIPTION: |
553 |
+# Regenerate configuration when a module is completely removed. |
554 |
+qt4-build-multilib_pkg_postrm() { |
555 |
+ qt4_regenerate_global_qconfigs |
556 |
+} |
557 |
+ |
558 |
+ |
559 |
+###### Public helpers ###### |
560 |
+ |
561 |
+# @FUNCTION: qt_use |
562 |
+# @USAGE: <flag> [feature] [enableval] |
563 |
+# @DESCRIPTION: |
564 |
+# <flag> is the name of a flag in IUSE. |
565 |
+# |
566 |
+# Outputs "-${enableval}-${feature}" if <flag> is enabled, "-no-${feature}" |
567 |
+# otherwise. If [feature] is not specified, <flag> is used in its place. |
568 |
+# If [enableval] is not specified, the "-${enableval}" prefix is omitted. |
569 |
+qt_use() { |
570 |
+ [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument" |
571 |
+ |
572 |
+ usex "$1" "${3:+-$3}-${2:-$1}" "-no-${2:-$1}" |
573 |
+} |
574 |
+ |
575 |
+# @FUNCTION: qt_native_use |
576 |
+# @USAGE: <flag> [feature] [enableval] |
577 |
+# @DESCRIPTION: |
578 |
+# <flag> is the name of a flag in IUSE. |
579 |
+# |
580 |
+# Outputs "-${enableval}-${feature}" if <flag> is enabled and we are currently |
581 |
+# building for the native ABI, "-no-${feature}" otherwise. If [feature] is not |
582 |
+# specified, <flag> is used in its place. If [enableval] is not specified, |
583 |
+# the "-${enableval}" prefix is omitted. |
584 |
+qt_native_use() { |
585 |
+ [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument" |
586 |
+ |
587 |
+ multilib_is_native_abi && qt_use "$@" || echo "-no-${2:-$1}" |
588 |
+} |
589 |
+ |
590 |
+ |
591 |
+###### Internal functions ###### |
592 |
+ |
593 |
+# @FUNCTION: qt4_prepare_env |
594 |
+# @INTERNAL |
595 |
+# @DESCRIPTION: |
596 |
+# Prepares the environment for building Qt. |
597 |
+qt4_prepare_env() { |
598 |
+ # setup installation directories |
599 |
+ # note: keep paths in sync with qmake-utils.eclass |
600 |
+ QT4_PREFIX=${EPREFIX}/usr |
601 |
+ QT4_HEADERDIR=${QT4_PREFIX}/include/qt4 |
602 |
+ QT4_LIBDIR=${QT4_PREFIX}/$(get_libdir)/qt4 |
603 |
+ QT4_BINDIR=${QT4_LIBDIR}/bin |
604 |
+ QT4_PLUGINDIR=${QT4_LIBDIR}/plugins |
605 |
+ QT4_IMPORTDIR=${QT4_LIBDIR}/imports |
606 |
+ QT4_DATADIR=${QT4_PREFIX}/share/qt4 |
607 |
+ QT4_DOCDIR=${QT4_PREFIX}/share/doc/qt-${PV} |
608 |
+ QT4_TRANSLATIONDIR=${QT4_DATADIR}/translations |
609 |
+ QT4_EXAMPLESDIR=${QT4_DATADIR}/examples |
610 |
+ QT4_DEMOSDIR=${QT4_DATADIR}/demos |
611 |
+ QT4_SYSCONFDIR=${EPREFIX}/etc/qt4 |
612 |
+ |
613 |
+ # are these still needed? |
614 |
+ QMAKE_LIBDIR_QT=${QT4_LIBDIR} |
615 |
+ export XDG_CONFIG_HOME="${T}" |
616 |
+ |
617 |
+ # can confuse qmake if set (bug 583352) |
618 |
+ unset QMAKESPEC |
619 |
+} |
620 |
+ |
621 |
+# @FUNCTION: qt4_foreach_target_subdir |
622 |
+# @INTERNAL |
623 |
+# @DESCRIPTION: |
624 |
+# Executes the given command inside each directory listed in QT4_TARGET_DIRECTORIES. |
625 |
+qt4_foreach_target_subdir() { |
626 |
+ local ret=0 subdir= |
627 |
+ for subdir in ${QT4_TARGET_DIRECTORIES}; do |
628 |
+ mkdir -p "${subdir}" || die |
629 |
+ pushd "${subdir}" >/dev/null || die |
630 |
+ |
631 |
+ einfo "Running $* ${subdir:+in ${subdir}}" |
632 |
+ "$@" |
633 |
+ ((ret+=$?)) |
634 |
+ |
635 |
+ popd >/dev/null || die |
636 |
+ done |
637 |
+ |
638 |
+ return ${ret} |
639 |
+} |
640 |
+ |
641 |
+# @FUNCTION: qt4_symlink_tools_to_build_dir |
642 |
+# @INTERNAL |
643 |
+# @DESCRIPTION: |
644 |
+# Symlinks qtcore tools to BUILD_DIR, |
645 |
+# so that they can be used when building other modules. |
646 |
+qt4_symlink_tools_to_build_dir() { |
647 |
+ local tool= tools=() |
648 |
+ if [[ ${PN} != qtcore ]]; then |
649 |
+ tools+=(qmake moc rcc uic) |
650 |
+ fi |
651 |
+ |
652 |
+ mkdir -p "${BUILD_DIR}"/bin || die |
653 |
+ pushd "${BUILD_DIR}"/bin >/dev/null || die |
654 |
+ |
655 |
+ for tool in "${tools[@]}"; do |
656 |
+ [[ -e ${QT4_BINDIR}/${tool} ]] || continue |
657 |
+ ln -s "${QT4_BINDIR}/${tool}" . || die "failed to symlink ${tool}" |
658 |
+ done |
659 |
+ |
660 |
+ popd >/dev/null || die |
661 |
+} |
662 |
+ |
663 |
+# @FUNCTION: qt4_qmake |
664 |
+# @INTERNAL |
665 |
+# @DESCRIPTION: |
666 |
+# Helper function that runs qmake in the current target subdir. |
667 |
+# Intended to be called by qt4_foreach_target_subdir(). |
668 |
+qt4_qmake() { |
669 |
+ local projectdir=${PWD/#${BUILD_DIR}/${S}} |
670 |
+ |
671 |
+ "${BUILD_DIR}"/bin/qmake \ |
672 |
+ "${projectdir}" \ |
673 |
+ CONFIG+=nostrip \ |
674 |
+ LIBS+=-L"${QT4_LIBDIR}" \ |
675 |
+ "${myqmakeargs[@]}" \ |
676 |
+ || die "qmake failed (${projectdir#${S}/})" |
677 |
+} |
678 |
+ |
679 |
+# @FUNCTION: qt4_install_module_qconfigs |
680 |
+# @INTERNAL |
681 |
+# @DESCRIPTION: |
682 |
+# Creates and installs gentoo-specific ${PN}-qconfig.{h,pri} files. |
683 |
+qt4_install_module_qconfigs() { |
684 |
+ local x |
685 |
+ if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then |
686 |
+ for x in QCONFIG_ADD QCONFIG_REMOVE; do |
687 |
+ [[ -n ${!x} ]] && echo ${x}=${!x} >> "${BUILD_DIR}"/${PN}-qconfig.pri |
688 |
+ done |
689 |
+ insinto ${QT4_DATADIR#${EPREFIX}}/mkspecs/gentoo |
690 |
+ doins "${BUILD_DIR}"/${PN}-qconfig.pri |
691 |
+ fi |
692 |
+ |
693 |
+ if [[ -n ${QCONFIG_DEFINE} ]]; then |
694 |
+ for x in ${QCONFIG_DEFINE}; do |
695 |
+ echo "#define ${x}" >> "${BUILD_DIR}"/gentoo-${PN}-qconfig.h |
696 |
+ done |
697 |
+ insinto ${QT4_HEADERDIR#${EPREFIX}}/Gentoo |
698 |
+ doins "${BUILD_DIR}"/gentoo-${PN}-qconfig.h |
699 |
+ fi |
700 |
+} |
701 |
+ |
702 |
+# @FUNCTION: qt4_regenerate_global_qconfigs |
703 |
+# @INTERNAL |
704 |
+# @DESCRIPTION: |
705 |
+# Generates Gentoo-specific qconfig.{h,pri} according to the build configuration. |
706 |
+# Don't call die here because dying in pkg_post{inst,rm} only makes things worse. |
707 |
+qt4_regenerate_global_qconfigs() { |
708 |
+ if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${PN} == qtcore ]]; then |
709 |
+ local x qconfig_add qconfig_remove qconfig_new |
710 |
+ for x in "${ROOT}${QT4_DATADIR}"/mkspecs/gentoo/*-qconfig.pri; do |
711 |
+ [[ -f ${x} ]] || continue |
712 |
+ qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")" |
713 |
+ qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")" |
714 |
+ done |
715 |
+ |
716 |
+ if [[ -e "${ROOT}${QT4_DATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then |
717 |
+ # start with the qconfig.pri that qtcore installed |
718 |
+ if ! cp "${ROOT}${QT4_DATADIR}"/mkspecs/gentoo/qconfig.pri \ |
719 |
+ "${ROOT}${QT4_DATADIR}"/mkspecs/qconfig.pri; then |
720 |
+ eerror "cp qconfig failed." |
721 |
+ return 1 |
722 |
+ fi |
723 |
+ |
724 |
+ # generate list of QT_CONFIG entries from the existing list |
725 |
+ # including qconfig_add and excluding qconfig_remove |
726 |
+ for x in $(sed -n 's/^QT_CONFIG +=//p' \ |
727 |
+ "${ROOT}${QT4_DATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do |
728 |
+ has ${x} ${qconfig_remove} || qconfig_new+=" ${x}" |
729 |
+ done |
730 |
+ |
731 |
+ # replace the existing QT_CONFIG list with qconfig_new |
732 |
+ if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \ |
733 |
+ "${ROOT}${QT4_DATADIR}"/mkspecs/qconfig.pri; then |
734 |
+ eerror "Sed for QT_CONFIG failed" |
735 |
+ return 1 |
736 |
+ fi |
737 |
+ |
738 |
+ # create Gentoo/qconfig.h |
739 |
+ if [[ ! -e ${ROOT}${QT4_HEADERDIR}/Gentoo ]]; then |
740 |
+ if ! mkdir -p "${ROOT}${QT4_HEADERDIR}"/Gentoo; then |
741 |
+ eerror "mkdir ${QT4_HEADERDIR}/Gentoo failed" |
742 |
+ return 1 |
743 |
+ fi |
744 |
+ fi |
745 |
+ : > "${ROOT}${QT4_HEADERDIR}"/Gentoo/gentoo-qconfig.h |
746 |
+ for x in "${ROOT}${QT4_HEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do |
747 |
+ [[ -f ${x} ]] || continue |
748 |
+ cat "${x}" >> "${ROOT}${QT4_HEADERDIR}"/Gentoo/gentoo-qconfig.h |
749 |
+ done |
750 |
+ else |
751 |
+ rm -f "${ROOT}${QT4_DATADIR}"/mkspecs/qconfig.pri |
752 |
+ rm -f "${ROOT}${QT4_HEADERDIR}"/Gentoo/gentoo-qconfig.h |
753 |
+ rmdir "${ROOT}${QT4_DATADIR}"/mkspecs \ |
754 |
+ "${ROOT}${QT4_DATADIR}" \ |
755 |
+ "${ROOT}${QT4_HEADERDIR}"/Gentoo \ |
756 |
+ "${ROOT}${QT4_HEADERDIR}" 2>/dev/null |
757 |
+ fi |
758 |
+ fi |
759 |
+} |
760 |
+ |
761 |
+# @FUNCTION: qt4_symlink_framework_headers |
762 |
+# @DESCRIPTION: |
763 |
+# On OS X we need to add some symlinks when frameworks are being |
764 |
+# used, to avoid complications with some more or less stupid packages. |
765 |
+qt4_symlink_framework_headers() { |
766 |
+ if use_if_iuse aqua && [[ ${CHOST##*-darwin} -ge 9 ]]; then |
767 |
+ local frw dest f h rdir |
768 |
+ # Some packages tend to include <Qt/...> |
769 |
+ dodir "${QT4_HEADERDIR#${EPREFIX}}"/Qt |
770 |
+ |
771 |
+ # Fake normal headers when frameworks are installed... eases life later |
772 |
+ # on, make sure we use relative links though, as some ebuilds assume |
773 |
+ # these dirs exist in src_install to add additional files |
774 |
+ f=${QT4_HEADERDIR} |
775 |
+ h=${QT4_LIBDIR} |
776 |
+ while [[ -n ${f} && ${f%%/*} == ${h%%/*} ]] ; do |
777 |
+ f=${f#*/} |
778 |
+ h=${h#*/} |
779 |
+ done |
780 |
+ rdir=${h} |
781 |
+ f="../" |
782 |
+ while [[ ${h} == */* ]] ; do |
783 |
+ f="${f}../" |
784 |
+ h=${h#*/} |
785 |
+ done |
786 |
+ rdir="${f}${rdir}" |
787 |
+ |
788 |
+ for frw in "${D}${QT4_LIBDIR}"/*.framework; do |
789 |
+ [[ -e "${frw}"/Headers ]] || continue |
790 |
+ f=$(basename ${frw}) |
791 |
+ dest="${QT4_HEADERDIR#${EPREFIX}}"/${f%.framework} |
792 |
+ dosym "${rdir}"/${f}/Headers "${dest}" |
793 |
+ |
794 |
+ # Link normal headers as well. |
795 |
+ for hdr in "${D}${QT4_LIBDIR}/${f}"/Headers/*; do |
796 |
+ h=$(basename ${hdr}) |
797 |
+ dosym "../${rdir}"/${f}/Headers/${h} \ |
798 |
+ "${QT4_HEADERDIR#${EPREFIX}}"/Qt/${h} |
799 |
+ done |
800 |
+ done |
801 |
+ fi |
802 |
+} |
803 |
+ |
804 |
+# @FUNCTION: qt4_get_mkspec |
805 |
+# @INTERNAL |
806 |
+# @DESCRIPTION: |
807 |
+# Returns the right mkspec for the current CHOST/CXX combination. |
808 |
+qt4_get_mkspec() { |
809 |
+ local spec= |
810 |
+ |
811 |
+ case ${CHOST} in |
812 |
+ *-linux*) |
813 |
+ spec=linux ;; |
814 |
+ *-darwin*) |
815 |
+ use_if_iuse aqua && |
816 |
+ spec=macx || # mac with carbon/cocoa |
817 |
+ spec=darwin ;; # darwin/mac with X11 |
818 |
+ *-freebsd*|*-dragonfly*) |
819 |
+ spec=freebsd ;; |
820 |
+ *-netbsd*) |
821 |
+ spec=netbsd ;; |
822 |
+ *-openbsd*) |
823 |
+ spec=openbsd ;; |
824 |
+ *-aix*) |
825 |
+ spec=aix ;; |
826 |
+ hppa*-hpux*) |
827 |
+ spec=hpux ;; |
828 |
+ ia64*-hpux*) |
829 |
+ spec=hpuxi ;; |
830 |
+ *-solaris*) |
831 |
+ spec=solaris ;; |
832 |
+ *) |
833 |
+ die "qt4-build-multilib.eclass: unsupported CHOST '${CHOST}'" ;; |
834 |
+ esac |
835 |
+ |
836 |
+ case $(tc-getCXX) in |
837 |
+ *g++*) |
838 |
+ spec+=-g++ ;; |
839 |
+ *clang*) |
840 |
+ if [[ -d ${S}/mkspecs/unsupported/${spec}-clang ]]; then |
841 |
+ spec=unsupported/${spec}-clang |
842 |
+ else |
843 |
+ ewarn "${spec}-clang mkspec does not exist, falling back to ${spec}-g++" |
844 |
+ spec+=-g++ |
845 |
+ fi ;; |
846 |
+ *icpc*) |
847 |
+ if [[ -d ${S}/mkspecs/${spec}-icc ]]; then |
848 |
+ spec+=-icc |
849 |
+ else |
850 |
+ ewarn "${spec}-icc mkspec does not exist, falling back to ${spec}-g++" |
851 |
+ spec+=-g++ |
852 |
+ fi ;; |
853 |
+ *) |
854 |
+ die "qt4-build-multilib.eclass: unsupported compiler '$(tc-getCXX)'" ;; |
855 |
+ esac |
856 |
+ |
857 |
+ # Add -64 for 64-bit prefix profiles |
858 |
+ if use amd64-linux || use ppc64-linux || |
859 |
+ use x64-macos || |
860 |
+ use sparc64-solaris || use x64-solaris |
861 |
+ then |
862 |
+ [[ -d ${S}/mkspecs/${spec}-64 ]] && spec+=-64 |
863 |
+ fi |
864 |
+ |
865 |
+ echo ${spec} |
866 |
+} |
867 |
|
868 |
diff --git a/eclass/qt4-r2.eclass b/eclass/qt4-r2.eclass |
869 |
new file mode 100644 |
870 |
index 0000000..d8a7252 |
871 |
--- /dev/null |
872 |
+++ b/eclass/qt4-r2.eclass |
873 |
@@ -0,0 +1,139 @@ |
874 |
+# Copyright 1999-2015 Gentoo Foundation |
875 |
+# Distributed under the terms of the GNU General Public License v2 |
876 |
+ |
877 |
+# @ECLASS: qt4-r2.eclass |
878 |
+# @MAINTAINER: |
879 |
+# qt@g.o |
880 |
+# @BLURB: Eclass for Qt4-based packages, second edition. |
881 |
+# @DESCRIPTION: |
882 |
+# This eclass contains various functions that may be useful when |
883 |
+# dealing with packages using Qt4 libraries. Supports only EAPIs |
884 |
+# 2, 3, 4, and 5. Use qmake-utils.eclass in EAPI 6 and later. |
885 |
+ |
886 |
+case ${EAPI} in |
887 |
+ 2|3|4|5) : ;; |
888 |
+ 6) die "qt4-r2.eclass is banned in EAPI 6 and later" ;; |
889 |
+ *) die "qt4-r2.eclass: unsupported EAPI=${EAPI:-0}" ;; |
890 |
+esac |
891 |
+ |
892 |
+inherit base eutils qmake-utils |
893 |
+ |
894 |
+export XDG_CONFIG_HOME="${T}" |
895 |
+ |
896 |
+# @ECLASS-VARIABLE: DOCS |
897 |
+# @DEFAULT_UNSET |
898 |
+# @DESCRIPTION: |
899 |
+# Array containing documents passed to dodoc command. |
900 |
+# Paths can be absolute or relative to ${S}. |
901 |
+# |
902 |
+# Example: DOCS=( ChangeLog README "${WORKDIR}/doc_folder/" ) |
903 |
+ |
904 |
+# @ECLASS-VARIABLE: HTML_DOCS |
905 |
+# @DEFAULT_UNSET |
906 |
+# @DESCRIPTION: |
907 |
+# Array containing documents passed to dohtml command. |
908 |
+# Paths can be absolute or relative to ${S}. |
909 |
+# |
910 |
+# Example: HTML_DOCS=( "doc/document.html" "${WORKDIR}/html_folder/" ) |
911 |
+ |
912 |
+# @ECLASS-VARIABLE: LANGS |
913 |
+# @DEFAULT_UNSET |
914 |
+# @DESCRIPTION: |
915 |
+# In case your Qt4 application provides various translations, use this variable |
916 |
+# to specify them in order to populate "linguas_*" IUSE automatically. Make sure |
917 |
+# that you set this variable before inheriting qt4-r2 eclass. |
918 |
+# |
919 |
+# Example: LANGS="de el it ja" |
920 |
+for x in ${LANGS}; do |
921 |
+ IUSE+=" linguas_${x}" |
922 |
+done |
923 |
+ |
924 |
+# @ECLASS-VARIABLE: LANGSLONG |
925 |
+# @DEFAULT_UNSET |
926 |
+# @DESCRIPTION: |
927 |
+# Same as LANGS, but this variable is for LINGUAS that must be in long format. |
928 |
+# Remember to set this variable before inheriting qt4-r2 eclass. |
929 |
+# Look at ${PORTDIR}/profiles/desc/linguas.desc for details. |
930 |
+# |
931 |
+# Example: LANGSLONG="en_GB ru_RU" |
932 |
+for x in ${LANGSLONG}; do |
933 |
+ IUSE+=" linguas_${x%_*}" |
934 |
+done |
935 |
+unset x |
936 |
+ |
937 |
+# @ECLASS-VARIABLE: PATCHES |
938 |
+# @DEFAULT_UNSET |
939 |
+# @DESCRIPTION: |
940 |
+# Array variable containing all the patches to be applied. This variable |
941 |
+# is expected to be defined in the global scope of ebuilds. Make sure to |
942 |
+# specify the full path. This variable is used in src_prepare phase. |
943 |
+# |
944 |
+# Example: |
945 |
+# @CODE |
946 |
+# PATCHES=( |
947 |
+# "${FILESDIR}/mypatch.patch" |
948 |
+# "${FILESDIR}/mypatch2.patch" |
949 |
+# ) |
950 |
+# @CODE |
951 |
+ |
952 |
+# @FUNCTION: qt4-r2_src_unpack |
953 |
+# @DESCRIPTION: |
954 |
+# Default src_unpack function for packages that depend on qt4. If you have to |
955 |
+# override src_unpack in your ebuild (probably you don't need to), call |
956 |
+# qt4-r2_src_unpack in it. |
957 |
+qt4-r2_src_unpack() { |
958 |
+ debug-print-function $FUNCNAME "$@" |
959 |
+ |
960 |
+ base_src_unpack "$@" |
961 |
+} |
962 |
+ |
963 |
+# @FUNCTION: qt4-r2_src_prepare |
964 |
+# @DESCRIPTION: |
965 |
+# Default src_prepare function for packages that depend on qt4. If you have to |
966 |
+# override src_prepare in your ebuild, you should call qt4-r2_src_prepare in it, |
967 |
+# otherwise autopatcher will not work! |
968 |
+qt4-r2_src_prepare() { |
969 |
+ debug-print-function $FUNCNAME "$@" |
970 |
+ |
971 |
+ base_src_prepare "$@" |
972 |
+} |
973 |
+ |
974 |
+# @FUNCTION: qt4-r2_src_configure |
975 |
+# @DESCRIPTION: |
976 |
+# Default src_configure function for packages that depend on qt4. If you have to |
977 |
+# override src_configure in your ebuild, call qt4-r2_src_configure in it. |
978 |
+qt4-r2_src_configure() { |
979 |
+ debug-print-function $FUNCNAME "$@" |
980 |
+ |
981 |
+ local project_file=$(qmake-utils_find_pro_file) |
982 |
+ |
983 |
+ if [[ -n ${project_file} ]]; then |
984 |
+ eqmake4 "${project_file}" |
985 |
+ else |
986 |
+ base_src_configure "$@" |
987 |
+ fi |
988 |
+} |
989 |
+ |
990 |
+# @FUNCTION: qt4-r2_src_compile |
991 |
+# @DESCRIPTION: |
992 |
+# Default src_compile function for packages that depend on qt4. If you have to |
993 |
+# override src_compile in your ebuild (probably you don't need to), call |
994 |
+# qt4-r2_src_compile in it. |
995 |
+qt4-r2_src_compile() { |
996 |
+ debug-print-function $FUNCNAME "$@" |
997 |
+ |
998 |
+ base_src_compile "$@" |
999 |
+} |
1000 |
+ |
1001 |
+# @FUNCTION: qt4-r2_src_install |
1002 |
+# @DESCRIPTION: |
1003 |
+# Default src_install function for qt4-based packages. Installs compiled code, |
1004 |
+# and documentation (via DOCS and HTML_DOCS variables). |
1005 |
+qt4-r2_src_install() { |
1006 |
+ debug-print-function $FUNCNAME "$@" |
1007 |
+ |
1008 |
+ base_src_install INSTALL_ROOT="${D}" "$@" |
1009 |
+ einstalldocs |
1010 |
+} |
1011 |
+ |
1012 |
+EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install |