2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, unzip, flex, tk, ncurses, readline }:
|
2020-11-30 08:33:03 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "lc3tools";
|
|
|
|
version = "0.12";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://highered.mheducation.com/sites/dl/free/0072467509/104652/lc3tools_v12.zip";
|
|
|
|
hash = "sha256-PTM0ole8pHiJmUaahjPwcBQY8/hVVgQhADZ4bSABt3I=";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# the original configure looks for things in the FHS path
|
|
|
|
# I have modified it to take environment vars
|
|
|
|
./0001-mangle-configure.patch
|
2020-12-09 12:39:15 +00:00
|
|
|
|
|
|
|
# lc3sim looks for the LC3 OS in $out/share/lc3tools instead of $out
|
|
|
|
./0002-lc3os-path.patch
|
|
|
|
|
|
|
|
# lc3sim-tk looks for lc3sim in $out/bin instead of $out
|
|
|
|
./0003-lc3sim-tk-path.patch
|
2022-06-26 10:26:21 +00:00
|
|
|
|
|
|
|
# use `cc` instead of `gcc`; on macOS the latter is not present
|
|
|
|
./0004-configure-use-cc.patch
|
2020-11-30 08:33:03 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
buildInputs = [ flex tk ncurses readline ];
|
|
|
|
|
|
|
|
# lumetta published this a while ago but handrolled his configure
|
|
|
|
# jank in the original packaging makes this necessary:
|
|
|
|
LIBS = "${flex}/lib:${ncurses}/lib:${readline}/lib";
|
|
|
|
INCLUDES = "${flex}/include:${ncurses}/include:${readline}/include";
|
|
|
|
|
|
|
|
# it doesn't take `--prefix`
|
|
|
|
prefixKey = "--installdir ";
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/{bin,share/lc3tools}
|
|
|
|
|
2020-12-09 12:39:15 +00:00
|
|
|
mv -t $out/share/lc3tools $out/{COPYING,NO_WARRANTY,README} $out/lc3os*
|
2020-11-30 08:33:03 +00:00
|
|
|
mv -t $out/bin $out/lc3*
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-06-26 10:26:21 +00:00
|
|
|
longDescription = ''
|
|
|
|
The LC-3 tools package contains the lc3as assembler, the lc3sim simulator,
|
|
|
|
and lc3sim-tk, a Tcl/Tk-based GUI frontend to the simulator.
|
|
|
|
'';
|
2020-11-30 08:33:03 +00:00
|
|
|
description = "Toolchain and emulator for the LC-3 architecture";
|
2022-06-26 10:26:21 +00:00
|
|
|
homepage = "https://highered.mheducation.com/sites/0072467509/student_view0/lc-3_simulator.html";
|
2020-11-30 08:33:03 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ anna328p ];
|
2022-06-26 10:26:21 +00:00
|
|
|
mainProgram = "lc3sim-tk";
|
|
|
|
platforms = with lib.platforms; unix ++ windows;
|
2020-11-30 08:33:03 +00:00
|
|
|
};
|
|
|
|
}
|