nixpkgs/pkgs/tools/misc/wv2/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

34 lines
1.2 KiB
Nix

{ 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.hostPlatform.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";
};
}