Ticket #1681: 0001-Make-CHICKEN-build-with-TCC.patch

File 0001-Make-CHICKEN-build-with-TCC.patch, 2.3 KB (added by Kooda, 4 years ago)

Patch to make CHICKEN compatible with TCC (Linux-specific due to Makefile changes)

  • Makefile.linux

    From f6ffb63f173a40826b731295555681d297987b88 Mon Sep 17 00:00:00 2001
    From: Kooda <kooda@upyum.com>
    Date: Fri, 14 Feb 2020 15:51:03 +0100
    Subject: [PATCH] Make CHICKEN build with TCC
    
    ---
     Makefile.linux | 4 ++--
     chicken.h      | 2 ++
     csc.scm        | 6 +++---
     3 files changed, 7 insertions(+), 5 deletions(-)
    
    diff --git a/Makefile.linux b/Makefile.linux
    index cfa8c2c5..7f0fa06c 100644
    a b C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer 
    4343endif
    4444endif
    4545LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
    46 LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-R"$(RUNTIME_LINKER_PATH)"
    47 LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R"$(RUNTIME_LINKER_PATH)"
     46LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
     47LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
    4848LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
    4949LIBRARIES = -lm -ldl
    5050NEEDS_RELINKING = yes
  • chicken.h

    diff --git a/chicken.h b/chicken.h
    index 376b0a26..9816cfc9 100644
    a b typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret; 
    10171017# else
    10181018#  define C_stack_pointer ((C_word *)C_alloca(1))
    10191019# endif
     1020#elif defined (__TINYC__)
     1021# define C_stack_pointer ((C_word *)C_alloca(1))
    10201022#else
    10211023# define C_stack_pointer ((C_word *)C_alloca(0))
    10221024#endif
  • csc.scm

    diff --git a/csc.scm b/csc.scm
    index a3a89aa3..f78a1b81 100644
    a b  
    262262   (cond (elf
    263263          (list
    264264           (conc "-L" library-dir)
    265            (conc "-Wl,-R"
     265           (conc "-Wl,-rpath="
    266266                 (if deployed
    267267                     "$ORIGIN"
    268268                     (if host-mode
    269269                         host-libdir
    270270                         TARGET_RUN_LIB_HOME)))))
    271271         (aix
    272           (list (conc "-Wl,-R\"" library-dir "\"")))
     272          (list (conc "-Wl,-rpath\"" library-dir "\"")))
    273273         (else
    274274          (list (conc "-L" library-dir))))
    275275   (if (and deployed (memq (software-version) '(freebsd openbsd netbsd)))
    EOF 
    776776                (set! rpath (car rest))
    777777                (when (and (memq (build-platform) '(gnu clang))
    778778                           (not mingw) (not osx))
    779                   (set! link-options (append link-options (list (string-append "-Wl,-R" rpath)))) )
     779                  (set! link-options (append link-options (list (string-append "-Wl,-rpath=" rpath)))) )
    780780                (set! rest (cdr rest)) ]
    781781               [(-host) #f]
    782782               ((-oi)