| 1 | # Copyright 2005 Gentoo Foundation |
1 | # Copyright 2005 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.2 2007/12/21 21:10:34 caleb Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.6 2007/12/23 20:48:30 caleb 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: |
| … | |
… | |
| 15 | IUSE="${IUSE} debug" |
15 | IUSE="${IUSE} debug" |
| 16 | |
16 | |
| 17 | qt4-build_pkg_setup() { |
17 | qt4-build_pkg_setup() { |
| 18 | # Set up installation directories |
18 | # Set up installation directories |
| 19 | |
19 | |
| 20 | QTBASEDIR=/usr/$(get_libdir)/qt4 |
20 | QTBASEDIR=/usr/$(get_libdir)/qt4 |
| 21 | QTPREFIXDIR=/usr |
21 | QTPREFIXDIR=/usr |
| 22 | QTBINDIR=/usr/bin |
22 | QTBINDIR=/usr/bin |
| 23 | QTLIBDIR=/usr/$(get_libdir)/qt4 |
23 | QTLIBDIR=/usr/$(get_libdir)/qt4 |
| 24 | QTPCDIR=/usr/$(get_libdir)/pkgconfig |
24 | QTPCDIR=/usr/$(get_libdir)/pkgconfig |
| 25 | QTDATADIR=/usr/share/qt4 |
25 | QTDATADIR=/usr/share/qt4 |
| 26 | QTDOCDIR=/usr/share/doc/${PF} |
26 | QTDOCDIR=/usr/share/doc/qt-${PV} |
| 27 | QTHEADERDIR=/usr/include/qt4 |
27 | QTHEADERDIR=/usr/include/qt4 |
| 28 | QTPLUGINDIR=${QTLIBDIR}/plugins |
28 | QTPLUGINDIR=${QTLIBDIR}/plugins |
| 29 | QTSYSCONFDIR=/etc/qt4 |
29 | QTSYSCONFDIR=/etc/qt4 |
| 30 | QTTRANSDIR=${QTDATADIR}/translations |
30 | QTTRANSDIR=${QTDATADIR}/translations |
| 31 | QTEXAMPLESDIR=${QTDATADIR}/examples |
31 | QTEXAMPLESDIR=${QTDATADIR}/examples |
| 32 | QTDEMOSDIR=${QTDATADIR}/demos |
32 | QTDEMOSDIR=${QTDATADIR}/demos |
| 33 | |
33 | |
| 34 | PLATFORM=$(qt_mkspecs_dir) |
34 | PLATFORM=$(qt_mkspecs_dir) |
| 35 | |
35 | |
| 36 | PATH="${S}/bin:${PATH}" |
36 | PATH="${S}/bin:${PATH}" |
| 37 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
37 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
| 38 | } |
38 | } |
| 39 | |
39 | |
| … | |
… | |
| 50 | ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" |
50 | ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" |
| 51 | append-flags -fno-stack-protector |
51 | append-flags -fno-stack-protector |
| 52 | fi |
52 | fi |
| 53 | } |
53 | } |
| 54 | |
54 | |
|
|
55 | qt4-build_src_install() { |
|
|
56 | install_directories "${QT4_TARGET_DIRECTORIES}" |
|
|
57 | fix_library_files |
|
|
58 | } |
|
|
59 | |
| 55 | standard_configure_options() { |
60 | standard_configure_options() { |
| 56 | local myconf="" |
61 | local myconf="" |
| 57 | |
62 | |
| 58 | [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)" |
63 | [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)" |
| 59 | |
64 | |
| … | |
… | |
| 68 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \ |
73 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \ |
| 69 | -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \ |
74 | -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \ |
| 70 | -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \ |
75 | -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \ |
| 71 | -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}" |
76 | -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}" |
| 72 | |
77 | |
| 73 | myconf="${myconf} -fast -reduce-relocations -nomake examples -nomake demos" |
78 | myconf="${myconf} -silent -fast -reduce-relocations -nomake examples -nomake demos" |
| 74 | |
79 | |
| 75 | echo "${myconf}" |
80 | echo "${myconf}" |
|
|
81 | } |
|
|
82 | |
|
|
83 | build_target_directories() { |
|
|
84 | build_directories "${QT4_TARGET_DIRECTORIES}" |
| 76 | } |
85 | } |
| 77 | |
86 | |
| 78 | build_directories() { |
87 | build_directories() { |
| 79 | local dirs="$@" |
88 | local dirs="$@" |
| 80 | for x in ${dirs}; do |
89 | for x in ${dirs}; do |
| 81 | cd "${S}"/${x} |
90 | cd "${S}"/${x} |
| 82 | "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" && emake || die |
91 | "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" && emake || die |
| 83 | done |
92 | done |
| 84 | } |
93 | } |
| 85 | |
94 | |
| 86 | install_directories() { |
95 | install_directories() { |
| 87 | local dirs="$@" |
96 | local dirs="$@" |
| … | |
… | |
| 132 | dodir ${QTPCDIR} |
141 | dodir ${QTPCDIR} |
| 133 | mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR} |
142 | mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR} |
| 134 | } |
143 | } |
| 135 | |
144 | |
| 136 | qt_use() { |
145 | qt_use() { |
| 137 | local flag="$1" |
146 | local flag="$1" |
| 138 | local feature="$1" |
147 | local feature="$1" |
| 139 | local enableval= |
148 | local enableval= |
| 140 | |
149 | |
| 141 | [[ -n $2 ]] && feature=$2 |
150 | [[ -n $2 ]] && feature=$2 |
| 142 | [[ -n $3 ]] && enableval="-$3" |
151 | [[ -n $3 ]] && enableval="-$3" |
| 143 | |
152 | |
| 144 | useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}" |
153 | useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}" |
| 145 | return 0 |
154 | return 0 |
| 146 | } |
155 | } |
| 147 | |
156 | |
| 148 | qt_mkspecs_dir() { |
157 | qt_mkspecs_dir() { |
| 149 | # Allows us to define which mkspecs dir we want to use. |
158 | # Allows us to define which mkspecs dir we want to use. |
| 150 | local spec |
159 | local spec |
| 151 | |
160 | |
| 152 | case ${CHOST} in |
161 | case ${CHOST} in |
| 153 | *-freebsd*|*-dragonfly*) |
162 | *-freebsd*|*-dragonfly*) |
| 154 | spec="freebsd" ;; |
163 | spec="freebsd" ;; |
| 155 | *-openbsd*) |
164 | *-openbsd*) |
| 156 | spec="openbsd" ;; |
165 | spec="openbsd" ;; |
| 157 | *-netbsd*) |
166 | *-netbsd*) |
| 158 | spec="netbsd" ;; |
167 | spec="netbsd" ;; |
| 159 | *-darwin*) |
168 | *-darwin*) |
| 160 | spec="darwin" ;; |
169 | spec="darwin" ;; |
| 161 | *-linux-*|*-linux) |
170 | *-linux-*|*-linux) |
| 162 | spec="linux" ;; |
171 | spec="linux" ;; |
| 163 | *) |
172 | *) |
| 164 | die "Unknown CHOST, no platform choosed." |
173 | die "Unknown CHOST, no platform choosed." |
| 165 | esac |
174 | esac |
| 166 | |
175 | |
| 167 | CXX=$(tc-getCXX) |
176 | CXX=$(tc-getCXX) |
| 168 | if [[ ${CXX/g++/} != ${CXX} ]]; then |
177 | if [[ ${CXX/g++/} != ${CXX} ]]; then |
| 169 | spec="${spec}-g++" |
178 | spec="${spec}-g++" |
| 170 | elif [[ ${CXX/icpc/} != ${CXX} ]]; then |
179 | elif [[ ${CXX/icpc/} != ${CXX} ]]; then |
| 171 | spec="${spec}-icc" |
180 | spec="${spec}-icc" |
| 172 | else |
181 | else |
| 173 | die "Unknown compiler ${CXX}." |
182 | die "Unknown compiler ${CXX}." |
| 174 | fi |
183 | fi |
| 175 | |
184 | |
| 176 | echo "${spec}" |
185 | echo "${spec}" |
| 177 | } |
186 | } |
| 178 | |
187 | |
| 179 | EXPORT_FUNCTIONS pkg_setup src-unpack |
188 | EXPORT_FUNCTIONS pkg_setup src_unpack src_install |