2021-08-28 15:27:27 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoconf
|
|
|
|
, automake
|
|
|
|
, fontconfig
|
|
|
|
, libX11
|
|
|
|
, perl
|
|
|
|
, flex
|
|
|
|
, bison
|
|
|
|
, pkg-config
|
|
|
|
, tcl
|
|
|
|
, tk
|
|
|
|
, xorg
|
|
|
|
, yices
|
|
|
|
, zlib
|
|
|
|
, ghc
|
|
|
|
, gmp-static
|
|
|
|
, verilog
|
|
|
|
, asciidoctor
|
|
|
|
, tex }:
|
2020-02-05 21:56:03 +00:00
|
|
|
|
|
|
|
let
|
2021-08-28 15:27:27 +01:00
|
|
|
ghcWithPackages = ghc.withPackages (g: (with g; [ old-time regex-compat syb split ]));
|
2021-08-25 23:29:42 +01:00
|
|
|
|
2020-02-05 21:56:03 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "bluespec";
|
2021-08-25 23:29:42 +01:00
|
|
|
version = "2021.07";
|
2020-02-05 21:56:03 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-08-25 23:29:42 +01:00
|
|
|
owner = "B-Lang-org";
|
|
|
|
repo = "bsc";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "0gw8wyp65lpkyfhv3laazz9qypdl8qkp1j7cqp0gv11592a9p5qw";
|
|
|
|
};
|
2020-02-05 21:56:03 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-08-25 23:29:42 +01:00
|
|
|
outputs = [ "out" "doc" ];
|
2020-02-05 21:56:03 +00:00
|
|
|
|
2021-08-27 22:37:17 +01:00
|
|
|
# https://github.com/B-Lang-org/bsc/pull/278
|
2021-08-25 23:29:42 +01:00
|
|
|
patches = [ ./libstp_stub_makefile.patch ];
|
2020-11-25 13:25:25 +00:00
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
mkdir -p $sourceRoot/src/vendor/yices/v2.6/yices2
|
|
|
|
# XXX: only works because yices.src isn't a tarball.
|
|
|
|
cp -av ${yices.src}/* $sourceRoot/src/vendor/yices/v2.6/yices2
|
|
|
|
chmod -R +rwX $sourceRoot/src/vendor/yices/v2.6/yices2
|
|
|
|
'';
|
2020-02-05 21:56:03 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
patchShebangs \
|
|
|
|
src/Verilog/copy_module.pl \
|
|
|
|
src/comp/update-build-version.sh \
|
|
|
|
src/comp/update-build-system.sh \
|
2021-08-27 22:40:22 +01:00
|
|
|
src/comp/wrapper.sh
|
2020-02-26 21:54:26 +00:00
|
|
|
|
|
|
|
substituteInPlace src/comp/Makefile \
|
|
|
|
--replace 'BINDDIR' 'BINDIR' \
|
|
|
|
--replace 'install-bsc install-bluetcl' 'install-bsc install-bluetcl $(UTILEXES) install-utils'
|
2021-08-25 23:29:42 +01:00
|
|
|
|
2020-11-25 13:25:25 +00:00
|
|
|
# allow running bsc to bootstrap
|
2021-08-27 22:37:17 +01:00
|
|
|
export LD_LIBRARY_PATH=$PWD/inst/lib/SAT
|
2020-02-05 21:56:03 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-25 23:29:42 +01:00
|
|
|
buildInputs = yices.buildInputs ++ [
|
|
|
|
fontconfig
|
|
|
|
libX11 # tcltk
|
|
|
|
tcl
|
|
|
|
tk
|
|
|
|
xorg.libXft
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
automake
|
|
|
|
autoconf
|
|
|
|
asciidoctor
|
|
|
|
bison
|
|
|
|
flex
|
|
|
|
ghcWithPackages
|
|
|
|
perl
|
|
|
|
pkg-config
|
|
|
|
tex
|
|
|
|
];
|
|
|
|
|
2020-02-05 21:56:03 +00:00
|
|
|
makeFlags = [
|
2021-08-25 23:29:42 +01:00
|
|
|
"release"
|
2020-11-25 13:25:25 +00:00
|
|
|
"NO_DEPS_CHECKS=1" # skip the subrepo check (this deriviation uses yices.src instead of the subrepo)
|
2020-02-05 21:56:03 +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-25 13:25:25 +00:00
|
|
|
"STP_STUB=1"
|
2020-02-05 21:56:03 +00:00
|
|
|
];
|
|
|
|
|
2021-08-28 15:27:27 +01:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
gmp-static
|
|
|
|
verilog
|
|
|
|
];
|
|
|
|
|
2021-08-27 22:37:17 +01:00
|
|
|
checkTarget = "check-smoke";
|
2021-08-25 23:29:42 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
mv inst/bin $out
|
|
|
|
mv inst/lib $out
|
|
|
|
|
2021-08-25 23:38:10 +01:00
|
|
|
# fragile, I know..
|
2021-08-25 23:29:42 +01:00
|
|
|
mkdir -p $doc/share/doc/bsc
|
2021-08-25 23:38:10 +01:00
|
|
|
mv inst/README $doc/share/doc/bsc
|
2021-08-25 23:29:42 +01:00
|
|
|
mv inst/ReleaseNotes.* $doc/share/doc/bsc
|
|
|
|
mv inst/doc/*.pdf $doc/share/doc/bsc
|
|
|
|
'';
|
|
|
|
|
2020-02-05 21:56:03 +00:00
|
|
|
meta = {
|
|
|
|
description = "Toolchain for the Bluespec Hardware Definition Language";
|
2021-08-25 23:29:42 +01:00
|
|
|
homepage = "https://github.com/B-Lang-org/bsc";
|
|
|
|
license = lib.licenses.bsd3;
|
2020-02-05 21:56:03 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
# 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-01-22 11:25:31 +00:00
|
|
|
maintainers = with lib.maintainers; [ jcumming thoughtpolice ];
|
2020-02-05 21:56:03 +00:00
|
|
|
};
|
|
|
|
}
|