diff --git a/pkgs/applications/networking/browsers/w3m/default.nix b/pkgs/applications/networking/browsers/w3m/default.nix index 358f005a8782..6f37477c1b37 100644 --- a/pkgs/applications/networking/browsers/w3m/default.nix +++ b/pkgs/applications/networking/browsers/w3m/default.nix @@ -1,9 +1,10 @@ -{ stdenv, fetchurl +{ stdenv, fetchurl, fetchpatch , ncurses, boehmgc, gettext, zlib , sslSupport ? true, openssl ? null , graphicsSupport ? true, imlib2 ? null , x11Support ? graphicsSupport, libX11 ? null , mouseSupport ? !stdenv.isDarwin, gpm-ncurses ? null +, perl, man }: assert sslSupport -> openssl != null; @@ -21,15 +22,49 @@ stdenv.mkDerivation rec { sha256 = "1qx9f0kprf92r1wxl3sacykla0g04qsi0idypzz24b7xy9ix5579"; }; - NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lsocket -lnsl"; + NIX_LDFLAGS = optionalString stdenv.isSunOS "-lsocket -lnsl"; - patches = [ ./glibc214.patch ./RAND_egd.libressl.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. - ++ 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 ]; + # we must set these so that the generated files (e.g. w3mhelp.cgi) contain + # the correct paths. + PERL = "${perl}/bin/perl"; + MAN = "${man}/bin/man"; + + # the Arch patches were pulled from: + # https://aur.archlinux.org/cgit/aur.git/?h=w3m-mouse + patches = [ + ./RAND_egd.libressl.patch + (fetchpatch { + name = "file_handle.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/file_handle.patch?h=w3m-mouse&id=5b5f0fbb59f674575e87dd368fed834641c35f03"; + sha256 = "0kkqm68ig9d658kf1iwa1dwcf651f6dy2j98gplcks1mn3bdlak4"; + }) + (fetchpatch { + name = "form_unknown.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/form_unknown.patch?h=w3m-mouse&id=5b5f0fbb59f674575e87dd368fed834641c35f03"; + sha256 = "1mbfclid3bihb1xv7sxcahprn3slzd6ga8rjzlq4rbq80bl053fw"; + }) + (fetchpatch { + name = "gc72.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/gc72.patch?h=w3m-mouse&id=5b5f0fbb59f674575e87dd368fed834641c35f03"; + sha256 = "1n6anaw17by0s6rn25bwkgj2mck7ffspizpwbijvx1ynk451459a"; + }) + (fetchpatch { + name = "https.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/https.patch?h=w3m-mouse&id=5b5f0fbb59f674575e87dd368fed834641c35f03"; + sha256 = "08skvaha1hjyapsh8zw5dgfy433mw2hk7qy9yy9avn8rjqj7kjxk"; + }) + (fetchpatch { + name = "perl.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/perl.patch?h=w3m-mouse&id=5b5f0fbb59f674575e87dd368fed834641c35f03"; + sha256 = "15cq7cwh0d2v64i8by44rgxw48156sgh872921hxrqdakr95p3gy"; + }) + (fetchpatch { + name = "w3m_rgba.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/w3m_rgba.patch?h=w3m-mouse&id=5b5f0fbb59f674575e87dd368fed834641c35f03"; + sha256 = "1dhp1p6z621ayyl9zip9w35x2cxyhhj72jv5dvf0zp4rk6cjm781"; + }) + ] ++ optional (graphicsSupport && !x11Support) [ ./no-x11.patch ] + ++ optional stdenv.isCygwin ./cygwin.patch; buildInputs = [ncurses boehmgc gettext zlib] ++ optional sslSupport openssl @@ -37,6 +72,10 @@ stdenv.mkDerivation rec { ++ optional graphicsSupport imlib2 ++ optional x11Support libX11; + postInstall = optionalString graphicsSupport '' + ln -s $out/libexec/w3m/w3mimgdisplay $out/bin + ''; + configureFlags = "--with-ssl=${openssl} --with-gc=${boehmgc}" + optionalString graphicsSupport " --enable-image=${optionalString x11Support "x11,"}fb"; @@ -48,11 +87,12 @@ stdenv.mkDerivation rec { enableParallelBuilding = false; # for w3mimgdisplay + # see: https://bbs.archlinux.org/viewtopic.php?id=196093 LIBS = optionalString x11Support "-lX11"; meta = { homepage = http://w3m.sourceforge.net/; description = "A text-mode web browser"; - maintainers = [ maintainers.mornfall ]; + maintainers = [ maintainers.mornfall maintainers.cstrahan ]; }; } diff --git a/pkgs/applications/networking/browsers/w3m/glibc214.patch b/pkgs/applications/networking/browsers/w3m/glibc214.patch deleted file mode 100644 index 37e466e21067..000000000000 --- a/pkgs/applications/networking/browsers/w3m/glibc214.patch +++ /dev/null @@ -1,60 +0,0 @@ -http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/w3m/files/w3m-0.5.3-glibc214.patch?revision=1.1 - ---- a/istream.c.~1.27.~ 2011-01-04 18:22:22.000000000 +0900 -+++ b/istream.c 2011-06-24 08:15:23.522990618 +0900 -@@ -22,8 +22,8 @@ - static void basic_close(int *handle); - static int basic_read(int *handle, char *buf, int len); - --static void file_close(struct file_handle *handle); --static int file_read(struct file_handle *handle, char *buf, int len); -+static void file_close(struct afile_handle *handle); -+static int file_read(struct afile_handle *handle, char *buf, int len); - - static int str_read(Str handle, char *buf, int len); - -@@ -114,7 +114,7 @@ - stream = New(union input_stream); - init_base_stream(&stream->base, STREAM_BUF_SIZE); - stream->file.type = IST_FILE; -- stream->file.handle = New(struct file_handle); -+ stream->file.handle = New(struct afile_handle); - stream->file.handle->f = f; - if (closep) - stream->file.handle->close = closep; -@@ -658,13 +658,13 @@ - } - - static void --file_close(struct file_handle *handle) -+file_close(struct afile_handle *handle) - { - handle->close(handle->f); - } - - static int --file_read(struct file_handle *handle, char *buf, int len) -+file_read(struct afile_handle *handle, char *buf, int len) - { - return fread(buf, 1, len, handle->f); - } ---- a/istream.h.~1.12.~ 2003-10-21 01:41:56.000000000 +0900 -+++ b/istream.h 2011-06-24 08:15:54.392991144 +0900 -@@ -20,7 +20,7 @@ - - typedef struct stream_buffer *StreamBuffer; - --struct file_handle { -+struct afile_handle { - FILE *f; - void (*close) (); - }; -@@ -53,7 +53,7 @@ - - struct file_stream { - struct stream_buffer stream; -- struct file_handle *handle; -+ struct afile_handle *handle; - char type; - char iseos; - int (*read) (); diff --git a/pkgs/applications/networking/browsers/w3m/newgc.patch b/pkgs/applications/networking/browsers/w3m/newgc.patch deleted file mode 100644 index db25e305c8c1..000000000000 --- a/pkgs/applications/networking/browsers/w3m/newgc.patch +++ /dev/null @@ -1,15 +0,0 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=555467 - ---- a/main.c.old 2007-05-31 06:49:50.000000000 +0530 -+++ b/main.c 2010-02-16 16:16:24.000000000 +0530 -@@ -842,7 +842,9 @@ - mySignal(SIGPIPE, SigPipe); - #endif - -- orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc); -+ orig_GC_warn_proc = GC_get_warn_proc(); -+ GC_set_warn_proc(wrap_GC_warn_proc); -+ - err_msg = Strnew(); - if (load_argc == 0) { - /* no URL specified */