w3m: fix cross-build

This commit is contained in:
Jörg Thalheim 2018-12-11 00:23:09 +00:00 committed by Robin Gloster
parent 629d011cea
commit 999387d718

View file

@ -4,7 +4,7 @@
, graphicsSupport ? true, imlib2 ? null
, x11Support ? graphicsSupport, libX11 ? null
, mouseSupport ? !stdenv.isDarwin, gpm-ncurses ? null
, perl, man, pkgconfig
, perl, man, pkgconfig, buildPackages, w3m
}:
assert sslSupport -> openssl != null;
@ -14,7 +14,17 @@ assert mouseSupport -> gpm-ncurses != null;
with stdenv.lib;
stdenv.mkDerivation rec {
let
mktable = buildPackages.stdenv.mkDerivation rec {
name = "w3m-mktable";
inherit (w3m) src;
nativeBuildInputs = [ pkgconfig boehmgc ];
makeFlags = [ "mktable" ];
installPhase = ''
install -D mktable $out/bin/mktable
'';
};
in stdenv.mkDerivation rec {
name = "w3m-0.5.3+git20180125";
src = fetchFromGitHub {
@ -31,6 +41,8 @@ stdenv.mkDerivation rec {
PERL = "${perl}/bin/perl";
MAN = "${man}/bin/man";
makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ];
patches = [
./RAND_egd.libressl.patch
(fetchpatch {
@ -40,8 +52,14 @@ stdenv.mkDerivation rec {
})
] ++ optional (graphicsSupport && !x11Support) [ ./no-x11.patch ];
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ ncurses boehmgc gettext zlib ]
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 ]
++ optional sslSupport openssl
++ optional mouseSupport gpm-ncurses
++ optional graphicsSupport imlib2