mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-24 22:04:20 +00:00
e0464e4788
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" ```
57 lines
1.9 KiB
Nix
57 lines
1.9 KiB
Nix
{ lib, stdenv, fetchurl, ncurses, libiconv }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "stfl";
|
|
version = "0.24";
|
|
|
|
src = fetchurl {
|
|
url = "http://www.clifford.at/stfl/stfl-${version}.tar.gz";
|
|
sha256 = "1460d5lc780p3q38l3wc9jfr2a7zlyrcra0li65aynj738cam9yl";
|
|
};
|
|
|
|
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
|
|
|
|
buildInputs = [ ncurses libiconv ];
|
|
|
|
# Silence warnings related to use of implicitly declared library functions and implicit ints.
|
|
# TODO: Remove and/or fix with patches the next time this package is updated.
|
|
env = lib.optionalAttrs stdenv.cc.isClang {
|
|
NIX_CFLAGS_COMPILE = toString [
|
|
"-Wno-error=implicit-function-declaration"
|
|
"-Wno-error=implicit-int"
|
|
];
|
|
};
|
|
|
|
preBuild = ''
|
|
sed -i s/gcc/cc/g Makefile
|
|
sed -i s%ncursesw/ncurses.h%ncurses.h% stfl_internals.h
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
sed -i s/-soname/-install_name/ Makefile
|
|
''
|
|
# upstream builds shared library unconditionally. Also, it has no
|
|
# support for cross-compilation.
|
|
+ lib.optionalString stdenv.hostPlatform.isStatic ''
|
|
sed -i 's/all:.*/all: libstfl.a stfl.pc/' Makefile
|
|
sed -i 's/\tar /\t${stdenv.cc.targetPrefix}ar /' Makefile
|
|
sed -i 's/\tranlib /\t${stdenv.cc.targetPrefix}ranlib /' Makefile
|
|
sed -i '/install -m 644 libstfl.so./d' Makefile
|
|
sed -i '/ln -fs libstfl.so./d' Makefile
|
|
'' ;
|
|
|
|
installPhase = ''
|
|
DESTDIR=$out prefix=\"\" make install
|
|
''
|
|
# some programs rely on libstfl.so.0 to be present, so link it
|
|
+ lib.optionalString (!stdenv.hostPlatform.isStatic) ''
|
|
ln -s $out/lib/libstfl.so.0.24 $out/lib/libstfl.so.0
|
|
'';
|
|
|
|
meta = {
|
|
homepage = "http://www.clifford.at/stfl/";
|
|
description = "Library which implements a curses-based widget set for text terminals";
|
|
maintainers = with lib.maintainers; [ lovek323 ];
|
|
license = lib.licenses.lgpl3;
|
|
platforms = lib.platforms.unix;
|
|
};
|
|
}
|