about summary refs log tree commit diff
path: root/pkgs/tools/misc/wv2/default.nix
blob: 3a7bd5d395a63528fff3f7bb70b86e5e3b493fbc (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
{ lib, stdenv, fetchurl, pkg-config, cmake, libgsf, glib, libxml2 }:

stdenv.mkDerivation rec {
  pname = "wv2";
  version = "0.4.2";
  src = fetchurl {
    url = "mirror://sourceforge/wvware/wv2-${version}.tar.bz2";
    sha256 = "1p1qxr8z5bsiq8pvlina3c8c1vjcb5d96bs3zz4jj3nb20wnsawz";
  };

  patches = [ ./fix-include.patch ];

  # Newer versions of clang default to C++17, which removes some deprecated APIs such as bind1st.
  # Setting the language version to C++14 makes them available again.
  cmakeFlags = lib.optionals stdenv.cc.isClang [ (lib.cmakeFeature "CMAKE_CXX_STANDARD" "14") ];

  # Linking gobject explicitly fixes missing symbols (such as missing `_g_object_unref`) on Darwin.
  preConfigure = lib.optionalString stdenv.isDarwin ''
    export NIX_LDFLAGS+=" $(pkg-config gobject-2.0 --libs)"
  '';

  nativeBuildInputs = [ cmake pkg-config ];
  buildInputs = [ libgsf glib libxml2 ];

  env.NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";

  meta = {
    description = "Excellent MS Word filter lib, used in most Office suites";
    mainProgram = "wv2-config";
    license = lib.licenses.lgpl2;
    homepage = "https://wvware.sourceforge.net";
  };
}