nixpkgs/pkgs/development/interpreters/racket/racket_7_9.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

151 lines
3.1 KiB
Nix

{
lib,
stdenv,
fetchurl,
makeFontsConf,
cacert,
cairo,
coreutils,
fontconfig,
freefont_ttf,
glib,
gmp,
gtk3,
libedit,
libffi,
libiconv,
libGL,
libGLU,
libjpeg,
libpng,
libtool,
mpfr,
openssl,
pango,
poppler,
readline,
sqlite,
disableDocs ? false,
CoreFoundation,
gsettings-desktop-schemas,
wrapGAppsHook3,
}:
let
fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf ]; };
libPath = lib.makeLibraryPath [
cairo
fontconfig
glib
gmp
gtk3
gsettings-desktop-schemas
libedit
libGL
libGLU
libjpeg
libpng
mpfr
openssl
pango
poppler
readline
sqlite
];
in
stdenv.mkDerivation rec {
pname = "racket";
version = "7.9"; # always change at once with ./minimal.nix
src =
(lib.makeOverridable (
{ name, sha256 }:
fetchurl {
url = "https://mirror.racket-lang.org/installers/${version}/${name}-src.tgz";
inherit sha256;
}
))
{
name = "${pname}-${version}";
sha256 = "0gmp2ahmfd97nn9bwpfx9lznjmjkd042slnrrbdmyh59cqh98y2m";
};
FONTCONFIG_FILE = fontsConf;
LD_LIBRARY_PATH = libPath;
NIX_LDFLAGS = lib.concatStringsSep " " [
(lib.optionalString (stdenv.cc.isGNU && !stdenv.hostPlatform.isDarwin) "-lgcc_s")
(lib.optionalString stdenv.hostPlatform.isDarwin "-framework CoreFoundation")
];
nativeBuildInputs = [
cacert
wrapGAppsHook3
];
buildInputs =
[
fontconfig
libffi
libtool
sqlite
gsettings-desktop-schemas
gtk3
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
CoreFoundation
];
preConfigure = ''
unset AR
for f in src/lt/configure src/cs/c/configure src/bc/src/string.c; do
substituteInPlace "$f" --replace /usr/bin/uname ${coreutils}/bin/uname
done
mkdir src/build
cd src/build
gappsWrapperArgs+=("--prefix" "LD_LIBRARY_PATH" ":" ${LD_LIBRARY_PATH})
'';
shared = if stdenv.hostPlatform.isDarwin then "dylib" else "shared";
configureFlags =
[
"--enable-${shared}"
"--enable-lt=${libtool}/bin/libtool"
]
++ lib.optionals disableDocs [ "--disable-docs" ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ "--enable-xonx" ];
configureScript = "../configure";
enableParallelBuilding = false;
meta = with lib; {
description = "Programmable programming language";
longDescription = ''
Racket is a full-spectrum programming language. It goes beyond
Lisp and Scheme with dialects that support objects, types,
laziness, and more. Racket enables programmers to link
components written in different dialects, and it empowers
programmers to create new, project-specific dialects. Racket's
libraries support applications from web servers and databases to
GUIs and charts.
'';
homepage = "https://racket-lang.org/";
license = with licenses; [
asl20 # or
mit
];
maintainers = [ ];
platforms = [
"x86_64-darwin"
"x86_64-linux"
"aarch64-linux"
];
broken = stdenv.hostPlatform.isDarwin; # No support yet for setting FFI lookup path
};
}