summaryrefslogtreecommitdiff
blob: 80a72852e9304a5e9e959dc8433b8b3e6d80d939 (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: gnome2-live.eclass
# @MAINTAINER:
# gnome@gentoo.org
# @AUTHOR:
# Nirbheek Chauhan <nirbheek@gentoo.org>
# @BLURB: Live ebuild phases for GNOME packages
# @DESCRIPTION:
# Exports additional functions used by live ebuilds written for GNOME packages
# Always to be imported *AFTER* gnome2.eclass

inherit autotools eutils gnome2 gnome2-utils libtool git-r3 xdg

EXPORTED_FUNCTIONS=" "
case "${EAPI:-0}" in
	4|5)
		EXPORT_FUNCTIONS src_unpack src_prepare pkg_postinst
		;;
	6)
		EXPORT_FUNCTIONS src_prepare pkg_postinst
		;;
	*)
		die "Unknown EAPI, Bug eclass maintainers." ;;
esac

# DEPEND on
# app-text/gnome-doc-utils for gnome-doc-*
# dev-util/gtk-doc for gtkdocize
# dev-util/intltool for intltoolize
# gnome-base/gnome-common for GNOME_COMMON_INIT
DEPEND="${DEPEND}
	app-text/gnome-doc-utils
	app-text/yelp-tools
	dev-util/gtk-doc
	dev-util/intltool
	gnome-base/gnome-common
	sys-devel/gettext"

# Extra options passed to elibtoolize
ELTCONF=${ELTCONF:-}

# @ECLASS-VARIABLE: GNOME_LIVE_MODULE
# @DESCRIPTION:
# Default git module name is assumed to be the same as the gnome.org module name
# used on ftp.gnome.org. We have GNOME_ORG_MODULE because we inherit gnome.org
: ${GNOME_LIVE_MODULE:="${GNOME_ORG_MODULE}"}

# @ECLASS-VARIABLE: EGIT_REPO_URI
# @DESCRIPTION:
# git URI for the project, uses GNOME_LIVE_MODULE by default
: "${EGIT_REPO_URI:="https://gitlab.gnome.org/GNOME/${GNOME_LIVE_MODULE}.git"}"

# @ECLASS-VARIABLE: PATCHES
# @DESCRIPTION:
# Whitespace-separated list of patches to apply after cloning
: ${PATCHES:=""}

# Unset SRC_URI auto-set by gnome2.eclass
SRC_URI=""

# @FUNCTION: gnome2-live_get_var
# @DESCRIPTION:
# Get macro variable values from configure.ac, etc
gnome2-live_get_var() {
	local var f
	var="$1"
	f="$2"
	echo $(sed -ne "s/${var}(\(.*\))/\1/p" "${f}" | tr -d '[]')
}

# @FUNCTION: gnome2-live_src_unpack
# @DESCRIPTION:
# Calls git-2_src_unpack, and unpacks ${A} if required.
# Also calls gnome2-live_src_prepare for older EAPI.
gnome2-live_src_unpack() {
	if has ${EAPI:-0} 4 5 ; then
		if test -n "${A}"; then
			unpack ${A}
		fi
		git-r3_src_unpack
		gnome2-live_src_prepare
	else
		die "gnome2-live_src_unpack is banned starting with EAPI=6"
	fi
}

# @FUNCTION: gnome2-live_src_prepare
# @DESCRIPTION:
# Lots of magic to workaround autogen.sh quirks in various packages
# Creates blank ChangeLog and necessary macro dirs. Runs various autotools
# programs if required, and finally runs eautoreconf.
gnome2-live_src_prepare() {
	if has ${EAPI:-0} 4 5 ; then
		for i in ${PATCHES}; do
			epatch "${i}"
		done

		epatch_user
	fi

	# If ChangeLog doesn't exist, maybe it's autogenerated
	# Avoid a `dodoc` failure by adding an empty ChangeLog
	if ! test -e ChangeLog; then
		echo > ChangeLog
	fi

	### Keep this in-sync with gnome2.eclass!

	xdg_src_prepare

	# eautoreconf is smart enough to run all necessary commands
	eautoreconf

	# Prevent assorted access violations and test failures
	gnome2_environment_reset

	# Prevent scrollkeeper access violations
	# We stop to run it from EAPI=6 as scrollkeeper helpers from
	# rarian are not running anything and, then, access violations
	# shouldn't occur.
	has ${EAPI:-0} 4 5 && gnome2_omf_fix

	# Run libtoolize
	# https://bugzilla.gnome.org/show_bug.cgi?id=655517
	elibtoolize ${ELTCONF}
}

# @FUNCTION: gnome2_src_unpack
# @DESCRIPTION:
# Defined so that it replaces gnome2_src_unpack in ebuilds that call it
gnome2_src_unpack() {
	gnome2-live_src_unpack
}

# @FUNCTION: gnome2_src_prepare
# @DESCRIPTION:
# Defined so that it replaces gnome2_src_prepare in ebuilds that call it
gnome2_src_prepare() {
	gnome2-live_src_prepare
}

# @FUNCTION: gnome2-live_pkg_postinst
# @DESCRIPTION:
# Must be run manually for ebuilds that have a custom pkg_postinst
gnome2-live_pkg_postinst() {
	gnome2_pkg_postinst

	ewarn "This is a live ebuild, upstream trunks will mostly be UNstable"
	ewarn "Do NOT report bugs about this package to Gentoo"
	ewarn "Report upstream bugs (with patches if possible) instead."
}