unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#33756] [PATCH] gnu: Add sct.
@ 2018-12-15  7:09 Nam Nguyen
  2018-12-15 16:49 ` [bug#33756] correction Nam Nguyen
  2018-12-16 21:25 ` [bug#33756] [PATCH] gnu: Add sct Nam Nguyen
  0 siblings, 2 replies; 5+ messages in thread
From: Nam Nguyen @ 2018-12-15  7:09 UTC (permalink / raw)
  To: 33756; +Cc: Nam Nguyen

* gnu/packages/xdisorg.scm (sct): New variable.
---
 gnu/packages/xdisorg.scm | 44 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

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)))
-- 
2.20.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#33756] correction
  2018-12-15  7:09 [bug#33756] [PATCH] gnu: Add sct Nam Nguyen
@ 2018-12-15 16:49 ` Nam Nguyen
  2018-12-16 11:55   ` Danny Milosavljevic
  2018-12-16 21:25 ` [bug#33756] [PATCH] gnu: Add sct Nam Nguyen
  1 sibling, 1 reply; 5+ messages in thread
From: Nam Nguyen @ 2018-12-15 16:49 UTC (permalink / raw)
  To: 33756

The trailing / in home-page should be removed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#33756] correction
  2018-12-15 16:49 ` [bug#33756] correction Nam Nguyen
@ 2018-12-16 11:55   ` Danny Milosavljevic
  0 siblings, 0 replies; 5+ messages in thread
From: Danny Milosavljevic @ 2018-12-16 11:55 UTC (permalink / raw)
  To: Nam Nguyen; +Cc: 33756

[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]

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?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#33756] [PATCH] gnu: Add sct.
  2018-12-15  7:09 [bug#33756] [PATCH] gnu: Add sct Nam Nguyen
  2018-12-15 16:49 ` [bug#33756] correction Nam Nguyen
@ 2018-12-16 21:25 ` Nam Nguyen
  2018-12-23 17:37   ` bug#33756: " Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: Nam Nguyen @ 2018-12-16 21:25 UTC (permalink / raw)
  To: 33756

* gnu/packages/xdisorg.scm (sct): New variable.
---
 gnu/packages/xdisorg.scm | 55 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 82ed065a3..dedff620d 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.
 ;;;
@@ -52,6 +53,8 @@
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages admin)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages check)
@@ -1555,3 +1558,55 @@ 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
+     '(#:make-flags (list "CC=gcc")
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'check)
+         (add-after 'unpack 'fix-sctd-paths
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (coreutils (assoc-ref inputs "coreutils"))
+                   (inetutils (assoc-ref inputs "inetutils")))
+               (substitute* "sctd.sh"
+                 (("\\$\\(which sct\\)") (string-append out "/bin/sct"))
+                 (("date") (string-append coreutils "/bin/date"))
+                 (("printf") (string-append coreutils "/bin/printf"))
+                 (("sleep") (string-append coreutils "/bin/sleep"))
+                 (("logger") (string-append inetutils "/bin/logger"))))))
+         (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"))
+               (install-file "sct.1" (string-append out "/man/man1"))
+               (install-file "sctd.1" (string-append out "/man/man1"))
+               (rename-file (string-append out "/bin/sctd.sh")
+                            (string-append out "/bin/sctd"))
+               #t))))))
+    (inputs
+     `(("coreutils" ,coreutils) ; sctd uses "date", "printf" and "sleep"
+       ("inetutils" ,inetutils) ; sctd uses "logger"
+       ("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)))
-- 
2.20.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#33756: [PATCH] gnu: Add sct.
  2018-12-16 21:25 ` [bug#33756] [PATCH] gnu: Add sct Nam Nguyen
@ 2018-12-23 17:37   ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2018-12-23 17:37 UTC (permalink / raw)
  To: Nam Nguyen; +Cc: 33756-done

Nam Nguyen <namn@berkeley.edu> skribis:

> * gnu/packages/xdisorg.scm (sct): New variable.

This was applied as commit d852cf9e331888c23b4f9377064145ae74339644,
thank you & Danny!

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-23 17:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-15  7:09 [bug#33756] [PATCH] gnu: Add sct Nam Nguyen
2018-12-15 16:49 ` [bug#33756] correction Nam Nguyen
2018-12-16 11:55   ` Danny Milosavljevic
2018-12-16 21:25 ` [bug#33756] [PATCH] gnu: Add sct Nam Nguyen
2018-12-23 17:37   ` bug#33756: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).