w3m: fix w3mimgdisplay, refactor the expression, make batch and nox versions, use batch version where appropriate

This commit is contained in:
Jan Malakhovski 2015-08-18 20:37:49 +00:00
parent 2b97070986
commit caed1528a3
3 changed files with 59 additions and 18 deletions

View File

@ -1,16 +1,18 @@
{ stdenv, fetchurl
, sslSupport ? true
, graphicsSupport ? false
, mouseSupport ? false
, ncurses, openssl ? null, boehmgc, gettext, zlib
, imlib2 ? null, xlibsWrapper ? null, fbcon ? null
, gpm-ncurses ? null
, ncurses, boehmgc, gettext, zlib
, sslSupport ? true, openssl ? null
, graphicsSupport ? true, imlib2 ? null
, x11Support ? graphicsSupport, libX11 ? null
, mouseSupport ? true, gpm-ncurses ? null
}:
assert sslSupport -> openssl != null;
assert graphicsSupport -> imlib2 != null && (xlibsWrapper != null || fbcon != null);
assert graphicsSupport -> imlib2 != null;
assert x11Support -> graphicsSupport && libX11 != null;
assert mouseSupport -> gpm-ncurses != null;
with stdenv.lib;
stdenv.mkDerivation rec {
name = "w3m-0.5.3";
@ -24,16 +26,19 @@ stdenv.mkDerivation rec {
patches = [ ./glibc214.patch ]
# Patch for the newer unstable boehm-gc 7.2alpha. Not all platforms use that
# alpha. At the time of writing this, boehm-gc-7.1 is the last stable.
++ stdenv.lib.optional (boehmgc.name != "boehm-gc-7.1") [ ./newgc.patch ]
++ stdenv.lib.optional stdenv.isCygwin ./cygwin.patch;
++ optional (boehmgc.name != "boehm-gc-7.1") [ ./newgc.patch ]
++ optional stdenv.isCygwin ./cygwin.patch
# for frame buffer only version
++ optional (graphicsSupport && !x11Support) [ ./no-x11.patch ];
buildInputs = [ncurses boehmgc gettext zlib]
++ stdenv.lib.optional sslSupport openssl
++ stdenv.lib.optional mouseSupport gpm-ncurses
++ stdenv.lib.optionals graphicsSupport [imlib2 xlibsWrapper fbcon];
++ optional sslSupport openssl
++ optional mouseSupport gpm-ncurses
++ optional graphicsSupport imlib2
++ optional x11Support libX11;
configureFlags = "--with-ssl=${openssl} --with-gc=${boehmgc}"
+ stdenv.lib.optionalString graphicsSupport " --enable-image=x11,fb";
+ optionalString graphicsSupport " --enable-image=${optionalString x11Support "x11,"}fb";
preConfigure = ''
substituteInPlace ./configure --replace "/lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib /lib64 /usr/lib64" /no-such-path
@ -42,7 +47,10 @@ stdenv.mkDerivation rec {
enableParallelBuilding = false;
meta = with stdenv.lib; {
# for w3mimgdisplay
LIBS = optionalString x11Support "-lX11";
meta = {
homepage = http://w3m.sourceforge.net/;
description = "A text-mode web browser";
maintainers = [ maintainers.mornfall ];

View File

@ -0,0 +1,15 @@
Forget about X11 in fb module.
This breaks w3mimgdisplay under X11, but removes X11 dependency it in pure fb.
diff --git a/w3mimg/fb/fb_imlib2.c b/w3mimg/fb/fb_imlib2.c
index ea36637..d3d7bc3 100644
--- a/w3mimg/fb/fb_imlib2.c
+++ b/w3mimg/fb/fb_imlib2.c
@@ -3,7 +3,7 @@
fb_imlib2.c 0.3 Copyright (C) 2002, hito
**************************************************************************/
-#include <X11/Xlib.h>
+#define X_DISPLAY_MISSING
#include <Imlib2.h>
#include "fb.h"
#include "fb_img.h"

View File

@ -924,6 +924,7 @@ let
asciidoc = callPackage ../tools/typesetting/asciidoc {
inherit (pythonPackages) matplotlib numpy aafigure recursivePthLoader;
w3m = w3m-batch;
enableStandardFeatures = false;
};
@ -3143,7 +3144,9 @@ let
stricat = callPackage ../tools/security/stricat { };
privoxy = callPackage ../tools/networking/privoxy { };
privoxy = callPackage ../tools/networking/privoxy {
w3m = w3m-batch;
};
swaks = callPackage ../tools/networking/swaks { };
@ -3597,7 +3600,7 @@ let
xmlstarlet = callPackage ../tools/text/xml/xmlstarlet { };
xmlto = callPackage ../tools/typesetting/xmlto {
w3m = w3m.override { graphicsSupport = false; };
w3m = w3m-batch;
};
xmltv = callPackage ../tools/misc/xmltv { };
@ -13388,8 +13391,21 @@ let
vym = callPackage ../applications/misc/vym { };
w3m = callPackage ../applications/networking/browsers/w3m {
w3m = callPackage ../applications/networking/browsers/w3m { };
# Should always be the version with the most features
w3m-full = w3m;
# Version without X11
w3m-nox = w3m.override {
x11Support = false;
};
# Version for batch text processing, not a good browser
w3m-batch = w3m.override {
graphicsSupport = false;
x11Support = false;
mouseSupport = false;
};
weechat = callPackage ../applications/networking/irc/weechat {
@ -13592,7 +13608,9 @@ let
xdg-user-dirs = callPackage ../tools/X11/xdg-user-dirs { };
xdg_utils = callPackage ../tools/X11/xdg-utils { };
xdg_utils = callPackage ../tools/X11/xdg-utils {
w3m = w3m-batch;
};
xdotool = callPackage ../tools/X11/xdotool { };