2023-06-16 00:32:11 +08:00
|
|
|
{
|
|
|
|
|
lib,
|
|
|
|
|
stdenv,
|
|
|
|
|
fetchFromGitHub,
|
2024-11-23 03:14:35 +00:00
|
|
|
boost,
|
2023-06-16 00:32:11 +08:00
|
|
|
catch2_3,
|
|
|
|
|
cmake,
|
|
|
|
|
ninja,
|
2024-11-12 11:50:56 +00:00
|
|
|
fmt_11,
|
|
|
|
|
mimalloc,
|
2023-06-16 00:32:11 +08:00
|
|
|
python3,
|
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "sv-lang";
|
2024-11-12 11:50:56 +00:00
|
|
|
version = "7.0";
|
2023-06-16 00:32:11 +08:00
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "MikePopoloski";
|
|
|
|
|
repo = "slang";
|
2025-04-08 02:51:45 -04:00
|
|
|
rev = "v${version}";
|
2024-11-12 11:50:56 +00:00
|
|
|
sha256 = "sha256-msSc6jw2xbEZfOwtqwFEDIKcwf5SDKp+j15lVbNO98g=";
|
2023-06-16 00:32:11 +08:00
|
|
|
};
|
|
|
|
|
|
2025-04-04 20:54:46 +02:00
|
|
|
postPatch = ''
|
|
|
|
|
substituteInPlace external/CMakeLists.txt \
|
|
|
|
|
--replace-fail 'set(mimalloc_min_version "2.1")' 'set(mimalloc_min_version "${lib.versions.majorMinor mimalloc.version}")'
|
|
|
|
|
'';
|
|
|
|
|
|
2023-06-16 00:32:11 +08:00
|
|
|
cmakeFlags = [
|
|
|
|
|
# fix for https://github.com/NixOS/nixpkgs/issues/144170
|
|
|
|
|
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
|
|
|
|
"-DCMAKE_INSTALL_LIBDIR=lib"
|
|
|
|
|
|
|
|
|
|
"-DSLANG_INCLUDE_TESTS=${if doCheck then "ON" else "OFF"}"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
|
cmake
|
|
|
|
|
python3
|
|
|
|
|
ninja
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
buildInputs = [
|
2024-11-23 03:14:35 +00:00
|
|
|
boost
|
2024-11-12 11:50:56 +00:00
|
|
|
fmt_11
|
|
|
|
|
mimalloc
|
2024-10-28 10:27:42 -04:00
|
|
|
# though only used in tests, cmake will complain its absence when configuring
|
|
|
|
|
catch2_3
|
2023-06-16 00:32:11 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# TODO: a mysterious linker error occurs when building the unittests on darwin.
|
|
|
|
|
# The error occurs when using catch2_3 in nixpkgs, not when fetching catch2_3 using CMake
|
|
|
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
|
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
|
description = "SystemVerilog compiler and language services";
|
|
|
|
|
homepage = "https://github.com/MikePopoloski/slang";
|
|
|
|
|
license = licenses.mit;
|
|
|
|
|
maintainers = with maintainers; [ sharzy ];
|
|
|
|
|
mainProgram = "slang";
|
|
|
|
|
platforms = platforms.all;
|
2024-11-12 11:50:56 +00:00
|
|
|
broken = stdenv.hostPlatform.isDarwin;
|
2023-06-16 00:32:11 +08:00
|
|
|
};
|
|
|
|
|
}
|