[bug#33756] gnu: Add sct.

Message ID 20181215070959.2260-1-namn@berkeley.edu
State Accepted
Headers show
Series [bug#33756] gnu: Add sct. | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied

Commit Message

Nam Nguyen Dec. 15, 2018, 7:09 a.m. UTC
* gnu/packages/xdisorg.scm (sct): New variable.
---
 gnu/packages/xdisorg.scm | 44 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

Comments

Nam Nguyen Dec. 15, 2018, 4:49 p.m. UTC | #1
The trailing / in home-page should be removed.
Danny Milosavljevic Dec. 16, 2018, 11:55 a.m. UTC | #2
Hi,

thanks for the patch.  I have the following suggestions:

* It's easier to just use #:make-flags to override the CC make variable -- and
it doesn't require a custom phase
* It's clearer to use #:tests? #f to indicate that there are no tests.
* install-file makes sure that the destination directory exists already,
so it's useless to manually create it
* sctd.sh uses "which" to find the "sct" executable.  Please patch it
so that it uses the sct executable of (assoc-ref outputs "out") "/bin"
(i.e. hard-code it) instead
* sctd.sh uses "logger" which is part of inetutils, so inetutils should
be a regular input.  Moreover, please patch sctd.sh so it uses inetutils'
logger (i.e. hard-code it using (assoc-ref inputs "inetutils"))
* sctd.sh uses "date", "printf" and "sleep" which are part of coreutils,
so coreutils should be a regular input.  Moreover, please patch sctd.sh so
it uses coreutils' things (i.e. hard-code it using (assoc-ref inputs "coreutils")

(See other files for how to use "substitute*" to patch things)

Could you send an updated patch?

Patch

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 82ed065a3..5d6257ab8 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -24,6 +24,7 @@ 
 ;;; Copyright © 2018 Thomas Sigurdsen <tonton@riseup.net>
 ;;; Copyright © 2018 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2018 Nam Nguyen <namn@berkeley.edu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1555,3 +1556,46 @@  to automatically turn it on on login.")
     (description "This package provides a small utility for inverting the
 colors on all monitors attached to an XRandR-capable X11 display server.")
     (license license:gpl3+)))
+
+(define-public sct
+  (package
+    (name "sct")
+    (version "0.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://www.umaxx.net/dl/sct-"
+                       version ".tar.gz"))
+       (sha256
+        (base32
+         "0r57z9ki8pvxhawfxys0v5h85z2x211sqxki0xvk1bga88ryldlv"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'replace-cc-with-gcc
+           ;; Use gcc in Makefile.
+           (lambda _
+             (substitute* "Makefile"
+               (("CC\\?\\=gcc")
+                "CC=gcc"))))
+         (delete 'configure)
+         (delete 'check)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (install-file "sct" (string-append out "/bin"))
+               (install-file "sctd.sh" (string-append out "/bin"))
+               (mkdir (string-append out "/man"))
+               (mkdir (string-append out "/man/man1"))
+               (install-file "sct.1" (string-append out "/man/man1"))
+               (install-file "sctd.1" (string-append out "/man/man1"))
+               #t))))))
+    (inputs
+     `(("libxrandr" ,libxrandr)))
+    (home-page "https://www.umaxx.net/")
+    (synopsis "Set the color temperature of the screen")
+    (description "@code{sct} is a lightweight utility to set the color
+temperature of the screen.")
+    (license license:bsd-3)))