aboutsummaryrefslogtreecommitdiff
path: root/packages/sys-apps/razercfg/razercfg.exlib
blob: 7caf9130c1addff3091b17dcfe6c71cd8612bb15 (plain) (blame)
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
# Copyright 2012 Guillermo Ramos
# Distributed under the terms of the GNU General Public License v2
# Based in part upon 'razercfg-0.17.ebuild' from Gentoo, which is:
#     Copyright 1999-2012 Gentoo Foundation

require cmake [ api=2 out_of_source=false ] systemd-service

SUMMARY="Utility for advanced configuration of Razer mice (DeathAdder, Krait, Lachesis)"
HOMEPAGE="http://bues.ch/cms/hacking/razercfg.html"
DOWNLOADS="http://bues.ch/${PN}/${PNV}.tar.bz2"

LICENCES="GPL-2"
MYOPTIONS="
    baselayout
    pm-utils [[ description = [ Add hibernate/resume support ] ]]
    qt4 [[ description = [ Install graphical configuration tool (qrazercfg) ] ]]
"

DEPENDENCIES="
    build+run:
        dev-lang/python
        pm-utils? ( sys-power/pm-utils )
        qt4? ( dev-python/PyQt4 )
"

src_prepare() {
    edo sed -i \
            -e '/ldconfig/{N;d}' \
            -e "s:/etc/udev/rules.d/:/usr/${LIBDIR}/udev/rules.d/:" \
            -e "s:/etc/pm/sleep.d:/usr/${LIBDIR}/pm-utils/sleep.d/:" \
            -e '/udevadm control/{N;d}' \
            -e 's:01-razer-udev.rules:40-razercfg.rules:' \
            -e 's:50-razer:80razer:' \
            librazer/CMakeLists.txt
}

DEFAULT_SRC_INSTALL_EXTRA_DOCS=( razer.conf )

src_install() {
    edo sed -i \
            -e "s:\${CMAKE_INSTALL_PREFIX}/lib:\${CMAKE_INSTALL_PREFIX}/${LIBDIR}:" \
            librazer/cmake_install.cmake
    cmake_src_install

    install_systemd_files
    option baselayout && newinitd "${FILES}"/razerd.init.d razerd
    option pm-utils || edo rm -r "${IMAGE}"/usr/"${LIBDIR}"/pm-utils
    if option qt4; then
        insinto /usr/share/applications
        doins "${FILES}"/qrazercfg.desktop
    else
        edo rm "${IMAGE}"/usr/bin/qrazercfg
    fi
}

pkg_postinst() {
    esandbox allow_net --connect 'unix:/run/udev/control'
    nonfatal edo udevadm control --reload-rules && udevadm trigger --subsystem-match=usb
}

BUGS_TO="0xwille@gmail.com"