about summary refs log tree commit diff
path: root/pkgs/development/interpreters/tinyscheme
diff options
context:
space:
mode:
authorRahul Butani <rrbutani@users.noreply.github.com>2022-07-18 15:12:40 -0500
committerRahul Butani <rrbutani@users.noreply.github.com>2022-07-18 16:20:12 -0500
commit698cedfa3c219cf8b8e16077aa215b7d15a2ce2d (patch)
treeaa9193bce6507c4da8dc0031b329307264205b52 /pkgs/development/interpreters/tinyscheme
parent2746a56f593437b8b7877b8d27f7ae98795f6849 (diff)
tinyscheme: don't require the gcc stdenv
Diffstat (limited to 'pkgs/development/interpreters/tinyscheme')
-rw-r--r--pkgs/development/interpreters/tinyscheme/02-use-toolchain-env-vars.patch26
-rw-r--r--pkgs/development/interpreters/tinyscheme/default.nix12
2 files changed, 36 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/tinyscheme/02-use-toolchain-env-vars.patch b/pkgs/development/interpreters/tinyscheme/02-use-toolchain-env-vars.patch
new file mode 100644
index 0000000000000..f23ad8d02ef58
--- /dev/null
+++ b/pkgs/development/interpreters/tinyscheme/02-use-toolchain-env-vars.patch
@@ -0,0 +1,26 @@
+diff --git a/makefile b/makefile
+index aeb2fcd..4c111a1 100644
+--- a/makefile
++++ b/makefile
+@@ -18,7 +18,7 @@
+ #AR= echo
+ 
+ # Unix, generally
+-CC = gcc -fpic -pedantic
++CC := $(CC) -fpic -pedantic
+ DEBUG=-g -Wall -Wno-char-subscripts -O
+ Osuf=o
+ SOsuf=so
+@@ -27,10 +27,10 @@ EXE_EXT=
+ LIBPREFIX=lib
+ OUT = -o $@
+ RM= -rm -f
+-AR= ar crs
++AR := $(AR) crs
+ 
+ # Linux
+-LD = gcc
++LD := $(CC)
+ LDFLAGS = -shared
+ DEBUG=-g -Wno-char-subscripts -O
+ SYS_LIBS= -ldl -lm
diff --git a/pkgs/development/interpreters/tinyscheme/default.nix b/pkgs/development/interpreters/tinyscheme/default.nix
index 0787c2c333110..96a0f355ec250 100644
--- a/pkgs/development/interpreters/tinyscheme/default.nix
+++ b/pkgs/development/interpreters/tinyscheme/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl }:
+{ lib, stdenv, fetchurl, dos2unix }:
 
 stdenv.mkDerivation rec {
   pname = "tinyscheme";
@@ -9,7 +9,15 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-F7Cxv/0i89SdWDPiKhILM5A50s/aC0bW/FHdLwG0B60=";
   };
 
-  patchPhase = ''
+  nativeBuildInputs = [ dos2unix ];
+
+  prePatch = "dos2unix makefile";
+  patches = [
+    # We want to have the makefile pick up $CC, etc. so that we don't have
+    # to unnecessarily tie this package to the GCC stdenv.
+    ./02-use-toolchain-env-vars.patch
+  ];
+  postPatch = ''
     substituteInPlace scheme.c --replace "init.scm" "$out/lib/init.scm"
   '';