Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sv-lang version 7.0 and sv-bugpoint #69

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
container-hotplug = pkgs.callPackage ./container-hotplug {};
surfer = pkgs.callPackage ./surfer/default.nix {};
uf2conv = pkgs.callPackage ./uf2conv.nix {};
sv-lang_6 = pkgs.callPackage ./sv-lang.nix {};

inherit (pkgs.callPackage ./sv-lang.nix {}) sv-lang_6 sv-lang_7;
sv-bugpoint = pkgs.callPackage ./sv-bugpoint.nix {sv-lang = sv-lang_7;};
veridian = pkgs.callPackage ./veridian/default.nix {inherit sv-lang_6;};
peakrdl = pkgs.callPackage ./peakrdl.nix {};

Expand Down
48 changes: 48 additions & 0 deletions pkgs/sv-bugpoint.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# SPDX-FileCopyrightText: lowRISC contributors
# SPDX-License-Identifier: MIT
{
lib,
stdenv,
fetchFromGitHub,
cmake,
ninja,
sv-lang,
fmt_10,
python3,
}: let
rev = "1e078fa961ac5ade9e2506ce63c091b53ad9dbdb";
in
stdenv.mkDerivation {
pname = "sv-bugpoint";
# take the first 10 characters of the revision
version = builtins.head (builtins.match "(.{10}).*" rev);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the latest convention in nixpkgs when a package has no version itself is to use 0-unstable-<DATE>


src = fetchFromGitHub {
owner = "antmicro";
repo = "sv-bugpoint";
inherit rev;
hash = "sha256-HGWPtadi+L+cXHSWSPelOv0KOPnkjVGKchRaYfZwwFg=";
};

cmakeFlags = [
"-DFETCHCONTENT_SOURCE_DIR_SLANG=${sv-lang.src.outPath}"
"-DFETCHCONTENT_SOURCE_DIR_FMT=${fmt_10.src.outPath}"
Comment on lines +28 to +29
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"-DFETCHCONTENT_SOURCE_DIR_SLANG=${sv-lang.src.outPath}"
"-DFETCHCONTENT_SOURCE_DIR_FMT=${fmt_10.src.outPath}"
"-DFETCHCONTENT_SOURCE_DIR_SLANG=${sv-lang.src}"
"-DFETCHCONTENT_SOURCE_DIR_FMT=${fmt_10.src}"

"-DSLANG_USE_MIMALLOC=OFF"
];

nativeBuildInputs = [
cmake
ninja
python3
sv-lang
];

meta = with lib; {
description = "Minimizes SystemVerilog code while preserving a user-defined property of that code.";
homepage = "https://github.com/antmicro/sv-bugpoint";
license = licenses.asl20;
maintainers = [];
mainProgram = "sv-bugpoint";
platforms = platforms.all;
};
}
107 changes: 50 additions & 57 deletions pkgs/sv-lang.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,74 +6,67 @@
fetchFromGitHub,
boost182,
catch2_3,
fmt_10,
cmake,
ninja,
python3,
}: let
fmt = fetchFromGitHub {
owner = "fmtlib";
repo = "fmt";
rev = "10.2.1";
hash = "sha256-pEltGLAHLZ3xypD/Ur4dWPWJ9BGVXwqQyKcDWVmC3co=";
};
catch2 = fetchFromGitHub {
owner = "catchorg";
repo = "Catch2";
rev = "v3.5.3";
hash = "sha256-A7vVRHMabm75Udy0fXwsPw4/JkXfjQq/MwmJukdS1Ic=";
};
in
stdenv.mkDerivation rec {
pname = "sv-lang";
version = "6.0";
svLangDerivation = version: hash:
stdenv.mkDerivation rec {
pname = "sv-lang";
inherit version;

src = fetchFromGitHub {
owner = "MikePopoloski";
repo = "slang";
rev = "v${version}";
sha256 = "sha256-mT8sfUz0H4jWM/SkV/uW4kmVKE9UQy6XieG65yJvIA8=";
};
src = fetchFromGitHub {
owner = "MikePopoloski";
repo = "slang";
rev = "v${version}";
inherit hash;
};

cmakeFlags = [
# fix for https://github.com/NixOS/nixpkgs/issues/144170
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBDIR=lib"
cmakeFlags = [
# fix for https://github.com/NixOS/nixpkgs/issues/144170
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBDIR=lib"

"-DFETCHCONTENT_SOURCE_DIR_FMT=${fmt}"
"-DFETCHCONTENT_SOURCE_DIR_CATCH2=${catch2}"
"-DFETCHCONTENT_SOURCE_DIR_FMT=${fmt_10.src.outPath}"
"-DFETCHCONTENT_SOURCE_DIR_CATCH2=${catch2_3.src.outPath}"
Comment on lines +31 to +32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"-DFETCHCONTENT_SOURCE_DIR_FMT=${fmt_10.src.outPath}"
"-DFETCHCONTENT_SOURCE_DIR_CATCH2=${catch2_3.src.outPath}"
"-DFETCHCONTENT_SOURCE_DIR_FMT=${fmt_10.src}"
"-DFETCHCONTENT_SOURCE_DIR_CATCH2=${catch2_3.src}"


"-DSLANG_INCLUDE_TESTS=${
if doCheck
then "ON"
else "OFF"
}"
"-DSLANG_USE_MIMALLOC=OFF"
];
"-DSLANG_INCLUDE_TESTS=${
if doCheck
then "ON"
else "OFF"
}"
"-DSLANG_USE_MIMALLOC=OFF"
];

nativeBuildInputs = [
cmake
python3
ninja
nativeBuildInputs = [
cmake
python3
ninja

# though only used in tests, cmake will complain its absence when configuring
catch2_3
];
# though only used in tests, cmake will complain its absence when configuring
catch2_3
];

buildInputs = [
boost182
];
buildInputs = [
boost182
];

# 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.isDarwin;
# 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.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";
broken = stdenv.isDarwin;
platforms = platforms.all;
meta = with lib; {
description = "SystemVerilog compiler and language services";
homepage = "https://github.com/MikePopoloski/slang";
license = licenses.mit;
maintainers = with maintainers; [sharzy];
mainProgram = "slang";
broken = stdenv.isDarwin;
platforms = platforms.all;
};
};
}
in {
sv-lang_6 = svLangDerivation "6.0" "sha256-mT8sfUz0H4jWM/SkV/uW4kmVKE9UQy6XieG65yJvIA8=";
sv-lang_7 = svLangDerivation "7.0" "sha256-msSc6jw2xbEZfOwtqwFEDIKcwf5SDKp+j15lVbNO98g=";
}