1 | # Copyright 2005 Gentoo Foundation |
1 | # Copyright 2007-2008 Gentoo Foundation |
2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.6 2007/12/23 20:48:30 caleb Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.7 2008/03/05 23:06:26 ingmar Exp $ |
4 | |
4 | |
5 | # @ECLASS: qt4-build.eclass |
5 | # @ECLASS: qt4-build.eclass |
6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
7 | # Caleb Tennis <caleb@gentoo.org> |
7 | # Caleb Tennis <caleb@gentoo.org> |
8 | # @BLURB: |
8 | # @BLURB: |
9 | # Eclass for Qt4 |
9 | # Eclass for Qt4 |
10 | # @DESCRIPTION: |
10 | # @DESCRIPTION: |
11 | # This eclass contains various functions that are used when building Qt4 |
11 | # This eclass contains various functions that are used when building Qt4 |
12 | |
12 | |
13 | inherit eutils multilib toolchain-funcs flag-o-matic |
13 | inherit eutils multilib toolchain-funcs flag-o-matic |
14 | |
14 | |
15 | IUSE="${IUSE} debug" |
15 | IUSE="${IUSE} debug" |
16 | |
16 | |
|
|
17 | case "${PV}" in |
|
|
18 | 4.4.0_beta*) |
|
|
19 | SRCTYPE="${SRCTYPE:-opensource-src}" |
|
|
20 | MY_PV="${PV/_beta/-beta}" |
|
|
21 | ;; |
|
|
22 | *) |
|
|
23 | SRCTYPE="${SRCTYPE:-opensource-src}" |
|
|
24 | MY_PV="${PV}" |
|
|
25 | ;; |
|
|
26 | esac |
|
|
27 | S=${WORKDIR}/qt-x11-${SRCTYPE}-${MY_PV} |
|
|
28 | |
|
|
29 | SRC_URI="ftp://ftp.trolltech.com/qt/source/qt-x11-${SRCTYPE}-${MY_PV}.tar.bz2" |
|
|
30 | |
17 | qt4-build_pkg_setup() { |
31 | qt4-build_pkg_setup() { |
|
|
32 | # Check USE requirements |
|
|
33 | qt4-build_check_use |
|
|
34 | |
18 | # Set up installation directories |
35 | # Set up installation directories |
19 | |
|
|
20 | QTBASEDIR=/usr/$(get_libdir)/qt4 |
36 | QTBASEDIR=/usr/$(get_libdir)/qt4 |
21 | QTPREFIXDIR=/usr |
37 | QTPREFIXDIR=/usr |
22 | QTBINDIR=/usr/bin |
38 | QTBINDIR=/usr/bin |
23 | QTLIBDIR=/usr/$(get_libdir)/qt4 |
39 | QTLIBDIR=/usr/$(get_libdir)/qt4 |
24 | QTPCDIR=/usr/$(get_libdir)/pkgconfig |
40 | QTPCDIR=/usr/$(get_libdir)/pkgconfig |
… | |
… | |
36 | PATH="${S}/bin:${PATH}" |
52 | PATH="${S}/bin:${PATH}" |
37 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
53 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
38 | } |
54 | } |
39 | |
55 | |
40 | qt4-build_src_unpack() { |
56 | qt4-build_src_unpack() { |
|
|
57 | # TODO: partial unpacks, cfr split KDE ebuilds. |
41 | unpack ${A} |
58 | unpack ${A} |
42 | cd "${S}" |
59 | cd "${S}" |
43 | |
60 | |
|
|
61 | if [[ ${PN} != qt-core ]]; then |
|
|
62 | skip_qmake_build_patch |
|
|
63 | skip_project_generation_patch |
|
|
64 | symlink_binaries_to_buildtree |
|
|
65 | fi |
|
|
66 | |
|
|
67 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
68 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
69 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
70 | -e "s:X11R6/::" \ |
|
|
71 | -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" |
|
|
72 | |
|
|
73 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
74 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
75 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
76 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
|
|
77 | } |
|
|
78 | |
|
|
79 | qt4-build_src_compile() { |
44 | # Don't let the user go too overboard with flags. If you really want to, uncomment |
80 | # Don't let the user go too overboard with flags. If you really want to, uncomment |
45 | # out the line below and give 'er a whirl. |
81 | # out the line below and give 'er a whirl. |
46 | strip-flags |
82 | strip-flags |
47 | replace-flags -O3 -O2 |
83 | replace-flags -O3 -O2 |
48 | |
84 | |
49 | if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then |
85 | if [[ $(gcc-fullversion) == "3.4.6" && gcc-specs-ssp ]] ; then |
50 | ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" |
86 | ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" |
51 | append-flags -fno-stack-protector |
87 | append-flags -fno-stack-protector |
52 | fi |
88 | fi |
|
|
89 | |
|
|
90 | myconf="$(standard_configure_options) ${myconf}" |
|
|
91 | |
|
|
92 | echo ./configure ${myconf} |
|
|
93 | ./configure ${myconf} || die "./configure failed" |
|
|
94 | |
|
|
95 | build_target_directories |
53 | } |
96 | } |
54 | |
97 | |
55 | qt4-build_src_install() { |
98 | qt4-build_src_install() { |
56 | install_directories "${QT4_TARGET_DIRECTORIES}" |
99 | install_directories "${QT4_TARGET_DIRECTORIES}" |
|
|
100 | install_qconfigs |
57 | fix_library_files |
101 | fix_library_files |
58 | } |
102 | } |
59 | |
103 | |
60 | standard_configure_options() { |
104 | standard_configure_options() { |
61 | local myconf="" |
105 | local myconf="" |
62 | |
106 | |
63 | [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)" |
107 | [[ $(get_libdir) != "lib" ]] && myconf="${myconf} -L/usr/$(get_libdir)" |
64 | |
108 | |
65 | # Disable visibility explicitly if gcc version isn't 4 |
109 | # Disable visibility explicitly if gcc version isn't 4 |
66 | if [[ "$(gcc-major-version)" != "4" ]]; then |
110 | if [[ "$(gcc-major-version)" -lt "4" ]]; then |
67 | myconf="${myconf} -no-reduce-exports" |
111 | myconf="${myconf} -no-reduce-exports" |
68 | fi |
112 | fi |
69 | |
113 | |
70 | use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info" |
114 | if use debug; then |
|
|
115 | myconf="${myconf} -debug -no-separate-debug-info" |
|
|
116 | else |
|
|
117 | myconf="${myconf} -release -no-separate-debug-info" |
|
|
118 | fi |
71 | |
119 | |
72 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath\ |
120 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
73 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \ |
121 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
74 | -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \ |
122 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
75 | -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \ |
123 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
76 | -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}" |
124 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
77 | |
125 | -demosdir ${QTDEMOSDIR} -silent -fast -reduce-relocations |
78 | myconf="${myconf} -silent -fast -reduce-relocations -nomake examples -nomake demos" |
126 | -nomake examples -nomake demos" |
79 | |
127 | |
80 | echo "${myconf}" |
128 | echo "${myconf}" |
81 | } |
129 | } |
82 | |
130 | |
83 | build_target_directories() { |
131 | build_target_directories() { |
… | |
… | |
86 | |
134 | |
87 | build_directories() { |
135 | build_directories() { |
88 | local dirs="$@" |
136 | local dirs="$@" |
89 | for x in ${dirs}; do |
137 | for x in ${dirs}; do |
90 | cd "${S}"/${x} |
138 | cd "${S}"/${x} |
91 | "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" && emake || die |
139 | "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" |
|
|
140 | emake || die "emake failed" |
92 | done |
141 | done |
93 | } |
142 | } |
94 | |
143 | |
95 | install_directories() { |
144 | install_directories() { |
96 | local dirs="$@" |
145 | local dirs="$@" |
97 | for x in ${dirs}; do |
146 | for x in ${dirs}; do |
98 | cd "${S}"/${x} |
147 | pushd "${S}"/${x} >/dev/null || die "Can't pushd ${S}/${x}" |
99 | emake INSTALL_ROOT="${D}" install || die |
148 | emake INSTALL_ROOT="${D}" install || die "emake install failed" |
|
|
149 | popd >/dev/null || die "Can't popd from ${S}/${x}" |
|
|
150 | done |
|
|
151 | } |
|
|
152 | |
|
|
153 | # @ECLASS-VARIABLE: QCONFIG_ADD |
|
|
154 | # @DESCRIPTION: |
|
|
155 | # List options that need to be added to QT_CONFIG in qconfig.pri |
|
|
156 | QCONFIG_ADD="${QCONFIG_ADD:-}" |
|
|
157 | |
|
|
158 | # @ECLASS-VARIABLE: QCONFIG_REMOVE |
|
|
159 | # @DESCRIPTION: |
|
|
160 | # List options that need to be removed from QT_CONFIG in qconfig.pri |
|
|
161 | QCONFIG_REMOVE="${QCONFIG_REMOVE:-}" |
|
|
162 | |
|
|
163 | # @ECLASS-VARIABLE: QCONFIG_DEFINE |
|
|
164 | # @DESCRIPTION: |
|
|
165 | # List variables that should be defined at the top of QtCore/qconfig.h |
|
|
166 | QCONFIG_DEFINE="${QCONFIG_DEFINE:-}" |
|
|
167 | |
|
|
168 | install_qconfigs() { |
|
|
169 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} ]]; then |
|
|
170 | local x |
|
|
171 | for x in QCONFIG_ADD QCONFIG_REMOVE; do |
|
|
172 | [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri |
100 | done |
173 | done |
101 | } |
174 | insinto ${QTDATADIR}/mkspecs/gentoo |
|
|
175 | doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed" |
102 | |
176 | |
|
|
177 | for x in ${QCONFIG_DEFINE}; do |
|
|
178 | echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h |
|
|
179 | done |
|
|
180 | insinto ${QTHEADERDIR}/Gentoo |
|
|
181 | doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" |
|
|
182 | fi |
|
|
183 | } |
|
|
184 | |
|
|
185 | # Stubs for functions used by the Qt 4.4.0_technical_preview_1. |
103 | qconfig_add_option() { |
186 | qconfig_add_option() { : ; } |
104 | local option=$1 |
|
|
105 | qconfig_remove_option $1 |
|
|
106 | sed -i -e "s:QT_CONFIG +=:QT_CONFIG += ${option}:g" /usr/share/qt4/mkspecs/qconfig.pri |
|
|
107 | } |
|
|
108 | |
|
|
109 | qconfig_remove_option() { |
187 | qconfig_remove_option() { : ; } |
110 | local option=$1 |
188 | |
111 | sed -i -e "s: ${option}::g" /usr/share/qt4/mkspecs/qconfig.pri |
189 | generate_qconfigs() { |
|
|
190 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then |
|
|
191 | local x qconfig_add qconfig_remove qconfig_new |
|
|
192 | for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do |
|
|
193 | [[ -f ${x} ]] || continue |
|
|
194 | qconfig_add="${qconfig_add} $(sed -n 's/^QCONFIG_ADD=//p' "${x}")" |
|
|
195 | qconfig_remove="${qconfig_remove} $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")" |
|
|
196 | done |
|
|
197 | |
|
|
198 | # these error checks do not use die because dying in pkg_post{inst,rm} |
|
|
199 | # just makes things worse. |
|
|
200 | if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then |
|
|
201 | # start with the qconfig.pri that qt-core installed |
|
|
202 | if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \ |
|
|
203 | "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then |
|
|
204 | eerror "cp qconfig failed." |
|
|
205 | return 1 |
|
|
206 | fi |
|
|
207 | |
|
|
208 | # generate list of QT_CONFIG entries from the existing list |
|
|
209 | # including qconfig_add and excluding qconfig_remove |
|
|
210 | for x in $(sed -n 's/^QT_CONFIG +=//p' \ |
|
|
211 | "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do |
|
|
212 | hasq ${x} ${qconfig_remove} || qconfig_new="${qconfig_new} ${x}" |
|
|
213 | done |
|
|
214 | |
|
|
215 | # replace the existing QT_CONFIG list with qconfig_new |
|
|
216 | if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \ |
|
|
217 | "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then |
|
|
218 | eerror "Sed for QT_CONFIG failed" |
|
|
219 | return 1 |
|
|
220 | fi |
|
|
221 | |
|
|
222 | # create Gentoo/qconfig.h |
|
|
223 | if [[ ! -e ${ROOT}${QTHEADERDIR}/Gentoo ]]; then |
|
|
224 | if ! mkdir -p "${ROOT}${QTHEADERDIR}"/Gentoo; then |
|
|
225 | eerror "mkdir ${QTHEADERDIR}/Gentoo failed" |
|
|
226 | return 1 |
|
|
227 | fi |
|
|
228 | fi |
|
|
229 | : > "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h |
|
|
230 | for x in "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do |
|
|
231 | [[ -f ${x} ]] || continue |
|
|
232 | cat "${x}" >> "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h |
|
|
233 | done |
|
|
234 | else |
|
|
235 | rm -f "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri |
|
|
236 | rm -f "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h |
|
|
237 | rmdir "${ROOT}${QTDATADIR}"/mkspecs \ |
|
|
238 | "${ROOT}${QTDATADIR}" \ |
|
|
239 | "${ROOT}${QTHEADERDIR}"/Gentoo \ |
|
|
240 | "${ROOT}${QTHEADERDIR}" 2>/dev/null |
|
|
241 | fi |
|
|
242 | fi |
|
|
243 | } |
|
|
244 | |
|
|
245 | qt4-build_pkg_postrm() { |
|
|
246 | generate_qconfigs |
|
|
247 | } |
|
|
248 | |
|
|
249 | qt4-build_pkg_postinst() { |
|
|
250 | generate_qconfigs |
112 | } |
251 | } |
113 | |
252 | |
114 | skip_qmake_build_patch() { |
253 | skip_qmake_build_patch() { |
115 | # Don't need to build qmake, as it's already installed from qmake-core |
254 | # Don't need to build qmake, as it's already installed from qt-core |
116 | sed -i -e "s:if true:if false:g" "${S}"/configure |
255 | sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed" |
117 | } |
256 | } |
118 | |
257 | |
119 | skip_project_generation_patch() { |
258 | skip_project_generation_patch() { |
120 | # Exit the script early by throwing in an exit before all of the .pro files are scanned |
259 | # Exit the script early by throwing in an exit before all of the .pro files are scanned |
121 | sed -i -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" "${S}"/configure |
260 | sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \ |
|
|
261 | -i "${S}"/configure || die "Sed failed" |
122 | } |
262 | } |
123 | |
263 | |
124 | install_binaries_to_buildtree() |
264 | symlink_binaries_to_buildtree() { |
125 | { |
265 | for bin in qmake moc uic rcc; do |
126 | cp ${QTBINDIR}/qmake ${S}/bin |
266 | ln -s ${QTBINDIR}/${bin} "${S}"/bin/ || die "Symlinking ${bin} to ${S}/bin failed." |
127 | cp ${QTBINDIR}/moc ${S}/bin |
267 | done |
128 | cp ${QTBINDIR}/uic ${S}/bin |
|
|
129 | cp ${QTBINDIR}/rcc ${S}/bin |
|
|
130 | } |
268 | } |
131 | |
269 | |
132 | fix_library_files() { |
270 | fix_library_files() { |
133 | sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la |
271 | for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do |
134 | sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl |
272 | if [[ -e ${libfile} ]]; then |
135 | sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc |
273 | sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "Sed on ${libfile} failed." |
|
|
274 | fi |
|
|
275 | done |
136 | |
276 | |
137 | # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix: |
277 | # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix: |
138 | sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc |
278 | for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do |
|
|
279 | if [[ -e ${libfile} ]]; then |
|
|
280 | sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "Sed failed" |
139 | |
281 | |
140 | # Move .pc files into the pkgconfig directory |
282 | # Move .pc files into the pkgconfig directory |
|
|
283 | |
141 | dodir ${QTPCDIR} |
284 | dodir ${QTPCDIR} |
142 | mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR} |
285 | mv ${libfile} "${D}"/${QTPCDIR}/ \ |
|
|
286 | || die "Moving ${libfile} to ${D}/${QTPCDIR}/ failed." |
|
|
287 | fi |
|
|
288 | done |
|
|
289 | |
|
|
290 | # Don't install an empty directory |
|
|
291 | rmdir "${D}"/${QTLIBDIR}/pkgconfig |
143 | } |
292 | } |
144 | |
293 | |
145 | qt_use() { |
294 | qt_use() { |
146 | local flag="$1" |
295 | local flag="${1}" |
147 | local feature="$1" |
296 | local feature="${1}" |
148 | local enableval= |
297 | local enableval= |
149 | |
298 | |
150 | [[ -n $2 ]] && feature=$2 |
299 | [[ -n ${2} ]] && feature=${2} |
151 | [[ -n $3 ]] && enableval="-$3" |
300 | [[ -n ${3} ]] && enableval="-${3}" |
152 | |
301 | |
153 | useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}" |
302 | if use ${flag}; then |
|
|
303 | echo "${enableval}-${feature}" |
|
|
304 | else |
|
|
305 | echo "-no-${feature}" |
|
|
306 | fi |
|
|
307 | } |
|
|
308 | |
|
|
309 | # @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK |
|
|
310 | # @DESCRIPTION: |
|
|
311 | # The contents of $QT4_BUILT_WITH_USE_CHECK gets fed to built_with_use |
|
|
312 | # (eutils.eclass), line per line. |
|
|
313 | # |
|
|
314 | # Example: |
|
|
315 | # @CODE |
|
|
316 | # pkg_setup() { |
|
|
317 | # use qt3support && QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} |
|
|
318 | # ~x11-libs/qt-gui-${PV} qt3support" |
|
|
319 | # qt4-build_check_use |
|
|
320 | # } |
|
|
321 | # @CODE |
|
|
322 | |
|
|
323 | # Run built_with_use on each flag and print appropriate error messages if any |
|
|
324 | # flags are missing |
|
|
325 | _qt_built_with_use() { |
|
|
326 | local missing opt pkg flag flags |
|
|
327 | |
|
|
328 | if [[ ${1} = "--missing" ]]; then |
|
|
329 | missing="${1} ${2}" && shift 2 |
|
|
330 | fi |
|
|
331 | if [[ ${1:0:1} = "-" ]]; then |
|
|
332 | opt=${1} && shift |
|
|
333 | fi |
|
|
334 | |
|
|
335 | pkg=${1} && shift |
|
|
336 | |
|
|
337 | for flag in "${@}"; do |
|
|
338 | flags="${flags} ${flag}" |
|
|
339 | if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then |
|
|
340 | flags="${flags}*" |
|
|
341 | else |
|
|
342 | [[ ${opt} = "-o" ]] && return 0 |
|
|
343 | fi |
|
|
344 | done |
|
|
345 | if [[ "${flags# }" = "${@}" ]]; then |
154 | return 0 |
346 | return 0 |
|
|
347 | fi |
|
|
348 | if [[ ${opt} = "-o" ]]; then |
|
|
349 | eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'." |
|
|
350 | else |
|
|
351 | eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'." |
|
|
352 | fi |
|
|
353 | return 1 |
|
|
354 | } |
|
|
355 | |
|
|
356 | # @FUNCTION: qt4-build_check_use |
|
|
357 | # @DESCRIPTION: |
|
|
358 | # Check if the listed packages in $QT4_BUILT_WITH_USE_CHECK are built with the |
|
|
359 | # USE flags listed. |
|
|
360 | # |
|
|
361 | # If any of the required USE flags are missing, an eerror will be printed for |
|
|
362 | # each package with missing USE flags. |
|
|
363 | qt4-build_check_use() { |
|
|
364 | local line missing |
|
|
365 | while read line; do |
|
|
366 | [[ -z ${line} ]] && continue |
|
|
367 | if ! _qt_built_with_use ${line}; then |
|
|
368 | missing=true |
|
|
369 | fi |
|
|
370 | done <<< "${QT4_BUILT_WITH_USE_CHECK}" |
|
|
371 | if [[ -n ${missing} ]]; then |
|
|
372 | echo |
|
|
373 | eerror "Flags marked with an * are missing." |
|
|
374 | die "Missing USE flags found" |
|
|
375 | fi |
155 | } |
376 | } |
156 | |
377 | |
157 | qt_mkspecs_dir() { |
378 | qt_mkspecs_dir() { |
158 | # Allows us to define which mkspecs dir we want to use. |
379 | # Allows us to define which mkspecs dir we want to use. |
159 | local spec |
380 | local spec |
… | |
… | |
163 | spec="freebsd" ;; |
384 | spec="freebsd" ;; |
164 | *-openbsd*) |
385 | *-openbsd*) |
165 | spec="openbsd" ;; |
386 | spec="openbsd" ;; |
166 | *-netbsd*) |
387 | *-netbsd*) |
167 | spec="netbsd" ;; |
388 | spec="netbsd" ;; |
168 | *-darwin*) |
389 | *-darwin*) |
169 | spec="darwin" ;; |
390 | spec="darwin" ;; |
170 | *-linux-*|*-linux) |
391 | *-linux-*|*-linux) |
171 | spec="linux" ;; |
392 | spec="linux" ;; |
172 | *) |
393 | *) |
173 | die "Unknown CHOST, no platform choosed." |
394 | die "Unknown CHOST, no platform choosen." |
174 | esac |
395 | esac |
175 | |
396 | |
176 | CXX=$(tc-getCXX) |
397 | CXX=$(tc-getCXX) |
177 | if [[ ${CXX/g++/} != ${CXX} ]]; then |
398 | if [[ ${CXX/g++/} != ${CXX} ]]; then |
178 | spec="${spec}-g++" |
399 | spec="${spec}-g++" |
… | |
… | |
183 | fi |
404 | fi |
184 | |
405 | |
185 | echo "${spec}" |
406 | echo "${spec}" |
186 | } |
407 | } |
187 | |
408 | |
188 | EXPORT_FUNCTIONS pkg_setup src_unpack src_install |
409 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst |