2024-08-15 10:36:23 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, gnumake
|
|
|
|
, pkg-config
|
|
|
|
, bison
|
|
|
|
, flex
|
|
|
|
, dtc
|
|
|
|
, check
|
|
|
|
, mini-gdbstub
|
|
|
|
, readline
|
|
|
|
, libllvm
|
|
|
|
, SDL2
|
|
|
|
, am-kernels ? ""
|
|
|
|
, defconfig ? "alldefconfig"
|
2024-03-04 03:59:50 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nemu";
|
2024-08-15 10:36:23 +00:00
|
|
|
version = "2024-08-15";
|
2024-03-04 03:59:50 +00:00
|
|
|
|
|
|
|
src = ./.;
|
|
|
|
|
2024-08-15 10:36:23 +00:00
|
|
|
nativeBuildInputs = [
|
2024-03-04 03:59:50 +00:00
|
|
|
gnumake
|
2024-03-06 04:50:56 +00:00
|
|
|
pkg-config
|
2024-03-04 03:59:50 +00:00
|
|
|
flex
|
|
|
|
bison
|
2024-03-25 17:53:17 +00:00
|
|
|
dtc
|
2024-03-04 03:59:50 +00:00
|
|
|
];
|
|
|
|
|
2024-08-15 10:36:23 +00:00
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
2024-03-04 03:59:50 +00:00
|
|
|
readline
|
|
|
|
libllvm
|
2024-04-25 08:54:27 +00:00
|
|
|
mini-gdbstub
|
2024-03-04 03:59:50 +00:00
|
|
|
];
|
|
|
|
|
2024-03-06 04:50:56 +00:00
|
|
|
checkInputs = [
|
2024-08-15 10:36:23 +00:00
|
|
|
check
|
2024-03-06 04:50:56 +00:00
|
|
|
am-kernels
|
|
|
|
];
|
|
|
|
|
2024-03-04 03:59:50 +00:00
|
|
|
configurePhase = ''
|
2024-03-06 04:50:56 +00:00
|
|
|
export NEMU_HOME=$(pwd)
|
2024-04-05 03:30:52 +00:00
|
|
|
make ${defconfig}
|
2024-03-04 03:59:50 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
make
|
|
|
|
'';
|
|
|
|
|
2024-08-15 10:36:23 +00:00
|
|
|
doCheck = (am-kernels != "");
|
|
|
|
checkPhase = ''
|
2024-07-09 09:06:15 +00:00
|
|
|
export NEMU_IMAGES_PATH=${am-kernels}/share/am-kernels
|
2024-03-04 03:59:50 +00:00
|
|
|
make test
|
2024-08-15 10:36:23 +00:00
|
|
|
'';
|
2024-03-04 03:59:50 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2024-08-15 10:36:23 +00:00
|
|
|
if [ -d "./lib" ] && [ "$(ls -A ./lib)" ]; then
|
|
|
|
mkdir -p "$out/lib"
|
|
|
|
fi
|
|
|
|
if [ -d "./bin" ] && [ "$(ls -A ./bin)" ]; then
|
|
|
|
mkdir -p $out/bin
|
|
|
|
fi
|
2024-03-04 03:59:50 +00:00
|
|
|
make PREFIX=$out install
|
|
|
|
'';
|
|
|
|
|
2024-03-06 04:50:56 +00:00
|
|
|
shellHook = ''
|
|
|
|
export NEMU_HOME=$(pwd)
|
|
|
|
'';
|
2024-03-04 03:59:50 +00:00
|
|
|
}
|