From 2311e4100387704945730da47fffbb29bf4354fc Mon Sep 17 00:00:00 2001 From: Richard Lowe Date: Wed, 7 Aug 2019 01:23:27 +0000 Subject: [PATCH 1/2] build on Solaris-like systems --- Makefile | 5 +++++ Makefile.detect | 13 +++++++++++++ lib/chibi/time.sld | 7 +++++-- lib/chibi/time.stub | 46 ++++++++++++++++++++++++++++++--------------- 4 files changed, 54 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index faa3d48c..153a6d88 100644 --- a/Makefile +++ b/Makefile @@ -109,6 +109,11 @@ XLDFLAGS := $(LDFLAGS) $(RLDFLAGS) $(GCLDFLAGS) $(LIBDL) -lm XCFLAGS := -Wall -g -g3 -O3 $(CFLAGS) endif +ifeq ($(PLATFORM),solaris) +XLDFLAGS += -lsocket +XCPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS +endif + ######################################################################## all: chibi-scheme$(EXE) all-libs chibi-scheme.pc $(META_FILES) diff --git a/Makefile.detect b/Makefile.detect index fddb88a8..3146f74d 100644 --- a/Makefile.detect +++ b/Makefile.detect @@ -35,6 +35,9 @@ else ifeq ($(shell uname -o),GNU/Linux) PLATFORM=linux else +ifeq ($(shell uname),SunOS) +PLATFORM=solaris +else PLATFORM=unix endif endif @@ -46,6 +49,7 @@ endif endif endif endif +endif ######################################################################## # Set default variables for the platform. @@ -72,6 +76,14 @@ CLINKFLAGS = -shared LIBDL = RLDFLAGS=-Wl,-R$(LIBDIR) else +ifeq ($(PLATFORM),solaris) +SO = .so +EXE = +CLIBFLAGS = -fPIC +CLINKFLAGS = -shared +LIBDL = -ldl +RLDFLAGS=-Wl,-R$(LIBDIR) +else ifeq ($(PLATFORM),windows) SO = .dll EXE = .exe @@ -112,6 +124,7 @@ endif endif endif endif +endif ifeq ($(PLATFORM),unix) #RLDFLAGS=-rpath $(LIBDIR) diff --git a/lib/chibi/time.sld b/lib/chibi/time.sld index 526795e3..1fba628e 100644 --- a/lib/chibi/time.sld +++ b/lib/chibi/time.sld @@ -5,9 +5,12 @@ make-timeval make-tm timeval-seconds timeval-microseconds timezone-offset timezone-dst-time time-second time-minute time-hour time-day time-month time-year - time-day-of-week time-day-of-year time-dst? time-timezone-name - time-offset + time-day-of-week time-day-of-year time-dst? tm? timeval? timezone?) + (cond-expand + (solaris) + (else + (export time-offset time-timezone-name))) (cond-expand (emscripten) (else diff --git a/lib/chibi/time.stub b/lib/chibi/time.stub index d917671b..1e42b78a 100644 --- a/lib/chibi/time.stub +++ b/lib/chibi/time.stub @@ -7,21 +7,37 @@ (c-system-include "time.h") (c-system-include "sys/time.h"))) -(define-c-struct tm - predicate: tm? - constructor: (make-tm tm_sec tm_min tm_hour - tm_mday tm_mon tm_year tm_isdst) - (int tm_sec time-second) - (int tm_min time-minute) - (int tm_hour time-hour) - (int tm_mday time-day) - (int tm_mon time-month) - (int tm_year time-year) - (int tm_wday time-day-of-week) - (int tm_yday time-day-of-year) - (int tm_isdst time-dst?) - (string tm_zone time-timezone-name) - (int tm_gmtoff time-offset)) +(cond-expand + (solaris + (define-c-struct tm + predicate: tm? + constructor: (make-tm tm_sec tm_min tm_hour + tm_mday tm_mon tm_year tm_isdst) + (int tm_sec time-second) + (int tm_min time-minute) + (int tm_hour time-hour) + (int tm_mday time-day) + (int tm_mon time-month) + (int tm_year time-year) + (int tm_wday time-day-of-week) + (int tm_yday time-day-of-year) + (int tm_isdst time-dst?))) + (else + (define-c-struct tm + predicate: tm? + constructor: (make-tm tm_sec tm_min tm_hour + tm_mday tm_mon tm_year tm_isdst) + (int tm_sec time-second) + (int tm_min time-minute) + (int tm_hour time-hour) + (int tm_mday time-day) + (int tm_mon time-month) + (int tm_year time-year) + (int tm_wday time-day-of-week) + (int tm_yday time-day-of-year) + (int tm_isdst time-dst?) + (string tm_zone time-timezone-name) + (int tm_gmtoff time-offset)))) ;;> Accessors for the \scheme{tm} struct. ;;/ From 4c1af8c92a54542ee34d2a84bea4c74f09a8271b Mon Sep 17 00:00:00 2001 From: Kris Katterjohn Date: Thu, 15 Aug 2019 19:03:57 -0500 Subject: [PATCH 2/2] Fix NetBSD, DragonFly BSD and Darwin feature detection On NetBSD systems the netbsd feature identifier was not actually provided because the macro SEXP_NETBSD was defined twice and the second value was 0. On DragonFly systems the dragonfly feature identifier was not actually provided because the macro SEXP_DRAGONFLY was defined twice and the second value was 0. Also on DragonFly systems the darwin feature identifier was incorrectly provided because SEXP_DARWIN had a value of 1 instead of 0. --- include/chibi/features.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/chibi/features.h b/include/chibi/features.h index 09926179..06a4209f 100644 --- a/include/chibi/features.h +++ b/include/chibi/features.h @@ -323,14 +323,12 @@ #define SEXP_NETBSD 1 #define SEXP_DRAGONFLY 0 #define SEXP_OPENBSD 0 -#define SEXP_NETBSD 0 #elif defined(__DragonFly__) -#define SEXP_DARWIN 1 +#define SEXP_DARWIN 0 #define SEXP_FREEBSD 0 #define SEXP_NETBSD 0 #define SEXP_DRAGONFLY 1 #define SEXP_OPENBSD 0 -#define SEXP_DRAGONFLY 0 #elif defined(__OpenBSD__) #define SEXP_DARWIN 0 #define SEXP_FREEBSD 0