/[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.145 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.145 2013/04/07 21:14:46 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.
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
12case ${EAPI} in 12case ${EAPI} in
13 3|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 *)
39 SRC_URI="http://releases.qt-project.org/qt4/source/${MY_P}.tar.gz" 34 QT4_BUILD_TYPE="release"
35 MY_P=qt-everywhere-opensource-src-${PV/_/-}
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."
111 ewarn
104 fi 112 fi
105 113
106 if [[ ${CATEGORY}/${PN} == dev-qt/qtwebkit ]]; then 114 if [[ ${PN} == qtwebkit ]]; then
107 eshopts_push -s extglob 115 eshopts_push -s extglob
108 if is-flagq '-g?(gdb)?([1-9])'; then 116 if is-flagq '-g?(gdb)?([1-9])'; then
109 echo 117 ewarn
110 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)."
111 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."
112 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."
113 ewarn "For more info check out https://bugs.gentoo.org/307861" 121 ewarn "For more info check out https://bugs.gentoo.org/307861"
114 echo 122 ewarn
115 fi 123 fi
116 eshopts_pop 124 eshopts_pop
117 fi 125 fi
118 126
119 case ${QT4_BUILD_TYPE} in 127 case ${QT4_BUILD_TYPE} in
120 live) 128 live)
121 git-2_src_unpack 129 git-r3_src_unpack
122 ;; 130 ;;
123 release) 131 release)
124 local tarball="${MY_P}.tar.gz" target= targets= 132 local tarball="${MY_P}.tar.gz" target= targets=
125 for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \ 133 for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \
126 src/{qbase,qt_targets,qt_install}.pri bin config.tests \ 134 src/{qbase,qt_targets,qt_install}.pri bin config.tests \
134 eend $? || die "failed to unpack" 142 eend $? || die "failed to unpack"
135 ;; 143 ;;
136 esac 144 esac
137} 145}
138 146
139# @ECLASS-VARIABLE: PATCHES
140# @DEFAULT_UNSET
141# @DESCRIPTION:
142# PATCHES array variable containing all various patches to be applied.
143# This variable is expected to be defined in global scope of ebuild.
144# Make sure to specify the full path. This variable is utilised in
145# src_prepare() phase.
146#
147# @CODE
148# PATCHES=( "${FILESDIR}/mypatch.patch"
149# "${FILESDIR}/patches_folder/" )
150# @CODE
151
152# @FUNCTION: qt4-build_src_prepare 147# @FUNCTION: qt4-build_src_prepare
153# @DESCRIPTION: 148# @DESCRIPTION:
154# 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
155# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in /etc/make.conf. 150# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in make.conf.
156qt4-build_src_prepare() { 151qt4-build_src_prepare() {
157 setqtenv 152 setqtenv
158 153
159 if [[ ${QT4_BUILD_TYPE} == live ]]; then 154 if [[ ${QT4_BUILD_TYPE} == live ]]; then
160 QTDIR="." ./bin/syncqt || die "syncqt failed" 155 QTDIR="." ./bin/syncqt || die "syncqt failed"
161 fi 156 fi
162 157
163 # avoid X11 dependency in non-gui packages 158 # avoid X11 dependency in non-gui packages
164 local nolibx11_pkgs="qtcore qtdbus qtscript qtsql qttest qtxmlpatterns" 159 local nolibx11_pkgs="qtbearer qtcore qtdbus qtscript qtsql qttest qtxmlpatterns"
165 has ${PN} ${nolibx11_pkgs} && qt_nolibx11 160 has ${PN} ${nolibx11_pkgs} && qt_nolibx11
166 161
167 if use aqua; then 162 if use aqua; then
168 # provide a proper macx-g++-64 163 # provide a proper macx-g++-64
169 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) 164 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
177 skip_qmake_build 172 skip_qmake_build
178 skip_project_generation 173 skip_project_generation
179 symlink_binaries_to_buildtree 174 symlink_binaries_to_buildtree
180 fi 175 fi
181 176
182 if [[ ${CHOST} == *86*-apple-darwin* ]]; then
183 # qmake bus errors with -O2 or -O3 but -O1 works
184 # Bug 373061
185 replace-flags -O[23] -O1
186 fi
187
188 # Bug 178652
189 if [[ $(gcc-major-version) == 3 ]] && use amd64; then
190 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
191 append-flags -fno-gcse
192 fi
193
194 if use_if_iuse c++0x; then 177 if use_if_iuse c++0x; then
195 append-cxxflags -std=c++0x 178 append-cxxflags -std=c++0x
196 fi 179 fi
197 180
198 # Unsupported old gcc versions - hardened needs this :(
199 if [[ $(gcc-major-version) -lt 4 ]]; then
200 ewarn "Appending -fno-stack-protector to CXXFLAGS"
201 append-cxxflags -fno-stack-protector
202 # Bug 253127
203 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
204 -i mkspecs/common/g++.conf || die
205 fi
206
207 # Bug 261632 181 # Bug 261632
208 if use ppc64; then 182 if use ppc64; then
209 ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS"
210 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
211 fi 196 fi
212 197
213 # Respect CC, CXX, {C,CXX,LD}FLAGS in .qmake.cache 198 # Respect CC, CXX, {C,CXX,LD}FLAGS in .qmake.cache
214 sed -e "/^SYSTEM_VARIABLES=/i \ 199 sed -e "/^SYSTEM_VARIABLES=/i \
215 CC='$(tc-getCC)'\n\ 200 CC='$(tc-getCC)'\n\
338 ppc-macos) conf+=" -arch ppc" ;; 323 ppc-macos) conf+=" -arch ppc" ;;
339 ppc|ppc64|ppc-*) conf+=" -arch powerpc" ;; 324 ppc|ppc64|ppc-*) conf+=" -arch powerpc" ;;
340 sparc|sparc-*|sparc64-*) conf+=" -arch sparc" ;; 325 sparc|sparc-*|sparc64-*) conf+=" -arch sparc" ;;
341 x86-macos) conf+=" -arch x86" ;; 326 x86-macos) conf+=" -arch x86" ;;
342 x86|x86-*) conf+=" -arch i386" ;; 327 x86|x86-*) conf+=" -arch i386" ;;
343 alpha|arm|ia64|mips|s390) conf+=" -arch $(tc-arch)" ;; 328 alpha|arm|arm64|ia64|mips|s390) conf+=" -arch $(tc-arch)" ;;
344 hppa|sh) conf+=" -arch generic" ;; 329 hppa|sh) conf+=" -arch generic" ;;
345 *) 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." ;;
346 esac 331 esac
347 332
348 conf+=" -platform $(qt_mkspecs_dir)" 333 conf+=" -platform $(qt_mkspecs_dir)"
550 AR="$(tc-getAR) cqs" \ 535 AR="$(tc-getAR) cqs" \
551 CC="$(tc-getCC)" \ 536 CC="$(tc-getCC)" \
552 CXX="$(tc-getCXX)" \ 537 CXX="$(tc-getCXX)" \
553 LINK="$(tc-getCXX)" \ 538 LINK="$(tc-getCXX)" \
554 RANLIB=":" \ 539 RANLIB=":" \
555 STRIP=":" \ 540 STRIP=":"
556 || die "emake failed"
557 popd >/dev/null || die 541 popd >/dev/null || die
558 done 542 done
559} 543}
560 544
561# @FUNCTION: install_directories 545# @FUNCTION: install_directories
564# @DESCRIPTION: 548# @DESCRIPTION:
565# Runs emake install in the given directories, which are separated by spaces. 549# Runs emake install in the given directories, which are separated by spaces.
566install_directories() { 550install_directories() {
567 for x in "$@"; do 551 for x in "$@"; do
568 pushd "${S}"/${x} >/dev/null || die 552 pushd "${S}"/${x} >/dev/null || die
569 emake INSTALL_ROOT="${D}" install || die "emake install failed" 553 emake INSTALL_ROOT="${D}" install
570 popd >/dev/null || die 554 popd >/dev/null || die
571 done 555 done
572} 556}
573 557
574# @ECLASS-VARIABLE: QCONFIG_ADD 558# @ECLASS-VARIABLE: QCONFIG_ADD
595 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then 579 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
596 for x in QCONFIG_ADD QCONFIG_REMOVE; do 580 for x in QCONFIG_ADD QCONFIG_REMOVE; do
597 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri 581 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
598 done 582 done
599 insinto ${QTDATADIR#${EPREFIX}}/mkspecs/gentoo 583 insinto ${QTDATADIR#${EPREFIX}}/mkspecs/gentoo
600 doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed" 584 doins "${T}"/${PN}-qconfig.pri
601 fi 585 fi
602 586
603 if [[ -n ${QCONFIG_DEFINE} ]]; then 587 if [[ -n ${QCONFIG_DEFINE} ]]; then
604 for x in ${QCONFIG_DEFINE}; do 588 for x in ${QCONFIG_DEFINE}; do
605 echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h 589 echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h
606 done 590 done
607 insinto ${QTHEADERDIR#${EPREFIX}}/Gentoo 591 insinto ${QTHEADERDIR#${EPREFIX}}/Gentoo
608 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" 592 doins "${T}"/gentoo-${PN}-qconfig.h
609 fi 593 fi
610} 594}
611 595
612# @FUNCTION: generate_qconfigs 596# @FUNCTION: generate_qconfigs
613# @INTERNAL 597# @INTERNAL
803} 787}
804 788
805# @FUNCTION: qt_nolibx11 789# @FUNCTION: qt_nolibx11
806# @INTERNAL 790# @INTERNAL
807# @DESCRIPTION: 791# @DESCRIPTION:
808# Ignore X11 tests for packages that don't need X libraries installed. 792# Skip X11 tests for packages that don't need X libraries installed.
809qt_nolibx11() { 793qt_nolibx11() {
810 sed -i "/unixtests\/compile.test.*config.tests\/x11\/xlib/,/fi$/d" "${S}"/configure || 794 sed -i -e '/^if.*PLATFORM_X11.*CFG_GUI/,/^fi$/d' "${S}"/configure || die
811 die "x11 check sed failed"
812} 795}
813 796
814EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst 797EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst

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

  ViewVC Help
Powered by ViewVC 1.1.20