Mac OS: add libedit to the set of native libraries
The libedit library supplied by Mac OS is old and does not support Unicode, so include a build that does support it.
This commit is contained in:
parent
e5899bd3e6
commit
ace1c6a128
|
@ -18,6 +18,7 @@ Currently, we use the following external packages and versions:
|
|||
pkg-config-0.28
|
||||
sed-4.2 (Windows only, to avoid non-GNU `sed`)
|
||||
sqlite[-autoconf]-3220000 (Windows, Linux, and PPC Mac OS only)
|
||||
libedit-20191231-3.1 (Mac OS only)
|
||||
openssl-1.1.1g
|
||||
libiconv-1.15 (Windows only)
|
||||
zlib-1.2.11 (Windows and Linux only)
|
||||
|
|
|
@ -154,6 +154,9 @@
|
|||
;; Needed when building with old GCC, such as 4.0:
|
||||
(define-runtime-path gmp-weak-patch "patches/gmp-weak.patch")
|
||||
|
||||
;; For `getline` on 32-bit Mac OS 10.6:
|
||||
(define-runtime-path libedit-getline-patch "patches/libedit-getline.patch")
|
||||
|
||||
;; Upstream patch to fix Win32 build:
|
||||
(define-runtime-path glib-win32-weekday-patch "patches/glib-win32-weekday.patch")
|
||||
|
||||
|
@ -359,6 +362,10 @@
|
|||
[("pkg-config") (config #:configure (list "--with-internal-glib"))]
|
||||
[("sed") (config)]
|
||||
[("longdouble") (config)]
|
||||
[("libedit") (config
|
||||
#:patches (if (and mac? m32?)
|
||||
(list libedit-getline-patch)
|
||||
null))]
|
||||
[("libiconv")
|
||||
(nonmac-only)
|
||||
(config)]
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
"libpangowin32-1.0.0"))
|
||||
|
||||
(define mac-libs
|
||||
'("PSMTabBarControl.framework"))
|
||||
'("libedit.0"
|
||||
"PSMTabBarControl.framework"))
|
||||
|
||||
(define mac64-libs
|
||||
'("MMTabBarView.framework"))
|
||||
|
@ -129,7 +130,10 @@
|
|||
["libiconv-2" "libiconv is released under the GNU Lesser General Public License (GNU LGPL)."]
|
||||
["longdouble" ,(~a "The source to longdouble is included with the Racket source code,\n"
|
||||
"which is available from\n"
|
||||
" http://www.racket-lang.org/")])]
|
||||
" http://www.racket-lang.org/")]
|
||||
["libedit" ,(~a "This package includes libedit software developed for NetBSD under the\n"
|
||||
"NetBSD license.")])]
|
||||
|
||||
["math"
|
||||
""
|
||||
"math"
|
||||
|
|
62
racket/src/native-libs/patches/libedit-getline.patch
Normal file
62
racket/src/native-libs/patches/libedit-getline.patch
Normal file
|
@ -0,0 +1,62 @@
|
|||
diff -u -r old/libedit-20191231-3.1/src/sys.h new/libedit-20191231-3.1/src/sys.h
|
||||
--- old/libedit-20191231-3.1/src/sys.h 2020-08-27 10:57:43.000000000 -0600
|
||||
+++ new/libedit-20191231-3.1/src/sys.h 2020-08-27 10:57:56.000000000 -0600
|
||||
@@ -43,6 +43,7 @@
|
||||
#ifdef HAVE_SYS_CDEFS_H
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
+#include <sys/types.h>
|
||||
|
||||
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
# define __attribute__(A)
|
||||
diff -u -r old/libedit-20191231-3.1/src/wcsdup.c new/libedit-20191231-3.1/src/wcsdup.c
|
||||
--- old/libedit-20191231-3.1/src/wcsdup.c 2020-08-27 10:57:43.000000000 -0600
|
||||
+++ new/libedit-20191231-3.1/src/wcsdup.c 2020-08-27 12:03:37.000000000 -0600
|
||||
@@ -41,3 +41,46 @@
|
||||
}
|
||||
|
||||
#endif
|
||||
+
|
||||
+
|
||||
+#ifndef HAVE_GETLINE
|
||||
+#include <sys/types.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+ssize_t getline(char **line, size_t *len, FILE *fp) {
|
||||
+ char *buffer, *r;
|
||||
+ int buflen, delta = 0, slen;
|
||||
+
|
||||
+ if (*line == NULL) {
|
||||
+ buflen = 256;
|
||||
+ buffer = malloc(buflen);
|
||||
+ } else {
|
||||
+ buffer = *line;
|
||||
+ buflen = *len;
|
||||
+ if (buflen == 0) {
|
||||
+ buflen = 128;
|
||||
+ buffer = realloc(buffer, buflen);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ while (1) {
|
||||
+ r = fgets(buffer + delta, buflen - delta, fp);
|
||||
+ if (!r) {
|
||||
+ if (delta == 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
+ delta += strlen(buffer + delta);
|
||||
+ if ((delta > 0) && (buffer[delta-1] == '\n')) {
|
||||
+ *line = buffer;
|
||||
+ *len = buflen;
|
||||
+ return delta;
|
||||
+ }
|
||||
+ if (delta + 1 == buflen) {
|
||||
+ buflen *= 2;
|
||||
+ buffer = realloc(buffer, buflen);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
Only in new/libedit-20191231-3.1/src: wcsdup.c~
|
Loading…
Reference in New Issue
Block a user