distro-build: change `#:source?' config to mean source packages, too

Use `#:source-runtime?' to make only the run-time system have
source form, while packages are pre-built.
This commit is contained in:
Matthew Flatt 2013-07-20 12:09:37 -06:00
parent c1ca89d674
commit 82c4e56631
6 changed files with 95 additions and 39 deletions

View File

@ -118,9 +118,14 @@ SERVER = localhost
# snapshot installers):
RELEASE_MODE =
# Set to "--source" to create a source "installer":
# Set to "--source" to create an archive (instead of an "installer"
# proper) on a client that has the run-time system in source form:
SOURCE_MODE =
# Set to "--source --no-setup" to include packages in an installer
# (or archive) only in source form:
PKG_SOURCE_MODE =
# Human-readable name (spaces allowed), installation name base, and
# Unix installation directory name for the generated installers:
DIST_NAME = Racket
@ -332,6 +337,7 @@ client:
COPY_ARGS = SERVER=$(SERVER) PKGS="$(PKGS)" \
RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) \
PKG_SOURCE_MODE=$(PKG_SOURCE_MODE) \
DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \
DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) \
DIST_DESC="$(DIST_DESC)" README="$(README)" \
@ -359,8 +365,8 @@ bundle-from-server:
mkdir -p bundle/racket
$(RACKET) -l setup/unixstyle-install bundle racket bundle/racket
$(RACKET) -l distro-build/unpack-collects http://$(SERVER):9440/
bundle/racket/bin/raco pkg install $(REMOTE_INST_AUTO) $(PKGS) $(REQUIRED_PKGS)
$(RACKET) -l setup/unixstyle-install post-adjust$(SOURCE_MODE) racket bundle/racket
bundle/racket/bin/raco pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS) $(REQUIRED_PKGS)
$(RACKET) -l setup/unixstyle-install post-adjust "$(SOURCE_MODE)" "$(PKG_SOURCE_MODE)" racket bundle/racket
bundle-config:
$(RACKET) -l distro-build/set-config $(BUNDLE_CONFIG) "" "" "$(DOC_SEARCH)" $(DIST_CATALOGS_q)
@ -386,8 +392,8 @@ win32-bundle:
win32-bundle-from-server:
$(MAKE) win32-bundle $(COPY_ARGS)
$(WIN32_RACKET) -l distro-build/unpack-collects http://$(SERVER):9440/
bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(REQUIRED_PKGS)
bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(PKGS)
bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(REQUIRED_PKGS)
bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS)
win32-installer-from-bundle:
$(WIN32_RACKET) -l- distro-build/installer $(DIST_ARGS_q)

View File

@ -138,6 +138,8 @@
[(#:pull?) (boolean? val)]
[(#:release?) (boolean? val)]
[(#:source?) (boolean? val)]
[(#:source-runtime?) (boolean? val)]
[(#:source-pkgs?) (boolean? val)]
[(#:site-dest) (path-string? val)]
[(#:pdf-doc?) (boolean? val)]
[(#:max-snapshots) (real? val)]

View File

@ -204,11 +204,20 @@ Site-configuration keywords (where <string*> means no spaces, etc.):
installers; the default is determined by the `RELEASE_MODE'
makefile variable
#:source? <boolean> --- if true, then create a kernel-source archive
(with pre-built packages), instead of a platform-specific
installer; a #t value works best when used with a Unix client
machine, since Unix clients typically have no native-library
packages; the default is #f
#:source? <boolean> --- determines the default value for
`#:source-runtime' and `#:source-pkgs'
#:source-runtime? <boolean> --- if true, then create an archive that
contains the run-time system in source form (possibly with built
packages), instead of a platform-specific installer; a #t value
works best when used with a Unix client machine, since Unix
clients typically have no native-library packages; the default is
the value of `#:source?'
#:source-pkgs? --- if true, then packages are included in the
installer/archive only in source form; a true value works best
when the `#:source-runtime?' value is also #t; the default is the
value of `#:source?'
#:site-dest <path-string> --- destination for completed build, used
by the `site' and `snapshot-site' makefile targets; the default is

View File

@ -250,6 +250,8 @@
(define dist-catalogs (choose-catalogs c '("")))
(define release? (get-opt c '#:release? default-release?))
(define source? (get-opt c '#:source? #f))
(define source-pkgs? (get-opt c '#:source-pkgs? source?))
(define source-runtime? (get-opt c '#:source-runtime? source?))
(~a " SERVER=" server
" PKGS=" (q pkgs)
" DOC_SEARCH=" (q doc-search)
@ -260,7 +262,10 @@
" DIST_SUFFIX=" (q dist-suffix)
" DIST_CATALOGS_q=" (qq dist-catalogs kind)
" RELEASE_MODE=" (if release? "--release" (q ""))
" SOURCE_MODE=" (if source? "--source" (q ""))
" SOURCE_MODE=" (if source-runtime? "--source" (q ""))
" PKG_SOURCE_MODE=" (if source-pkgs?
(q "--source --no-setup")
(q ""))
" README=" (q (file-name-from-path readme))))
(define (unix-build c host port user server repo clean? pull? readme)

View File

@ -21,10 +21,13 @@
@|(hash-ref config '#:name "Racket")|
distribution for version @(version)@(maybe-stamp config).@;
@(if (hash-ref config '#:source? #f)
@(if (let ([src? (hash-ref config '#:source? #f)])
(or (hash-ref config '#:source-runtime? src?)
(hash-ref config '#:source-pkgs? src?)))
(string-append "\n" (make-source-notes config) "\n")
"")@;
@(if (and (not (hash-ref config '#:source? #f))
@(if (and (not (hash-ref config '#:source-runtime?
(hash-ref config '#:source? #f)))
(eq? (hash-ref config '#:platform (system-type)) 'macosx))
(string-append "\n" (make-macosx-notes config) "\n")
"")@;
@ -66,14 +69,28 @@
share/COPYING_LESSER.txt for more information.})
(define (make-source-notes config)
@~a{This distribution provides source for the Racket run-time system;
for build and installation instructions, see "racket/src/README".
Besides the run-time system's source, the distribution provides
pre-built versions of the core Racket bytecode, as well as pre-built
versions of included packages and documentation --- which makes it
suitable for quick installation on a Unix platform for which
executable binaries are not already provided.})
(define src? (hash-ref config '#:source? #f))
(define rt-src
@~a{This distribution provides source for the Racket run-time system;
for build and installation instructions, see "racket/src/README".})
(define pkg-src
@~a{(The distribution also includes the core Racket collections and any
installed packages in source form.)})
(define pkg-built
@~a{Besides the run-time system's source, the distribution provides
pre-built versions of the core Racket bytecode, as well as pre-built
versions of included packages and documentation --- which makes it
suitable for quick installation on a Unix platform for which
executable binaries are not already provided.})
(cond
[(and (hash-ref config '#:source-runtime? src?)
(not (hash-ref config '#:source-pkgs? src?)))
(~a rt-src "\n" pkg-built)]
[(and (hash-ref config '#:source-runtime? src?)
(hash-ref config '#:source-pkgs? src?))
(~a rt-src "\n" pkg-src)]
[else
@~a{The distribution includes any pre-installed packages in source form.}]))
(define (make-macosx-notes config)
@~a{Install by dragging the enclosing

View File

@ -12,8 +12,9 @@
;; (interactive, undo-on-error, create-uninstaller)
;; - `copy': similar to `move', but copies instead of moving
;; - `bundle': like `copy', but no uninstall script
;; - `post-adjust': adjust an existing bundle after package installs
;; - `post-adjust--source': (really two dashes), like `post-adjust', but for source
;; - `post-adjust': adjust an existing bundle after package installs;
;; two extra arguments determine whether to strip build
;; artifacts
;; - `make-install-copytree': copies some toplevel directories, skips ".*"
;; subdirs, and rewrites "config.rkt", but no uninstaller
;; (used by `make install') (requires an additional `origtree' argument)
@ -35,6 +36,9 @@
(begin0 (car args) (set! args (cdr args))))
(define op (string->symbol (get-arg)))
(define adjust-mode
(and (eq? op 'post-adjust)
(list (get-arg) (get-arg))))
(define rktdir (get-arg))
(define base-destdir (and (pair? args)
(null? (cdr args))
@ -119,6 +123,16 @@
(delete-directory path)]
[else #t])) ; shouldn't happen
;; removes "compiled" subdirectories recursively
(define (rm-compiled path)
(define (loop path)
(cond [(equal? path "compiled") (rm path)]
[(directory-exists? path)
(parameterize ([current-directory path]) (for-each loop (ls)))]
[else (void)]))
(parameterize ([current-directory path])
(for-each loop (ls))))
;; used for filtering files when copying (and moving toplevels)
(define skip-filter (lambda (p) #f))
@ -469,20 +483,24 @@
(fix-executables bindir librktdir)
(unless origtree? (write-config configdir)))
(define (post-adjust-source)
(define do-tree (move/copy-tree #f))
(current-directory rktdir)
;; Copy source into place:
(set! skip-filter ; skip src/build
(lambda (p) (regexp-match? #rx"^build$" p)))
(do-tree "src" (build-path base-destdir "src"))
;; Remove directories that get re-created:
(define (remove! dst*) (rm (dir: dst*)))
(remove! 'bin)
(remove! 'lib)
(remove! 'man)
(remove! 'config) ; may be recreated by a later bundle step
(remove! 'includerkt))
(define (post-adjust)
(when (regexp-match? #rx"--source" (car adjust-mode))
(define do-tree (move/copy-tree #f))
(current-directory rktdir)
;; Copy source into place:
(set! skip-filter ; skip src/build
(lambda (p) (regexp-match? #rx"^build$" p)))
(do-tree "src" (build-path base-destdir "src"))
;; Remove directories that get re-created:
(define (remove! dst*) (rm (dir: dst*)))
(remove! 'bin)
(remove! 'lib)
(remove! 'man)
(remove! 'config) ; may be recreated by a later bundle step
(remove! 'includerkt)
(when (regexp-match? #rx"--source" (cadr adjust-mode))
;; strip "compiled" directories back out of "collects"
(rm-compiled (dir: 'collects)))))
;; --------------------------------------------------------------------------
@ -491,8 +509,7 @@
[(move) (move/copy-distribution #t #f)]
[(copy) (move/copy-distribution #f #f)]
[(bundle) (move/copy-distribution #f #t)]
[(post-adjust) (void)]
[(post-adjust--source) (post-adjust-source)]
[(post-adjust) (post-adjust)]
[(make-install-copytree) (make-install-copytree)]
[(make-install-destdir-fix) (make-install-destdir-fix)]
[else (error (format "unknown operation: ~e" op))]))