about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/wlroots
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-04-21 00:59:52 +0000
committerAlyssa Ross <hi@alyssa.is>2019-04-23 10:10:42 +0000
commitb6fb912740883115fc3a746f0ca0c775bb23a36b (patch)
treeb90f7c2a63b1b9eeaa46b8bfedb299198e568acb /nixpkgs/pkgs/development/libraries/wlroots
parent8c8ac77d6521b9e37ad77c69718493b9daebbd35 (diff)
downloadnixlib-b6fb912740883115fc3a746f0ca0c775bb23a36b.tar
nixlib-b6fb912740883115fc3a746f0ca0c775bb23a36b.tar.gz
nixlib-b6fb912740883115fc3a746f0ca0c775bb23a36b.tar.bz2
nixlib-b6fb912740883115fc3a746f0ca0c775bb23a36b.tar.lz
nixlib-b6fb912740883115fc3a746f0ca0c775bb23a36b.tar.xz
nixlib-b6fb912740883115fc3a746f0ca0c775bb23a36b.tar.zst
nixlib-b6fb912740883115fc3a746f0ca0c775bb23a36b.zip
wlroots: make optional dependencies optional
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/wlroots')
-rw-r--r--nixpkgs/pkgs/development/libraries/wlroots/0001-Fix-missing-headers-when-building-without-X11.patch133
-rw-r--r--nixpkgs/pkgs/development/libraries/wlroots/default.nix31
2 files changed, 153 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/development/libraries/wlroots/0001-Fix-missing-headers-when-building-without-X11.patch b/nixpkgs/pkgs/development/libraries/wlroots/0001-Fix-missing-headers-when-building-without-X11.patch
new file mode 100644
index 000000000000..7eb55132100f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wlroots/0001-Fix-missing-headers-when-building-without-X11.patch
@@ -0,0 +1,133 @@
+From 3588e89124d37c8d1968b3b6dbb723b4f6c4525c Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Sun, 21 Apr 2019 00:35:57 +0000
+Subject: [PATCH] Fix missing headers when building without X11
+
+The deleted includes are redundant, because other headers will include
+the necessary files. Additionally, they cause build failures, because
+including EGL/egl.h or EGL/eglext.h directly, instead of through
+wlr/render/egl.h or wlr/render/interface.h, will mean that
+MESA_EGL_NO_X11_HEADERS will not have been defined, and so the EGL
+headers will attempt to pull in unnecessary X11 headers that may not
+exist on the system.
+
+For the headers produced by glgen.sh, the includes couldn't simply be
+deleted, because no other header would include the EGL headers. Neither
+wlr/render/egl.h or wlr/render/interface.h felt appropriate to include,
+so I opted instead to copy the MESA_EGL_NO_X11_HEADERS definition before
+the EGL includes.
+---
+ backend/drm/drm.c         | 2 --
+ backend/drm/renderer.c    | 2 --
+ backend/headless/output.c | 2 --
+ backend/wayland/backend.c | 2 --
+ glgen.sh                  | 5 +++++
+ include/render/gles2.h    | 2 --
+ render/egl.c              | 2 --
+ rootston/output.c         | 1 -
+ 8 files changed, 5 insertions(+), 13 deletions(-)
+
+diff --git a/backend/drm/drm.c b/backend/drm/drm.c
+index 7fd36794..74aeeb42 100644
+--- a/backend/drm/drm.c
++++ b/backend/drm/drm.c
+@@ -2,8 +2,6 @@
+ #include <assert.h>
+ #include <drm_fourcc.h>
+ #include <drm_mode.h>
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <errno.h>
+ #include <gbm.h>
+ #include <GLES2/gl2.h>
+diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
+index 72cfd430..1771e725 100644
+--- a/backend/drm/renderer.c
++++ b/backend/drm/renderer.c
+@@ -1,6 +1,4 @@
+ #include <assert.h>
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <gbm.h>
+ #include <stdbool.h>
+ #include <stdlib.h>
+diff --git a/backend/headless/output.c b/backend/headless/output.c
+index 3cb35dce..283b5513 100644
+--- a/backend/headless/output.c
++++ b/backend/headless/output.c
+@@ -1,6 +1,4 @@
+ #include <assert.h>
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <stdlib.h>
+ #include <wlr/interfaces/wlr_output.h>
+ #include <wlr/render/wlr_renderer.h>
+diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
+index 2a937de7..7c8bb4e0 100644
+--- a/backend/wayland/backend.c
++++ b/backend/wayland/backend.c
+@@ -5,8 +5,6 @@
+ 
+ #include <wlr/config.h>
+ 
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <wayland-server.h>
+ 
+ #include <wlr/backend/interface.h>
+diff --git a/glgen.sh b/glgen.sh
+index fb3bb3c6..daa98b00 100755
+--- a/glgen.sh
++++ b/glgen.sh
+@@ -62,6 +62,11 @@ cat > "$OUTDIR/$BASE.h" << EOF
+ #define $INCLUDE_GUARD
+ 
+ #include <stdbool.h>
++#include <wlr/config.h>
++
++#if !WLR_HAS_X11_BACKEND && !WLR_HAS_XWAYLAND && !defined MESA_EGL_NO_X11_HEADERS
++#define MESA_EGL_NO_X11_HEADERS
++#endif
+ 
+ #include <EGL/egl.h>
+ #include <EGL/eglext.h>
+diff --git a/include/render/gles2.h b/include/render/gles2.h
+index 593c7d1c..7e0782d4 100644
+--- a/include/render/gles2.h
++++ b/include/render/gles2.h
+@@ -1,8 +1,6 @@
+ #ifndef RENDER_GLES2_H
+ #define RENDER_GLES2_H
+ 
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <GLES2/gl2.h>
+ #include <GLES2/gl2ext.h>
+ #include <stdbool.h>
+diff --git a/render/egl.c b/render/egl.c
+index cc00dece..c0d43609 100644
+--- a/render/egl.c
++++ b/render/egl.c
+@@ -1,7 +1,5 @@
+ #include <assert.h>
+ #include <drm_fourcc.h>
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <wlr/render/egl.h>
+diff --git a/rootston/output.c b/rootston/output.c
+index bc2f4d6c..4e9e9d18 100644
+--- a/rootston/output.c
++++ b/rootston/output.c
+@@ -13,7 +13,6 @@
+ #include <wlr/types/wlr_xdg_shell.h>
+ #include <wlr/util/log.h>
+ #include <wlr/util/region.h>
+-#include <wlr/xwayland.h>
+ #include "rootston/config.h"
+ #include "rootston/layers.h"
+ #include "rootston/output.h"
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/wlroots/default.nix b/nixpkgs/pkgs/development/libraries/wlroots/default.nix
index cce9af2d707f..82782125d204 100644
--- a/nixpkgs/pkgs/development/libraries/wlroots/default.nix
+++ b/nixpkgs/pkgs/development/libraries/wlroots/default.nix
@@ -1,6 +1,10 @@
-{ stdenv, fetchFromGitHub, fetchpatch, meson, ninja, pkgconfig
-, wayland, libGL, wayland-protocols, libinput, libxkbcommon, pixman
-, xcbutilwm, libX11, libcap, xcbutilerrors, mesa_noglu
+{ stdenv, lib, fetchFromGitHub, fetchpatch, meson, ninja, pkgconfig
+, wayland, libGL, wayland-protocols, libinput, libxkbcommon, pixman, mesa_noglu
+
+, libcapSupport ? true, libcap
+, x11Support ? true, libX11
+, xcbIcccmSupport ? x11Support, xcbutilwm
+, xcbErrorsSupport ? x11Support, xcbutilerrors
 }:
 
 let
@@ -16,6 +20,8 @@ in stdenv.mkDerivation rec {
     sha256 = "1phiidyddzgaxy4gbqwmykxn0y8za6y5mp66l9dpd9i6fml153yq";
   };
 
+  patches = [ ./0001-Fix-missing-headers-when-building-without-X11.patch ];
+
   # $out for the library, $bin for rootston, and $examples for the example
   # programs (in examples) AND rootston
   outputs = [ "out" "bin" "examples" ];
@@ -23,14 +29,17 @@ in stdenv.mkDerivation rec {
   nativeBuildInputs = [ meson ninja pkgconfig ];
 
   buildInputs = [
-    wayland libGL wayland-protocols libinput libxkbcommon pixman
-    xcbutilwm libX11 libcap xcbutilerrors mesa_noglu
-  ];
+    wayland libGL wayland-protocols libinput libxkbcommon pixman mesa_noglu
+  ] ++ lib.optional libcapSupport libcap
+    ++ lib.optional x11Support libX11
+    ++ lib.optional xcbErrorsSupport xcbutilerrors
+    ++ lib.optional xcbIcccmSupport xcbutilwm;
 
-  mesonFlags = [
-    "-Dlibcap=enabled" "-Dlogind=enabled" "-Dxwayland=enabled" "-Dx11-backend=enabled"
-    "-Dxcb-icccm=enabled" "-Dxcb-errors=enabled"
-  ];
+  mesonFlags = [ "-Dlogind=enabled" ]
+    ++ lib.optional libcapSupport "-Dlibcap=enabled"
+    ++ lib.optionals x11Support [ "-Dxwayland=enabled" "-Dx11-backend=enabled" ]
+    ++ lib.optional xcbErrorsSupport "-Dxcb-errors=enabled"
+    ++ lib.optional xcbIcccmSupport  "-Dxcb-icccm=enabled";
 
   postPatch = ''
     # It happens from time to time that the version wasn't updated:
@@ -71,7 +80,7 @@ in stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A modular Wayland compositor library";
     inherit (src.meta) homepage;
     license     = licenses.mit;