Skip to content

Commit

Permalink
Merge pull request #11222 from oxij/w3m-fixes
Browse files Browse the repository at this point in the history
w3m and ranger fixes
  • Loading branch information
jagajaga committed Nov 28, 2015
2 parents 2b97070 + 244fba3 commit 8795eeb
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 19 deletions.
2 changes: 1 addition & 1 deletion nixos/modules/services/misc/nixos-manual.nix
Expand Up @@ -117,7 +117,7 @@ in
services.mingetty.helpLine = mkIf cfg.showManual
"\nPress <Alt-F${toString cfg.ttyNumber}> for the NixOS manual.";

services.nixosManual.browser = mkDefault "${pkgs.w3m}/bin/w3m";
services.nixosManual.browser = mkDefault "${pkgs.w3m-nox}/bin/w3m";

};

Expand Down
36 changes: 22 additions & 14 deletions pkgs/applications/networking/browsers/w3m/default.nix
@@ -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";

Expand All @@ -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
Expand All @@ -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 ];
Expand Down
15 changes: 15 additions & 0 deletions pkgs/applications/networking/browsers/w3m/no-x11.patch
@@ -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"
26 changes: 22 additions & 4 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -924,6 +924,7 @@ let

asciidoc = callPackage ../tools/typesetting/asciidoc {
inherit (pythonPackages) matplotlib numpy aafigure recursivePthLoader;
w3m = w3m-batch;
enableStandardFeatures = false;
};

Expand Down Expand Up @@ -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 { };

Expand Down Expand Up @@ -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 { };
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 { };

Expand Down

0 comments on commit 8795eeb

Please sign in to comment.