ante: unstable-2023-12-18 -> 0-unstable-2025-07-12

This commit is contained in:
Emily
2025-08-19 16:08:35 +01:00
parent e6a984ea76
commit 9ef1336132
+31 -15
View File
@@ -1,54 +1,70 @@
{
stdenv,
fetchFromGitHub,
lib,
zlib,
libffi,
libxml2,
llvmPackages_16,
llvmPackages_18,
ncurses,
darwin,
rustPlatform,
}:
rustPlatform.buildRustPackage {
pname = "ante";
version = "unstable-2023-12-18";
version = "0-unstable-2025-07-12";
src = fetchFromGitHub {
owner = "jfecher";
repo = "ante";
rev = "e38231ffa51b84a2ca53b4b0439d1ca5e0dea32a";
hash = "sha256-UKEoOm+Jc0YUwO74Tn038MLeX/c3d2z8I0cTBVfX61U=";
rev = "e1f68f00937ae39badcc42a48c0078b608f294bf";
fetchSubmodules = true;
hash = "sha256-mbjV7S705bSseA/P31jiJiktpUEQ8hS+M4kcs2AM1/Y=";
};
cargoHash = "sha256-uOOSxRoc59XzJT5oVO2NOYC0BwrNq4X6Jd/gQz0ZBp8=";
cargoHash = "sha256-cRF1JFqWpGGQO3fIGcatVY1pp65CvNeM/6LFYDJxdpM=";
/*
https://crates.io/crates/llvm-sys#llvm-compatibility
llvm-sys requires a specific version of llvmPackages,
that is not the same as the one included by default with rustPlatform.
*/
nativeBuildInputs = [ llvmPackages_16.llvm ];
strictDeps = true;
nativeBuildInputs = [ llvmPackages_18.llvm ];
buildInputs = [
zlib
libffi
libxml2
ncurses
];
postPatch = ''
substituteInPlace tests/golden_tests.rs --replace \
substituteInPlace tests/golden_tests.rs --replace-fail \
'target/debug' "target/$(rustc -vV | sed -n 's|host: ||p')/release"
substituteInPlace src/util/mod.rs \
--replace-fail '"gcc"' '"${lib.getExe llvmPackages_18.clang}"'
'';
preBuild =
let
major = lib.versions.major llvmPackages_16.llvm.version;
minor = lib.versions.minor llvmPackages_16.llvm.version;
major = lib.versions.major llvmPackages_18.llvm.version;
minor = lib.versions.minor llvmPackages_18.llvm.version;
llvm-sys-ver = "${major}${builtins.substring 0 1 minor}";
in
''
# On some architectures llvm-sys is not using the package listed inside nativeBuildInputs
export LLVM_SYS_${llvm-sys-ver}_PREFIX=${llvmPackages_16.llvm.dev}
export LLVM_SYS_${llvm-sys-ver}_PREFIX=${llvmPackages_18.llvm.dev}
export ANTE_STDLIB_DIR=$out/lib
mkdir -p $ANTE_STDLIB_DIR
cp -r $src/stdlib/* $ANTE_STDLIB_DIR
'';
# Ante uses the default LLVM target which, because we currently
# dont include a Darwin version in the target, seemingly defaults
# to the host macOS version, which makes `ld(1)` warn about the
# mismatching deployment targets, which breaks the tests.
#
# TODO: Remove this once it stops being necessary.
preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
export MACOSX_DEPLOYMENT_TARGET=$(
${lib.getExe' darwin.DarwinTools "sw_vers"} -productVersion
)
'';
meta = with lib; {
homepage = "https://antelang.org/";