blob: cc7fefc8bef2d0190a4571aca6679da34a99a82e [file] [log] [blame]
Nick Sandersf8ff9e12011-02-08 16:39:31 -08001# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5EAPI="2"
6inherit eutils cros-binary
7
8# Synaptics touchpad generic eclass.
9IUSE="is_touchpad ps_touchpad"
10
Puneet Kumar936af5d2011-02-25 18:59:10 -080011RDEPEND="x11-base/xorg-server"
Nick Sandersf8ff9e12011-02-08 16:39:31 -080012DEPEND="${RDEPEND}"
13
14CROS_BINARY_INSTALL_FLAGS="--strip-components=1"
15
Dave Parker68929712011-04-04 18:28:16 -070016# @ECLASS-VARIABLE: SYNAPTICS_TOUCHPAD_PN
17# @DESCRIPTION: The packagename used as part of the binary tarball filename.
18: ${SYNAPTICS_TOUCHPAD_PN:=${PN}}
19
Nick Sandersf8ff9e12011-02-08 16:39:31 -080020export_uri() {
21 local XORG_VERSION_STRING
22 local XORG_VERSION
23 local X_VERSION
24
25 XORG_VERSION_STRING=$(grep "XORG_VERSION_CURRENT" "$ROOT/usr/include/xorg/xorg-server.h")
26 XORG_VERSION_STRING=${XORG_VERSION_STRING/#\#define*XORG_VERSION_CURRENT}
27 XORG_VERSION=$(($XORG_VERSION_STRING))
Puneet Kumarc10ccd02011-08-04 10:56:03 -070028
29 if [ $XORG_VERSION -ge 11100000 ]; then
30 X_VERSION=1.11
Stéphane Marchesin75bc1f32011-10-21 19:21:24 -070031 elif [ $XORG_VERSION -ge 11000000 ]; then
Puneet Kumarc10ccd02011-08-04 10:56:03 -070032 X_VERSION=1.10
33 elif [ $XORG_VERSION -ge 10903000 ]; then
Nick Sandersf8ff9e12011-02-08 16:39:31 -080034 X_VERSION=1.9
35 else
36 X_VERSION=1.7
37 fi
Puneet Kumarf6342d62011-10-24 19:33:40 -070038 CROS_BINARY_URI="http://commondatastorage.googleapis.com/synaptics/${SYNAPTICS_TOUCHPAD_PN}-xorg-${X_VERSION}-${PV}-${PR}.tar.gz"
Nick Sandersf8ff9e12011-02-08 16:39:31 -080039}
40
41function synaptics-touchpad_src_unpack() {
42 export_uri
43 cros-binary_src_unpack
44}
45
46function synaptics-touchpad_src_install() {
47 # Currently you must have files/* in each ebuild that inherits
48 # from here. These files will go away soon after they are pushed
49 # into the synaptics tarball.
50 export_uri
51 cros-binary_src_install
Nick Sandersf8ff9e12011-02-08 16:39:31 -080052
Daniel Kurtz057d46e2012-01-06 02:18:19 +080053 exeinto /opt/Synaptics/bin
54 doexe "${FILESDIR}/tpcontrol_syncontrol" || die
Nick Sandersf8ff9e12011-02-08 16:39:31 -080055
56 # link the appropriate config files for the type of trackpad
57 if use is_touchpad && use ps_touchpad; then
58 die "Specify only one type of touchpad"
59 elif use is_touchpad; then
60 dosym HKLM_Kernel_IS /opt/Synaptics/HKLM_Kernel || die
61 dosym HKLM_User_IS /opt/Synaptics/HKLM_User || die
62 elif use ps_touchpad; then
63 dosym HKLM_Kernel_PS /opt/Synaptics/HKLM_Kernel || die
64 dosym HKLM_User_PS /opt/Synaptics/HKLM_User || die
65 else
66 die "Type of touchpad not specified"
67 fi
68
69}
70