summary refs log tree commit diff
path: root/pkgs/tools/X11
diff options
context:
space:
mode:
authorAnthony Roussel <anthony@roussel.dev>2023-11-10 01:00:21 +0100
committerAnthony Roussel <anthony@roussel.dev>2023-11-10 12:46:52 +0100
commit28b9e1a3258c14d91ec77090587efd53441a35c1 (patch)
tree3e50d0f5ebf7e1712ae115ea1f2de1e7261084b6 /pkgs/tools/X11
parent07b8ca7ea175152787c4d3448e6098dd5c2de2b5 (diff)
downloadnixpkgs-28b9e1a3258c14d91ec77090587efd53441a35c1.tar
nixpkgs-28b9e1a3258c14d91ec77090587efd53441a35c1.tar.gz
nixpkgs-28b9e1a3258c14d91ec77090587efd53441a35c1.tar.bz2
nixpkgs-28b9e1a3258c14d91ec77090587efd53441a35c1.tar.lz
nixpkgs-28b9e1a3258c14d91ec77090587efd53441a35c1.tar.xz
nixpkgs-28b9e1a3258c14d91ec77090587efd53441a35c1.tar.zst
nixpkgs-28b9e1a3258c14d91ec77090587efd53441a35c1.zip
xprintidle-ng: fix build
Fixes the config.h include error during build:

```console
In file included from src/xprintidle-ng.c:36:
lib/time.h:28:3: error: #error "Please include config.h first."
    28 |  #error "Please include config.h first."
      |   ^~~~~
```

Introduced since gnulib upgrade:
* https://github.com/coreutils/gnulib/commit/8ad7bc6
* https://lists.gnu.org/archive/html/bug-gnulib/2023-04/msg00088.html
* https://www.gnu.org/software/gnulib/manual/html_node/Source-changes.html

The last version of gnulib now checks that config.h is the first include
in every compilation unit.

This is not the case with the xprintidle-ng source code, so this patch
moves these `config.h` inclusions to be first.
Diffstat (limited to 'pkgs/tools/X11')
-rw-r--r--pkgs/tools/X11/xprintidle-ng/default.nix4
-rw-r--r--pkgs/tools/X11/xprintidle-ng/fix-config_h-includes-should-be-first.patch62
2 files changed, 66 insertions, 0 deletions
diff --git a/pkgs/tools/X11/xprintidle-ng/default.nix b/pkgs/tools/X11/xprintidle-ng/default.nix
index fdb3b7c58a5..076323a4cab 100644
--- a/pkgs/tools/X11/xprintidle-ng/default.nix
+++ b/pkgs/tools/X11/xprintidle-ng/default.nix
@@ -27,6 +27,10 @@ stdenv.mkDerivation rec {
     sha256 = "0a5024vimpfrpj6w60j1ad8qvjkrmxiy8w1yijxfwk917ag9rkpq";
   };
 
+  patches = [
+    ./fix-config_h-includes-should-be-first.patch
+  ];
+
   postPatch = ''
     substituteInPlace configure.ac \
       --replace "AC_PREREQ([2.62])" "AC_PREREQ([2.64])"
diff --git a/pkgs/tools/X11/xprintidle-ng/fix-config_h-includes-should-be-first.patch b/pkgs/tools/X11/xprintidle-ng/fix-config_h-includes-should-be-first.patch
new file mode 100644
index 00000000000..01b4b5d63bd
--- /dev/null
+++ b/pkgs/tools/X11/xprintidle-ng/fix-config_h-includes-should-be-first.patch
@@ -0,0 +1,62 @@
+Fixes the config.h include error during build:
+
+```console
+In file included from src/xprintidle-ng.c:36:
+lib/time.h:28:3: error: #error "Please include config.h first."
+    28 |  #error "Please include config.h first."
+      |   ^~~~~
+```
+
+Introduced since gnulib upgrade:
+* https://github.com/coreutils/gnulib/commit/8ad7bc6
+* https://lists.gnu.org/archive/html/bug-gnulib/2023-04/msg00088.html
+* https://www.gnu.org/software/gnulib/manual/html_node/Source-changes.html
+
+The last version of gnulib now checks that config.h is the first include
+in every compilation unit.
+
+This is not the case with the xprintidle-ng source code, so this patch
+moves these `config.h` inclusions to be first.
+
+---
+ src/time-format.c   | 2 +-
+ src/xprintidle-ng.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/time-format.c b/src/time-format.c
+index 3a46749..4c0a4d2 100644
+--- a/src/time-format.c
++++ b/src/time-format.c
+@@ -18,10 +18,10 @@
+ //     51 Franklin Street, Fifth Floor
+ //     Boston, MA 02110-1301, USA.
+
++#include <config.h>
+ #include <stdbool.h>
+ #include <signal.h>
+ #include <time.h>
+-#include <config.h>
+ #include "system.h"
+ #include "xalloc.h"
+
+diff --git a/src/xprintidle-ng.c b/src/xprintidle-ng.c
+index 5156adf..ca69b2d 100644
+--- a/src/xprintidle-ng.c
++++ b/src/xprintidle-ng.c
+@@ -28,13 +28,13 @@
+ // Eivind Magnus Hvidevold <hvidevold@gmail.com>.
+ // kpowersave is licensed under the GNU GPL, version 2 _only_.
+
++#include <config.h>
+ #include <X11/Xlib.h>
+ #include <X11/extensions/dpms.h>
+ #include <X11/extensions/scrnsaver.h>
+ #include <stdbool.h>
+ #include <signal.h>
+ #include <time.h>
+-#include <config.h>
+ #include "system.h"
+ #include "errno.h"
+ #include "error.h"
+--
+2.42.0