summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/icecat-3/default.nix
blob: 4e6743c0286b434289ce9feec8683676a249df46 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{ stdenv, fetchurl, pkgconfig, gtk, pango, perl, python, ply, zip, libIDL
, libjpeg, libpng, zlib, cairo, dbus, dbus_glib, bzip2, xlibs, alsaLib
, gnomevfs, libgnomeui
, freetype, fontconfig
, application ? "browser" }:

let version = "3.5.3"; in
stdenv.mkDerivation {
  name = "icecat-${version}";

  src = fetchurl {
    url = "mirror://gnu/gnuzilla/${version}/icecat-${version}.tar.bz2";
    sha256 = "0cjf75crk4g84swya57ixm7152v774hsxif3xrws4yz9dasqlz5j";
  };

  buildInputs = [
    libgnomeui gnomevfs alsaLib
    pkgconfig gtk perl zip libIDL libjpeg libpng zlib cairo bzip2
    python ply dbus dbus_glib pango freetype fontconfig
    xlibs.libXi xlibs.libX11 xlibs.libXrender xlibs.libXft xlibs.libXt
  ];

  patches = [
    ./skip-gre-registration.patch ./rpath-link.patch
  ];

  configureFlags = [
    "--enable-application=${application}"
    "--enable-libxul"
    "--disable-javaxpcom"

    "--enable-optimize"
    "--disable-debug"
    "--enable-strip"
    "--with-system-jpeg"
    "--with-system-zlib"
    "--with-system-bz2"
    # "--with-system-png" # <-- "--with-system-png won't work because the system's libpng doesn't have APNG support"
    "--enable-system-cairo"
    #"--enable-system-sqlite" # <-- this seems to be discouraged
    "--disable-crashreporter"
  ];

  preConfigure = ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fPIC"'';

  postInstall = ''
    export dontPatchELF=1;

    # Strip some more stuff
    strip -S $out/lib/*/* || true
    
    # This fixes starting IceCat when there already is a running
    # instance.  The `icecat' wrapper script actually expects to be
    # in the same directory as `run-mozilla.sh', apparently.
    libDir=$(cd $out/lib && ls -d icecat-[0-9]*)
    test -n "$libDir"

    if [ -f "$out/bin/icecat" ]
    then
        # Fix references to /bin paths in the IceCat shell script.
        substituteInPlace $out/bin/icecat		\
            --replace /bin/pwd "$(type -tP pwd)"	\
            --replace /bin/ls "$(type -tP ls)"

        cd $out/bin
        mv icecat ../lib/$libDir/
        ln -s ../lib/$libDir/icecat .

        # Register extensions etc.
        echo "running \`icecat -register'..."
        (cd $out/lib/$libDir && LD_LIBRARY_PATH=. ./icecat-bin -register) || false
    fi

    if [ -f "$out/lib/$libDir/xpidl" ]
    then
        # XulRunner's IDL compiler.
        echo "linking \`xpidl'..."
        ln -s "$out/lib/$libDir/xpidl" "$out/bin"
    fi

    # Put the GNU IceCat icon in the right place.
    ensureDir $out/lib/$libDir/chrome/icons/default
    ln -s ../../../icons/default.xpm  $out/lib/$libDir/chrome/icons/default/
  ''; # */

  meta = {
    description = "GNU IceCat, a free web browser based on Mozilla Firefox";

    longDescription = ''
      Gnuzilla is the GNU version of the Mozilla suite, and GNU IceCat
      is the GNU version of the Firefox browser.  Its main advantage
      is an ethical one: it is entirely free software.  While the
      source code from the Mozilla project is free software, the
      binaries that they release include additional non-free software.
      Also, they distribute and recommend non-free software as
      plug-ins.  In addition, GNU IceCat includes some privacy
      protection features.
    '';

    homepage = http://www.gnu.org/software/gnuzilla/;
    licenses = [ "GPLv2+" "LGPLv2+" "MPLv1+" ];

    maintainers = [ stdenv.lib.maintainers.ludo ];
    platforms = stdenv.lib.platforms.gnu;
  };

  passthru = {
    inherit gtk version;
    isFirefox3Like = true;
  };
}