1 { lib, stdenv, fetchurl, unzip, flex, tk, ncurses, readline }:
8 url = "https://highered.mheducation.com/sites/dl/free/0072467509/104652/lc3tools_v12.zip";
9 hash = "sha256-PTM0ole8pHiJmUaahjPwcBQY8/hVVgQhADZ4bSABt3I=";
13 # the original configure looks for things in the FHS path
14 # I have modified it to take environment vars
15 ./0001-mangle-configure.patch
17 # lc3sim looks for the LC3 OS in $out/share/lc3tools instead of $out
18 ./0002-lc3os-path.patch
20 # lc3sim-tk looks for lc3sim in $out/bin instead of $out
21 ./0003-lc3sim-tk-path.patch
23 # use `cc` instead of `gcc`; on macOS the latter is not present
24 ./0004-configure-use-cc.patch
27 nativeBuildInputs = [ unzip ];
28 buildInputs = [ flex tk ncurses readline ];
30 # lumetta published this a while ago but handrolled his configure
31 # jank in the original packaging makes this necessary:
32 LIBS = "${flex}/lib:${ncurses}/lib:${readline}/lib";
33 INCLUDES = "${flex}/include:${ncurses}/include:${readline}/include";
35 # it doesn't take `--prefix`
36 prefixKey = "--installdir ";
39 mkdir -p $out/{bin,share/lc3tools}
41 mv -t $out/share/lc3tools $out/{COPYING,NO_WARRANTY,README} $out/lc3os*
42 mv -t $out/bin $out/lc3*
47 The LC-3 tools package contains the lc3as assembler, the lc3sim simulator,
48 and lc3sim-tk, a Tcl/Tk-based GUI frontend to the simulator.
50 description = "Toolchain and emulator for the LC-3 architecture";
51 homepage = "https://highered.mheducation.com/sites/0072467509/student_view0/lc-3_simulator.html";
52 license = licenses.gpl2;
53 maintainers = with maintainers; [ anna328p ];
54 mainProgram = "lc3sim-tk";
55 platforms = with lib.platforms; unix ++ windows;