2021-01-22 11:25:31 +00:00
|
|
|
{ lib, stdenv
|
2020-02-05 21:56:03 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, autoconf
|
|
|
|
, automake
|
|
|
|
, fontconfig
|
2020-11-25 13:25:25 +00:00
|
|
|
, gmp-static
|
2020-02-05 21:56:03 +00:00
|
|
|
, gperf
|
|
|
|
, libX11
|
|
|
|
, libpoly
|
|
|
|
, perl
|
2020-11-25 13:25:25 +00:00
|
|
|
, flex
|
|
|
|
, bison
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
2020-11-25 13:25:25 +00:00
|
|
|
, itktcl
|
|
|
|
, incrtcl
|
|
|
|
, tcl
|
|
|
|
, tk
|
2020-02-05 21:56:03 +00:00
|
|
|
, verilog
|
|
|
|
, xorg
|
2020-11-25 13:25:25 +00:00
|
|
|
, yices
|
2020-02-05 21:56:03 +00:00
|
|
|
, zlib
|
2020-07-24 14:54:20 +00:00
|
|
|
, ghc
|
2020-02-05 21:56:03 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2020-11-25 13:25:25 +00:00
|
|
|
ghcWithPackages = ghc.withPackages (g: (with g; [old-time regex-compat syb split ]));
|
2020-02-05 21:56:03 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "bluespec";
|
2021-02-22 20:18:50 +00:00
|
|
|
version = "unstable-2021.02.14";
|
2020-02-05 21:56:03 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-11-25 13:25:25 +00:00
|
|
|
owner = "B-Lang-org";
|
|
|
|
repo = "bsc";
|
2021-02-22 20:18:50 +00:00
|
|
|
rev = "c085ecd807d85f31d102d8bec71f5c28dc96b31d";
|
|
|
|
sha256 = "0c86gwhrarw78cr9c9slb9vij6kcwx3x281kbqji96qqzs0dfb32";
|
2020-11-25 13:25:25 +00:00
|
|
|
};
|
2020-02-05 21:56:03 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-11-25 13:25:25 +00:00
|
|
|
patches = [ ./libstp_stub_makefile.patch ];
|
|
|
|
|
|
|
|
buildInputs = yices.buildInputs ++ [
|
2020-02-05 21:56:03 +00:00
|
|
|
zlib
|
2020-11-25 13:25:25 +00:00
|
|
|
tcl tk
|
2020-02-05 21:56:03 +00:00
|
|
|
libX11 # tcltk
|
|
|
|
xorg.libXft
|
|
|
|
fontconfig
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
automake autoconf
|
|
|
|
perl
|
2020-11-25 13:25:25 +00:00
|
|
|
flex
|
|
|
|
bison
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2020-02-05 21:56:03 +00:00
|
|
|
ghcWithPackages
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
verilog
|
|
|
|
];
|
|
|
|
|
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 \
|
|
|
|
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'
|
2020-11-25 13:25:25 +00:00
|
|
|
# allow running bsc to bootstrap
|
|
|
|
export LD_LIBRARY_PATH=/build/source/inst/lib/SAT
|
2020-02-05 21:56:03 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
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
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = "mv inst $out";
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Toolchain for the Bluespec Hardware Definition Language";
|
|
|
|
homepage = "https://github.com/B-Lang-org/bsc";
|
2021-01-22 11:25:31 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|