| 1 | # Copyright 2007-2008 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.8 2008/03/06 01:23:51 ingmar Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.14 2008/05/26 14:30:44 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: Eclass for Qt4 split ebuilds. |
8 | # @BLURB: Eclass for Qt4 split ebuilds. |
| 9 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 10 | # This eclass contains various functions that are used when building Qt4 |
10 | # This eclass contains various functions that are used when building Qt4 |
| 11 | |
11 | |
| 12 | inherit eutils multilib toolchain-funcs flag-o-matic |
12 | inherit eutils multilib toolchain-funcs flag-o-matic |
| 13 | |
13 | |
| 14 | IUSE="${IUSE} debug" |
14 | IUSE="${IUSE} debug pch" |
| 15 | |
15 | |
| 16 | case "${PV}" in |
16 | case "${PV}" in |
| 17 | 4.4.0_beta*) |
17 | 4.4.0_beta*) |
| 18 | SRCTYPE="${SRCTYPE:-opensource-src}" |
18 | SRCTYPE="${SRCTYPE:-opensource-src}" |
| 19 | MY_PV="${PV/_beta/-beta}" |
19 | MY_PV="${PV/_beta/-beta}" |
|
|
20 | ;; |
|
|
21 | 4.4.0_rc*) |
|
|
22 | SRCTYPE="${SRCTYPE:-opensource-src}" |
|
|
23 | MY_PV="${PV/_rc/-rc}" |
| 20 | ;; |
24 | ;; |
| 21 | *) |
25 | *) |
| 22 | SRCTYPE="${SRCTYPE:-opensource-src}" |
26 | SRCTYPE="${SRCTYPE:-opensource-src}" |
| 23 | MY_PV="${PV}" |
27 | MY_PV="${PV}" |
| 24 | ;; |
28 | ;; |
| 25 | esac |
29 | esac |
| 26 | S=${WORKDIR}/qt-x11-${SRCTYPE}-${MY_PV} |
30 | MY_P=qt-x11-${SRCTYPE}-${MY_PV} |
|
|
31 | S=${WORKDIR}/${MY_P} |
| 27 | |
32 | |
| 28 | SRC_URI="ftp://ftp.trolltech.com/qt/source/qt-x11-${SRCTYPE}-${MY_PV}.tar.bz2" |
33 | SRC_URI="ftp://ftp.trolltech.com/qt/source/${MY_P}.tar.bz2" |
|
|
34 | |
|
|
35 | case "${PV}" in |
|
|
36 | 4.4.0|4.4.0_rc*) |
|
|
37 | SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" |
|
|
38 | ;; |
|
|
39 | *) |
|
|
40 | ;; |
|
|
41 | esac |
| 29 | |
42 | |
| 30 | qt4-build_pkg_setup() { |
43 | qt4-build_pkg_setup() { |
| 31 | # Check USE requirements |
44 | # Check USE requirements |
| 32 | qt4-build_check_use |
45 | qt4-build_check_use |
| 33 | |
46 | |
| … | |
… | |
| 50 | |
63 | |
| 51 | PATH="${S}/bin:${PATH}" |
64 | PATH="${S}/bin:${PATH}" |
| 52 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
65 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
| 53 | } |
66 | } |
| 54 | |
67 | |
|
|
68 | qt4_unpack() { |
|
|
69 | local target targets |
|
|
70 | for target in configure LICENSE.{GPL2,GPL3,QPL} 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.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 | |
| 55 | qt4-build_src_unpack() { |
87 | qt4-build_src_unpack() { |
| 56 | # TODO: partial unpacks, cfr split KDE ebuilds. |
88 | qt4_unpack |
| 57 | unpack ${A} |
|
|
| 58 | cd "${S}" |
|
|
| 59 | |
|
|
| 60 | if [[ ${PN} != qt-core ]]; then |
89 | if [[ ${PN} != qt-core ]]; then |
|
|
90 | cd "${S}" |
| 61 | skip_qmake_build_patch |
91 | skip_qmake_build_patch |
| 62 | skip_project_generation_patch |
92 | skip_project_generation_patch |
| 63 | symlink_binaries_to_buildtree |
93 | symlink_binaries_to_buildtree |
| 64 | fi |
94 | fi |
| 65 | |
95 | |
| … | |
… | |
| 84 | if [[ $(gcc-fullversion) == "3.4.6" && gcc-specs-ssp ]] ; then |
114 | if [[ $(gcc-fullversion) == "3.4.6" && gcc-specs-ssp ]] ; then |
| 85 | ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" |
115 | ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" |
| 86 | append-flags -fno-stack-protector |
116 | append-flags -fno-stack-protector |
| 87 | fi |
117 | fi |
| 88 | |
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 | |
| 89 | myconf="$(standard_configure_options) ${myconf}" |
125 | myconf="$(standard_configure_options) ${myconf}" |
| 90 | |
126 | |
| 91 | echo ./configure ${myconf} |
127 | echo ./configure ${myconf} |
| 92 | ./configure ${myconf} || die "./configure failed" |
128 | ./configure ${myconf} || die "./configure failed" |
| 93 | |
129 | |
| … | |
… | |
| 108 | # Disable visibility explicitly if gcc version isn't 4 |
144 | # Disable visibility explicitly if gcc version isn't 4 |
| 109 | if [[ "$(gcc-major-version)" -lt "4" ]]; then |
145 | if [[ "$(gcc-major-version)" -lt "4" ]]; then |
| 110 | myconf="${myconf} -no-reduce-exports" |
146 | myconf="${myconf} -no-reduce-exports" |
| 111 | fi |
147 | fi |
| 112 | |
148 | |
|
|
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 |
|
|
155 | |
| 113 | if use debug; then |
156 | if use debug; then |
| 114 | myconf="${myconf} -debug -no-separate-debug-info" |
157 | myconf="${myconf} -debug -no-separate-debug-info" |
| 115 | else |
158 | else |
| 116 | myconf="${myconf} -release -no-separate-debug-info" |
159 | myconf="${myconf} -release -no-separate-debug-info" |
| 117 | fi |
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 |
| 118 | |
172 | |
| 119 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
173 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
| 120 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
174 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
| 121 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
175 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
| 122 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
176 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
| … | |
… | |
| 163 | # @DESCRIPTION: |
217 | # @DESCRIPTION: |
| 164 | # List variables that should be defined at the top of QtCore/qconfig.h |
218 | # List variables that should be defined at the top of QtCore/qconfig.h |
| 165 | QCONFIG_DEFINE="${QCONFIG_DEFINE:-}" |
219 | QCONFIG_DEFINE="${QCONFIG_DEFINE:-}" |
| 166 | |
220 | |
| 167 | install_qconfigs() { |
221 | install_qconfigs() { |
| 168 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} ]]; then |
|
|
| 169 | local x |
222 | local x |
|
|
223 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then |
| 170 | for x in QCONFIG_ADD QCONFIG_REMOVE; do |
224 | for x in QCONFIG_ADD QCONFIG_REMOVE; do |
| 171 | [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri |
225 | [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri |
| 172 | done |
226 | done |
| 173 | insinto ${QTDATADIR}/mkspecs/gentoo |
227 | insinto ${QTDATADIR}/mkspecs/gentoo |
| 174 | doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed" |
228 | doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed" |
|
|
229 | fi |
| 175 | |
230 | |
|
|
231 | if [[ -n ${QCONFIG_DEFINE} ]]; then |
| 176 | for x in ${QCONFIG_DEFINE}; do |
232 | for x in ${QCONFIG_DEFINE}; do |
| 177 | echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h |
233 | echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h |
| 178 | done |
234 | done |
| 179 | insinto ${QTHEADERDIR}/Gentoo |
235 | insinto ${QTHEADERDIR}/Gentoo |
| 180 | doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" |
236 | doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" |