blob: 5c5fa8dcb047463d7625e5db5c809b8ae582a9a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: qmake-utils.eclass
# @MAINTAINER:
# qt@gentoo.org
# @AUTHOR:
# Davide Pesavento <pesa@gentoo.org>
# @SUPPORTED_EAPIS: 7 8
# @BLURB: Common functions for qmake-based packages.
# @DESCRIPTION:
# Utility eclass providing wrapper functions for Qt qmake.
#
# This eclass does not set any metadata variables nor export any phase
# functions. It can be inherited safely.
case ${EAPI} in
7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_QMAKE_UTILS_ECLASS} ]]; then
_QMAKE_UTILS_ECLASS=1
inherit toolchain-funcs
# @FUNCTION: qt5_get_bindir
# @DESCRIPTION:
# Echoes the directory where Qt5 binaries are installed.
# EPREFIX is already prepended to the returned path.
qt5_get_bindir() {
echo ${EPREFIX}$(qt5_get_libdir)/qt5/bin
}
# @FUNCTION: qt5_get_headerdir
# @DESCRIPTION:
# Echoes the directory where Qt5 headers are installed.
qt5_get_headerdir() {
echo /usr/include/qt5
}
# @FUNCTION: qt5_get_libdir
# @DESCRIPTION:
# Echoes the directory where Qt5 libraries are installed.
qt5_get_libdir() {
echo /usr/$(get_libdir)
}
# @FUNCTION: qt5_get_mkspecsdir
# @DESCRIPTION:
# Echoes the directory where Qt5 mkspecs are installed.
qt5_get_mkspecsdir() {
echo $(qt5_get_libdir)/qt5/mkspecs
}
# @FUNCTION: qt5_get_plugindir
# @DESCRIPTION:
# Echoes the directory where Qt5 plugins are installed.
qt5_get_plugindir() {
echo $(qt5_get_libdir)/qt5/plugins
}
# @FUNCTION: qt5_get_qmake_args
# @DESCRIPTION:
# Echoes a multi-line string containing arguments to pass to qmake.
qt5_get_qmake_args() {
cat <<-EOF
QMAKE_AR="$(tc-getAR) cqs"
QMAKE_CC="$(tc-getCC)"
QMAKE_LINK_C="$(tc-getCC)"
QMAKE_LINK_C_SHLIB="$(tc-getCC)"
QMAKE_CXX="$(tc-getCXX)"
QMAKE_LINK="$(tc-getCXX)"
QMAKE_LINK_SHLIB="$(tc-getCXX)"
QMAKE_OBJCOPY="$(tc-getOBJCOPY)"
QMAKE_RANLIB=
QMAKE_STRIP=
QMAKE_CFLAGS="${CFLAGS}"
QMAKE_CFLAGS_RELEASE=
QMAKE_CFLAGS_DEBUG=
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO=
QMAKE_CXXFLAGS="${CXXFLAGS}"
QMAKE_CXXFLAGS_RELEASE=
QMAKE_CXXFLAGS_DEBUG=
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO=
QMAKE_LFLAGS="${LDFLAGS}"
QMAKE_LFLAGS_RELEASE=
QMAKE_LFLAGS_DEBUG=
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO=
EOF
}
# @FUNCTION: eqmake5
# @USAGE: [arguments for qmake]
# @DESCRIPTION:
# Wrapper for Qt5's qmake. All arguments are passed to qmake.
#
# For recursive build systems, i.e. those based on the subdirs template,
# you should run eqmake5 on the top-level project file only, unless you
# have a valid reason to do otherwise. During the building, qmake will
# be automatically re-invoked with the right arguments on every directory
# specified inside the top-level project file.
eqmake5() {
debug-print-function ${FUNCNAME} "$@"
ebegin "Running qmake"
local -a args
mapfile -t args <<<"$(qt5_get_qmake_args)"
# NB: we're passing literal quotes in but qmake doesn't seem to mind
"$(qt5_get_bindir)"/qmake -makefile "${args[@]}" "$@"
if ! eend $? ; then
echo
eerror "Running qmake has failed! (see above for details)"
eerror "This shouldn't happen - please send a bug report to https://bugs.gentoo.org/"
echo
die "eqmake5 failed"
fi
}
# @FUNCTION: qt6_get_bindir
# @DESCRIPTION:
# Echoes the directory where Qt6 binaries are installed.
# EPREFIX is already prepended to the returned path.
qt6_get_bindir() {
echo ${EPREFIX}$(qt6_get_libdir)/qt6/bin
}
# @FUNCTION: qt6_get_headerdir
# @DESCRIPTION:
# Echoes the directory where Qt6 headers are installed.
qt6_get_headerdir() {
echo /usr/include/qt6
}
# @FUNCTION: qt6_get_libdir
# @DESCRIPTION:
# Echoes the directory where Qt6 libraries are installed.
qt6_get_libdir() {
echo /usr/$(get_libdir)
}
# @FUNCTION: qt6_get_mkspecsdir
# @DESCRIPTION:
# Echoes the directory where Qt6 mkspecs are installed.
qt6_get_mkspecsdir() {
echo $(qt6_get_libdir)/qt6/mkspecs
}
# @FUNCTION: qt6_get_plugindir
# @DESCRIPTION:
# Echoes the directory where Qt6 plugins are installed.
qt6_get_plugindir() {
echo $(qt6_get_libdir)/qt6/plugins
}
# @FUNCTION: qt6_get_qmake_args
# @DESCRIPTION:
# Echoes a multi-line string containing arguments to pass to qmake.
qt6_get_qmake_args() {
cat <<-EOF
QMAKE_AR="$(tc-getAR) cqs"
QMAKE_CC="$(tc-getCC)"
QMAKE_LINK_C="$(tc-getCC)"
QMAKE_LINK_C_SHLIB="$(tc-getCC)"
QMAKE_CXX="$(tc-getCXX)"
QMAKE_LINK="$(tc-getCXX)"
QMAKE_LINK_SHLIB="$(tc-getCXX)"
QMAKE_OBJCOPY="$(tc-getOBJCOPY)"
QMAKE_RANLIB=
QMAKE_STRIP=
QMAKE_CFLAGS="${CFLAGS}"
QMAKE_CFLAGS_RELEASE=
QMAKE_CFLAGS_DEBUG=
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO=
QMAKE_CXXFLAGS="${CXXFLAGS}"
QMAKE_CXXFLAGS_RELEASE=
QMAKE_CXXFLAGS_DEBUG=
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO=
QMAKE_LFLAGS="${LDFLAGS}"
QMAKE_LFLAGS_RELEASE=
QMAKE_LFLAGS_DEBUG=
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO=
EOF
}
# @FUNCTION: eqmake6
# @USAGE: [arguments for qmake]
# @DESCRIPTION:
# Wrapper for Qt6's qmake. All arguments are passed to qmake.
#
# For recursive build systems, i.e. those based on the subdirs template,
# you should run eqmake6 on the top-level project file only, unless you
# have a valid reason to do otherwise. During the building, qmake will
# be automatically re-invoked with the right arguments on every directory
# specified inside the top-level project file.
eqmake6() {
debug-print-function ${FUNCNAME} "$@"
ebegin "Running qmake"
local -a args
mapfile -t args <<<"$(qt6_get_qmake_args)"
# NB: we're passing literal quotes in but qmake doesn't seem to mind
"$(qt6_get_bindir)"/qmake -makefile "${args[@]}" "$@"
if ! eend $? ; then
echo
eerror "Running qmake has failed! (see above for details)"
eerror "This shouldn't happen - please send a bug report to https://bugs.gentoo.org/"
echo
die "eqmake6 failed"
fi
}
fi
|