3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/networking/browsers/w3m/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
3.1 KiB
Nix
Raw Normal View History

2021-01-15 05:42:41 +00:00
{ lib, stdenv, fetchFromGitHub, fetchpatch
, ncurses, boehmgc, gettext, zlib
, sslSupport ? true, openssl ? null
2019-02-03 15:30:24 +00:00
, graphicsSupport ? !stdenv.isDarwin, imlib2 ? null
, x11Support ? graphicsSupport, libX11 ? null
, mouseSupport ? !stdenv.isDarwin, gpm-ncurses ? null
, perl, man, pkg-config, buildPackages, w3m
}:
assert sslSupport -> openssl != null;
assert graphicsSupport -> imlib2 != null;
assert x11Support -> graphicsSupport && libX11 != null;
assert mouseSupport -> gpm-ncurses != null;
2021-01-15 05:42:41 +00:00
with lib;
2018-12-11 00:23:09 +00:00
let
2019-08-13 22:52:01 +01:00
mktable = buildPackages.stdenv.mkDerivation {
2018-12-11 00:23:09 +00:00
name = "w3m-mktable";
inherit (w3m) src;
nativeBuildInputs = [ pkg-config boehmgc ];
2018-12-11 00:23:09 +00:00
makeFlags = [ "mktable" ];
installPhase = ''
install -D mktable $out/bin/mktable
'';
};
in stdenv.mkDerivation rec {
2019-03-03 22:57:41 +00:00
pname = "w3m";
version = "0.5.3+git20190105";
src = fetchFromGitHub {
owner = "tats";
2019-03-03 22:57:41 +00:00
repo = pname;
rev = "v${version}";
sha256 = "1fbg2p8qh2gvi3g4iz4q6vc0k70pf248r4yndi5lcn2m3mzvjx0i";
};
NIX_LDFLAGS = optionalString stdenv.isSunOS "-lsocket -lnsl";
2013-12-21 12:48:11 +00: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 00:23:09 +00:00
makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ];
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 14:35:47 +01:00
] ++ optional (graphicsSupport && !x11Support) [ ./no-x11.patch ];
2018-12-11 00:23:09 +00: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 = [ pkg-config gettext ];
2018-12-11 00:23:09 +00:00
buildInputs = [ ncurses boehmgc zlib ]
++ optional sslSupport openssl
++ optional mouseSupport gpm-ncurses
++ optional graphicsSupport imlib2
++ optional x11Support libX11;
postInstall = optionalString graphicsSupport ''
ln -s $out/libexec/w3m/w3mimgdisplay $out/bin
'';
hardeningDisable = [ "format" ];
2015-12-23 01:59:47 +00:00
2017-12-10 18:40:18 +00: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";
preConfigure = ''
substituteInPlace ./configure --replace "/lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib /lib64 /usr/lib64" /no-such-path
substituteInPlace ./configure --replace /usr /no-such-path
'';
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.cstrahan ];
2021-01-15 05:42:41 +00:00
platforms = lib.platforms.unix;
license = lib.licenses.mit;
};
}