From 4cc4535566f0496e24fcf567c73494c18d4b8a08 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Sat, 5 Jan 2019 00:32:16 +0100 Subject: [PATCH 4/7] gnu: Add input-wacom * gnu/packages/firmware.scm (input-wacom): New variable --- gnu/packages/firmware.scm | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 0f2d32bbd..be2fc4de4 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2017, 2018 Efraim Flashner ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Vagrant Cascadian +;;; Copyright © 2019 Tim Gesthuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,6 +32,7 @@ #:use-module (gnu packages) #:use-module (gnu packages admin) #:use-module (gnu packages assembly) + #:use-module (gnu packages autotools) #:use-module (gnu packages bison) #:use-module (gnu packages cmake) #:use-module (gnu packages cross-base) @@ -530,3 +532,99 @@ switching support).\n") #t))))) (native-inputs `(("cross-gcc" ,(cross-gcc "arm-none-eabi" #:xgcc gcc-7)) ("cross-binutils" ,(cross-binutils "arm-none-eabi")))))) + +(define-public input-wacom + (package + (name "input-wacom") + (version "0.42.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/linuxwacom/input-wacom.git") + (commit (string-append name "-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv7j")))) + (build-system gnu-build-system) + (native-inputs `(("autoconf" ,autoconf) + ("automake" ,automake) + ("gcc" ,@(assoc-ref (package-native-inputs linux-libre) + "gcc")))) + (inputs `(("linux-source" ,linux-libre "source"))) + (arguments `(#:configure-flags (list + (string-append "--with-kernel-dir=" + (assoc-ref %build-inputs + "linux-source") + ,(linux-libre-module-path + (package-version linux-libre))) + (string-append "--with-kernel-version=" + ,(linux-libre-fill-version + (package-version linux-libre)) + "-gnu")) + #:modules ((ice-9 ftw) + (ice-9 format) + (ice-9 regex) + (guix build utils) + (guix build gnu-build-system)) + #:phases (modify-phases %standard-phases + (replace 'bootstrap + (lambda* (#:key inputs outputs #:allow-other-keys) + (setenv "CC" (string-append (assoc-ref inputs "gcc") + "/bin/gcc")) + (substitute* "configure.ac" + (("/lib/modules/.*/") + (string-append (assoc-ref inputs "linux-source") + ,(linux-libre-module-path + (package-version linux-libre)) + "/")) + (("`uname -r`") + (string-append ,(linux-libre-fill-version (package-version linux-libre)) + "-gnu"))) + (invoke (string-append (assoc-ref inputs "autoconf") + "/bin/autoreconf") + "-v" "--install") + (substitute* "configure" + (("/bin/sh") + (string-append (assoc-ref inputs "bash") + "/bin/sh"))) + #t)) + ;; input-wacom tries to use the Makefile of the + ;; kernels build tree to install its modules into + ;; the OSs structure. This does not work for us + ;; as we cannot pass extra arguments to make which + ;; results in an installation to /lib. Because of + ;; this we just copy all modules that were build + ;; to the output. + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((install-dir + (string-append + (assoc-ref outputs "out") + ,(linux-libre-module-path + (package-version linux-libre)) + "/kernel/drivers/input/touchscreen/"))) + (mkdir-p install-dir) + (file-system-fold + ;; Don't enter hidden directories + (lambda (path stat result) + (not (equal? #\. (string-ref (basename path) 0)))) + (lambda (path stat result) + (when (string-match "^.*\\.ko$" path) + (format #t "Installing module ~a\n" + (basename path)) + (copy-file path + (string-append install-dir + (basename path))))) + (const #t) + (const #t) + (const #t) + (lambda _ (throw 'file-system-error)) + #t + (getcwd)) + #t)))))) + (home-page "https://linuxwacom.github.io/") + (synopsis "Linux kernel driver for various wacom touchscreens") + (description "A set of kernel drivers that add support for various wacom +touchscreens. In combination with xf86-input-wacom and libwacom it forms a set +of modules to support wacom touchscreens with the X server.") + (license license:gpl2))) -- 2.20.1