2021-09-18 10:52:07 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
2022-04-15 01:41:22 +00:00
|
|
|
, fetchurl
|
2020-04-24 23:36:52 +00:00
|
|
|
, autoconf
|
|
|
|
, automake
|
|
|
|
, fontconfig
|
|
|
|
, libX11
|
|
|
|
, perl
|
2020-11-30 08:33:03 +00:00
|
|
|
, flex
|
|
|
|
, bison
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-11-30 08:33:03 +00:00
|
|
|
, tcl
|
|
|
|
, tk
|
2020-04-24 23:36:52 +00:00
|
|
|
, xorg
|
2020-11-30 08:33:03 +00:00
|
|
|
, yices
|
2020-04-24 23:36:52 +00:00
|
|
|
, zlib
|
2020-08-20 17:08:02 +00:00
|
|
|
, ghc
|
2021-09-18 10:52:07 +00:00
|
|
|
, gmp-static
|
|
|
|
, verilog
|
|
|
|
, asciidoctor
|
2022-04-15 01:41:22 +00:00
|
|
|
, tex
|
|
|
|
, which
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2021-09-18 10:52:07 +00:00
|
|
|
ghcWithPackages = ghc.withPackages (g: (with g; [ old-time regex-compat syb split ]));
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "bluespec";
|
2023-03-30 22:05:00 +00:00
|
|
|
version = "2023.01";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-09-18 10:52:07 +00:00
|
|
|
owner = "B-Lang-org";
|
|
|
|
repo = "bsc";
|
|
|
|
rev = version;
|
2023-03-30 22:05:00 +00:00
|
|
|
sha256 = "sha256-kFHQtRaQmZiHo+IQ+mwbW23i3kbdAh/XH0OE7P/ibd0=";
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
yices-src = fetchurl {
|
|
|
|
url = "https://github.com/B-Lang-org/bsc/releases/download/${version}/yices-src-for-bsc-${version}.tar.gz";
|
2023-03-30 22:05:00 +00:00
|
|
|
sha256 = "sha256-pyEdCJvmgwOYPMZEtw7aro76tSn/Y/2GcKTyARmIh4E=";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
outputs = [ "out" "doc" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# https://github.com/B-Lang-org/bsc/pull/278
|
|
|
|
patches = [ ./libstp_stub_makefile.patch ];
|
2020-11-30 08:33:03 +00:00
|
|
|
|
|
|
|
postUnpack = ''
|
2023-03-30 22:05:00 +00:00
|
|
|
tar -C $sourceRoot/ -xf ${yices-src}
|
2020-11-30 08:33:03 +00:00
|
|
|
chmod -R +rwX $sourceRoot/src/vendor/yices/v2.6/yices2
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
patchShebangs \
|
|
|
|
src/Verilog/copy_module.pl \
|
|
|
|
src/comp/update-build-version.sh \
|
|
|
|
src/comp/update-build-system.sh \
|
|
|
|
src/comp/wrapper.sh
|
|
|
|
|
|
|
|
substituteInPlace src/comp/Makefile \
|
|
|
|
--replace 'BINDDIR' 'BINDIR' \
|
|
|
|
--replace 'install-bsc install-bluetcl' 'install-bsc install-bluetcl $(UTILEXES) install-utils'
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
# allow running bsc to bootstrap
|
2021-09-18 10:52:07 +00:00
|
|
|
export LD_LIBRARY_PATH=$PWD/inst/lib/SAT
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
buildInputs = yices.buildInputs ++ [
|
|
|
|
fontconfig
|
|
|
|
libX11 # tcltk
|
|
|
|
tcl
|
|
|
|
tk
|
2022-04-15 01:41:22 +00:00
|
|
|
which
|
2021-09-18 10:52:07 +00:00
|
|
|
xorg.libXft
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
automake
|
|
|
|
autoconf
|
|
|
|
asciidoctor
|
|
|
|
bison
|
|
|
|
flex
|
|
|
|
ghcWithPackages
|
|
|
|
perl
|
|
|
|
pkg-config
|
|
|
|
tex
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
makeFlags = [
|
2021-09-18 10:52:07 +00:00
|
|
|
"release"
|
2023-03-30 22:05:00 +00:00
|
|
|
"NO_DEPS_CHECKS=1" # skip the subrepo check (this deriviation uses yices-src instead of the subrepo)
|
2020-04-24 23:36:52 +00:00
|
|
|
"NOGIT=1" # https://github.com/B-Lang-org/bsc/issues/12
|
|
|
|
"LDCONFIG=ldconfig" # https://github.com/B-Lang-org/bsc/pull/43
|
2020-11-30 08:33:03 +00:00
|
|
|
"STP_STUB=1"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-09-18 10:52:07 +00:00
|
|
|
gmp-static
|
|
|
|
verilog
|
|
|
|
];
|
|
|
|
|
|
|
|
checkTarget = "check-smoke";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
mv inst/bin $out
|
|
|
|
mv inst/lib $out
|
|
|
|
|
|
|
|
# fragile, I know..
|
|
|
|
mkdir -p $doc/share/doc/bsc
|
|
|
|
mv inst/README $doc/share/doc/bsc
|
|
|
|
mv inst/ReleaseNotes.* $doc/share/doc/bsc
|
|
|
|
mv inst/doc/*.pdf $doc/share/doc/bsc
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "Toolchain for the Bluespec Hardware Definition Language";
|
2021-09-18 10:52:07 +00:00
|
|
|
homepage = "https://github.com/B-Lang-org/bsc";
|
|
|
|
license = lib.licenses.bsd3;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2022-08-12 12:06:08 +00:00
|
|
|
mainProgram = "bsc";
|
2020-04-24 23:36:52 +00:00
|
|
|
# darwin fails at https://github.com/B-Lang-org/bsc/pull/35#issuecomment-583731562
|
|
|
|
# aarch64 fails, as GHC fails with "ghc: could not execute: opt"
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = with lib.maintainers; [ jcumming thoughtpolice ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|