about summary refs log tree commit diff
path: root/pkgs/applications/misc/redshift
diff options
context:
space:
mode:
authorYegor Timoshenko <yegortimoshenko@riseup.net>2018-01-16 13:44:59 +0000
committerYegor Timoshenko <yegortimoshenko@riseup.net>2018-01-16 13:44:59 +0000
commit7d70261aa43eaef9116fd7c84defd79ded8f248c (patch)
tree0111af8dee9cd4f516002be211ef4b29141bef21 /pkgs/applications/misc/redshift
parent9d57972cd55a6d75cf32c80ab89d933aa1627702 (diff)
redshift: fix redshift-gtk, autoreconfHook
Diffstat (limited to 'pkgs/applications/misc/redshift')
-rw-r--r--pkgs/applications/misc/redshift/575.patch51
-rw-r--r--pkgs/applications/misc/redshift/default.nix85
2 files changed, 87 insertions, 49 deletions
diff --git a/pkgs/applications/misc/redshift/575.patch b/pkgs/applications/misc/redshift/575.patch
new file mode 100644
index 0000000000000..d731d8ec43ad4
--- /dev/null
+++ b/pkgs/applications/misc/redshift/575.patch
@@ -0,0 +1,51 @@
+From 467156efccc5e36a36bec8c0b64cc5a70f14d5ed Mon Sep 17 00:00:00 2001
+From: Yegor Timoshenko <yegortimoshenko@riseup.net>
+Date: Tue, 16 Jan 2018 11:43:46 +0000
+Subject: [PATCH] Fix Autoconf script
+
+gettext/intltool macros are not used correctly, see:
+https://bugs.launchpad.net/inkscape/+bug/1418943
+---
+ bootstrap    | 6 +-----
+ configure.ac | 5 +----
+ 2 files changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/bootstrap b/bootstrap
+index 0599cf5..40b1dca 100755
+--- a/bootstrap
++++ b/bootstrap
+@@ -1,7 +1,3 @@
+ #!/bin/sh
+ 
+-# change to root directory
+-cd $(dirname "$0")
+-
+-autopoint --force && \
+-	AUTOPOINT="intltoolize --automake --copy" autoreconf --force --install --verbose
++autoreconf --force --install && intltoolize
+diff --git a/configure.ac b/configure.ac
+index be0b51a..a2e7c42 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -17,6 +17,7 @@ AC_PROG_OBJC # For macOS support modules
+ AC_LANG([C])
+ 
+ AC_PROG_INTLTOOL([0.50])
++AC_SUBST(LIBINTL)
+ 
+ AC_CANONICAL_HOST
+ 
+@@ -51,10 +52,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [
+ ])
+ AC_LANG_POP([Objective C])
+ 
+-# Checks for libraries.
+-AM_GNU_GETTEXT_VERSION([0.17])
+-AM_GNU_GETTEXT([external])
+-
+ GETTEXT_PACKAGE=redshift
+ AC_SUBST(GETTEXT_PACKAGE)
+ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
+-- 
+2.15.1
+
diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix
index 3fe0503d7f9d1..92745a404c386 100644
--- a/pkgs/applications/misc/redshift/default.nix
+++ b/pkgs/applications/misc/redshift/default.nix
@@ -1,68 +1,55 @@
-{ fetchurl, stdenv, gettext, intltool, makeWrapper, pkgconfig
-, geoclue2
-, guiSupport ? true, hicolor_icon_theme, librsvg, gtk3, python, pygobject3, pyxdg
-, drmSupport ? true, libdrm
-, randrSupport ? true, libxcb
-, vidModeSupport ? true, libX11, libXxf86vm
-}:
+{ stdenv, fetchFromGitHub, fetchurl, autoconf, automake, gettext, intltool
+, libtool, pkgconfig, wrapGAppsHook, wrapPython, geoclue2, gobjectIntrospection
+, gtk3, python, pygobject3, pyxdg, libdrm, libxcb }:
 
-let
-  mkFlag = flag: name: if flag
-    then "--enable-${name}"
-    else "--disable-${name}";
-in
 stdenv.mkDerivation rec {
   name = "redshift-${version}";
   version = "1.11";
 
-  src = fetchurl {
-    sha256 = "0ngkwj7rg8nfk806w0sg443w6wjr91xdc0zisqfm5h2i77wm1qqh";
-    url = "https://github.com/jonls/redshift/releases/download/v${version}/redshift-${version}.tar.xz";
+  src = fetchFromGitHub {
+    owner = "jonls";
+    repo = "redshift";
+    rev = "v${version}";
+    sha256 = "0jfi4wqklqw2rm0r2xwalyzir88zkdvqj0z5id0l5v20vsrfiiyj";
   };
 
-  buildInputs = [ geoclue2 ]
-    ++ stdenv.lib.optionals guiSupport [ hicolor_icon_theme librsvg gtk3
-      python pygobject3 pyxdg ]
-    ++ stdenv.lib.optionals drmSupport [ libdrm ]
-    ++ stdenv.lib.optionals randrSupport [ libxcb ]
-    ++ stdenv.lib.optionals vidModeSupport [ libX11 libXxf86vm ];
-  nativeBuildInputs = [ gettext intltool makeWrapper pkgconfig ];
+  patches = [
+    # https://github.com/jonls/redshift/pull/575
+    ./575.patch
+  ];
 
-  configureFlags = [
-    (mkFlag guiSupport "gui")
-    (mkFlag drmSupport "drm")
-    (mkFlag randrSupport "randr")
-    (mkFlag vidModeSupport "vidmode")
+  nativeBuildInputs = [
+    autoconf
+    automake
+    gettext
+    intltool
+    libtool
+    pkgconfig
+    wrapGAppsHook
+    wrapPython
   ];
 
-  enableParallelBuilding = true;
+  buildInputs = [
+    geoclue2
+    gobjectIntrospection
+    gtk3
+    libdrm
+    libxcb
+    python
+  ];
 
-  preInstall = stdenv.lib.optionalString guiSupport ''
-    substituteInPlace src/redshift-gtk/redshift-gtk \
-      --replace "/usr/bin/env python3" "${python}/bin/${python.executable}"
-  '';
-  postInstall = stdenv.lib.optionalString guiSupport ''
-    wrapProgram "$out/bin/redshift-gtk" \
-      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
-      --prefix PYTHONPATH : "$PYTHONPATH" \
-      --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
-      --prefix XDG_DATA_DIRS : "$out/share:${hicolor_icon_theme}/share"
+  pythonPath = [ pygobject3 pyxdg ];
 
-    install -Dm644 {.,$out/share/doc/redshift}/redshift.conf.sample
-  '';
+  preConfigure = "./bootstrap";
+  postFixup = "wrapPythonPrograms";
+
+  enableParallelBuilding = true;
 
   meta = with stdenv.lib; {
-    description = "Gradually change screen color temperature";
-    longDescription = ''
-      The color temperature is set according to the position of the
-      sun. A different color temperature is set during night and
-      daytime. During twilight and early morning, the color
-      temperature transitions smoothly from night to daytime
-      temperature to allow your eyes to slowly adapt.
-    '';
+    description = "Screen color temperature manager";
     license = licenses.gpl3Plus;
     homepage = http://jonls.dk/redshift;
     platforms = platforms.linux;
     maintainers = with maintainers; [ mornfall nckx ];
-  }; 
+  };
 }