Ticket #150: csc.scm.2.patch

File csc.scm.2.patch, 2.5 KB (added by ddp, 15 years ago)

a better patch

  • csc.scm

    diff --git a/csc.scm b/csc.scm
    index 4f3afe5..b88c261 100644
    a b  
    199199(define default-shared-library-files (if msvc
    200200                                         (list (string-append "libchicken." library-extension))
    201201                                         '("-lchicken")))
     202(define unsafe-libraries #f)
    202203(define unsafe-library-files
    203204  (list
    204205   (quotewrap
     
    209210(define unsafe-shared-library-files (if msvc
    210211                                        (list (string-append "libuchicken." library-extension))
    211212                                        '("-luchicken")))
     213(define (use-unsafe-libraries)
     214  (set! unsafe-libraries #t)
     215  (set! library-files unsafe-library-files)
     216  (set! shared-library-files unsafe-shared-library-files))
     217
    212218(define gui-library-files default-library-files)
    213219(define gui-shared-library-files default-shared-library-files)
    214220(define library-files default-library-files)
    EOF 
    639645               [(|-O5|)
    640646                (set! rest (cons* "-optimize-level" "5" rest))
    641647                (t-options "-unsafe-libraries")
    642                 (set! library-files unsafe-library-files)
    643                 (set! shared-library-files unsafe-shared-library-files)
     648                (use-unsafe-libraries)
    644649                (when (memq (build-platform) '(mingw32 cygwin gnu))
    645650                  (set! compile-options
    646651                    (cons* "-O3" "-fomit-frame-pointer" compile-options)) ) ]
    EOF 
    685690                (set! rest (cdr rest)) ]
    686691               [(-unsafe-libraries)
    687692                (t-options arg)
    688                 (set! library-files unsafe-library-files)
    689                 (set! shared-library-files unsafe-shared-library-files) ]
     693                (use-unsafe-libraries) ]
    690694               [(-rpath)
    691695                (check s rest)
    692696                (when (eq? 'gnu (build-platform))
    EOF 
    699703               [else
    700704                (when (memq s '(-unsafe -benchmark-mode))
    701705                  (when (eq? s '-benchmark-mode)
    702                     (set! library-files unsafe-library-files)
    703                     (set! shared-library-files unsafe-shared-library-files) ) )
     706                        (use-unsafe-libraries) ) )
    704707                (when (eq? s '-to-stdout)
    705708                  (set! to-stdout #t)
    706709                  (set! translate-only #t) )
    EOF 
    845848    (when (and osx (or (not cross-chicken) host-mode))
    846849      (unless (zero? ($system
    847850                      (string-append
    848                        "install_name_tool -change libchicken.dylib "
     851                       "install_name_tool -change lib" (if unsafe-libraries "u" "") "chicken.dylib "
    849852                       (quotewrap
    850853                        (make-pathname
    851854                         (prefix "" "lib"
    852855                                 (if host-mode
    853856                                     INSTALL_LIB_HOME
    854857                                     TARGET_RUN_LIB_HOME))
    855                          "libchicken.dylib") )
     858                         (if unsafe-libraries "libuchicken.dylib" "libchicken.dylib")) )
    856859                       " "
    857860                       target) ) )
    858861        (exit last-exit-code) ) )