From 743348c767007d78748779724a09f80a41fa6c0c Mon Sep 17 00:00:00 2001
From: Stefan Anzinger <stefan.anzinger@oracle.com>
Date: Wed, 26 Jul 2017 11:41:22 +0000
Subject: [PATCH] Use patch instead of ed when fixing gnur configure script.

---
 com.oracle.truffle.r.native/gnur/Makefile.gnur |  6 +-----
 .../gnur/configure.patch                       | 18 ++++++++++++++++++
 com.oracle.truffle.r.native/gnur/edconfigure   |  9 ---------
 3 files changed, 19 insertions(+), 14 deletions(-)
 create mode 100644 com.oracle.truffle.r.native/gnur/configure.patch
 delete mode 100644 com.oracle.truffle.r.native/gnur/edconfigure

diff --git a/com.oracle.truffle.r.native/gnur/Makefile.gnur b/com.oracle.truffle.r.native/gnur/Makefile.gnur
index 711ab5dc42..2f82aecaa3 100644
--- a/com.oracle.truffle.r.native/gnur/Makefile.gnur
+++ b/com.oracle.truffle.r.native/gnur/Makefile.gnur
@@ -57,11 +57,7 @@ all: Makefile $(GNUR_HOME) iconv config build
 
 $(GNUR_HOME): 
 	tar xf $(TOPDIR)/../libdownloads/R-$(R_VERSION).tar.gz
-# Solaris doesn't need this and ed can't handle the size of the configure file!
-ifneq ($(OSNAME), SunOS)
-	ed $(GNUR_HOME)/configure < edconfigure # to fix the zlib version check (fixed in GNUR in the meantime)
-endif
-
+	(cd $(GNUR_HOME) && patch < $(TOPDIR)/gnur/configure.patch) # to fix the zlib version check (fixed in GNUR in the meantime)
 
 # After this platform check, GNUR_CONFIG_FLAGS must be set
 ifeq ($(OSNAME), SunOS)
diff --git a/com.oracle.truffle.r.native/gnur/configure.patch b/com.oracle.truffle.r.native/gnur/configure.patch
new file mode 100644
index 0000000000..b4f0be9936
--- /dev/null
+++ b/com.oracle.truffle.r.native/gnur/configure.patch
@@ -0,0 +1,18 @@
+--- ./R-3.3.2/configure Mon Oct 24 04:34:26 2016
++++ ./configure.new     Wed Jul 26 04:43:08 2017
+@@ -35507,10 +35507,11 @@
+ #include <string.h>
+ #include <zlib.h>
+ int main() {
+-#ifdef ZLIB_VERSION
+-/* Work around Debian bug: it uses 1.2.3.4 even though there was no such
+-   version on the master site zlib.net */
+-  exit(strncmp(ZLIB_VERSION, "1.2.5", 5) < 0);
++#ifdef ZLIB_VERNUM
++  if (ZLIB_VERNUM < 0x1250) {
++    exit(1);
++  }
++  exit(0);
+ #else
+   exit(1);
+ #endif
diff --git a/com.oracle.truffle.r.native/gnur/edconfigure b/com.oracle.truffle.r.native/gnur/edconfigure
deleted file mode 100644
index ba5c8bbaf6..0000000000
--- a/com.oracle.truffle.r.native/gnur/edconfigure
+++ /dev/null
@@ -1,9 +0,0 @@
-35510,35513c
-#ifdef ZLIB_VERNUM
-  if (ZLIB_VERNUM < 0x1250) {
-    exit(1);
-  }
-  exit(0);
-.
-w
-q
-- 
GitLab