1 |
commit: 4aa226b76f0168f53919278534004e8cba8ce0cc |
2 |
Author: Davide Pesavento <davidepesa <AT> gmail <DOT> com> |
3 |
AuthorDate: Fri Jun 8 00:02:26 2012 +0000 |
4 |
Commit: Davide Pesavento <pesa <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jun 8 00:02:26 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=commit;h=4aa226b7 |
7 |
|
8 |
[qt5-build.eclass] Add support for building other Qt modules. |
9 |
|
10 |
--- |
11 |
eclass/qt5-build.eclass | 74 +++++++++++++++++++++++++++++++++------------- |
12 |
1 files changed, 53 insertions(+), 21 deletions(-) |
13 |
|
14 |
diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass |
15 |
index 03bb283..874e9e2 100644 |
16 |
--- a/eclass/qt5-build.eclass |
17 |
+++ b/eclass/qt5-build.eclass |
18 |
@@ -150,20 +150,24 @@ qt5-build_src_unpack() { |
19 |
default |
20 |
;; |
21 |
esac |
22 |
- |
23 |
- qt5_prepare_env |
24 |
} |
25 |
|
26 |
# @FUNCTION: qt5-build_src_prepare |
27 |
# @DESCRIPTION: |
28 |
# Prepare the sources before the configure phase. |
29 |
qt5-build_src_prepare() { |
30 |
+ qt5_prepare_env |
31 |
+ |
32 |
+ mkdir -p "${QT5_BUILD_DIR}" || die |
33 |
+ |
34 |
if [[ ${PN} != "qt-core" ]]; then |
35 |
- skip_qmake_build |
36 |
- skip_project_generation |
37 |
- symlink_binaries_to_buildtree |
38 |
+ symlink_tools_to_buildtree |
39 |
fi |
40 |
|
41 |
+ # Avoid unnecessary qmake recompilations |
42 |
+ sed -i -re "s|^if true;.*(\[ '\!').*(\"\\\$outpath/bin/qmake\".*)|if \1 -e \2 then|" \ |
43 |
+ configure || die "sed configure failed" |
44 |
+ |
45 |
# Respect CC, CXX, *FLAGS, MAKEOPTS and EXTRA_EMAKE when building qmake |
46 |
sed -i -e "/\"\$MAKE\".*QMAKE_BUILD_ERROR/ s:): \ |
47 |
${MAKEOPTS} ${EXTRA_EMAKE} \ |
48 |
@@ -182,11 +186,11 @@ qt5-build_src_prepare() { |
49 |
# in compile.test, -m flags are passed to the linker via LIBS |
50 |
# config tests that use $COMPILER directly ignore toolchain |
51 |
|
52 |
- # respect compiler |
53 |
+ # Respect C/C++ compiler |
54 |
tc-export CC CXX |
55 |
# qmake-generated Makefiles use LD/LINK for linking |
56 |
export LD="$(tc-getCXX)" |
57 |
- # don't strip binaries |
58 |
+ # Don't strip binaries |
59 |
export STRIP=":" |
60 |
|
61 |
base_src_prepare |
62 |
@@ -252,13 +256,23 @@ qt5-build_src_configure() { |
63 |
"${myconf[@]}" |
64 |
) |
65 |
|
66 |
- mkdir -p "${QT5_BUILD_DIR}" || die |
67 |
pushd "${QT5_BUILD_DIR}" >/dev/null || die |
68 |
- |
69 |
einfo "Configuring with: ${conf[@]}" |
70 |
"${S}"/configure "${conf[@]}" || die "configure failed" |
71 |
- |
72 |
popd >/dev/null || die |
73 |
+ |
74 |
+ if [[ ${PN} != "qt-core" ]]; then |
75 |
+ local subdir |
76 |
+ for subdir in "${QT5_TARGET_SUBDIRS[@]}"; do |
77 |
+ pushd "${QT5_BUILD_DIR}/${subdir}" >/dev/null || die |
78 |
+ einfo "Running qmake in: ${subdir}" |
79 |
+ "${QT5_BUILD_DIR}"/bin/qmake \ |
80 |
+ "${S}/${subdir}/${subdir##*/}.pro" \ |
81 |
+ QMAKE_LIBDIR_QT="${QTLIBDIR}" \ |
82 |
+ || die "qmake failed in ${subdir}" |
83 |
+ popd >/dev/null || die |
84 |
+ done |
85 |
+ fi |
86 |
} |
87 |
|
88 |
# @FUNCTION: qt5-build_src_compile |
89 |
@@ -268,7 +282,7 @@ qt5-build_src_compile() { |
90 |
local subdir |
91 |
for subdir in "${QT5_TARGET_SUBDIRS[@]}"; do |
92 |
pushd "${QT5_BUILD_DIR}/${subdir}" >/dev/null || die |
93 |
- einfo "Building in ${subdir}" |
94 |
+ einfo "Building in: ${subdir}" |
95 |
emake |
96 |
popd >/dev/null || die |
97 |
done |
98 |
@@ -320,11 +334,26 @@ qt5-build_pkg_postrm() { |
99 |
: |
100 |
} |
101 |
|
102 |
+# @FUNCTION: qt_use |
103 |
+# @USAGE: < flag > [ feature ] [ enableval ] |
104 |
+# @DESCRIPTION: |
105 |
+# This will echo "-${enableval}-${feature}" if <flag> is enabled, or |
106 |
+# "-no-${feature}" if it's disabled. If [feature] is not specified, <flag> |
107 |
+# will be used for that. If [enableval] is not specified, it omits the |
108 |
+# "-${enableval}" part. |
109 |
+qt_use() { |
110 |
+ use "$1" && echo "${3:+-$3}-${2:-$1}" || echo "-no-${2:-$1}" |
111 |
+} |
112 |
+ |
113 |
+ |
114 |
+###### Internal functions ###### |
115 |
+ |
116 |
# @FUNCTION: qt5_prepare_env |
117 |
# @INTERNAL |
118 |
# @DESCRIPTION: |
119 |
-# Sets up installation directories. |
120 |
+# Prepares the environment for building Qt. |
121 |
qt5_prepare_env() { |
122 |
+ # setup installation directories |
123 |
QTPREFIXDIR=${EPREFIX}/usr |
124 |
QTBINDIR=${EPREFIX}/usr/qt5/bin # FIXME |
125 |
QTLIBDIR=${QTPREFIXDIR}/$(get_libdir)/qt5 |
126 |
@@ -339,21 +368,24 @@ qt5_prepare_env() { |
127 |
QTSYSCONFDIR=${EPREFIX}/etc/qt5 |
128 |
} |
129 |
|
130 |
-# @FUNCTION: qt_use |
131 |
-# @USAGE: < flag > [ feature ] [ enableval ] |
132 |
+# @FUNCTION: symlink_tools_to_buildtree |
133 |
+# @INTERNAL |
134 |
# @DESCRIPTION: |
135 |
-# This will echo "-${enableval}-${feature}" if <flag> is enabled, or |
136 |
-# "-no-${feature}" if it's disabled. If [feature] is not specified, <flag> |
137 |
-# will be used for that. If [enableval] is not specified, it omits the |
138 |
-# "-${enableval}" part. |
139 |
-qt_use() { |
140 |
- use "$1" && echo "${3:+-$3}-${2:-$1}" || echo "-no-${2:-$1}" |
141 |
+# Symlinks qt-core tools to buildtree, so they can be used when building other modules. |
142 |
+symlink_tools_to_buildtree() { |
143 |
+ mkdir -p "${QT5_BUILD_DIR}"/bin || die |
144 |
+ |
145 |
+ local bin |
146 |
+ for bin in "${QTBINDIR}"/{qmake,moc,rcc}; do |
147 |
+ ln -s "${bin}" "${QT5_BUILD_DIR}"/bin/ \ |
148 |
+ || die "symlinking '${bin}' to '${QT5_BUILD_DIR}/bin/' failed" |
149 |
+ done |
150 |
} |
151 |
|
152 |
# @FUNCTION: install_qconfigs |
153 |
# @INTERNAL |
154 |
# @DESCRIPTION: |
155 |
-# Install gentoo-specific mkspecs configurations. |
156 |
+# Installs gentoo-specific mkspecs configurations. |
157 |
install_qconfigs() { |
158 |
local x |