| 1 | # Copyright 2007-2009 Gentoo Foundation |
1 | # Copyright 2007-2009 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.20 2009/02/11 21:14:59 yngwin Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.24 2009/02/15 00:11:50 hwoarang Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: qt4-build.eclass |
5 | # @ECLASS: qt4-build.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ben de Groot <yngwin@gentoo.org> |
7 | # Ben de Groot <yngwin@gentoo.org> |
| 8 | # Markos Chandras <hwoarang@gentoo.org> |
8 | # Markos Chandras <hwoarang@gentoo.org> |
| … | |
… | |
| 72 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
72 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
| 73 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
73 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
| 74 | echo |
74 | echo |
| 75 | ebeep 5 |
75 | ebeep 5 |
| 76 | fi |
76 | fi |
| 77 | } |
|
|
| 78 | |
77 | |
| 79 | qt4-build_src_unpack() { |
|
|
| 80 | local target targets |
|
|
| 81 | for target in configure LICENSE.{GPL2,GPL3} projects.pro \ |
|
|
| 82 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
|
|
| 83 | ${QT4_EXTRACT_DIRECTORIES}; do |
|
|
| 84 | targets="${targets} ${MY_P}/${target}" |
|
|
| 85 | done |
|
|
| 86 | |
|
|
| 87 | echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} |
|
|
| 88 | tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} |
|
|
| 89 | |
|
|
| 90 | case "${PV}" in |
|
|
| 91 | 4.4.?) |
|
|
| 92 | echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 |
|
|
| 93 | tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 |
|
|
| 94 | ;; |
|
|
| 95 | esac |
|
|
| 96 | |
|
|
| 97 | # Be backwards compatible for now |
|
|
| 98 | if [[ $EAPI != 2 ]]; then |
|
|
| 99 | qt4-build_src_prepare |
|
|
| 100 | fi |
|
|
| 101 | } |
|
|
| 102 | |
|
|
| 103 | qt4-build_src_prepare() { |
|
|
| 104 | cd "${S}" |
|
|
| 105 | |
|
|
| 106 | if [[ ${PN} != qt-core ]]; then |
|
|
| 107 | skip_qmake_build_patch |
|
|
| 108 | skip_project_generation_patch |
|
|
| 109 | symlink_binaries_to_buildtree |
|
|
| 110 | fi |
|
|
| 111 | |
|
|
| 112 | # Bug 253127 |
|
|
| 113 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
|
|
| 114 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
|
|
| 115 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
|
|
| 116 | fi |
|
|
| 117 | |
|
|
| 118 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
| 119 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
| 120 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
| 121 | -e "s:X11R6/::" \ |
|
|
| 122 | -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" |
|
|
| 123 | |
|
|
| 124 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
| 125 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
| 126 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
| 127 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
|
|
| 128 | } |
|
|
| 129 | |
|
|
| 130 | qt4-build_src_configure() { |
|
|
| 131 | if use custom-cxxflags; then |
78 | if use custom-cxxflags; then |
| 132 | echo |
79 | echo |
| 133 | ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the" |
80 | ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the" |
| 134 | ewarn "CXXFLAGS you have set in /etc/make.conf. This is not supported, and we" |
81 | ewarn "CXXFLAGS you have set in /etc/make.conf. This is not supported, and we" |
| 135 | ewarn "recommend to unset this useflag. But you are free to experiment with it." |
82 | ewarn "recommend to unset this useflag. But you are free to experiment with it." |
| 136 | ewarn "Just do not start crying if it breaks your system, or eats your kitten" |
83 | ewarn "Just do not start crying if it breaks your system, or eats your kitten" |
| 137 | ewarn "for breakfast. ;-) " |
84 | ewarn "for breakfast. ;-) " |
| 138 | echo |
85 | echo |
| 139 | else |
86 | fi |
|
|
87 | |
|
|
88 | } |
|
|
89 | |
|
|
90 | qt4-build_src_unpack() { |
|
|
91 | local target targets |
|
|
92 | for target in configure LICENSE.{GPL2,GPL3} projects.pro \ |
|
|
93 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
|
|
94 | ${QT4_EXTRACT_DIRECTORIES}; do |
|
|
95 | targets="${targets} ${MY_P}/${target}" |
|
|
96 | done |
|
|
97 | |
|
|
98 | echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} |
|
|
99 | tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} |
|
|
100 | |
|
|
101 | case "${PV}" in |
|
|
102 | 4.4.?) |
|
|
103 | echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 |
|
|
104 | tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 |
|
|
105 | ;; |
|
|
106 | esac |
|
|
107 | |
|
|
108 | # Be backwards compatible for now |
|
|
109 | if [[ $EAPI != 2 ]]; then |
|
|
110 | qt4-build_src_prepare |
|
|
111 | fi |
|
|
112 | } |
|
|
113 | |
|
|
114 | qt4-build_src_prepare() { |
|
|
115 | cd "${S}" |
|
|
116 | |
|
|
117 | if [[ ${PN} != qt-core ]]; then |
|
|
118 | skip_qmake_build_patch |
|
|
119 | skip_project_generation_patch |
|
|
120 | symlink_binaries_to_buildtree |
|
|
121 | fi |
|
|
122 | |
|
|
123 | if ! use custom-cxxflags;then |
| 140 | # Don't let the user go too overboard with flags. |
124 | # Don't let the user go too overboard with flags. |
| 141 | strip-flags |
125 | strip-flags |
| 142 | replace-flags -O3 -O2 |
126 | replace-flags -O3 -O2 |
| 143 | fi |
127 | fi |
| 144 | |
128 | |
|
|
129 | # Bug 253127 |
| 145 | # Unsupported old gcc versions - hardened needs this :( |
130 | # Unsupported old gcc versions - hardened needs this :( |
| 146 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
131 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
| 147 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
132 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
| 148 | append-cxxflags -fno-stack-protector |
133 | append-cxxflags -fno-stack-protector |
| 149 | fi |
134 | fi |
| … | |
… | |
| 151 | # Bug 178652 |
136 | # Bug 178652 |
| 152 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
137 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
| 153 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
138 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
| 154 | append-flags -fno-gcse |
139 | append-flags -fno-gcse |
| 155 | fi |
140 | fi |
|
|
141 | |
|
|
142 | # Bug 172219 |
|
|
143 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
144 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
145 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
146 | -e "s:X11R6/::" \ |
|
|
147 | -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" |
|
|
148 | |
|
|
149 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
150 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
151 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
152 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
|
|
153 | |
|
|
154 | } |
|
|
155 | |
|
|
156 | qt4-build_src_configure() { |
| 156 | |
157 | |
| 157 | myconf="$(standard_configure_options) ${myconf}" |
158 | myconf="$(standard_configure_options) ${myconf}" |
| 158 | |
159 | |
| 159 | echo ./configure ${myconf} |
160 | echo ./configure ${myconf} |
| 160 | ./configure ${myconf} || die "./configure failed" |
161 | ./configure ${myconf} || die "./configure failed" |