ysyx-workbench/nemu/default.nix
xinyangli 4c540bd109
All checks were successful
Build abstract machine with nix / build-packages (abstract-machine) (push) Successful in 9s
Build abstract machine with nix / build-packages (nemu) (push) Successful in 20s
Build abstract machine with nix / build-packages (nemu-lib) (push) Successful in 9s
Build abstract machine with nix / build-packages (rv32Cross.abstract-machine) (push) Successful in 8s
Build npc tests / npc-build (flow) (push) Successful in 8s
Build npc tests / npc-build (flow-simlib) (push) Successful in 9s
nemu,build: build libnemu with nix
2024-08-15 18:36:23 +08:00

71 lines
974 B
Nix

{ stdenv
, lib
, gnumake
, pkg-config
, bison
, flex
, dtc
, check
, mini-gdbstub
, readline
, libllvm
, SDL2
, am-kernels ? ""
, defconfig ? "alldefconfig"
}:
stdenv.mkDerivation rec {
pname = "nemu";
version = "2024-08-15";
src = ./.;
nativeBuildInputs = [
gnumake
pkg-config
flex
bison
dtc
];
buildInputs = [
SDL2
readline
libllvm
mini-gdbstub
];
checkInputs = [
check
am-kernels
];
configurePhase = ''
export NEMU_HOME=$(pwd)
make ${defconfig}
'';
buildPhase = ''
make
'';
doCheck = (am-kernels != "");
checkPhase = ''
export NEMU_IMAGES_PATH=${am-kernels}/share/am-kernels
make test
'';
installPhase = ''
if [ -d "./lib" ] && [ "$(ls -A ./lib)" ]; then
mkdir -p "$out/lib"
fi
if [ -d "./bin" ] && [ "$(ls -A ./bin)" ]; then
mkdir -p $out/bin
fi
make PREFIX=$out install
'';
shellHook = ''
export NEMU_HOME=$(pwd)
'';
}