summaryrefslogtreecommitdiff
blob: a664a5a010a743dbad05332b0e7b4f7f19e96406 (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu-guest-agent/qemu-guest-agent-2.1.2.ebuild,v 1.2 2015/02/15 01:28:20 vapier Exp $

EAPI=5

PYTHON_COMPAT=( python{2_6,2_7} )

inherit eutils systemd udev python-r1

BACKPORTS=
MY_PN="qemu"
MY_P="${MY_PN}-${PV}"

if [[ ${PV} = *9999* ]]; then
	EGIT_REPO_URI="git://git.qemu.org/qemu.git"
	inherit git-2
else
	SRC_URI="http://wiki.qemu.org/download/${MY_P}.tar.bz2
		${BACKPORTS:+
			http://dev.gentoo.org/~cardoe/distfiles/${MY_P}-${BACKPORTS}.tar.xz}"
	KEYWORDS="amd64 ppc ppc64 x86 ~x86-fbsd"
fi

DESCRIPTION="QEMU Guest Agent (qemu-ga) for use when running inside a VM"
HOMEPAGE="http://wiki.qemu.org/Features/QAPI/GuestAgent"

LICENSE="GPL-2 BSD-2"
SLOT="0"
IUSE=""

RDEPEND=">=dev-libs/glib-2.22
	!<app-emulation/qemu-1.1.1-r1
	!<sys-apps/sysvinit-2.88-r5"
DEPEND="${RDEPEND}
	${PYTHON_DEPS}"

S="${WORKDIR}/${MY_P}"

src_prepare() {
	[[ -n ${BACKPORTS} ]] && \
		EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
			epatch

	epatch_user
}

src_configure() {
	python_export_best

	tc-export AR LD OBJCOPY

	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--libdir="/usr/$(get_libdir)" \
		--localstatedir=/ \
		--disable-bsd-user \
		--disable-linux-user \
		--disable-system \
		--disable-strip \
		--disable-werror \
		--enable-guest-agent \
		--python="${PYTHON}" \
		--cc="$(tc-getCC)" \
		--cxx="$(tc-getCXX)" \
		--host-cc="$(tc-getBUILD_CC)"
}

src_compile() {
	emake V=1 qemu-ga
}

src_install() {
	dobin qemu-ga

	# Normal init stuff
	newinitd "${FILESDIR}/qemu-ga.init-r1" qemu-guest-agent
	newconfd "${FILESDIR}/qemu-ga.conf-r1" qemu-guest-agent

	insinto /etc/logrotate.d
	newins "${FILESDIR}/qemu-ga.logrotate" qemu-guest-agent

	# systemd stuff
	udev_newrules "${FILESDIR}/qemu-ga-systemd.udev" 99-qemu-guest-agent.rules

	systemd_newunit "${FILESDIR}/qemu-ga-systemd.service" \
		qemu-guest-agent.service
}

pkg_postinst() {
	elog "You should add 'qemu-guest-agent' to the default runlevel."
	elog "e.g. rc-update add qemu-guest-agent default"
}