add ++aux' flag to
raco exe'
This commit is contained in:
parent
735ca7f3c3
commit
ca0d7b5ef4
|
@ -2,6 +2,7 @@
|
||||||
(require scheme/cmdline
|
(require scheme/cmdline
|
||||||
raco/command-name
|
raco/command-name
|
||||||
compiler/private/embed
|
compiler/private/embed
|
||||||
|
launcher/launcher
|
||||||
dynext/file)
|
dynext/file)
|
||||||
|
|
||||||
(define verbose (make-parameter #f))
|
(define verbose (make-parameter #f))
|
||||||
|
@ -40,6 +41,11 @@
|
||||||
[("--cgc") "Generate using CGC variant"
|
[("--cgc") "Generate using CGC variant"
|
||||||
(3m #f)]
|
(3m #f)]
|
||||||
#:multi
|
#:multi
|
||||||
|
[("++aux") aux-file "Extra executable info (based on <aux-file> suffix)"
|
||||||
|
(let ([auxes (extract-aux-from-path (path->complete-path aux-file))])
|
||||||
|
(when (null? auxes)
|
||||||
|
(printf " warning: no recognized information from ~s\n" aux-file))
|
||||||
|
(exe-aux (append auxes (exe-aux))))]
|
||||||
[("++lib") lib "Embed <lib> in executable"
|
[("++lib") lib "Embed <lib> in executable"
|
||||||
(exe-embedded-libraries (append (exe-embedded-libraries) (list lib)))]
|
(exe-embedded-libraries (append (exe-embedded-libraries) (list lib)))]
|
||||||
[("++exf") flag "Add flag to embed in executable"
|
[("++exf") flag "Add flag to embed in executable"
|
||||||
|
|
|
@ -46,6 +46,7 @@ mred-launcher-put-file-extension+style+filters
|
||||||
mzscheme-launcher-put-file-extension+style+filters
|
mzscheme-launcher-put-file-extension+style+filters
|
||||||
|
|
||||||
build-aux-from-path
|
build-aux-from-path
|
||||||
|
extract-aux-from-path
|
||||||
current-launcher-variant
|
current-launcher-variant
|
||||||
available-mred-variants
|
available-mred-variants
|
||||||
available-mzscheme-variants
|
available-mzscheme-variants
|
||||||
|
|
|
@ -503,11 +503,17 @@
|
||||||
(define (strip-suffix s)
|
(define (strip-suffix s)
|
||||||
(path-replace-suffix s #""))
|
(path-replace-suffix s #""))
|
||||||
|
|
||||||
(define (build-aux-from-path aux-root)
|
(define (extract-aux-from-path path)
|
||||||
(let ([aux-root (if (string? aux-root) (string->path aux-root) aux-root)])
|
(define path-bytes (path->bytes (if (string? path)
|
||||||
|
(string->path path)
|
||||||
|
path)))
|
||||||
|
(define len (bytes-length path-bytes))
|
||||||
(define (try key suffix)
|
(define (try key suffix)
|
||||||
(let ([p (path-replace-suffix aux-root suffix)])
|
(if (and (len . > . (bytes-length suffix))
|
||||||
(if (file-exists? p) (list (cons key p)) null)))
|
(equal? (subbytes path-bytes (- len (bytes-length suffix)))
|
||||||
|
suffix))
|
||||||
|
(list (cons key path))
|
||||||
|
null))
|
||||||
(append
|
(append
|
||||||
(try 'icns #".icns")
|
(try 'icns #".icns")
|
||||||
(try 'ico #".ico")
|
(try 'ico #".ico")
|
||||||
|
@ -527,14 +533,16 @@
|
||||||
(with-input-from-file (cdar l)
|
(with-input-from-file (cdar l)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let*-values ([(d) (read)]
|
(let*-values ([(d) (read)]
|
||||||
[(local-dir base dir?) (split-path aux-root)]
|
[(local-dir base dir?) (split-path path)]
|
||||||
[(icon-files)
|
[(icon-files)
|
||||||
(append-map
|
(append-map
|
||||||
(lambda (spec)
|
(lambda (spec)
|
||||||
(let ([m (assoc "CFBundleTypeIconFile" spec)])
|
(let ([m (assoc "CFBundleTypeIconFile" spec)])
|
||||||
(if m
|
(if m
|
||||||
(list (build-path
|
(list (build-path
|
||||||
(path->complete-path local-dir)
|
(if (eq? local-dir 'relative)
|
||||||
|
(current-directory)
|
||||||
|
(path->complete-path local-dir))
|
||||||
(format "~a.icns" (cadr m))))
|
(format "~a.icns" (cadr m))))
|
||||||
null)))
|
null)))
|
||||||
d)])
|
d)])
|
||||||
|
@ -548,7 +556,22 @@
|
||||||
(with-input-from-file (cdar l)
|
(with-input-from-file (cdar l)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let ([d (read)])
|
(let ([d (read)])
|
||||||
(list (cons 'uti-exports d)))))))))))
|
(list (cons 'uti-exports d))))))))))
|
||||||
|
|
||||||
|
(define (build-aux-from-path aux-root)
|
||||||
|
(let ([aux-root (if (string? aux-root) (string->path aux-root) aux-root)])
|
||||||
|
(define (try suffix)
|
||||||
|
(let ([p (path-replace-suffix aux-root suffix)])
|
||||||
|
(if (file-exists? p)
|
||||||
|
(extract-aux-from-path p)
|
||||||
|
null)))
|
||||||
|
(append
|
||||||
|
(try #".icns")
|
||||||
|
(try #".ico")
|
||||||
|
(try #".lch")
|
||||||
|
(try #".creator")
|
||||||
|
(try #".filetypes")
|
||||||
|
(try #".utiexports"))))
|
||||||
|
|
||||||
(define (make-gracket-program-launcher file collection dest)
|
(define (make-gracket-program-launcher file collection dest)
|
||||||
(make-mred-launcher (list "-l-" (string-append collection "/" file))
|
(make-mred-launcher (list "-l-" (string-append collection "/" file))
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require scribble/manual "common.rkt" (for-label racket/runtime-path))
|
@(require scribble/manual
|
||||||
|
"common.rkt"
|
||||||
|
(for-label racket/runtime-path
|
||||||
|
launcher/launcher))
|
||||||
|
|
||||||
@title[#:tag "exe"]{@exec{raco exe}: Creating Stand-Alone Executables}
|
@title[#:tag "exe"]{@exec{raco exe}: Creating Stand-Alone Executables}
|
||||||
|
|
||||||
|
@ -62,6 +65,12 @@ and possibly other run-time files declared via
|
||||||
support libraries to create a distribution using @exec{raco
|
support libraries to create a distribution using @exec{raco
|
||||||
distribute}, as described in @secref["exe-dist"].
|
distribute}, as described in @secref["exe-dist"].
|
||||||
|
|
||||||
|
The @DFlag{ico} (Windows) or @DFlag{icns} (Mac OS X) flag sets the
|
||||||
|
icon for the generated executable. For generally, @DPFlag{aux}
|
||||||
|
attaches information to the executable based on the auxilliary file's
|
||||||
|
suffix; see @racket[extract-aux-from-path] for a list of recognized
|
||||||
|
suffixes and meanings.
|
||||||
|
|
||||||
@; ----------------------------------------------------------------------
|
@; ----------------------------------------------------------------------
|
||||||
|
|
||||||
@include-section["exe-api.scrbl"]
|
@include-section["exe-api.scrbl"]
|
||||||
|
|
|
@ -299,11 +299,22 @@ launcher.}
|
||||||
(listof (cons/c symbol? any/c))]{
|
(listof (cons/c symbol? any/c))]{
|
||||||
|
|
||||||
Creates an association list suitable for use with
|
Creates an association list suitable for use with
|
||||||
@racket[make-gracket-launcher] or @racket[create-embedding-executable].
|
@racket[make-gracket-launcher] or
|
||||||
It builds associations by adding to @racket[path] suffixes, such as
|
@racket[create-embedding-executable]. It builds associations by
|
||||||
@filepath{.icns}, and checking whether such a file exists.
|
adding to @racket[path] suffixes, such as @filepath{.icns}, checking
|
||||||
|
whether such a file exists, and calling @racket[extract-aux-from-path]
|
||||||
|
if so. The results from all recognized suffixes are appended
|
||||||
|
together.}
|
||||||
|
|
||||||
The recognized suffixes are as follows:
|
|
||||||
|
@defproc[(extract-aux-from-path [path path-string?])
|
||||||
|
(listof (cons/c symbol? any/c))]{
|
||||||
|
|
||||||
|
Creates an association list suitable for use with
|
||||||
|
@racket[make-gracket-launcher] or
|
||||||
|
@racket[create-embedding-executable]. It builds associations by
|
||||||
|
recognizing the suffix of @racket[path], where the recognized suffixes
|
||||||
|
are as follows:
|
||||||
|
|
||||||
@itemize[
|
@itemize[
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user