From fd8230152d84525e673fe0ce72205705aeb8efc4 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 19 Jan 2012 07:53:45 -0700 Subject: [PATCH] fix `raco ctool --c-mods' for `racket' Merge to 5.2.1 (cherry picked from commit 6c4cd0e9c249b502827398f597dd49b2f4ac8df6) --- collects/compiler/embed-unit.rkt | 11 +++++++---- collects/tests/racket/ctool.rkt | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 collects/tests/racket/ctool.rkt diff --git a/collects/compiler/embed-unit.rkt b/collects/compiler/embed-unit.rkt index eb4d7952d1..315ea20fd1 100644 --- a/collects/compiler/embed-unit.rkt +++ b/collects/compiler/embed-unit.rkt @@ -800,7 +800,10 @@ (define (do-write-module-bundle outp verbose? modules config? literal-files literal-expressions collects-dest on-extension program-name compiler expand-namespace src-filter get-extra-imports on-decls-done) - (let* ([module-paths (map cadr modules)] + (let* ([program-name-bytes (if program-name + (path->bytes program-name) + #"?")] + [module-paths (map cadr modules)] [resolve-one-path (lambda (mp) (let ([f (resolve-module-path mp #f)]) (unless f @@ -882,7 +885,7 @@ ;; The program name isn't used. It just helps ensures that ;; there's plenty of room in the executable for patching ;; the path later when making a distribution. - (path->bytes program-name)))) + program-name-bytes))) extensions))]) (for-each (lambda (pr) (current-module-declare-name (make-resolved-module-path (cadr pr))) @@ -970,7 +973,7 @@ (build-path (path-only (mod-file nc)) p)))))) ;; As for the extension table, a placeholder to save ;; room likely needed by the distribution-mangler - (bytes-append #"................." (path->bytes program-name)))) + (bytes-append #"................." program-name-bytes))) (mod-runtime-paths nc) (mod-runtime-module-syms nc))) runtimes))]) @@ -1031,7 +1034,7 @@ (do-write-module-bundle (current-output-port) verbose? modules config? literal-files literal-expressions #f ; collects-dest on-extension - "?" ; program-name + #f ; program-name compiler expand-namespace src-filter get-extra-imports void)) diff --git a/collects/tests/racket/ctool.rkt b/collects/tests/racket/ctool.rkt new file mode 100644 index 0000000000..32c2e36907 --- /dev/null +++ b/collects/tests/racket/ctool.rkt @@ -0,0 +1,19 @@ +#lang racket +(require setup/dirs) + +(define raco (build-path (find-console-bin-dir) + (if (eq? (system-type) 'windows) + "raco.exe" + "raco"))) + +(define tmp (make-temporary-file)) + +(system* raco + "ctool" + "--3m" + "--c-mods" + tmp + "++lib" + "racket") + +(delete-file tmp)