nixpkgs/pkgs/development/compilers/clasp/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

78 lines
1.7 KiB
Nix

{ lib
, llvmPackages_15
, fetchzip
, sbcl
, pkg-config
, fmt_9
, gmpxx
, libelf
, boost
, libunwind
, ninja
}:
let
inherit (llvmPackages_15) stdenv llvm libclang;
in
stdenv.mkDerivation rec {
pname = "clasp";
version = "2.6.0";
src = fetchzip {
url = "https://github.com/clasp-developers/clasp/releases/download/${version}/clasp-${version}.tar.gz";
hash = "sha256-SiQ4RMha6dMV7V2fh+UxtAIgEEH/6/hF9fe+bPtoGIw=";
};
patches = [
./remove-unused-command-line-argument.patch
];
# Workaround for https://github.com/clasp-developers/clasp/issues/1590
postPatch = ''
echo '(defmethod configure-unit (c (u (eql :git))))' >> src/koga/units.lisp
'';
nativeBuildInputs = [
sbcl
pkg-config
fmt_9
gmpxx
libelf
boost
libunwind
ninja
llvm
libclang
];
ninjaFlags = [ "-C" "build" ];
configurePhase = ''
export SOURCE_DATE_EPOCH=1
export ASDF_OUTPUT_TRANSLATIONS=$(pwd):$(pwd)/__fasls
sbcl --script koga \
--skip-sync \
--build-mode=bytecode-faso \
--cc=$NIX_CC/bin/cc \
--cxx=$NIX_CC/bin/c++ \
--reproducible-build \
--package-path=/ \
--bin-path=$out/bin \
--lib-path=$out/lib \
--share-path=$out/share
'';
meta = {
description = "Common Lisp implementation based on LLVM with C++ integration";
license = lib.licenses.lgpl21Plus ;
maintainers = lib.teams.lisp.members;
platforms = ["x86_64-linux" "x86_64-darwin"];
# Upstream claims support, but breaks with:
# error: use of undeclared identifier 'aligned_alloc'
broken = stdenv.hostPlatform.isDarwin;
homepage = "https://github.com/clasp-developers/clasp";
mainProgram = "clasp";
};
}