aboutsummaryrefslogtreecommitdiff
blob: 50aa754500d92590ff691ba967234fe690f280f7 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: clutter-multilib.eclass
# @MAINTAINER:
# Nobody
# @AUTHOR:
# Nirbheek Chauhan <nirbheek@gentoo.org>
# Greg Turner <gmt@be-evil.net>
# @BLURB: Sets SRC_URI, LICENSE, etc and exports src_install function.
# descendant of clutter.eclass which reimplements src_install in a
# multilib-build-compatible manner.

# EAPI=4 is required by our super-eclasses
case ${EAPI:-0} in
	4|5) ;;
	*) die "EAPI=${EAPI} is not supported" ;;
esac

HOMEPAGE="http://www.clutter-project.org/"
inherit eutils ehooker versionator multilib-build

RV=($(get_version_components))
SRC_URI="http://www.clutter-project.org/sources/${PN}/${RV[0]}.${RV[1]}/${P}.tar.bz2"

# All official clutter packages use LGPL-2.1 or later
LICENSE="${LICENSE:-LGPL-2.1+}"

# This will be used by all clutter packages
DEPEND="virtual/pkgconfig"

# @ECLASS-VARIABLE: CLUTTER_LA_PUNT
# @DESCRIPTION:
# Set to anything except 'no' to remove *all* .la files before installing.
# Not to be used without due consideration, sometimes .la files *are* needed.
CLUTTER_LA_PUNT="${CLUTTER_LA_PUNT:-"no"}"

# @ECLASS-VARIABLE: DOCS
# @DESCRIPTION:
# This variable holds an array of relative paths of files to be dodoc-ed.
# By default, it contains the standard list of autotools doc files.
# Because clutter declares it as a non-array by default, we adapt it here;
# this way, if other -multilib eclasses (most of which use an array for DOCS)
# are involved at the ebuild level, the right thing is more likely to happen
if [[ $(declare -p DOCS 2>/dev/null ) != declare\ -a* ]] ; then
	declare -a DOCS=( ${DOCS} )
fi

DOCS+=( AUTHORS ChangeLog NEWS README TODO )

# @ECLASS-VARIABLE: EXAMPLES
# @DESCRIPTION:
# This variable holds relative paths of files to be added as examples when the
# "examples" USE-flag exists, and is switched on. Bash expressions can be used
# since the variable is eval-ed before substitution. Empty by default.
EXAMPLES="${EXAMPLES:-""}"

# @FUNCTION: clutter-multilib_src_install
# @DESCRIPTION:
# Runs emake install for each abi, dodoc, and installs examples
# Performs @GET_LIBDIR@ substitution on arguments
# Fires the clutter-multilib-{pre,post}_src_install ehooks
# Checks header installation for abi-conflicts
clutter-multilib_src_install() {
	debug-print-function "${FUNCNAME}" "$@"

	if [[ $(declare -p DOCS) != declare\ -a* ]] ; then
		declare -a DOCS=( ${DOCS} )
	fi

	_clutter_multilib_secure_install() { 
		debug-print-function "${FUNCNAME}" "$@"

		# perform @GET_LIBDIR@ substitution on arguments
		declare -a clutter_multilib_install_args=()
		for arg in DESTDIR="${D}" install "$@" ; do
			clutter_multilib_install_args+=( "$(get_libdir_subst "${arg}")" )
		done

		#ehook_fire and emake install
		if ehook_fire clutter-multilib-per-abi-pre_src_install ; then
			if ( ! multilib_is_best_abi ) || ehook_fire clutter-multilib-best-abi-pre_src_install ; then
				emake "${clutter_multilib_install_args[@]}"
			fi
		fi
		multilib_is_best_abi && ehook_fire clutter-multilib-best-abi-post_src_install -u
		ehook_fire clutter-multilib-per-abi-post_src_install -u

		# Do multilib magic only when >1 ABI is used.
		if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]]; then
			multilib_prepare_wrappers
			# Make sure all headers are the same for each ABI.
			multilib_check_headers
		fi
	}

	if ehook_fire clutter-multilib-global-pre_src_install ; then
		multilib_foreach_abi multilib-build_run_in_build_dir _clutter_multilib_secure_install "$@"
		multilib_install_wrappers

		pushd "${S}" > /dev/null || die

		dodoc "${DOCS[@]}"

		# examples
		if has examples ${IUSE} && use examples; then
			insinto /usr/share/doc/${PF}/examples

			# We use eval to be able to use globs and other bash expressions
			for example in $(eval echo ${EXAMPLES}); do
				# If directory
				if [[ ${example: -1} == "/" ]]; then
					doins -r ${example}
				else
					doins ${example}
				fi
			done
		fi

		popd > /dev/null || die

		# Delete all .la files
		if [[ "${CLUTTER_LA_PUNT}" != "no" ]]; then
			prune_libtool_files --all
		fi
	fi
	pushd "${S}" > /dev/null || die
	ehook_fire clutter-multilib-global-post_src_install -u
	popd > /dev/null || die
}

EXPORT_FUNCTIONS src_install