2022-09-09 14:08:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildBazelPackage
|
|
|
|
, bazel_4
|
|
|
|
, flex
|
|
|
|
, bison
|
|
|
|
, python3
|
|
|
|
}:
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
let
|
|
|
|
system = stdenv.hostPlatform.system;
|
|
|
|
in
|
2022-09-09 14:08:57 +00:00
|
|
|
buildBazelPackage rec {
|
|
|
|
pname = "verible";
|
|
|
|
|
|
|
|
# These environment variables are read in bazel/build-version.py to create
|
2023-02-09 11:40:11 +00:00
|
|
|
# a build string shown in the tools --version output.
|
|
|
|
# If env variables not set, it would attempt to extract it from .git/.
|
2023-04-29 16:46:19 +00:00
|
|
|
GIT_DATE = "2023-04-14";
|
|
|
|
GIT_VERSION = "v0.0-3179-g525ffaf7";
|
2023-02-09 11:40:11 +00:00
|
|
|
|
|
|
|
# Derive nix package version from GIT_VERSION: "v1.2-345-abcde" -> "1.2.345"
|
|
|
|
version = builtins.concatStringsSep "." (lib.take 3 (lib.drop 1 (builtins.splitVersion GIT_VERSION)));
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "chipsalliance";
|
|
|
|
repo = "verible";
|
2023-02-09 11:40:11 +00:00
|
|
|
rev = "${GIT_VERSION}";
|
2023-04-29 16:46:19 +00:00
|
|
|
sha256 = "sha256-IXS8yeyryBNpPkCpMcOUsdIlKo447d0a8aZKroFJOzM=";
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Patch WORKSPACE file to not include windows-related dependencies,
|
|
|
|
# as they are removed by bazel, breaking the fixed output derivation
|
|
|
|
# TODO: fix upstream
|
|
|
|
./remove-unused-deps.patch
|
|
|
|
];
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
bazelFlags = [
|
|
|
|
"--//bazel:use_local_flex_bison"
|
|
|
|
"--javabase=@bazel_tools//tools/jdk:remote_jdk11"
|
|
|
|
"--host_javabase=@bazel_tools//tools/jdk:remote_jdk11"
|
|
|
|
];
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
fetchAttrs = {
|
2022-11-21 17:40:18 +00:00
|
|
|
# Fixed output derivation hash after bazel fetch.
|
|
|
|
# This varies per platform, probably from the JDK pulled in being part
|
|
|
|
# of the output derivation ? Is there a more robust way to do this ?
|
|
|
|
# (Hashes extracted from the ofborg build logs)
|
|
|
|
sha256 = {
|
2023-04-29 16:46:19 +00:00
|
|
|
aarch64-linux = "sha256-BrJyFeq3BB4sHIXMMxRIaYV+VJAfTs2bvK7pnw6faBY=";
|
|
|
|
x86_64-linux = "sha256-G6tqHWeQBi2Ph3IDFNu2sp+UU2BO93+lcyJ+kvpuRJo=";
|
2022-11-21 17:40:18 +00:00
|
|
|
}.${system} or (throw "No hash for system: ${system}");
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
flex # We use local flex and bison as WORKSPACE sources fail
|
|
|
|
bison # .. to compile with newer glibc
|
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2022-10-21 18:38:19 +00:00
|
|
|
patchShebangs\
|
|
|
|
bazel/build-version.py \
|
|
|
|
bazel/sh_test_with_runfiles_lib.sh \
|
|
|
|
common/lsp/dummy-ls_test.sh \
|
|
|
|
common/tools/patch_tool_test.sh \
|
|
|
|
common/tools/verible-transform-interactive.sh \
|
|
|
|
common/tools/verible-transform-interactive-test.sh \
|
|
|
|
kythe-browse.sh \
|
|
|
|
verilog/tools
|
2022-09-09 14:08:57 +00:00
|
|
|
'';
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
bazel = bazel_4;
|
2022-09-09 14:08:57 +00:00
|
|
|
removeRulesCC = false;
|
2023-04-12 12:48:02 +00:00
|
|
|
bazelTargets = [ ":install-binaries" ];
|
2022-10-21 18:38:19 +00:00
|
|
|
bazelTestTargets = [ "//..." ];
|
2022-09-09 14:08:57 +00:00
|
|
|
bazelBuildFlags = [
|
|
|
|
"-c opt"
|
|
|
|
];
|
|
|
|
buildAttrs = {
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
|
|
|
|
install bazel-bin/common/tools/verible-patch-tool "$out/bin"
|
|
|
|
|
|
|
|
V_TOOLS_DIR=bazel-bin/verilog/tools
|
|
|
|
install $V_TOOLS_DIR/diff/verible-verilog-diff "$out/bin"
|
|
|
|
install $V_TOOLS_DIR/formatter/verible-verilog-format "$out/bin"
|
|
|
|
install $V_TOOLS_DIR/kythe/verible-verilog-kythe-extractor "$out/bin"
|
|
|
|
install $V_TOOLS_DIR/lint/verible-verilog-lint "$out/bin"
|
|
|
|
install $V_TOOLS_DIR/ls/verible-verilog-ls "$out/bin"
|
|
|
|
install $V_TOOLS_DIR/obfuscator/verible-verilog-obfuscate "$out/bin"
|
|
|
|
install $V_TOOLS_DIR/preprocessor/verible-verilog-preprocessor "$out/bin"
|
|
|
|
install $V_TOOLS_DIR/project/verible-verilog-project "$out/bin"
|
|
|
|
install $V_TOOLS_DIR/syntax/verible-verilog-syntax "$out/bin"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/chipsalliance/verible";
|
|
|
|
description = "Suite of SystemVerilog developer tools. Including a style-linter, indexer, formatter, and language server.";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux;
|
2022-11-21 17:40:18 +00:00
|
|
|
maintainers = with maintainers; [ hzeller newam ];
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
}
|