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