2021-01-15 05:42:41 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch
|
2015-08-18 20:37:49 +00:00
|
|
|
, ncurses, boehmgc, gettext, zlib
|
2022-08-24 22:20:22 +00:00
|
|
|
, sslSupport ? true, openssl
|
|
|
|
, graphicsSupport ? !stdenv.hostPlatform.isDarwin, imlib2
|
|
|
|
, x11Support ? graphicsSupport, libX11
|
|
|
|
, mouseSupport ? !stdenv.hostPlatform.isDarwin, gpm-ncurses
|
2021-01-17 02:09:27 +00:00
|
|
|
, perl, man, pkg-config, buildPackages, w3m
|
2024-07-20 05:27:28 +00:00
|
|
|
, testers, updateAutotoolsGnuConfigScriptsHook
|
2005-09-14 16:23:02 +00:00
|
|
|
}:
|
|
|
|
|
2018-12-11 00:23:09 +00:00
|
|
|
let
|
2019-08-13 21:52:01 +00:00
|
|
|
mktable = buildPackages.stdenv.mkDerivation {
|
2018-12-11 00:23:09 +00:00
|
|
|
name = "w3m-mktable";
|
|
|
|
inherit (w3m) src;
|
2021-01-17 02:09:27 +00:00
|
|
|
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";
|
2023-03-10 20:44:00 +00:00
|
|
|
version = "0.5.3+git20230121";
|
2008-11-14 11:16:54 +00:00
|
|
|
|
2016-11-24 00:35:19 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tats";
|
2019-03-03 22:57:41 +00:00
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-03-10 20:44:00 +00:00
|
|
|
hash = "sha256-upb5lWqhC1jRegzTncIz5e21v4Pw912FyVn217HucFs=";
|
2005-09-14 16:23:02 +00:00
|
|
|
};
|
2008-11-14 11:16:54 +00:00
|
|
|
|
2022-08-24 22:20:22 +00:00
|
|
|
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isSunOS "-lsocket -lnsl";
|
2013-12-21 12:48:11 +00:00
|
|
|
|
2015-12-25 20:14:20 +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" ];
|
|
|
|
|
2015-12-25 20:14:20 +00: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";
|
|
|
|
})
|
2022-08-24 22:20:22 +00:00
|
|
|
];
|
2010-08-21 17:07:03 +00:00
|
|
|
|
2022-08-24 22:20:22 +00:00
|
|
|
postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
2018-12-11 00:23:09 +00:00
|
|
|
ln -s ${mktable}/bin/mktable mktable
|
|
|
|
# stop make from recompiling mktable
|
|
|
|
sed -ie 's!mktable.*:.*!mktable:!' Makefile.in
|
|
|
|
'';
|
|
|
|
|
2024-07-20 05:27:28 +00:00
|
|
|
# updateAutotoolsGnuConfigScriptsHook necessary to build on FreeBSD native pending inclusion of
|
|
|
|
# https://git.savannah.gnu.org/cgit/config.git/commit/?id=e4786449e1c26716e3f9ea182caf472e4dbc96e0
|
|
|
|
nativeBuildInputs = [ pkg-config gettext updateAutotoolsGnuConfigScriptsHook ];
|
2018-12-11 00:23:09 +00:00
|
|
|
buildInputs = [ ncurses boehmgc zlib ]
|
2022-08-24 22:20:22 +00:00
|
|
|
++ lib.optional sslSupport openssl
|
|
|
|
++ lib.optional mouseSupport gpm-ncurses
|
|
|
|
++ lib.optional graphicsSupport imlib2
|
|
|
|
++ lib.optional x11Support libX11;
|
2008-11-14 11:16:54 +00:00
|
|
|
|
2022-08-24 22:20:22 +00:00
|
|
|
postInstall = lib.optionalString graphicsSupport ''
|
2015-12-25 20:14:20 +00:00
|
|
|
ln -s $out/libexec/w3m/w3mimgdisplay $out/bin
|
|
|
|
'';
|
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
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}" ]
|
2022-08-24 22:20:22 +00:00
|
|
|
++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
2017-12-10 18:40:18 +00:00
|
|
|
"ac_cv_func_setpgrp_void=yes"
|
|
|
|
]
|
2022-08-24 22:20:22 +00:00
|
|
|
++ lib.optional graphicsSupport "--enable-image=${lib.optionalString x11Support "x11,"}fb"
|
|
|
|
++ lib.optional (graphicsSupport && !x11Support) "--without-x";
|
2008-11-14 11:16:54 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
2012-07-31 21:34:52 +00: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 11:16:54 +00:00
|
|
|
substituteInPlace ./configure --replace /usr /no-such-path
|
|
|
|
'';
|
2008-01-30 19:49:42 +00:00
|
|
|
|
2013-01-17 13:34:58 +00:00
|
|
|
enableParallelBuilding = false;
|
2012-10-16 18:33:08 +00:00
|
|
|
|
2015-08-18 20:37:49 +00:00
|
|
|
# for w3mimgdisplay
|
2015-12-25 20:14:20 +00:00
|
|
|
# see: https://bbs.archlinux.org/viewtopic.php?id=196093
|
2022-08-24 22:20:22 +00:00
|
|
|
LIBS = lib.optionalString x11Support "-lX11";
|
2015-08-18 20:37:49 +00:00
|
|
|
|
2023-03-10 20:44:00 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
inherit version;
|
|
|
|
package = w3m;
|
|
|
|
command = "w3m -version";
|
|
|
|
};
|
|
|
|
|
2022-08-24 22:20:22 +00:00
|
|
|
meta = with lib; {
|
2023-01-21 21:41:12 +00:00
|
|
|
homepage = "https://w3m.sourceforge.net/";
|
2023-03-10 20:44:00 +00:00
|
|
|
changelog = "https://github.com/tats/w3m/blob/v${version}/ChangeLog";
|
2008-11-14 11:16:54 +00:00
|
|
|
description = "Text-mode web browser";
|
2023-09-29 22:29:36 +00:00
|
|
|
maintainers = with maintainers; [ anthonyroussel ];
|
2022-08-24 22:20:22 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.mit;
|
2023-03-10 20:44:00 +00:00
|
|
|
mainProgram = "w3m";
|
2008-01-30 19:49:42 +00:00
|
|
|
};
|
2005-09-14 16:23:02 +00:00
|
|
|
}
|