summaryrefslogtreecommitdiff
blob: 6b6397157d0e48967832582504b3df5d6e484ae4 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-misc/magick-rotation/magick-rotation-1.6.2.ebuild,v 1.1 2012/10/20 11:24:36 pinkbyte Exp $

EAPI=4

PYTHON_DEPEND="2"

inherit eutils python toolchain-funcs user versionator

MY_PV=$(get_version_component_range 1-2)

DESCRIPTION="application that rotate tablet pc's screen automatically, depending on orientation"
HOMEPAGE="https://launchpad.net/magick-rotation"
SRC_URI="http://launchpad.net/magick-rotation/trunk/${MY_PV}/+download/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
IUSE=""

DEPEND="x11-libs/libXrandr
	x11-libs/libX11"

RDEPEND="${DEPEND}
	dev-python/pygobject
	dev-python/py-notify
	x11-apps/xinput"

pkg_setup() {
	python_pkg_setup
	enewgroup magick
}

src_prepare() {
	# Remove unneeded files
	rm -r apt_* installer_gtk.py MAGICK-INSTALL gset_addkeyval.py MagickIcons/MagickSplash.png MagickUninstall || die 'removing unneeded files failed'
}

src_compile() {
	if use x86; then
		$(tc-getCC) -lX11 -lXrandr check.c -o checkmagick32 || die 'compilation failed'
	fi
	if use amd64; then
		$(tc-getCC) -lX11 -lXrandr check.c -o checkmagick64 || die 'compilation failed'
	fi
}

src_install() {
	#TODO: add installation of GNOME Shell 3.2 extension
	dobin	checkmagick*

	insinto	/lib/udev/rules.d
	doins	62-magick.rules

	insinto	/usr/share/${PN}
	doins	*.py

	insinto	/usr/share/${PN}/MagickIcons
	doins	MagickIcons/*.png

	exeinto /usr/share/${PN}
	doexe	magick-rotation
	doexe	xrotate.py

	dodoc *.txt ChangeLog

	make_desktop_entry /usr/share/${PN}/${PN} "Magick Rotation" /usr/share/${PN}/MagickIcons/magick-rotation-enabled.png "System;Utility;"
}

pkg_postinst() {
	optfeature() {
		elog "  [\e[1m$(has_version ${1} && echo I || echo ' ')\e[0m] ${1} (${2})"
	}

	python_mod_optimize /usr/share/${PN}

	elog
	elog "In order to use Magick Rotation with an on-screen keyboard and handwriting,"
	elog "the following additional package may also be installed for use at run-time:"
	elog
	optfeature 'media-gfx/cellwriter' "Magick Rotation's default onscreen keyboard"
	elog

	ewarn "in order to use Magick Rotation you have to be in the 'magick' group."
	ewarn "Just run 'gpasswd -a <USER> magick', then have <USER> re-login."
}

pkg_postrm() {
	python_mod_cleanup /usr/share/${PN}
}