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