Ticket #790: 0001-applied-patch-by-Sergey-for-musl-support.patch

File 0001-applied-patch-by-Sergey-for-musl-support.patch, 3.5 KB (added by felix winkelmann, 10 years ago)
  • Makefile.linux

    From 4d5659d61818f8f297bbdc176a4cf5c4fcf96c68 Mon Sep 17 00:00:00 2001
    From: felix <felix@call-with-current-continuation.org>
    Date: Tue, 21 Feb 2012 11:14:59 +0100
    Subject: [PATCH] applied patch by 'Sergey' for musl support
    
    ---
     Makefile.linux |    2 +-
     posixunix.scm  |   32 --------------------------------
     runtime.c      |    5 +----
     3 files changed, 2 insertions(+), 37 deletions(-)
    
    diff --git a/Makefile.linux b/Makefile.linux
    index 6e5116a..6114b81 100644
    a b ARCH ?= $(shell sh $(SRCDIR)/config-arch.sh) 
    3737
    3838# options
    3939
    40 C_COMPILER_OPTIONS ?= -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H
     40C_COMPILER_OPTIONS ?= -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -D_GNU_SOURCE -fPIC
    4141ifdef DEBUGBUILD
    4242C_COMPILER_OPTIMIZATION_OPTIONS ?= -g -Wall -Wno-unused
    4343else
  • posixunix.scm

    diff --git a/posixunix.scm b/posixunix.scm
    index 9b23846..a597993 100644
    a b static C_TLS sigset_t C_sigset; 
    310310
    311311#define C_ctime(n)          (C_secs = (n), ctime(&C_secs))
    312312
    313 #if defined(__SVR4) || defined(C_MACOSX)
    314313/* Seen here: http://lists.samba.org/archive/samba-technical/2002-November/025571.html */
    315314
    316315static time_t C_timegm(struct tm *t)
    static time_t C_timegm(struct tm *t) 
    340339    }
    341340  return (tl - (tb - tl));
    342341}
    343 #else
    344 #define C_timegm timegm
    345 #endif
    346342
    347343#define cpy_tmvec_to_tmstc08(ptm, v) \
    348344    (memset((ptm), 0, sizeof(struct tm)), \
    static time_t C_timegm(struct tm *t) 
    379375#define C_tm_get_08(v)  cpy_tmstc08_to_tmvec( (v), &C_tm )
    380376#define C_tm_get_9(v)   cpy_tmstc9_to_tmvec( (v), &C_tm )
    381377
    382 #if !defined(C_GNU_ENV) || defined(__CYGWIN__) || defined(__uClinux__)
    383 
    384378static struct tm *
    385379C_tm_set( C_word v )
    386380{
    C_tm_get( C_word v ) 
    395389  return v;
    396390}
    397391
    398 #else
    399 
    400 static struct tm *
    401 C_tm_set( C_word v )
    402 {
    403   C_tm_set_08( v );
    404   C_tm_set_9( v );
    405   return &C_tm;
    406 }
    407 
    408 static C_word
    409 C_tm_get( C_word v )
    410 {
    411   C_tm_get_08( v );
    412   C_tm_get_9( v );
    413   return v;
    414 }
    415 
    416 #endif
    417 
    418392#define C_asctime(v)    (asctime(C_tm_set(v)))
    419393#define C_a_mktime(ptr, c, v)  C_flonum(ptr, mktime(C_tm_set(v)))
    420394#define C_a_timegm(ptr, c, v)  C_flonum(ptr, C_timegm(C_tm_set(v)))
    EOF 
    16651639
    16661640(define local-timezone-abbreviation
    16671641  (foreign-lambda* c-string ()
    1668    "\n#if !defined(__CYGWIN__) && !defined(__SVR4) && !defined(__uClinux__) && !defined(__hpux__)\n"
    1669    "time_t clock = time(NULL);"
    1670    "struct tm *ltm = C_localtime(&clock);"
    1671    "char *z = ltm ? (char *)ltm->tm_zone : 0;"
    1672    "\n#else\n"
    16731642   "char *z = (daylight ? tzname[1] : tzname[0]);"
    1674    "\n#endif\n"
    16751643   "C_return(z);") )
    16761644
    16771645
  • runtime.c

    diff --git a/runtime.c b/runtime.c
    index 41a2f9d..433182c 100644
    a b void C_ccall C_decode_seconds(C_word c, C_word closure, C_word k, C_word secs, C 
    79197919                  C_fix(tmt->tm_mday), C_fix(tmt->tm_mon), C_fix(tmt->tm_year),
    79207920                  C_fix(tmt->tm_wday), C_fix(tmt->tm_yday),
    79217921                  tmt->tm_isdst > 0 ? C_SCHEME_TRUE : C_SCHEME_FALSE,
    7922 #ifdef C_GNU_ENV
    7923                   /* negative for west of UTC, but we want positive */
    7924                   C_fix(-tmt->tm_gmtoff)
    7925 #elif defined(__CYGWIN__) || defined(__MINGW32__) || defined(_WIN32) || defined(__WINNT__)
     7922#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(_WIN32) || defined(__WINNT__)
    79267923                  C_fix(mode == C_SCHEME_FALSE ? _timezone : 0) /* does not account for DST */
    79277924#else
    79287925                  C_fix(mode == C_SCHEME_FALSE ? timezone : 0)  /* does not account for DST */