Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 82 lines 2.4 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, dos2unix 5, runCommand 6, tinyscheme 7}: 8 9stdenv.mkDerivation rec { 10 pname = "tinyscheme"; 11 version = "1.42"; 12 13 src = fetchurl { 14 url = "mirror://sourceforge/tinyscheme/${pname}-${version}.tar.gz"; 15 sha256 = "sha256-F7Cxv/0i89SdWDPiKhILM5A50s/aC0bW/FHdLwG0B60="; 16 }; 17 18 nativeBuildInputs = [ dos2unix ]; 19 20 prePatch = "dos2unix makefile"; 21 patches = [ 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 25 # 26 # In any case, this is not needed to build on macOS. 27 ./01-remove-macOS-main.patch 28 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.targetPlatform.isDarwin [ 33 # On macOS the library suffix is .dylib: 34 ./03-macOS-SOsuf.patch 35 ]; 36 postPatch = '' 37 substituteInPlace scheme.c --replace "init.scm" "$out/lib/init.scm" 38 ''; 39 40 installPhase = '' 41 mkdir -p $out/bin $out/lib 42 cp init.scm $out/lib 43 cp libtinyscheme* $out/lib 44 cp scheme $out/bin/tinyscheme 45 ''; 46 47 passthru.tests = { 48 # Checks that the program can run and exit: 49 simple = runCommand "${pname}-simple-test" {} '' 50 ${tinyscheme}/bin/tinyscheme <<<"(quit 0)" 51 echo "success" > $out 52 ''; 53 fileIo = runCommand "${pname}-file-io-test" {} '' 54 ${tinyscheme}/bin/tinyscheme <<EOF 55 (call-with-output-file "$out" 56 (lambda (p) 57 (begin 58 (write "success!" p) 59 (newline p) 60 ))) 61 EOF 62 ''; 63 helpText = runCommand "${pname}-help-text-test" {} '' 64 ${tinyscheme}/bin/tinyscheme '-?' | tee > $out || : 65 [[ "$(cat $out)" =~ ^Usage: ]] 66 ''; 67 }; 68 69 meta = with lib; { 70 description = "Lightweight Scheme implementation"; 71 longDescription = '' 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. 74 ''; 75 homepage = "https://tinyscheme.sourceforge.net/"; 76 changelog = "https://tinyscheme.sourceforge.net/CHANGES"; 77 license = licenses.bsdOriginal; 78 mainProgram = pname; 79 maintainers = [ maintainers.ebzzry ]; 80 platforms = platforms.unix; 81 }; 82}