{ stdenv
, fetchurl
, libtsm
, systemd
, libxkbcommon
, libdrm
, mesa
, pango
, pixman
, pkgconfig
, docbook_xsl
, libxslt
}:

stdenv.mkDerivation rec {
  name = "kmscon-8";

  src = fetchurl {
    url = "http://www.freedesktop.org/software/kmscon/releases/${name}.tar.xz";
    sha256 = "0axfwrp3c8f4gb67ap2sqnkn75idpiw09s35wwn6kgagvhf1rc0a";
  };

  buildInputs = [
    libtsm
    systemd
    libxkbcommon
    libdrm
    mesa
    pango
    pixman
    pkgconfig
    docbook_xsl
    libxslt
  ];

  configureFlags = [
    "--enable-multi-seat"
    "--disable-debug"
    "--enable-optimizations"
    "--with-renderers=bbulk,gltex,pixman"
  ];

  meta = {
    description = "KMS/DRM based System Console";
    homepage = "http://www.freedesktop.org/wiki/Software/kmscon/";
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.linux;
  };
}

{ stdenv
, fetchurl
, libtsm
, systemd
, libxkbcommon
, libdrm
, mesa
, pango
, pixman
, pkgconfig
, docbook_xsl
, libxslt
}:

stdenv.mkDerivation rec {
  name = "kmscon-8";

  src = fetchurl {
    url = "http://www.freedesktop.org/software/kmscon/releases/${name}.tar.xz";
    sha256 = "0axfwrp3c8f4gb67ap2sqnkn75idpiw09s35wwn6kgagvhf1rc0a";
  };

  buildInputs = [
    libtsm
    systemd
    libxkbcommon
    libdrm
    mesa
    pango
    pixman
    pkgconfig
    docbook_xsl
    libxslt
  ];

  # FIXME: Remove as soon as kmscon > 8 comes along.
  postPatch = ''
    sed -i -e 's/libsystemd-daemon libsystemd-login/libsystemd/g' configure
  '';

  configureFlags = [
    "--enable-multi-seat"
    "--disable-debug"
    "--enable-optimizations"
    "--with-renderers=bbulk,gltex,pixman"
  ];

  meta = {
    description = "KMS/DRM based System Console";
    homepage = "http://www.freedesktop.org/wiki/Software/kmscon/";
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.linux;
  };
}

Fix build against systemd 230
kmscon: Fix build against systemd 230

From the changelog:

  The compatibility libraries libsystemd-daemon.so,
  libsystemd-journal.so, libsystemd-id128.so, and libsystemd-login.so
  which have been deprecated since systemd-209 have been removed along
  with the corresponding pkg-config files. All symbols provided by those
  libraries are provided by libsystemd.so.

So let's just replace the use of libsystemd-daemon and libsystemd-login
with libsystemd in the configure script until a new version of kmscon
comes along.

Signed-off-by: aszlig <ee1aa092358634f9c53f01b5a783726c9e21b35a@redmoonstudios.org>
