Add a generic toplevel README file, make the bundle script use it.

Also, get rid of the old readme-specs.
This commit is contained in:
Eli Barzilay 2010-05-18 17:20:49 -04:00
parent 4e7fb7f62c
commit ab116a5c8b
4 changed files with 120 additions and 195 deletions

38
README Normal file
View File

@ -0,0 +1,38 @@
The Racket programming language
===============================
Important executables:
* DrRacket: Racket's integrated development environment (start here!).
* Racket: the main command-line entry point for running racket programs
and scripts.
* GRacket: the GUI-enabled Racket executable.
* raco: Racket's command-line toolset.
More Information
----------------
Racket comes with extensive documentation: use DrRacket's `Help' menu,
or run `raco docs'. Also, visit us at http://racket-lang.org/ for more
Racket resources.
Instructions for building Racket from source are in src/README.
License
-------
Racket
Copyright (c) 2010 PLT Scheme Inc.
Racket is distributed under the GNU Lesser General Public License
(LGPL). This means that you can link Racket into proprietary
applications, provided you follow the rules stated in the LGPL. You can
also modify Racket; if you distribute a modified version, you must
distribute it under the terms of the LGPL, which in particular means
that you must release the source code for the modified software. See
doc/release-notes/COPYING.LIB for more information.

View File

@ -4,10 +4,9 @@
#lang scheme/base
(require scheme/cmdline scheme/runtime-path scheme/match scheme/promise
meta/checker (prefix-in dist: meta/dist-specs) meta/specs
(for-syntax scheme/base) ; for runtime-path
scheme/file (only-in scheme/system system)
(except-in scheme/mpair mappend)
(only-in scheme/system system))
meta/checker (prefix-in dist: meta/dist-specs) meta/specs)
(define (/-ify x)
(regexp-replace #rx"/?$" (if (path? x) (path->string x) x) "/"))
@ -23,14 +22,14 @@
(define cd current-directory)
(define *readme-file*
(build-path plt/ "readme.txt"))
(build-path plt/ "README"))
(define *info-domain-file*
(build-path plt/ "collects" "info-domain" "compiled" "cache.rktd"))
(define *readme-cache* #f)
(define *info-domain-cache* #f)
(define-runtime-path *spec-file* "distribution-specs")
(define-runtime-path *readme-specs-file* "readme-specs")
(define *verify?* #t)
(define *btgz?* #t)
@ -109,11 +108,6 @@
(car paths)))))
(loop (cons line lines)))))))
;;; ===========================================================================
;;; Spec management
(define *readme-specs* (make-parameter #f))
;;; ===========================================================================
;;; Start working
@ -165,7 +159,6 @@
(current-namespace (namespace-anchor->namespace bundle-specs))
(dprintf "Reading specs...")
(dist:register-specs!)
(read-spec-file *readme-specs-file* *readme-specs*)
(dprintf " done.\n"))
(define (input-tgz-name? f)
@ -232,39 +225,12 @@
(when (null? trees)
(error 'binaries "no binaries found for ~s" platform)))
*platforms* *platform-tree-lists*)
;; Create the readme file so it is included with the plt tree
(with-output-to-file *readme-file* newline #:exists 'truncate)
;; Get the plt tree, remove junk and binary stuff
(set-plt-tree! plt-base/ plt/-name *platform-tree-lists*)
(set-bin-files-delayed-lists!
(delay (map (lambda (trees)
(sort* (mappend tree-flatten (add-trees trees))))
*platform-tree-lists*)))
;; Get the plt tree, remove junk and binary stuff
(delete-file *readme-file*))
;; works with any newline format, expects text that always ends with a newline,
;; does not handle tabs, does not handle prefix whitespaces, is not efficient.
(define (wrap-string str width)
(define (wrap-line str nl r)
(cond [(<= (string-length str) width) (list* nl str r)]
[(or (regexp-match-positions #rx"^.*( +)" str 0 width)
;; no space in limit, go for the first space afterwards
(regexp-match-positions #rx"^.*?( +)" str))
=> (lambda (m)
(wrap-line (substring str (cdadr m)) nl
(list* nl (substring str 0 (caadr m)) r)))]
[else (list* nl str r)]))
(let loop ([str str] [r '()])
(let ([m (regexp-match #rx"^(.*?)(\r\n|\r|\n)(.*)$" str)])
(if m
(loop (cadddr m) (wrap-line (cadr m) (caddr m) r))
(apply string-append (reverse (cons str r)))))))
(define (make-readme)
(let ([readme (parameterize ([*specs* (*readme-specs*)])
(apply string-append (expand-spec 'readme)))])
(display (wrap-string readme 72))))
*platform-tree-lists*))))
(define (make-info-domain trees)
(unless (= 1 (length trees))
@ -278,6 +244,27 @@
*info-domain-cache*)])
(lambda () (write info) (newline))))
(define readme-skeleton
(delay (let ([m (regexp-match #rx"^(.*?\n====+\n)\n*(.*)$" *readme-cache*)])
;; title, rest (without generic source reference)
(if m
(list (cadr m)
(regexp-replace #rx"\nInstructions for building[^\n]*\n"
(caddr m)
""))
(error 'readme-skeleton "unexpected toplevel README")))))
(define (make-readme)
(for-each
;; convert to CRLF on Windows
(if (memq 'win (*environment*))
(lambda (x) (display (regexp-replace* #rx"\r?\n" x "\r\n")))
display)
`(,(car (force readme-skeleton))
"\n"
,@(expand-spec 'readme-header)
"\n"
,(cadr (force readme-skeleton)))))
(define (create-binaries platform trees)
(parameterize ([cd (build-path binaries/ platform)])
(let ([full-tgz (concat "plt-"platform"-full.tgz")]
@ -511,17 +498,13 @@
(register-spec! 'verify! (lambda () (when *verify?* (verify!))))
;; make auto-generated files exist
(define (create-generated-files)
;; no need to create the cache.ss, since it's there, but read it
(set! *info-domain-cache*
(with-input-from-file *info-domain-file* read))
(with-output-to-file *readme-file* newline #:exists 'truncate))
(define (delete-generated-files)
;; don't delete the cache, but write original unfiltered contents
(with-output-to-file *info-domain-file*
(lambda () (write *info-domain-cache*) (newline)) #:exists 'truncate)
(delete-file *readme-file*))
(define (read-orig-files)
(set! *readme-cache* (file->string *readme-file*))
(set! *info-domain-cache* (with-input-from-file *info-domain-file* read)))
(define (write-orig-files)
(display-to-file *readme-file* *readme-cache*)
(with-output-to-file *info-domain-file* #:exists 'truncate
(lambda () (write *info-domain-cache*) (newline))))
;; mimic the chown syntax
(define (chown #:rec [rec #f] who path . paths)
@ -538,8 +521,7 @@
(map (lambda (p) (format " \"~a\"" p)) paths)))))))
(define whoami
(delay
(parameterize ([current-output-port (open-output-string)])
(delay (parameterize ([current-output-port (open-output-string)])
(system "echo \"`id -nu`:`id -ng`\"")
(regexp-replace
#rx"[ \r\n]*$" (get-output-string (current-output-port)) ""))))
@ -556,7 +538,7 @@
(initialize)
(for-each create-binaries *platforms* *platform-tree-lists*)
(dynamic-wind
(lambda () (create-generated-files) (chown-dirs-to 'root))
(lambda () (read-orig-files) (chown-dirs-to 'root))
;; Start the verification and distribution
(lambda () (expand-spec 'distributions) (void))
(lambda () (chown-dirs-to 'me) (delete-generated-files)))
(lambda () (chown-dirs-to 'me) (write-orig-files)))

View File

@ -1,137 +0,0 @@
;; -*- scheme -*-
;; This file defines the readme files for the different distributions. It is
;; similar to the distribution specs file, see that for explanations on its
;; format.
\\ := (cond win => "\r\n"
;; (or ppc-osx-mac i386-osx-mac) => "\r" ; is this still needed?
else => "\n" )
package-name
:= (cond full => "PLT Scheme Full Repository"
plt => "PLT Scheme"
dr => "DrScheme"
mr => "MrEd"
mz => "MzScheme")
dist-type
:= (cond src => "source"
else => "executable")
platform-type
:= (cond unix => "Unix"
mac => "Macintosh"
win => "Windows")
platform
:= (cond i386-linux => "Linux (i386)"
i386-linux-gcc2 => "Linux (i386/gcc2)"
i386-linux-fc2 => "Fedora Core 2 (i386)"
i386-linux-fc5 => "Fedora Core 5 (i386)"
i386-linux-fc6 => "Fedora Core 6 (i386)"
i386-linux-f7 => "Fedora 7 (i386)"
x86_64-linux-f7 => "Fedora 7 (x86_64)"
i386-linux-f9 => "Fedora 9 (i386)"
i386-linux-f12 => "Fedora 12 (i386)"
i386-linux-debian => "Debian Stable (i386)"
i386-linux-debian-testing => "Debian Testing (i386)"
i386-linux-debian-unstable => "Debian Unstable (i386)"
i386-linux-ubuntu => "Ubuntu (i386)"
i386-linux-ubuntu-dapper => "Ubuntu Dapper (i386)"
i386-linux-ubuntu-edgy => "Ubuntu Edgy (i386)"
i386-linux-ubuntu-feisty => "Ubuntu Feisty (i386)"
i386-linux-ubuntu-hardy => "Ubuntu Hardy (i386)"
i386-linux-ubuntu-intrepid => "Ubuntu Intrepid (i386)"
i386-linux-ubuntu-jaunty => "Ubuntu Jaunty (i386)"
i386-freebsd => "FreeBSD (i386)"
sparc-solaris => "Solaris"
ppc-osx-mac => "Mac OS X (PPC)"
i386-osx-mac => "Mac OS X (Intel)"
ppc-darwin => "Mac OS X using X11 (PPC)"
i386-darwin => "Mac OS X using X11 (Intel)"
i386-win32 => "Windows"
else => platform-type)
executable := (cond mac => "application" else => "executable")
dir := (cond (or win mac) => "folder" else => "directory")
version := (lambda () (version))
drscheme*
:= (cond unix => "bin/drscheme" win => "DrScheme.exe" mac => "DrScheme")
plt-help*
:= (cond unix => "bin/plt-help" win => "plt-help.exe" mac => "bin/plt-help")
setup-plt*
:= (cond unix => "bin/setup-plt" win => "Setup PLT.exe" mac => "bin/setup-plt")
mred*
:= (cond unix => "bin/mred" win => "MrEd.exe" mac => "MrEd")
mzscheme*
:= (cond unix => "bin/mzscheme" win => "MzScheme.exe" mac => "bin/mzscheme")
mzc*
:= (cond unix => "bin/mzc" win => "mzc.exe" mac => "bin/mzc")
planet*
:= (cond unix => "bin/planet" win => "planet.exe" mac => "bin/planet")
intro
:= "This is the "package-name" v"(version)" "dist-type" package "dir" for "
platform"." \\
main-exe
:= "These are some of the important "executable"s that are included:" \\
\\
(cond (or dr plt full) =>
" "drscheme*" -- the PLT Scheme development environment" \\ \\)
" "mzscheme*" -- a text-only Scheme interpreter" \\
(cond (or md dr plt full) =>
" "mred*" -- a graphical Scheme interpreter" \\)
" "mzc*" -- command-line tool for creating executables, etc." \\
(cond (or dr plt full) =>
" "plt-help*" --- for Help (also built into DrScheme)" \\)
" "setup-plt*" --- command-line setup tool" \\
" "planet*" --- a command-line helper for for managing third-party "
"libraries" \\
\\
(cond full => "This package contains the complete build tree, which "
"includes `cgc' binaries that use a conservative collector." \\
\\)
main-src
:= "You must compile MzScheme " (cond (or mr dr plt full) => "and MrEd ")
"before using the "package-name" software"
(cond (or dr plt full) => " (including DrScheme)")"." \\
\\
"For compilation instructions, see \""
(cond win => "plt\\src\\worksp\\README"
else => "plt/src/README")
"\"." \\
main
:= (cond src => main-src else => main-exe)
license
:= "License" \\
"-------" \\ \\
"PLT Software" \\
"Copyright (c) 1995-2003 PLT" \\
"Copyright (c) 2004-2008 PLT Inc." \\
\\
"PLT software is distributed under the GNU Lesser General Public "
"License (LGPL). This means you can link PLT software (such as "
"MzScheme or MrEd) into proprietary applications, provided you follow "
"the specific rules stated in the LGPL. You can also modify PLT "
"software; if you distribute a modified version, you must distribute it "
"under the terms of the LGPL, which in particular means that you must "
"release the source code for the modified software. See "
"doc/release-notes/COPYING.LIB for more information." \\
(cond full =>
\\ "Note that this is the "package-name" distribution, which might "
"contain parts that are GPL." \\)
more-information
:= "More Information" \\
"----------------" \\
\\
"For further information, use DrRacket's `Help' menu, or run "plt-help*". "
"Also, visit http://racket-lang.org/." \\
readme
:= intro \\ main \\ \\ license \\ \\ more-information

View File

@ -327,7 +327,7 @@ plt := (+ dr plt-extras)
;; ============================================================================
;; Packages etc
mz-base := "/plt/readme.txt" ; generated
mz-base := "/plt/README"
(package: "racket") (package: "mzscheme")
"/plt/include/"
;; configuration stuff
@ -677,3 +677,45 @@ plt-extras :+= (package: "schemeunit/")
plt-extras :+= (package: "raclog/")
;; ============================================================================
;; Readme header
version := (lambda () (version))
platform
:= (cond i386-linux => "Linux (i386)"
i386-linux-gcc2 => "Linux (i386/gcc2)"
i386-linux-fc2 => "Fedora Core 2 (i386)"
i386-linux-fc5 => "Fedora Core 5 (i386)"
i386-linux-fc6 => "Fedora Core 6 (i386)"
i386-linux-f7 => "Fedora 7 (i386)"
x86_64-linux-f7 => "Fedora 7 (x86_64)"
i386-linux-f9 => "Fedora 9 (i386)"
i386-linux-f12 => "Fedora 12 (i386)"
i386-linux-debian => "Debian Stable (i386)"
i386-linux-debian-testing => "Debian Testing (i386)"
i386-linux-debian-unstable => "Debian Unstable (i386)"
i386-linux-ubuntu => "Ubuntu (i386)"
i386-linux-ubuntu-dapper => "Ubuntu Dapper (i386)"
i386-linux-ubuntu-edgy => "Ubuntu Edgy (i386)"
i386-linux-ubuntu-feisty => "Ubuntu Feisty (i386)"
i386-linux-ubuntu-hardy => "Ubuntu Hardy (i386)"
i386-linux-ubuntu-intrepid => "Ubuntu Intrepid (i386)"
i386-linux-ubuntu-jaunty => "Ubuntu Jaunty (i386)"
i386-freebsd => "FreeBSD (i386)"
sparc-solaris => "Solaris"
ppc-osx-mac => "Mac OS X (PPC)"
i386-osx-mac => "Mac OS X (Intel)"
ppc-darwin => "Mac OS X using X11 (PPC)"
i386-darwin => "Mac OS X using X11 (Intel)"
i386-win32 => "Windows"
;; generic platforms for source distributions
unix => "Unix"
mac => "Macintosh"
win => "Windows")
readme-header
:= "This is the Racket v"(version)" "(cond src => "source" else => "binary")
" package for "platform".\n"
(cond src => "See the build instructions in src/README.\n")
;; ============================================================================