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

48 lines
1.5 KiB
Nix

{ lib, stdenv, fetchurl, fetchpatch, perl, zlib, bzip2 }:
stdenv.mkDerivation rec {
pname = "routino";
version = "3.4.1";
src = fetchurl {
url = "https://routino.org/download/routino-${version}.tgz";
hash = "sha256-C6qNKljRdV0ProbgSxfrZLgZH+Pl8kcpKmTb83GLhSs=";
};
patchFlags = [ "-p0" ];
patches = lib.optionals stdenv.hostPlatform.isDarwin [
(fetchpatch {
url = "https://raw.githubusercontent.com/macports/macports-ports/18fd229516a46e7272003acbe555735b2a902db7/gis/routino/files/patch-Makefile_conf.diff";
sha256 = "1b7hpa4sizansnwwxq1c031nxwdwh71pg08jl9z9apiab8pjsn53";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/macports/macports-ports/18fd229516a46e7272003acbe555735b2a902db7/gis/routino/files/patch-src_Makefile_dylib_extension.diff";
sha256 = "1kigxcfr7977baxdsfvrw6q453cpqlzqakhj7av2agxkcvwyilpv";
})
];
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace Makefile.conf \
--subst-var-by PREFIX $out
'';
nativeBuildInputs = [ perl ];
buildInputs = [ zlib bzip2 ];
outputs = [ "out" "doc" ];
CLANG = lib.optionalString stdenv.cc.isClang "1";
makeFlags = [ "prefix=$(out)" ];
meta = with lib; {
homepage = "http://www.routino.org/";
changelog = "http://routino.org/software/NEWS.txt";
description = "OpenStreetMap Routing Software";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ dotlambda ];
platforms = with platforms; linux ++ darwin;
};
}