2016-11-24 01:35:19 +01:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch
|
2015-08-18 22:37:49 +02:00
|
|
|
, ncurses, boehmgc, gettext, zlib
|
|
|
|
, sslSupport ? true, openssl ? null
|
2019-02-03 16:30:24 +01:00
|
|
|
, graphicsSupport ? !stdenv.isDarwin, imlib2 ? null
|
2015-08-18 22:37:49 +02:00
|
|
|
, x11Support ? graphicsSupport, libX11 ? null
|
2015-12-06 21:40:38 +01:00
|
|
|
, mouseSupport ? !stdenv.isDarwin, gpm-ncurses ? null
|
2018-12-11 01:23:09 +01:00
|
|
|
, perl, man, pkgconfig, buildPackages, w3m
|
2005-09-14 18:23:02 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert sslSupport -> openssl != null;
|
2015-08-18 22:37:49 +02:00
|
|
|
assert graphicsSupport -> imlib2 != null;
|
|
|
|
assert x11Support -> graphicsSupport && libX11 != null;
|
2015-09-14 17:46:48 +02:00
|
|
|
assert mouseSupport -> gpm-ncurses != null;
|
2005-09-14 18:23:02 +02:00
|
|
|
|
2015-08-18 22:37:49 +02:00
|
|
|
with stdenv.lib;
|
|
|
|
|
2018-12-11 01:23:09 +01:00
|
|
|
let
|
2019-08-13 23:52:01 +02:00
|
|
|
mktable = buildPackages.stdenv.mkDerivation {
|
2018-12-11 01:23:09 +01:00
|
|
|
name = "w3m-mktable";
|
|
|
|
inherit (w3m) src;
|
|
|
|
nativeBuildInputs = [ pkgconfig boehmgc ];
|
|
|
|
makeFlags = [ "mktable" ];
|
|
|
|
installPhase = ''
|
|
|
|
install -D mktable $out/bin/mktable
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-03-03 23:57:41 +01:00
|
|
|
pname = "w3m";
|
2019-03-04 00:02:04 +01:00
|
|
|
version = "0.5.3+git20190105";
|
2008-11-14 12:16:54 +01:00
|
|
|
|
2016-11-24 01:35:19 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tats";
|
2019-03-03 23:57:41 +01:00
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2019-03-04 00:02:04 +01:00
|
|
|
sha256 = "1fbg2p8qh2gvi3g4iz4q6vc0k70pf248r4yndi5lcn2m3mzvjx0i";
|
2005-09-14 18:23:02 +02:00
|
|
|
};
|
2008-11-14 12:16:54 +01:00
|
|
|
|
2015-12-25 21:14:20 +01:00
|
|
|
NIX_LDFLAGS = optionalString stdenv.isSunOS "-lsocket -lnsl";
|
2013-12-21 13:48:11 +01:00
|
|
|
|
2015-12-25 21:14:20 +01:00
|
|
|
# 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";
|
|
|
|
|
2018-12-11 01:23:09 +01:00
|
|
|
makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ];
|
|
|
|
|
2015-12-25 21:14:20 +01:00
|
|
|
patches = [
|
|
|
|
./RAND_egd.libressl.patch
|
|
|
|
(fetchpatch {
|
|
|
|
name = "https.patch";
|
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/https.patch?h=w3m-mouse&id=5b5f0fbb59f674575e87dd368fed834641c35f03";
|
|
|
|
sha256 = "08skvaha1hjyapsh8zw5dgfy433mw2hk7qy9yy9avn8rjqj7kjxk";
|
|
|
|
})
|
2017-05-23 15:35:47 +02:00
|
|
|
] ++ optional (graphicsSupport && !x11Support) [ ./no-x11.patch ];
|
2010-08-21 19:07:03 +02:00
|
|
|
|
2018-12-11 01:23:09 +01:00
|
|
|
postPatch = optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
|
|
|
ln -s ${mktable}/bin/mktable mktable
|
|
|
|
# stop make from recompiling mktable
|
|
|
|
sed -ie 's!mktable.*:.*!mktable:!' Makefile.in
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgconfig gettext ];
|
|
|
|
buildInputs = [ ncurses boehmgc zlib ]
|
2015-08-18 22:37:49 +02:00
|
|
|
++ optional sslSupport openssl
|
|
|
|
++ optional mouseSupport gpm-ncurses
|
|
|
|
++ optional graphicsSupport imlib2
|
|
|
|
++ optional x11Support libX11;
|
2008-11-14 12:16:54 +01:00
|
|
|
|
2015-12-25 21:14:20 +01:00
|
|
|
postInstall = optionalString graphicsSupport ''
|
|
|
|
ln -s $out/libexec/w3m/w3mimgdisplay $out/bin
|
|
|
|
'';
|
|
|
|
|
2016-02-26 18:38:15 +01:00
|
|
|
hardeningDisable = [ "format" ];
|
2015-12-23 02:59:47 +01:00
|
|
|
|
2017-12-10 19:40:18 +01:00
|
|
|
configureFlags =
|
|
|
|
[ "--with-ssl=${openssl.dev}" "--with-gc=${boehmgc.dev}" ]
|
|
|
|
++ optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
|
|
|
"ac_cv_func_setpgrp_void=yes"
|
|
|
|
]
|
|
|
|
++ optional graphicsSupport "--enable-image=${optionalString x11Support "x11,"}fb";
|
2008-11-14 12:16:54 +01:00
|
|
|
|
|
|
|
preConfigure = ''
|
2012-07-31 23:34:52 +02:00
|
|
|
substituteInPlace ./configure --replace "/lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib /lib64 /usr/lib64" /no-such-path
|
2008-11-14 12:16:54 +01:00
|
|
|
substituteInPlace ./configure --replace /usr /no-such-path
|
|
|
|
'';
|
2008-01-30 20:49:42 +01:00
|
|
|
|
2013-01-17 14:34:58 +01:00
|
|
|
enableParallelBuilding = false;
|
2012-10-16 20:33:08 +02:00
|
|
|
|
2015-08-18 22:37:49 +02:00
|
|
|
# for w3mimgdisplay
|
2015-12-25 21:14:20 +01:00
|
|
|
# see: https://bbs.archlinux.org/viewtopic.php?id=196093
|
2015-08-18 22:37:49 +02:00
|
|
|
LIBS = optionalString x11Support "-lX11";
|
|
|
|
|
|
|
|
meta = {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://w3m.sourceforge.net/";
|
2008-11-14 12:16:54 +01:00
|
|
|
description = "A text-mode web browser";
|
2018-01-17 06:13:23 +01:00
|
|
|
maintainers = [ maintainers.cstrahan ];
|
2016-08-02 19:50:55 +02:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
2018-08-04 16:08:03 +02:00
|
|
|
license = stdenv.lib.licenses.mit;
|
2008-01-30 20:49:42 +01:00
|
|
|
};
|
2005-09-14 18:23:02 +02:00
|
|
|
}
|