about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/browsers/netsurf/browser.nix
blob: db4940093b309591f0db89f5290675be1499652a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{ lib, stdenv, fetchurl, fetchpatch, makeWrapper, wrapGAppsHook

# Buildtime dependencies.
, check, pkg-config, xxd

# Runtime dependencies.
, curl, expat, libXcursor, libXrandr, libidn, libjpeg, libpng, libwebp, libxml2
, openssl, perl, perlPackages

# uilib-specific dependencies
, gtk2 # GTK 2
, gtk3 # GTK 3
, SDL  # Framebuffer

# Configuration
, uilib

# Netsurf-specific dependencies
, libcss, libdom, libhubbub, libnsbmp, libnsfb, libnsgif
, libnslog, libnspsl, libnsutils, libparserutils, libsvgtiny, libutf8proc
, libwapcaplet, nsgenbind
}:

let
  inherit (lib) optional optionals;
in
stdenv.mkDerivation rec {
  pname = "netsurf";
  version = "3.10";

  src = fetchurl {
    url = "http://download.netsurf-browser.org/netsurf/releases/source/${pname}-${version}-src.tar.gz";
    sha256 = "sha256-NkhEKeGTYUaFwv8kb1W9Cm3d8xoBi+5F4NH3wohRmV4=";
  };

  nativeBuildInputs = [
    makeWrapper
    perl
    perlPackages.HTMLParser
    pkg-config
    xxd
  ]
  ++ optional (uilib == "gtk2" || uilib == "gtk3") wrapGAppsHook
  ;

  buildInputs = [
    check curl libXcursor libXrandr libidn libjpeg libpng libwebp libxml2 openssl
    # Netsurf-specific libraries
    nsgenbind libnsfb libwapcaplet libparserutils libnslog libcss
    libhubbub libdom libnsbmp libnsgif libsvgtiny libnsutils libnspsl
    libutf8proc
  ]
  ++ optionals (uilib == "framebuffer") [ expat SDL ]
  ++ optional (uilib == "gtk2") gtk2
  ++ optional (uilib == "gtk3") gtk3
  ;

  preConfigure = ''
    cat <<EOF > Makefile.conf
    override NETSURF_GTK_RES_PATH  := $out/share/
    override NETSURF_USE_GRESOURCE := YES
    EOF
  '';

  makeFlags = [
    "PREFIX=${placeholder "out"}"
    "TARGET=${uilib}"
  ];

  meta = with lib; {
    homepage = "https://www.netsurf-browser.org/";
    description = "A free, open source, small web browser";
    longDescription = ''
      NetSurf is a free, open source web browser. It is written in C and
      released under the GNU Public Licence version 2. NetSurf has its own
      layout and rendering engine entirely written from scratch. It is small and
      capable of handling many of the web standards in use today.
    '';
    license = licenses.gpl2Only;
    maintainers = [ maintainers.vrthra maintainers.AndersonTorres ];
    platforms = platforms.linux;
  };
}