nixpkgs/pkgs/development/libraries/serf/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

59 lines
1.4 KiB
Nix

{ lib
, stdenv
, fetchurl
, apr
, scons
, openssl
, aprutil
, zlib
, libkrb5
, pkg-config
, libiconv
, fetchpatch
}:
stdenv.mkDerivation rec {
pname = "serf";
version = "1.3.10";
src = fetchurl {
url = "mirror://apache/serf/${pname}-${version}.tar.bz2";
hash = "sha256-voHvCLqiUW7Np2p3rffe97wyJ+61eLmjO0X3tB3AZOY=";
};
nativeBuildInputs = [ pkg-config scons ];
buildInputs = [ apr openssl aprutil zlib libiconv ]
++ lib.optional (!stdenv.hostPlatform.isCygwin) libkrb5;
patches = [
./scons.patch
(fetchpatch {
url = "https://src.fedoraproject.org/rpms/libserf/raw/rawhide/f/libserf-1.3.9-errgetfunc.patch";
hash = "sha256-FQJvXOIZ0iItvbbcu4kR88j74M7fOi7C/0NN3o1/ub4=";
})
];
prefixKey = "PREFIX=";
preConfigure = ''
sconsFlags+=" APR=$(echo ${apr.dev}/bin/*-config)"
sconsFlags+=" APU=$(echo ${aprutil.dev}/bin/*-config)"
sconsFlags+=" CC=$CC"
sconsFlags+=" OPENSSL=${openssl}"
sconsFlags+=" ZLIB=${zlib}"
'' + lib.optionalString (!stdenv.hostPlatform.isCygwin) ''
sconsFlags+=" GSSAPI=${libkrb5.dev}"
'';
enableParallelBuilding = true;
meta = with lib; {
description = "HTTP client library based on APR";
homepage = "https://serf.apache.org/";
license = licenses.asl20;
maintainers = with maintainers; [ orivej raskin ];
platforms = platforms.linux ++ platforms.darwin;
};
}