summary refs log tree commit diff
path: root/pkgs/development/tools/lc3tools
diff options
context:
space:
mode:
authorDmitry Kudriavtsev <dkudriavtsev@gmail.com>2020-11-20 18:35:41 -0800
committerDmitry Kudriavtsev <dkudriavtsev@gmail.com>2020-11-29 00:36:34 -0800
commit2ed27dc1a11a87f3b17abd50fc4214c71bbe14b1 (patch)
tree929384dd583b5b7c5bbcaf6f5e617747d9a8aa26 /pkgs/development/tools/lc3tools
parent5417bf80f56c33ecc6dd67d0e475c210a797aad9 (diff)
downloadnixpkgs-2ed27dc1a11a87f3b17abd50fc4214c71bbe14b1.tar
nixpkgs-2ed27dc1a11a87f3b17abd50fc4214c71bbe14b1.tar.gz
nixpkgs-2ed27dc1a11a87f3b17abd50fc4214c71bbe14b1.tar.bz2
nixpkgs-2ed27dc1a11a87f3b17abd50fc4214c71bbe14b1.tar.lz
nixpkgs-2ed27dc1a11a87f3b17abd50fc4214c71bbe14b1.tar.xz
nixpkgs-2ed27dc1a11a87f3b17abd50fc4214c71bbe14b1.tar.zst
nixpkgs-2ed27dc1a11a87f3b17abd50fc4214c71bbe14b1.zip
lc3tools: init at 0.12
Diffstat (limited to 'pkgs/development/tools/lc3tools')
-rw-r--r--pkgs/development/tools/lc3tools/0001-mangle-configure.patch29
-rw-r--r--pkgs/development/tools/lc3tools/default.nix42
2 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/development/tools/lc3tools/0001-mangle-configure.patch b/pkgs/development/tools/lc3tools/0001-mangle-configure.patch
new file mode 100644
index 00000000000..80b5c7d2117
--- /dev/null
+++ b/pkgs/development/tools/lc3tools/0001-mangle-configure.patch
@@ -0,0 +1,29 @@
+diff --git a/configure b/configure
+index 46f9af4..dfc1b3e 100755
+--- a/configure
++++ b/configure
+@@ -17,10 +17,11 @@ esac
+ 
+ # Some binaries that we'll need, and the places that we might find them.
+ 
+-binlist="uname flex gcc wish rm cp mkdir chmod sed"
+-pathlist="/bin /usr/bin /usr/local/bin /sw/bin /usr/x116/bin /usr/X11R6/bin"
+-libpathlist="/lib /usr/lib /usr/local/lib"
+-incpathlist="/include /usr/include /usr/local/include"
++IFS=:
++binlist="uname:flex:gcc:wish:rm:cp:mkdir:chmod:sed"
++pathlist=$PATH
++libpathlist=$LIBS
++incpathlist=$INCLUDES
+ 
+ 
+ # Find the binaries (or die trying).
+@@ -55,7 +56,7 @@ case `$uname -s` in
+ 		echo "Configuring for Cygwin..."
+ 		;;
+ 	Linux*) echo "Configuring for Linux..."
+-		OS_SIM_LIBS="-lcurses"
++		# OS_SIM_LIBS="-lcurses"
+ 		;;
+ 	SunOS*)  echo "Configuring for Solaris..."
+ 		OS_SIM_LIBS="-lcurses -lsocket -lnsl"
diff --git a/pkgs/development/tools/lc3tools/default.nix b/pkgs/development/tools/lc3tools/default.nix
new file mode 100644
index 00000000000..25b476f68c0
--- /dev/null
+++ b/pkgs/development/tools/lc3tools/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, unzip, flex, tk, ncurses, readline }:
+
+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
+  ];
+
+  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 = ''
+    rm $out/{COPYING,NO_WARRANTY,README}
+    mkdir -p $out/{bin,share/lc3tools}
+
+    mv -t $out/share/lc3tools $out/lc3os*
+    mv -t $out/bin $out/lc3*
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Toolchain and emulator for the LC-3 architecture";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ anna328p ];
+  };
+}