]> Pileus Git - ~andy/sunrise/blob - x11-drivers/asus-switcheroo/asus-switcheroo-0_p20110504.ebuild
app-misc/autokey-gtk: Add ~amd64 keyword, EAPI bump
[~andy/sunrise] / x11-drivers / asus-switcheroo / asus-switcheroo-0_p20110504.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=4
6 inherit linux-mod eutils
7
8 DESCRIPTION="Modules to turn off nVidia card for ASUS laptops"
9 HOMEPAGE="https://github.com/awilliam/asus-switcheroo"
10
11 KEYWORDS="~amd64"
12 DEPEND="sys-power/pm-utils"
13 RDEPEND="${DEPEND}"
14 SLOT="0"
15 LICENSE="GPL-2"
16 IUSE="video_cards_intel video_cards_nouveau video_cards_nvidia"
17 REQUIRED_USE="video_cards_nouveau? ( !video_cards_nvidia )"
18
19 GITHUB_COMMIT="178d072"
20 SRC_URI="http://www.github.com/awilliam/${PN}/tarball/${GITHUB_COMMIT} -> ${P}.tar.gz"
21 S="${WORKDIR}/awilliam-${PN}-${GITHUB_COMMIT}"
22
23 BUILD_TARGETS="default"
24
25 pkg_setup() {
26         MODULE_NAMES="${PN}(extra/${PN}:${S})"
27         use video_cards_intel && MODULE_NAMES="${MODULE_NAMES}  i915-jprobe(extra/${PN}:${S})"
28         use video_cards_nouveau && MODULE_NAMES="${MODULE_NAMES}  nouveau-jprobe(extra/${PN}:${S})"
29
30         linux-mod_pkg_setup
31 }
32
33 src_install(){
34         linux-mod_src_install
35         exeinto /etc/pm/sleep.d
36         doexe  ${PN}-pm
37
38         if use video_cards_nvidia ; then
39                 insinto /etc/modprobe.d
40                 newins "${FILESDIR}"/${PN}.conf-nvidia ${PN}.conf
41
42                 newinitd "${FILESDIR}"/switcheroo.rc switcheroo
43
44                 exeinto /usr/sbin
45                 newexe "${FILESDIR}"/switcheroo-to-nvidia.sh switcheroo-to-nvidia
46
47                 insinto /etc/X11
48                 doins "${FILESDIR}"/xorg.conf-nvidia
49
50         elif use video_cards_nouveau ; then
51                 insinto /etc/modprobe.d
52                 newins ${PN}.conf-modprobe.d ${PN}.conf
53         fi
54 }
55
56 pkg_postinst() {
57         elog "If debugfs isn't automatically mounted for you,"
58         elog " add this to your /etc/fstab:"
59         elog ""
60         elog " debugfs /sys/kernel/debug debugfs defaults 0 0"
61         elog ""
62         elog "Remember to add asus_switcheroo to /etc/conf.d/modules"
63         elog ""
64         elog "To turn off the discrete card on boot, put"
65         elog ""
66         elog 'if [ -f "/sys/kernel/debug/vgaswitcheroo/switch" ] ; then '
67         elog "   /bin/echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"
68         elog "fi"
69         elog ""
70         elog "in /etc/conf.d/local.start"
71
72         if use video_cards_nvidia ; then
73                 elog ""
74                 elog "This ebuild has installed a system for switching"
75                 elog "to the nVidia card and driver. This system requires"
76                 elog "that you use the supplied xorg.conf for nVidia"
77                 elog "and no xorg.conf for the intel card. The switching"
78                 elog "is handled by the command switcheroo-to-nvidia"
79                 elog "and the switcheroo init.d script."
80         fi
81
82         linux-mod_pkg_postinst
83 }