/[gentoo-x86]/eclass/qt4-build.eclass
Gentoo

Diff of /eclass/qt4-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.149 Revision 1.159
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2015 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.149 2013/08/13 10:05:37 pesa Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.159 2015/03/06 14:08:07 dlan Exp $
4 4
5# @ECLASS: qt4-build.eclass 5# @ECLASS: qt4-build.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Qt herd <qt@gentoo.org> 7# Qt herd <qt@gentoo.org>
8# @BLURB: Eclass for Qt4 split ebuilds. 8# @BLURB: Eclass for Qt4 split ebuilds.
12case ${EAPI} in 12case ${EAPI} in
13 4|5) : ;; 13 4|5) : ;;
14 *) die "qt4-build.eclass: unsupported EAPI=${EAPI:-0}" ;; 14 *) die "qt4-build.eclass: unsupported EAPI=${EAPI:-0}" ;;
15esac 15esac
16 16
17inherit eutils flag-o-matic multilib toolchain-funcs versionator 17inherit eutils flag-o-matic multilib toolchain-funcs
18 18
19if [[ ${PV} == *9999* ]]; then 19HOMEPAGE="https://www.qt.io/ https://qt-project.org/"
20 QT4_BUILD_TYPE="live"
21 inherit git-2
22else
23 QT4_BUILD_TYPE="release"
24fi
25
26HOMEPAGE="http://qt-project.org/ http://qt.digia.com/"
27LICENSE="|| ( LGPL-2.1 GPL-3 )" 20LICENSE="|| ( LGPL-2.1 GPL-3 )"
21SLOT="4"
28 22
29MY_PV=${PV/_/-} 23case ${PV} in
30MY_P=qt-everywhere-opensource-src-${MY_PV} 24 4.?.9999)
31 25 QT4_BUILD_TYPE="live"
32case ${QT4_BUILD_TYPE} in 26 EGIT_REPO_URI=(
33 live)
34 EGIT_REPO_URI="git://gitorious.org/qt/qt.git 27 "git://gitorious.org/qt/qt.git"
35 https://git.gitorious.org/qt/qt.git" 28 "https://git.gitorious.org/qt/qt.git"
29 )
36 EGIT_BRANCH=${PV%.9999} 30 EGIT_BRANCH=${PV%.9999}
31 inherit git-r3
37 ;; 32 ;;
38 release) 33 *)
34 QT4_BUILD_TYPE="release"
35 MY_P=qt-everywhere-opensource-src-${PV/_/-}
39 SRC_URI="http://download.qt-project.org/official_releases/qt/${PV%.*}/${PV}/${MY_P}.tar.gz" 36 SRC_URI="http://download.qt.io/archive/qt/${PV%.*}/${PV}/${MY_P}.tar.gz"
37 S=${WORKDIR}/${MY_P}
40 ;; 38 ;;
41esac 39esac
42 40
43IUSE="aqua debug pch" 41IUSE="aqua debug pch"
44[[ ${CATEGORY}/${PN} != dev-qt/qtwebkit ]] && IUSE+=" c++0x"
45[[ ${CATEGORY}/${PN} != dev-qt/qtxmlpatterns ]] && IUSE+=" +exceptions" 42[[ ${PN} != qtxmlpatterns ]] && IUSE+=" +exceptions"
46 43
47DEPEND="virtual/pkgconfig" 44DEPEND="virtual/pkgconfig"
48if [[ ${QT4_BUILD_TYPE} == live ]]; then 45if [[ ${QT4_BUILD_TYPE} == live ]]; then
49 DEPEND+=" dev-lang/perl" 46 DEPEND+=" dev-lang/perl"
50fi 47fi
51 48
52S=${WORKDIR}/${MY_P}
53
54# @FUNCTION: qt4-build_pkg_setup 49# @FUNCTION: qt4-build_pkg_setup
55# @DESCRIPTION: 50# @DESCRIPTION:
56# Sets up PATH and LD_LIBRARY_PATH. 51# Sets up PATH and LD_LIBRARY_PATH.
57qt4-build_pkg_setup() { 52qt4-build_pkg_setup() {
58 # Protect users by not allowing downgrades between releases. 53 # Warn users of possible breakage when downgrading to a previous release.
59 # Downgrading revisions within the same release should be allowed. 54 # Downgrading revisions within the same release is safe.
60 if has_version ">${CATEGORY}/${P}-r9999:4"; then 55 if has_version ">${CATEGORY}/${P}-r9999:4"; then
61 if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then 56 ewarn
62 eerror " *** Sanity check to keep you from breaking your system ***"
63 eerror "Downgrading Qt is completely unsupported and will break your system!"
64 die "aborting to save your system"
65 else
66 ewarn "Downgrading Qt is completely unsupported and will break your system!" 57 ewarn "Downgrading Qt is completely unsupported and can break your system!"
67 fi 58 ewarn
68 fi 59 fi
69 60
70 PATH="${S}/bin${PATH:+:}${PATH}" 61 PATH="${S}/bin${PATH:+:}${PATH}"
71 if [[ ${CHOST} != *-darwin* ]]; then 62 if [[ ${CHOST} != *-darwin* ]]; then
72 LD_LIBRARY_PATH="${S}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}" 63 LD_LIBRARY_PATH="${S}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
79 QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm 70 QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm
80 ${QT4_EXTRACT_DIRECTORIES}" 71 ${QT4_EXTRACT_DIRECTORIES}"
81 fi 72 fi
82} 73}
83 74
75# @ECLASS-VARIABLE: PATCHES
76# @DEFAULT_UNSET
77# @DESCRIPTION:
78# Array variable containing all the patches to be applied. This variable
79# is expected to be defined in the global scope of ebuilds. Make sure to
80# specify the full path. This variable is used in src_prepare phase.
81#
82# Example:
83# @CODE
84# PATCHES=(
85# "${FILESDIR}/mypatch.patch"
86# "${FILESDIR}/patches_folder/"
87# )
88# @CODE
89
84# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES 90# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES
85# @DEFAULT_UNSET 91# @DEFAULT_UNSET
86# @DESCRIPTION: 92# @DESCRIPTION:
87# Space-separated list including the directories that will be extracted from 93# Space-separated list of directories that will be extracted
88# Qt tarball. 94# from Qt tarball.
89 95
90# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES 96# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
91# @DEFAULT_UNSET 97# @DEFAULT_UNSET
92# @DESCRIPTION: 98# @DESCRIPTION:
93# Arguments for build_target_directories. Takes the directories in which the 99# Space-separated list of directories that will be configured,
94# code should be compiled. This is a space-separated list. 100# compiled, and installed. All paths must be relative to ${S}.
95 101
96# @FUNCTION: qt4-build_src_unpack 102# @FUNCTION: qt4-build_src_unpack
97# @DESCRIPTION: 103# @DESCRIPTION:
98# Unpacks the sources. 104# Unpacks the sources.
99qt4-build_src_unpack() { 105qt4-build_src_unpack() {
100 setqtenv 106 setqtenv
101 107
102 if ! version_is_at_least 4.1 $(gcc-version); then 108 if [[ $(gcc-major-version) -lt 4 ]] || [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ]]; then
109 ewarn
103 ewarn "Using a GCC version lower than 4.1 is not supported." 110 ewarn "Using a GCC version lower than 4.4 is not supported."
104 elif use_if_iuse c++0x && ! version_is_at_least 4.4 $(gcc-version); then 111 ewarn
105 ewarn "USE=c++0x requires GCC 4.4 or later."
106 fi 112 fi
107 113
108 if [[ ${CATEGORY}/${PN} == dev-qt/qtwebkit ]]; then 114 if [[ ${PN} == qtwebkit ]]; then
109 eshopts_push -s extglob 115 eshopts_push -s extglob
110 if is-flagq '-g?(gdb)?([1-9])'; then 116 if is-flagq '-g?(gdb)?([1-9])'; then
111 echo 117 ewarn
112 ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)." 118 ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)."
113 ewarn "You may experience really long compilation times and/or increased memory usage." 119 ewarn "You may experience really long compilation times and/or increased memory usage."
114 ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug." 120 ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug."
115 ewarn "For more info check out https://bugs.gentoo.org/307861" 121 ewarn "For more info check out https://bugs.gentoo.org/307861"
116 echo 122 ewarn
117 fi 123 fi
118 eshopts_pop 124 eshopts_pop
119 fi 125 fi
120 126
121 case ${QT4_BUILD_TYPE} in 127 case ${QT4_BUILD_TYPE} in
122 live) 128 live)
123 git-2_src_unpack 129 git-r3_src_unpack
124 ;; 130 ;;
125 release) 131 release)
126 local tarball="${MY_P}.tar.gz" target= targets= 132 local tarball="${MY_P}.tar.gz" target= targets=
127 for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \ 133 for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \
128 src/{qbase,qt_targets,qt_install}.pri bin config.tests \ 134 src/{qbase,qt_targets,qt_install}.pri bin config.tests \
136 eend $? || die "failed to unpack" 142 eend $? || die "failed to unpack"
137 ;; 143 ;;
138 esac 144 esac
139} 145}
140 146
141# @ECLASS-VARIABLE: PATCHES
142# @DEFAULT_UNSET
143# @DESCRIPTION:
144# PATCHES array variable containing all various patches to be applied.
145# This variable is expected to be defined in global scope of ebuild.
146# Make sure to specify the full path. This variable is utilised in
147# src_prepare() phase.
148#
149# @CODE
150# PATCHES=( "${FILESDIR}/mypatch.patch"
151# "${FILESDIR}/patches_folder/" )
152# @CODE
153
154# @FUNCTION: qt4-build_src_prepare 147# @FUNCTION: qt4-build_src_prepare
155# @DESCRIPTION: 148# @DESCRIPTION:
156# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix 149# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
157# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in make.conf. 150# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in make.conf.
158qt4-build_src_prepare() { 151qt4-build_src_prepare() {
161 if [[ ${QT4_BUILD_TYPE} == live ]]; then 154 if [[ ${QT4_BUILD_TYPE} == live ]]; then
162 QTDIR="." ./bin/syncqt || die "syncqt failed" 155 QTDIR="." ./bin/syncqt || die "syncqt failed"
163 fi 156 fi
164 157
165 # avoid X11 dependency in non-gui packages 158 # avoid X11 dependency in non-gui packages
166 local nolibx11_pkgs="qtcore qtdbus qtscript qtsql qttest qtxmlpatterns" 159 local nolibx11_pkgs="qtbearer qtcore qtdbus qtscript qtsql qttest qtxmlpatterns"
167 has ${PN} ${nolibx11_pkgs} && qt_nolibx11 160 has ${PN} ${nolibx11_pkgs} && qt_nolibx11
168 161
169 if use aqua; then 162 if use aqua; then
170 # provide a proper macx-g++-64 163 # provide a proper macx-g++-64
171 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) 164 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
179 skip_qmake_build 172 skip_qmake_build
180 skip_project_generation 173 skip_project_generation
181 symlink_binaries_to_buildtree 174 symlink_binaries_to_buildtree
182 fi 175 fi
183 176
184 if [[ ${CHOST} == *86*-apple-darwin* ]]; then
185 # qmake bus errors with -O2 or -O3 but -O1 works
186 # Bug 373061
187 replace-flags -O[23] -O1
188 fi
189
190 if use_if_iuse c++0x; then 177 if use_if_iuse c++0x; then
191 append-cxxflags -std=c++0x 178 append-cxxflags -std=c++0x
192 fi 179 fi
193 180
194 # Bug 261632 181 # Bug 261632
195 if use ppc64; then 182 if use ppc64; then
196 ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS"
197 append-flags -mminimal-toc 183 append-flags -mminimal-toc
184 fi
185
186 # Bug 373061
187 # qmake bus errors with -O2 or -O3 but -O1 works
188 if [[ ${CHOST} == *86*-apple-darwin* ]]; then
189 replace-flags -O[23] -O1
190 fi
191
192 # Bug 417105
193 # graphite on gcc 4.7 causes miscompilations
194 if [[ $(gcc-version) == "4.7" ]]; then
195 filter-flags -fgraphite-identity
198 fi 196 fi
199 197
200 # Respect CC, CXX, {C,CXX,LD}FLAGS in .qmake.cache 198 # Respect CC, CXX, {C,CXX,LD}FLAGS in .qmake.cache
201 sed -e "/^SYSTEM_VARIABLES=/i \ 199 sed -e "/^SYSTEM_VARIABLES=/i \
202 CC='$(tc-getCC)'\n\ 200 CC='$(tc-getCC)'\n\
325 ppc-macos) conf+=" -arch ppc" ;; 323 ppc-macos) conf+=" -arch ppc" ;;
326 ppc|ppc64|ppc-*) conf+=" -arch powerpc" ;; 324 ppc|ppc64|ppc-*) conf+=" -arch powerpc" ;;
327 sparc|sparc-*|sparc64-*) conf+=" -arch sparc" ;; 325 sparc|sparc-*|sparc64-*) conf+=" -arch sparc" ;;
328 x86-macos) conf+=" -arch x86" ;; 326 x86-macos) conf+=" -arch x86" ;;
329 x86|x86-*) conf+=" -arch i386" ;; 327 x86|x86-*) conf+=" -arch i386" ;;
330 alpha|arm|ia64|mips|s390) conf+=" -arch $(tc-arch)" ;; 328 alpha|arm|arm64|ia64|mips|s390) conf+=" -arch $(tc-arch)" ;;
331 hppa|sh) conf+=" -arch generic" ;; 329 hppa|sh) conf+=" -arch generic" ;;
332 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; 330 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
333 esac 331 esac
334 332
335 conf+=" -platform $(qt_mkspecs_dir)" 333 conf+=" -platform $(qt_mkspecs_dir)"

Legend:
Removed from v.1.149  
changed lines
  Added in v.1.159

  ViewVC Help
Powered by ViewVC 1.1.20