aboutsummaryrefslogtreecommitdiff
blob: e07e65d78f98fa50d377da8086fdaba216cb8adb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: qt4-build-edge.eclass
# @MAINTAINER:
# Qt herd <qt@gentoo.org>
# @BLURB: Eclass for Qt4 split ebuilds in qting-edge overlay.
# @DESCRIPTION:
# This eclass contains various functions that are used when building Qt4.

# WARNING: This eclass requires EAPI 2, 3 or 4
#
# NOTES:
#
#	4.9999 and 4.?.9999[-kde-qt]
#			stands for live ebuilds from qtsoftware's git repository
#			(that is Nokia, previously trolltech)
#	4.?.9999[kde-qt]
#			stands for live ebuilds from kde-qt git repository
#	4.*.*_{beta,rc,}* and *
#			are official releases or snapshots from Nokia
#

MY_EGIT_COMMIT=${EGIT_COMMIT:=}

inherit eutils git-2 qt4-build

if [[ ${PV} == *.9999 ]]; then
	SRC_URI=
	DEPEND="dev-lang/perl"
fi

# @FUNCTION: qt4-build-edge_pkg_setup
# @DESCRIPTION:
# Sets up PATH, {,DY}LD_LIBRARY_PATH and EGIT_* variables.
qt4-build-edge_pkg_setup() {
	debug-print-function $FUNCNAME "$@"

	MY_PV_EXTRA="${PV}"

	case "${MY_PV_EXTRA}" in
		4.?.9999)
			EGIT_REPO_URI="git://gitorious.org/qt/qt.git"
			EGIT_PROJECT="qt-${PV}"
			EGIT_BRANCH="${MY_PV_EXTRA/.9999}"
			;;
		4.9999)
			EGIT_REPO_URI="git://gitorious.org/qt/qt.git"
			EGIT_PROJECT="qt-${PV}"
			EGIT_BRANCH="master"
			;;
	esac

	EGIT_COMMIT=${MY_EGIT_COMMIT:=${EGIT_BRANCH}}

	# Let users know what they are getting themselves into ;-)
	if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
		echo
		ewarn "Please file bugs on bugs.gentoo.org and prepend the summary"
		ewarn "with [qting-edge]. Alternatively, contact <qt@gentoo.org>."
		ewarn "Thank you for using qting-edge overlay."
		ewarn
		case "${MY_PV_EXTRA}" in
			4.?.9999 | 4.9999)
				ewarn "The ${PV} version ebuilds install live git code from Nokia Qt Software."
				;;
			4.*.*_*)
				ewarn "The ${PV} version ebuilds install a pre-release from Nokia Qt Software."
				;;
		esac
		echo
	fi

	qt4-build_pkg_setup
}

# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
# @DESCRIPTION:
# Arguments for build_target_directories. Takes the directories in which the
# code should be compiled. This is a space-separated list of relative paths.

# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES
# @DESCRIPTION:
# Space-separated list of directories that will be extracted from Qt tarball.

# @FUNCTION: qt4-build-edge_src_unpack
# @DESCRIPTION:
# Unpacks the sources.
qt4-build-edge_src_unpack() {
	debug-print-function $FUNCNAME "$@"
	setqtenv

	local target= targets=
	for target in configure LICENSE.{GPL3,LGPL} projects.pro \
			src/{qbase,qt_targets,qt_install}.pri \
			bin config.tests mkspecs qmake \
			${QT4_EXTRACT_DIRECTORIES}; do
		targets+=" ${MY_P}/${target}"
	done

	case "${PV}" in
		*.9999)
			git-2_src_unpack
			;;
		*)
			echo tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets}
			tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} || die
			;;
	esac
}

# @ECLASS-VARIABLE: PATCHES
# @DESCRIPTION:
# In case you have patches to apply, specify them here. Make sure to specify
# the full path. This variable is necessary for src_prepare phase.
# Example:
# PATCHES=( "${FILESDIR}"/mypatch.patch
# "${FILESDIR}"/mypatch2.patch )

# @FUNCTION: qt4-build-edge_src_prepare
# @DESCRIPTION:
# Prepares the sources before the configure phase. Strips C(XX)FLAGS if necessary, and fixes
# source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf.
qt4-build-edge_src_prepare() {
	debug-print-function $FUNCNAME "$@"
	generate_include
	# We need to remove any specific hardcoded compiler flags
	sed -i -e '/^QMAKE_CFLAGS[^_.*]/s:\+=.*:=:' \
		-e '/^QMAKE_CXXFLAGS[^_.*]/s:\+=.*:=:' \
		-e '/^QMAKE_LFLAGS[^_.*]/s:\+=.*:=:' \
		"${S}"/mkspecs/common/g++.conf

	qt4-build_src_prepare
}

# @FUNCTION: qt4-build-edge_src_configure
# @DESCRIPTION:
# Runs ./configure with appropriate arguments. You can use
# the ${myconf} variable to pass additional arguments.
qt4-build-edge_src_configure() {
	debug-print-function $FUNCNAME "$@"
	qt4-build_src_configure
}

# @FUNCTION: qt4-build-edge_src_compile
# @DESCRIPTION:
# Compiles the code in ${QT4_TARGET_DIRECTORIES}.
qt4-build-edge_src_compile() {
	debug-print-function $FUNCNAME "$@"
	qt4-build_src_compile
}

# @FUNCTION: qt4-build-edge_src_install
# @DESCRIPTION:
# Performs the actual installation including some library fixes.
qt4-build-edge_src_install() {
	debug-print-function $FUNCNAME "$@"
	qt4-build_src_install
}

# @FUNCTION: qt4-build-edge_src_test
# @DESCRIPTION:
# Runs make check in target directories only (required for live ebuilds).
qt4-build-edge_src_test() {
	debug-print-function $FUNCNAME "$@"
	qt4-build_src_test
}

# @FUNCTION: qt4-build-edge_pkg_postrm
# @DESCRIPTION:
# Generates configuration when the package is completely removed.
qt4-build-edge_pkg_postrm() {
	debug-print-function $FUNCNAME "$@"
	qt4-build_pkg_postrm
}

# @FUNCTION: qt4-build-edge_pkg_postinst
# @DESCRIPTION:
# Generates configuration after the package is installed.
qt4-build-edge_pkg_postinst() {
	debug-print-function $FUNCNAME "$@"
	qt4-build_pkg_postinst
}

# @FUNCTION: generate_include
# @DESCRIPTION:
# Internal function, required for live ebuilds.
generate_include() {
	QTDIR="." perl bin/syncqt
}

EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst