nixpkgs/pkgs/development/misc/msp430/mspds/binary.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

36 lines
1.3 KiB
Nix

{ stdenv, lib, fetchurl, unzip, autoPatchelfHook }:
let
archPostfix = lib.optionalString (stdenv.hostPlatform.is64bit && !stdenv.hostPlatform.isDarwin) "_64";
in stdenv.mkDerivation rec {
pname = "msp-debug-stack-bin";
version = "3.15.1.1";
src = fetchurl {
url = "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPDS/3_15_1_001/export/MSP430_DLL_Developer_Package_Rev_3_15_1_1.zip";
sha256 = "1m1ssrwbhqvqwbp3m4hnjyxnz3f9d4acz9vl1av3fbnhvxr0d2hb";
};
sourceRoot = ".";
libname =
if stdenv.hostPlatform.isWindows then "MSP430${archPostfix}.dll"
else "libmsp430${archPostfix}${stdenv.hostPlatform.extensions.sharedLibrary}";
nativeBuildInputs = [ unzip ]
++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc ];
installPhase = ''
install -Dm0755 $libname $out/lib/''${libname//_64/}
install -Dm0644 -t $out/include Inc/*.h
'';
meta = with lib; {
description = "Unfree binary release of the TI MSP430 FET debug driver";
homepage = "https://www.ti.com/tool/MSPDS";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ aerialx ];
};
}