nixpkgs/pkgs/tools/misc/bibutils/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

52 lines
1.6 KiB
Nix

{ lib
, stdenv
, fetchurl
, static ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "bibutils";
version = "7.2";
src = fetchurl {
url = "mirror://sourceforge/bibutils/bibutils_${version}_src.tgz";
sha256 = "sha256-bgKK7x6Kaz5azvCYWEp7tocI81z+dAEbNBwR/qXktcM=";
};
preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace lib/Makefile.dynamic \
--replace '-Wl,-soname,$(SONAME)' ""
'';
# the configure script is not generated by autoconf
# and do not recognize --build/--host cross compilation flags
configurePlatforms = [ ];
configureFlags = [
(if static then "--static" else "--dynamic")
"--install-dir" "$(out)/bin"
"--install-lib" "$(out)/lib"
];
dontAddPrefix = true;
makeFlags = [
"CC:=$(CC)"
];
doCheck = true;
checkTarget = "test";
preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
export DYLD_LIBRARY_PATH=`pwd`/lib
'';
meta = with lib; {
description = "Bibliography format interconversion";
longDescription = "The bibutils program set interconverts between various bibliography formats using a common MODS-format XML intermediate. For example, one can convert RIS-format files to Bibtex by doing two transformations: RIS->MODS->Bibtex. By using a common intermediate for N formats, only 2N programs are required and not N²-N. These programs operate on the command line and are styled after standard UNIX-like filters.";
homepage = "https://sourceforge.net/p/bibutils/home/Bibutils/";
license = licenses.gpl2Only;
maintainers = [ maintainers.garrison ];
platforms = platforms.unix;
};
}