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