[PATCH 0/5] Add ydotool

OpenSubmitted by Alexandr Vityazev.
Details
One participant
  • Alexandr Vityazev
Owner
unassigned
Severity
normal
A
A
Alexandr Vityazev wrote on 27 Sep 2021 15:52
(address . guix-patches@gnu.org)
87wnn2ruq9.fsf@posteo.org
Alexandr Vityazev (5):
gnu: Add iodash.
gnu: Add libuinputplus.
gnu: Add libevdevplus.
gnu: Add cxxopts-next.
gnu: Add ydotool.

gnu/local.mk | 2 +
gnu/packages/cpp.scm | 136 ++++++++++++++++++
gnu/packages/linux.scm | 36 +++++
.../ydotool-cmakelists-remove-cpm.patch | 118 +++++++++++++++
4 files changed, 292 insertions(+)
create mode 100644 gnu/packages/patches/ydotool-cmakelists-remove-cpm.patch

--
2.33.0


--

Alexandr Vityazev
A
A
Alexandr Vityazev wrote on 27 Sep 2021 15:54
[PATCH 1/5] gnu: Add iodash.
(address . 50847@debbugs.gnu.org)
87v92mruna.fsf@posteo.org
* gnu/packages/cpp.scm (iodash): New variable.
---
gnu/packages/cpp.scm | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

Toggle diff (70 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 4af71ba93a..e3b73b1612 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
 ;;; Copyright © 2020 Milkey Mouse <milkeymouse@meme.institute>
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
+;;; Copyright © 2021 Alexandr Vityazev <avityazev@posteo.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -956,6 +957,49 @@ provides a number of utilities to make coding with expected cleaner.")
     (home-page "https://tl.tartanllama.xyz/")
     (license license:cc0)))
 
+(define-public iodash
+  ;; there is no cpp_modules in the release version
+  (let ((commit "acefbb532c48108a29beb3633d4ea0c0dffb0a7b")
+        (revision "0")
+        ;; ydotool requires this version
+        (version "0.1.0"))
+    (package
+      (name "iodash")
+      (version (git-version version revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/YukiWorkshop/IODash")
+               (commit commit)
+               (recursive? #t)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1syfzi4g79pxj6zxajh800j8zsi3nqj5q49swykc6mn2143nkh05"))))
+      (build-system cmake-build-system)
+      (arguments
+       ;; No tests
+       `(#:tests? #f
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (inc (string-append out "/include"))
+                      (lib (string-append out "/lib")))
+                 (install-file "libIODash.a" lib)
+                 (with-directory-excursion "../source"
+                   (install-file "IODash.hpp" inc)
+                   (install-file
+                    "cpp_modules/portable-endian/portable-endian.h" inc)
+                   (copy-recursively "IODash"
+                                     (string-append inc "/IODash")))))))))
+      (home-page "https://github.com/YukiWorkshop/IODash")
+      (synopsis "Lightweight C++ I/O library for POSIX operation systems")
+      (description "@code{IODash} is a C++ library for POSIX operation systems.")
+      (license license:expat))))
+
 (define-public magic-enum
   (package
     (name "magic-enum")
-- 
2.33.0



-- 

Alexandr Vityazev
A
A
Alexandr Vityazev wrote on 27 Sep 2021 15:54
[PATCH 2/5] gnu: Add libuinputplus.
(address . 50847@debbugs.gnu.org)
87tui6rumt.fsf@posteo.org
* gnu/packages/cpp.scm (libuinputplus): New variable.
---
gnu/packages/cpp.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

Toggle diff (56 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index e3b73b1612..26f933996c 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1000,6 +1000,43 @@ provides a number of utilities to make coding with expected cleaner.")
       (description "@code{IODash} is a C++ library for POSIX operation systems.")
       (license license:expat))))
 
+(define-public libuinputplus
+  (package
+    (name "libuinputplus")
+    (version "0.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/YukiWorkshop/libuInputPlus")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0sind2ghhy4h9kfkr5hsmhcq0di4ifwqyv4gac96rgj5mwvs33lp"))))
+    (build-system cmake-build-system)
+    (arguments
+     ;; No tests
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; No rule to make target 'install' in version 0.2.1
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (inc (string-append out "/include"))
+                    (lib (string-append out "/lib")))
+               (install-file "libuInputPlus.a" lib)
+               (with-directory-excursion "../source"
+                 (install-file "CommonIncludes.hpp" inc)
+                 (install-file "uInput.hpp" inc)
+                 (install-file "uInputSetup.hpp" inc))))))))
+    (home-page "https://github.com/YukiWorkshop/libuInputPlus")
+    (synopsis "C++ library for the Linux uinput interface")
+    (description "@code{libuInputPlus} is a C++ library for the Linux
+uinput interface.")
+    (license license:expat)))
+
 (define-public magic-enum
   (package
     (name "magic-enum")
-- 
2.33.0



-- 

Alexandr Vityazev
A
A
Alexandr Vityazev wrote on 27 Sep 2021 15:55
[PATCH 3/5] gnu: Add libevdevplus.
(address . 50847@debbugs.gnu.org)
87sfxqruma.fsf@posteo.org
* gnu/packages/cpp.scm (libevdevplus): New variable.
---
gnu/packages/cpp.scm | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)

Toggle diff (55 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 26f933996c..cf063fc921 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1037,6 +1037,42 @@ provides a number of utilities to make coding with expected cleaner.")
 uinput interface.")
     (license license:expat)))
 
+(define-public libevdevplus
+  (package
+    (name "libevdevplus")
+    (version "0.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/YukiWorkshop/libevdevPlus")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "09y65s16gch0w7fy1s9yjk9gz3bjzxix36h5wmwww6lkj2i1z3rj"))))
+    (build-system cmake-build-system)
+    (arguments
+     ;; No tests
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; No rule to make target 'install' in version 0.2.1
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (inc (string-append out "/include"))
+                    (lib (string-append out "/lib")))
+               (install-file "libevdevPlus.a" lib)
+               (with-directory-excursion "../source"
+                 (install-file "CommonIncludes.hpp" inc)
+                 (install-file "evdevPlus.hpp" inc)
+                 (install-file "InputEvent.hpp" inc))))))))
+    (home-page "https://github.com/YukiWorkshop/libevdevPlus")
+    (synopsis "Easy-to-use event device library in C++")
+    (description "@code{libevdevPlus} is a C++ event device library.")
+    (license license:expat)))
+
 (define-public magic-enum
   (package
     (name "magic-enum")
-- 
2.33.0



-- 

Alexandr Vityazev
A
A
Alexandr Vityazev wrote on 27 Sep 2021 15:56
[PATCH 4/5] gnu: Add cxxopts-next.
(address . 50847@debbugs.gnu.org)
87r1daruka.fsf@posteo.org
* gnu/packages/cpp.scm (cxxopts-next): New variable.
---
gnu/packages/cpp.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index cf063fc921..30a5bb4d12 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -834,6 +834,25 @@ standard GNU style syntax for options.")
     (home-page "https://github.com/jarro2783/cxxopts/wiki")
     (license license:expat)))
 
+(define-public cxxopts-next
+  ;; No release version 3.0.0 cxxopts required by ydotool,
+  ;; include breaking changes.
+  (let ((commit "2d8e17c4f88efce80e274cb03eeb902e055a91d3")
+        (revision "0")
+        (version "3.0.0"))
+    (package/inherit cxxopts
+      (name "cxxopts-next")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/jarro2783/cxxopts")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0pwrac81zfqjs17g3hx8r3ds2xf04npb6mz111qjy4bx17314ib7")))))))
+
 (define-public folly
   (package
     (name "folly")
-- 
2.33.0



-- 

Alexandr Vityazev
A
A
Alexandr Vityazev wrote on 27 Sep 2021 15:57
[PATCH 5/5] gnu: Add ydotool.
(address . 50847@debbugs.gnu.org)
87pmsuruj6.fsf@posteo.org
* gnu/packages/linux.scm (ydotool): New variable.
* gnu/packages/patches/ydotool-cmakelists-remove-cpm.patch: NEW FILE.
* gnu/local.mk: Add ydotool-cmakelists-remove-cpm.patch to dist_patch_DATA.
---
gnu/local.mk | 2 +
gnu/packages/linux.scm | 36 ++++++
.../ydotool-cmakelists-remove-cpm.patch | 118 ++++++++++++++++++
3 files changed, 156 insertions(+)
create mode 100644 gnu/packages/patches/ydotool-cmakelists-remove-cpm.patch

Toggle diff (213 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index b8ae060326..9efe2d18e9 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -44,6 +44,7 @@
 # Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 # Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
 # Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz>
+# Copyright © 2021 Alexandr Vityazev <avityazev@posteo.org>
 #
 # This file is part of GNU Guix.
 #
@@ -1902,6 +1903,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/xsane-fix-snprintf-buffer-length.patch	\
   %D%/packages/patches/xsane-support-ipv6.patch			\
   %D%/packages/patches/xsane-tighten-default-umask.patch	\
+  %D%/packages/patches/ydotool-cmakelists-remove-cpm.patch	\
   %D%/packages/patches/yggdrasil-extra-config.patch	\
   %D%/packages/patches/ytfzf-programs.patch        \
   %D%/packages/patches/ytfzf-updates.patch        \
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 41b6dfd022..e260c1ee4c 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -52,6 +52,7 @@
 ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
 ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
+;;; Copyright © 2021 Alexandr Vityazev <avityazev@posteo.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -145,6 +146,7 @@
   #:use-module (gnu packages rsync)
   #:use-module (gnu packages selinux)
   #:use-module (gnu packages swig)
+  #:use-module (gnu packages cpp)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
@@ -8524,6 +8526,40 @@ These trace events are logged in @file{/sys/kernel/debug/tracing} and reported
 through standard log mechanisms like syslog.")
     (license license:gpl2)))
 
+(define-public ydotool
+  (package
+    (name "ydotool")
+    (version "0.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ReimuNotMoe/ydotool")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "17mgg9cqw4wjkmp9k6c8kgm7v2bvri5y49giqkbs6l2hv6ap5m9a"))
+       (patches (search-patches "ydotool-cmakelists-remove-cpm.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f                    ;No tests
+       #:configure-flags
+       (let* ((out (assoc-ref %outputs "out")))
+         (list (string-append "-DCMAKE_INSTALL_MANDIR=" out "/share/man")
+               (string-append "-DCMAKE_INSTALL_SYSCONFDIR=" out "/etc")))))
+    (inputs
+     `(("libuinputplus" ,libuinputplus)
+       ("libevdevplus" ,libevdevplus)
+       ("cxxopts" ,cxxopts-next)
+       ("iodash" ,iodash)
+       ("scdoc" ,scdoc)))
+    (home-page "https://github.com/ReimuNotMoe/ydotool")
+    (synopsis "Generic Linux command-line automation tool (no X!)")
+    (description "@code{ydotool} is a Linux command-line tool that simulates
+keyboard input, mouse actions, etc. programmatically or manually.")
+    (license license:agpl3+)))
+
 (define-public libgpiod
   (package
     (name "libgpiod")
diff --git a/gnu/packages/patches/ydotool-cmakelists-remove-cpm.patch b/gnu/packages/patches/ydotool-cmakelists-remove-cpm.patch
new file mode 100644
index 0000000000..42ee38fd94
--- /dev/null
+++ b/gnu/packages/patches/ydotool-cmakelists-remove-cpm.patch
@@ -0,0 +1,118 @@
+From f68869deba8b71ff77cc0a2acd22eb449a61f7e9 Mon Sep 17 00:00:00 2001
+From: Alexandr Vityazev <avityazev@posteo.org>
+Date: Sat, 25 Sep 2021 23:15:15 +0300
+Subject: [PATCH] CMakeLists: remove CPM.
+
+- CMakeLists: remove CPM, remove linking cxxopts - header-only library,
+- add targets to install binaries;
+- ADD: Daemon/80-uinput.rules, Daemon/CMakeLists, manpage/CMakeLists.
+
+---
+ CMakeLists.txt         | 48 ++++++------------------------------------
+ Daemon/80-uinput.rules |  1 +
+ Daemon/CMakeLists.txt  |  1 +
+ manpage/CMakeLists.txt |  9 ++++++++
+ 4 files changed, 17 insertions(+), 42 deletions(-)
+ create mode 100644 Daemon/80-uinput.rules
+ create mode 100644 Daemon/CMakeLists.txt
+ create mode 100644 manpage/CMakeLists.txt
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3dd15bf..8a882c5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -3,41 +3,6 @@ project(ydotool)
+
+ set(CMAKE_CXX_STANDARD 17)
+
+-set(CPM_DOWNLOAD_VERSION 0.27.5)
+-set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
+-
+-if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
+-    message(STATUS "Downloading CPM.cmake")
+-    file(DOWNLOAD https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake ${CPM_DOWNLOAD_LOCATION})
+-endif()
+-
+-include(${CPM_DOWNLOAD_LOCATION})
+-
+-CPMAddPackage(
+-        NAME IODash
+-        GITHUB_REPOSITORY YukiWorkshop/IODash
+-        VERSION 0.1.0
+-)
+-
+-CPMAddPackage(
+-        NAME libevdevPlus
+-        GITHUB_REPOSITORY YukiWorkshop/libevdevPlus
+-        VERSION 0.2.1
+-)
+-
+-CPMAddPackage(
+-        NAME libuInputPlus
+-        GITHUB_REPOSITORY YukiWorkshop/libuInputPlus
+-        VERSION 0.2.1
+-)
+-
+-CPMAddPackage(
+-        NAME cxxopts
+-        GITHUB_REPOSITORY jarro2783/cxxopts
+-        VERSION 3.0.0
+-        GIT_TAG 2d8e17c4f88efce80e274cb03eeb902e055a91d3
+-)
+-
+ set(SOURCE_FILES_LIBRARY
+         CommonIncludes.hpp
+         Library/Tool.hpp Library/Tool.cpp
+@@ -59,15 +24,14 @@ set(SOURCE_FILES_CLIENT
+         CommonIncludes.hpp
+         Client/ydotool.cpp Client/ydotool.hpp)
+
+-include_directories(${libevdevPlus_SOURCE_DIR})
+-include_directories(${libuInputPlus_SOURCE_DIR})
+-include_directories(${IODash_SOURCE_DIR})
+-include_directories(${IODash_SOURCE_DIR}/cpp_modules/portable-endian) # FIXME
+-include_directories(${cxxopts_SOURCE_DIR}/include)
+-
+ add_executable(ydotoold ${SOURCE_FILES_DAEMON})
+-target_link_libraries(ydotoold PUBLIC cxxopts uInputPlus evdevPlus)
++target_link_libraries(ydotoold PUBLIC uInputPlus evdevPlus)
++install(TARGETS ydotoold DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ add_library(ydotool_library STATIC ${SOURCE_FILES_LIBRARY})
+ add_executable(ydotool ${SOURCE_FILES_CLIENT})
+ target_link_libraries(ydotool ydotool_library dl pthread uInputPlus evdevPlus)
++install(TARGETS ydotool DESTINATION ${CMAKE_INSTALL_BINDIR})
++
++add_subdirectory(manpage)
++add_subdirectory(Daemon)
+diff --git a/Daemon/80-uinput.rules b/Daemon/80-uinput.rules
+new file mode 100644
+index 0000000..fad61d4
+--- /dev/null
++++ b/Daemon/80-uinput.rules
+@@ -0,0 +1 @@
++KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
+diff --git a/Daemon/CMakeLists.txt b/Daemon/CMakeLists.txt
+new file mode 100644
+index 0000000..0f478f8
+--- /dev/null
++++ b/Daemon/CMakeLists.txt
+@@ -0,0 +1 @@
++install(FILES 80-uinput.rules DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/udev/rules.d/)
+diff --git a/manpage/CMakeLists.txt b/manpage/CMakeLists.txt
+new file mode 100644
+index 0000000..c749dfc
+--- /dev/null
++++ b/manpage/CMakeLists.txt
+@@ -0,0 +1,9 @@
++function(man_page section page)
++  set(src "${CMAKE_CURRENT_SOURCE_DIR}/${page}.${section}.scd")
++  set(bin "${CMAKE_CURRENT_BINARY_DIR}/${page}.${section}")
++  add_custom_target(${page}.${section} ALL COMMAND scdoc < ${src} > ${bin})
++  install(FILES ${bin} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}/)
++endfunction(man_page)
++
++man_page(1 ydotool)
++man_page(8 ydotoold)
+--
+2.33.0
-- 
2.33.0



-- 

Alexandr Vityazev
?