9 stdenv.mkDerivation rec {
14 url = "mirror://sourceforge/tinyscheme/${pname}-${version}.tar.gz";
15 sha256 = "sha256-F7Cxv/0i89SdWDPiKhILM5A50s/aC0bW/FHdLwG0B60=";
18 nativeBuildInputs = [ dos2unix ];
20 prePatch = "dos2unix makefile";
22 # The alternate macOS main makes use of `ccommand` which seems to be
23 # `MetroWerks CodeWarrier` specific:
24 # https://ptgmedia.pearsoncmg.com/imprint_downloads/informit/downloads/9780201703535/macfix.html
26 # In any case, this is not needed to build on macOS.
27 ./01-remove-macOS-main.patch
29 # We want to have the makefile pick up $CC, etc. so that we don't have
30 # to unnecessarily tie this package to the GCC stdenv.
31 ./02-use-toolchain-env-vars.patch
32 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
33 # On macOS the library suffix is .dylib:
34 ./03-macOS-SOsuf.patch
37 substituteInPlace scheme.c --replace "init.scm" "$out/lib/init.scm"
41 mkdir -p $out/bin $out/lib
43 cp libtinyscheme* $out/lib
44 cp scheme $out/bin/tinyscheme
48 # Checks that the program can run and exit:
49 simple = runCommand "${pname}-simple-test" {} ''
50 ${tinyscheme}/bin/tinyscheme <<<"(quit 0)"
53 fileIo = runCommand "${pname}-file-io-test" {} ''
54 ${tinyscheme}/bin/tinyscheme <<EOF
55 (call-with-output-file "$out"
63 helpText = runCommand "${pname}-help-text-test" {} ''
64 ${tinyscheme}/bin/tinyscheme '-?' | tee > $out || :
65 [[ "$(cat $out)" =~ ^Usage: ]]
70 description = "Lightweight Scheme implementation";
72 TinyScheme is a lightweight Scheme interpreter that implements as large a
73 subset of R5RS as was possible without getting very large and complicated.
75 homepage = "https://tinyscheme.sourceforge.net/";
76 changelog = "https://tinyscheme.sourceforge.net/CHANGES";
77 license = licenses.bsdOriginal;
78 mainProgram = "tinyscheme";
79 maintainers = [ maintainers.ebzzry ];
80 platforms = platforms.unix;