nixpkgs/pkgs/development/interpreters/tclreadline/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

67 lines
1.5 KiB
Nix

{ lib, stdenv
, fetchFromGitHub
, automake
, autoconf
, libtool
, readline
, tcl
, tk
}:
tcl.mkTclDerivation rec {
pname = "tclreadline";
version = "2.3.8";
src = fetchFromGitHub {
owner = "flightaware";
repo = "tclreadline";
rev = "v${version}";
sha256 = "18jl56p0hwgynxpvr0v7b5mvvzc1m64fn61c0957bgb45mc250yq";
};
nativeBuildInputs = [
automake
autoconf
libtool
];
buildInputs = [
readline
tk
];
preConfigure = "NOCONFIGURE=1 ./autogen.sh";
configureFlags = [
"--enable-tclshrl"
"--enable-wishrl"
"--with-tk=${tk}/lib"
"--with-readline-includes=${readline.dev}/include/readline"
"--with-libtool=${libtool}"
];
# The provided makefile leaves a wrong reference to /build/ in RPATH,
# so we fix it after checking that everything is also present in $out
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
needed_libraries=$(ls .libs | grep '\.\(so\|la\)$')
for lib in $needed_libraries; do
if ! ls $out/lib | grep "$lib"; then
echo "$lib was not installed correctly"
exit 1
fi
done
for executable in $out/bin/{wishrl,tclshrl}; do
patchelf --set-rpath \
"$(patchelf --print-rpath "$executable" | sed "s@$builddir/.libs@$out/lib@")" \
"$executable"
done
'';
meta = with lib; {
description = "GNU readline for interactive tcl shells";
homepage = "https://github.com/flightaware/tclreadline";
license = licenses.bsd3;
maintainers = with maintainers; [ fgaz ];
platforms = platforms.all;
};
}