Loading pkgs/by-name/bl/bluespec/package.nix +145 −36 Original line number Diff line number Diff line Loading @@ -22,11 +22,23 @@ asciidoctor, texliveFull, which, makeWrapper, cctools, targetPackages, # install -m 644 lib/libstp.dylib /private/tmp/nix-build-bluespec-2024.07.drv-5/source/inst/lib/SAT # install: cannot stat 'lib/libstp.dylib': No such file or directory # https://github.com/B-Lang-org/bsc/pull/600 might fix it stubStp ? !stdenv.hostPlatform.isDarwin, withDocs ? true, # With 23 core parallel 10 mins on r9 5900x # Broken on darwin currently withSuiteCheck ? false, gnugrep, time, dejagnu, systemc, glibcLocales, buildPackages, }: let Loading Loading @@ -76,7 +88,8 @@ stdenv.mkDerivation rec { chmod -R +rwX $sourceRoot/src/vendor/yices/v2.6/yices2 ''; preBuild = '' postPatch = '' patchShebangs \ src/vendor/stp/src/AST/genkinds.pl \ src/Verilog/copy_module.pl \ Loading @@ -91,7 +104,40 @@ stdenv.mkDerivation rec { # ld: library not found for -ltcl8.5 substituteInPlace ./platform.sh \ --replace-fail 'TCLSH=/usr/bin/tclsh' 'TCLSH=`which tclsh`' '' + lib.optionalString withSuiteCheck '' substituteInPlace testsuite/bsc.options/verilog-e/verilog-e.exp \ --replace-fail "/bin/echo" "${lib.getExe' buildPackages.coreutils "echo"}" substituteInPlace testsuite/test_list.sh testsuite/findfailures.csh \ --replace-fail "bin/csh" "${lib.getExe buildPackages.tcsh}" patchShebangs \ testsuite/test_list.sh \ testsuite/findfailures.csh \ scripts/tool-find.sh \ testsuite/bsc.bluetcl/packages/expandPorts/compareOutput.pl \ testsuite/bsc.bsv_examples/AES/funcit.pl \ testsuite/bsc.bsv_examples/AES/makeVecs.pl \ testsuite/bsc.bsv_examples/AES/makeVecs192.pl \ testsuite/bsc.bsv_examples/AES/makeVecs256.pl \ testsuite/bsc.if/split/canonicalize.pl \ testsuite/bsc.interra/operators/Arith/generate/gen.pl \ testsuite/bsc.interra/operators/Arith/generate/sort.pl \ testsuite/bsc.interra/operators/BitSel/generate/gen.pl \ testsuite/bsc.interra/operators/BitSel/generate/sort.pl \ testsuite/bsc.interra/operators/Logic/generate/gen.pl \ testsuite/bsc.interra/operators/Logic/generate/sort.pl \ testsuite/bsc.preprocessor/ifdef/iftestcase-perl.pl \ testsuite/bsc.verilog/filter/basicinout.pl \ testsuite/scripts/collapse.pl \ testsuite/scripts/double-directory.pl \ testsuite/scripts/process-summary-file.pl \ testsuite/scripts/sort-by-time.pl \ testsuite/scripts/times-by-directory.pl ''; preBuild = '' # allow running bsc to bootstrap export LD_LIBRARY_PATH=$PWD/inst/lib/SAT Loading @@ -110,7 +156,8 @@ stdenv.mkDerivation rec { zlib ]; nativeBuildInputs = [ nativeBuildInputs = [ automake autoconf asciidoctor Loading @@ -121,6 +168,13 @@ stdenv.mkDerivation rec { pkg-config texliveFull tcl makeWrapper ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # https://github.com/B-Lang-org/bsc/blob/main/src/comp/bsc.hs#L1838 # /nix/store/7y0vlsf6l8lr3vjsbrirqrsbx4mwqiwf-cctools-binutils-darwin-1010.6/bin/strip: error: unknown argument '-u' # make[1]: *** [Makefile:97: smoke_test_bluesim] Error 1 cctools ]; env.NIX_CFLAGS_COMPILE = toString ( Loading @@ -141,17 +195,6 @@ stdenv.mkDerivation rec { "STP_STUB=1" # uses yices as a SMT solver and stub out STP ]; doCheck = true; nativeCheckInputs = [ gmp-static iverilog ]; # /nix/store/7y0vlsf6l8lr3vjsbrirqrsbx4mwqiwf-cctools-binutils-darwin-1010.6/bin/strip: error: unknown argument '-u' # make[1]: *** [Makefile:97: smoke_test_bluesim] Error 1 checkTarget = lib.optionalString (!stdenv.hostPlatform.isDarwin) "check-smoke"; # this is the shortest check but "check-suite" tests much more installPhase = '' mkdir -p $out Loading @@ -167,6 +210,72 @@ stdenv.mkDerivation rec { mv inst/doc/*.pdf $doc/share/doc/bsc ''; postFixup = '' # https://github.com/B-Lang-org/bsc/blob/65e3a87a17f6b9cf38cbb7b6ad7a4473f025c098/src/comp/bsc.hs#L1839 wrapProgram $out/bin/bsc --prefix PATH : ${ lib.makeBinPath (if stdenv.hostPlatform.isDarwin then [ cctools ] else [ targetPackages.stdenv.cc ]) } ''; doCheck = true; # TODO To fix check-suite: # On darwin # ``` # FAIL: `Cpreprocess_line.bsv.bsc-out' differs from `Cpreprocess_line.bsv.bsc-out.expected' # FAIL: `sysGCD.bsc-vcomp-out.filtered' differs from `empty.expected' # FAIL: module `' in `ImpArgConnect3.bsv' should compile to Verilog # Caught error in sed: sed: can't read mkArgImpConnect3.v: No such file or directory # FAIL: `mkArgImpConnect3.v.filtered' differs from `mkArgImpConnect3.v.expected.filtered' # ``` checkTarget = if withSuiteCheck then "checkparallel" else "check-smoke"; # this is the shortest check but "check-suite" tests much more # bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) LOCALE_ARCHIVE = lib.optionalString ( withSuiteCheck && stdenv.hostPlatform.isLinux ) "${glibcLocales}/lib/locale/locale-archive"; nativeCheckInputs = [ gmp-static iverilog ] ++ lib.optionals withSuiteCheck [ time dejagnu # for `/bin/runtest` in `check-suite` gnugrep # `testsuite/bsc.interra/operators/Arith/arith.exp` and more ]; checkInputs = lib.optionals withSuiteCheck [ systemc ]; checkPhase = lib.optionalString withSuiteCheck '' ( cd testsuite set +e # disable exit on error make -j $NIX_BUILD_CORES $checkTarget test_exit_code=$? set -e failures=$(./findfailures.csh) echo "$failures" for failure in $failures; do logpath="''${failure/%sum/log}" echo "\nFAILURE LOG: $logpath" cat "$logpath" echo "END LOG: $logpath" done if [[ "$test_exit_code" != "0" || -n "$failures" ]]; then echo "Some tests failed or the makefile failed to run" exit 1 fi ) ''; meta = { description = "Toolchain for the Bluespec Hardware Definition Language"; homepage = "https://github.com/B-Lang-org/bsc"; Loading Loading
pkgs/by-name/bl/bluespec/package.nix +145 −36 Original line number Diff line number Diff line Loading @@ -22,11 +22,23 @@ asciidoctor, texliveFull, which, makeWrapper, cctools, targetPackages, # install -m 644 lib/libstp.dylib /private/tmp/nix-build-bluespec-2024.07.drv-5/source/inst/lib/SAT # install: cannot stat 'lib/libstp.dylib': No such file or directory # https://github.com/B-Lang-org/bsc/pull/600 might fix it stubStp ? !stdenv.hostPlatform.isDarwin, withDocs ? true, # With 23 core parallel 10 mins on r9 5900x # Broken on darwin currently withSuiteCheck ? false, gnugrep, time, dejagnu, systemc, glibcLocales, buildPackages, }: let Loading Loading @@ -76,7 +88,8 @@ stdenv.mkDerivation rec { chmod -R +rwX $sourceRoot/src/vendor/yices/v2.6/yices2 ''; preBuild = '' postPatch = '' patchShebangs \ src/vendor/stp/src/AST/genkinds.pl \ src/Verilog/copy_module.pl \ Loading @@ -91,7 +104,40 @@ stdenv.mkDerivation rec { # ld: library not found for -ltcl8.5 substituteInPlace ./platform.sh \ --replace-fail 'TCLSH=/usr/bin/tclsh' 'TCLSH=`which tclsh`' '' + lib.optionalString withSuiteCheck '' substituteInPlace testsuite/bsc.options/verilog-e/verilog-e.exp \ --replace-fail "/bin/echo" "${lib.getExe' buildPackages.coreutils "echo"}" substituteInPlace testsuite/test_list.sh testsuite/findfailures.csh \ --replace-fail "bin/csh" "${lib.getExe buildPackages.tcsh}" patchShebangs \ testsuite/test_list.sh \ testsuite/findfailures.csh \ scripts/tool-find.sh \ testsuite/bsc.bluetcl/packages/expandPorts/compareOutput.pl \ testsuite/bsc.bsv_examples/AES/funcit.pl \ testsuite/bsc.bsv_examples/AES/makeVecs.pl \ testsuite/bsc.bsv_examples/AES/makeVecs192.pl \ testsuite/bsc.bsv_examples/AES/makeVecs256.pl \ testsuite/bsc.if/split/canonicalize.pl \ testsuite/bsc.interra/operators/Arith/generate/gen.pl \ testsuite/bsc.interra/operators/Arith/generate/sort.pl \ testsuite/bsc.interra/operators/BitSel/generate/gen.pl \ testsuite/bsc.interra/operators/BitSel/generate/sort.pl \ testsuite/bsc.interra/operators/Logic/generate/gen.pl \ testsuite/bsc.interra/operators/Logic/generate/sort.pl \ testsuite/bsc.preprocessor/ifdef/iftestcase-perl.pl \ testsuite/bsc.verilog/filter/basicinout.pl \ testsuite/scripts/collapse.pl \ testsuite/scripts/double-directory.pl \ testsuite/scripts/process-summary-file.pl \ testsuite/scripts/sort-by-time.pl \ testsuite/scripts/times-by-directory.pl ''; preBuild = '' # allow running bsc to bootstrap export LD_LIBRARY_PATH=$PWD/inst/lib/SAT Loading @@ -110,7 +156,8 @@ stdenv.mkDerivation rec { zlib ]; nativeBuildInputs = [ nativeBuildInputs = [ automake autoconf asciidoctor Loading @@ -121,6 +168,13 @@ stdenv.mkDerivation rec { pkg-config texliveFull tcl makeWrapper ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # https://github.com/B-Lang-org/bsc/blob/main/src/comp/bsc.hs#L1838 # /nix/store/7y0vlsf6l8lr3vjsbrirqrsbx4mwqiwf-cctools-binutils-darwin-1010.6/bin/strip: error: unknown argument '-u' # make[1]: *** [Makefile:97: smoke_test_bluesim] Error 1 cctools ]; env.NIX_CFLAGS_COMPILE = toString ( Loading @@ -141,17 +195,6 @@ stdenv.mkDerivation rec { "STP_STUB=1" # uses yices as a SMT solver and stub out STP ]; doCheck = true; nativeCheckInputs = [ gmp-static iverilog ]; # /nix/store/7y0vlsf6l8lr3vjsbrirqrsbx4mwqiwf-cctools-binutils-darwin-1010.6/bin/strip: error: unknown argument '-u' # make[1]: *** [Makefile:97: smoke_test_bluesim] Error 1 checkTarget = lib.optionalString (!stdenv.hostPlatform.isDarwin) "check-smoke"; # this is the shortest check but "check-suite" tests much more installPhase = '' mkdir -p $out Loading @@ -167,6 +210,72 @@ stdenv.mkDerivation rec { mv inst/doc/*.pdf $doc/share/doc/bsc ''; postFixup = '' # https://github.com/B-Lang-org/bsc/blob/65e3a87a17f6b9cf38cbb7b6ad7a4473f025c098/src/comp/bsc.hs#L1839 wrapProgram $out/bin/bsc --prefix PATH : ${ lib.makeBinPath (if stdenv.hostPlatform.isDarwin then [ cctools ] else [ targetPackages.stdenv.cc ]) } ''; doCheck = true; # TODO To fix check-suite: # On darwin # ``` # FAIL: `Cpreprocess_line.bsv.bsc-out' differs from `Cpreprocess_line.bsv.bsc-out.expected' # FAIL: `sysGCD.bsc-vcomp-out.filtered' differs from `empty.expected' # FAIL: module `' in `ImpArgConnect3.bsv' should compile to Verilog # Caught error in sed: sed: can't read mkArgImpConnect3.v: No such file or directory # FAIL: `mkArgImpConnect3.v.filtered' differs from `mkArgImpConnect3.v.expected.filtered' # ``` checkTarget = if withSuiteCheck then "checkparallel" else "check-smoke"; # this is the shortest check but "check-suite" tests much more # bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) LOCALE_ARCHIVE = lib.optionalString ( withSuiteCheck && stdenv.hostPlatform.isLinux ) "${glibcLocales}/lib/locale/locale-archive"; nativeCheckInputs = [ gmp-static iverilog ] ++ lib.optionals withSuiteCheck [ time dejagnu # for `/bin/runtest` in `check-suite` gnugrep # `testsuite/bsc.interra/operators/Arith/arith.exp` and more ]; checkInputs = lib.optionals withSuiteCheck [ systemc ]; checkPhase = lib.optionalString withSuiteCheck '' ( cd testsuite set +e # disable exit on error make -j $NIX_BUILD_CORES $checkTarget test_exit_code=$? set -e failures=$(./findfailures.csh) echo "$failures" for failure in $failures; do logpath="''${failure/%sum/log}" echo "\nFAILURE LOG: $logpath" cat "$logpath" echo "END LOG: $logpath" done if [[ "$test_exit_code" != "0" || -n "$failures" ]]; then echo "Some tests failed or the makefile failed to run" exit 1 fi ) ''; meta = { description = "Toolchain for the Bluespec Hardware Definition Language"; homepage = "https://github.com/B-Lang-org/bsc"; Loading