make: fix Unix-style build

This commit is contained in:
Matthew Flatt 2014-12-04 17:30:30 -07:00
parent 0b461f98bd
commit c6d2548e22
4 changed files with 102 additions and 97 deletions

View File

@ -20,9 +20,6 @@ distributions will work in the
way that you probably expect.
>>>> SORRY! Some of the information in this file is out of date.
>>>> Build modes and information here are being updated.
If you stick with this repository, then you have several options:
* In-place build --- the default, creates a build in the "racket"
@ -182,60 +179,42 @@ Installing Packages
-------------------
After you've built and installed minimal Racket, you could install
packages via the package-catalog server --- ignoring the content of
"pkgs" and "native-pkgs".
packages via the package-catalog server, completely ignoring the
content of "pkgs".
If you want to install packages manually out of the "pkgs" and
"native-pkgs" directories, the `local-catalog' target creates a
catalog as "build/local/catalog" that points to the sources in "pkgs"
and "native-pkgs". A Unix-style build works that way: it builds and
If you want to install packages manually out of the "pkgs", the
`local-catalog' target creates a catalog as "racket/local/catalog" that
merges the currently configured catalog's content with pointers to the
packages in "pkgs". A Unix-style build works that way: it builds and
installs minimal Racket, and then it installs packags out of a catalog
that is created by `make local-catalog'.
Linking Packages for In-place Development Mode
----------------------------------------------
Using the "main-distribution" package corresponds to a build that is
like the main Racket distribution. Furthermore, if you install all of
those packages with `raco pkg install -i --link ...', then you can
edit libraries or update via `git pull' plus `raco setup' (as opposed
to updating or reinstalling packages). That's how the in-place build
works.
With an in-place build, you can edit packages within "pkgs" directly
or update those packages with `git pull' plus `raco setup', since the
packages are installed with the equivalent of `raco pkg install -i
--static-link ...'.
The `pkg-links' target of the makefile links (or re-links) packages
from "pkgs" and "native-pkgs" into the "racket" build. By default,
`pkg-links' starts with the "main-distribution" and "plt-services"
packages and links all of their dependencies, which includes all of
the packages in "pkgs". Specify a subset of the packages with
`PKGS="...."' as an argument to `make pkg-links'. Make the `pkg-links'
target whenever the set of dependencies can change.
Instead of actually using `raco pkg install --static-link ...`, the
`pkgs-catalog' makefile target creates a catalog that points to the
packages in "pkgs", and the catalog indicates that the packages are to
be installed as links. The `pkgs-catalog' target further configures
the new catalog as the first one to check when installing
packages. The configuration adjustment is made only if no
configuration file "racket/etc/config.rktd" exists already.
Packages are linked in a database (at "racket/lib/devel-pkgs") that is
added to the installation's search paths. As a result, the links
affect only the build in the "racket" directory, and they are not
mixed with any links that you specifically install in installation
scope. Packages are linked with the `--no-setup' flag (effectively),
which means that a `raco setup' is needed after installing links.
All other packages (as specified by `PKGS') are installed via the
default package catalog. They are installed in installation scope, but
the content of "racket/share/pkgs" is not meant to be edited. To
reinstall a package in a mode suitable for editing and manipulation
with Git tools, use
Native-library packages provide (on Mac OS X and Windows) pre-built
native libraries, such as Cairo. They are available through a Git
submodule "native-pkgs", so use `git submodule init' and `git
submodule update' as needed.
raco pkg update --clone extra-pkgs/<pkg-name>
By default, the `PKGS' value is remembered by `pkg-links', but a
previously remembered value is not used. Supply `LINK_MODE=--restore'
as an argument to to `make' to use the previously remembered `PKGS'
value, if any. The `again' (or `win32-again') makefile target is the
same as `in-place' (or `win32-in-place'), but with
`LINK_MODE=--restore'. To suppress remembering a `PKGS' value, supply
`LINK_MODE='; the `PKGS' value is saved by default because
`LINK_MODE=--save' is the default.
The `pkg-links' makefile target installs links to a specific
"devel-pkgs" directory and also sets the default package scope for the
build to "installation" mode. Both of those configuration adjustments
are made only if no configuration file "racket/etc/config.rktd" exists
already.
The "extra-pkgs" directory name is a convention that is supported by a
".gitignore" entry.
The Whole Enchilada: Building Installers

View File

@ -69,7 +69,8 @@ win32-in-place:
PREFIX =
CONFIG_PREFIX_ARGS = --prefix="$(PREFIX)" --enable-macprefix
UNIX_RACO_ARGS = $(JOB_OPTIONS) --catalog build/local/catalog --auto -i
UNIX_CATALOG = build/local/catalog
UNIX_RACO_ARGS = $(JOB_OPTIONS) --catalog $(UNIX_CATALOG) --auto -i
UNIX_BASE_ARGS = SELF_FLAGS_qq="" SKIP_DESTDIR_FIX="skip"
unix-style:
@ -83,10 +84,9 @@ cpus-unix-style:
plain-unix-style:
if [ "$(PREFIX)" = "" ] ; then $(MAKE) error-need-prefix ; fi
$(MAKE) base CONFIGURE_ARGS_qq='$(CONFIGURE_ARGS_qq) $(CONFIG_PREFIX_ARGS)' $(UNIX_BASE_ARGS)
$(MAKE) local-source-catalog
$(MAKE) local-catalog
"$(DESTDIR)$(PREFIX)/bin/raco" pkg install $(UNIX_RACO_ARGS) $(REQUIRED_PKGS) $(PKGS)
cd racket/src/build; $(MAKE) fix-paths
"$(DESTDIR)$(PREFIX)/bin/raco" pkg install $(JOB_OPTIONS) -i --dep search-auto $(INSTALL_PKGS)
error-need-prefix:
: ================================================================
@ -94,6 +94,12 @@ error-need-prefix:
: ================================================================
exit 1
LOC_CATALOG = build/local/pkgs-catalog
local-catalog:
"$(DESTDIR)$(PREFIX)/bin/racket" racket/src/pkgs-catalog.rkt $(LOC_CATALOG) pkgs
"$(DESTDIR)$(PREFIX)/bin/raco" pkg catalog-copy --force --from-config $(LOC_CATALOG) $(UNIX_CATALOG)
# ------------------------------------------------------------
# Base build
@ -279,10 +285,12 @@ WIN32_BUNDLE_RACO = bundle\racket\racket $(BUNDLE_RACO_FLAGS)
# ------------------------------------------------------------
# Linking all packages (development mode; not an installer build)
PKGS_CATALOG = -U -G build/config racket/src/pkgs-catalog.rkt pkgs
PKGS_CATALOG = -U -G build/config racket/src/pkgs-catalog.rkt --link
PKGS_CONFIG = -U -G build/config racket/src/pkgs-config.rkt
pkgs-catalog:
$(PLAIN_RACKET) $(PKGS_CATALOG)
$(PLAIN_RACKET) $(PKGS_CATALOG) racket/share/pkgs-catalog pkgs
$(PLAIN_RACKET) $(PKGS_CONFIG)
win32-pkgs-catalog:
$(MAKE) pkgs-catalog PLAIN_RACKET="$(WIN32_PLAIN_RACKET)"

View File

@ -1,49 +1,28 @@
#lang racket/base
(require racket/cmdline
racket/file
racket/list
racket/format
racket/string
racket/set
racket/path
setup/getinfo
pkg/lib
pkg/path)
pkg/lib)
;; Find packages in a directory tree ("info.rkt" indicates a package),
;; create a catalog that points to those packages to be installed as
;; links, and adjust the configuration to consult that catalog first.
;; create a catalog that points to those packages --- to be installed as
;; links if `--link` is specified.
;; Used by the top-level Makefile in the main Racket repository.
(define config-dir-path (build-path "racket" "etc"))
(define config-file-path (build-path config-dir-path "config.rktd"))
(define catalog-relative-path (build-path 'up "share" "pkgs-catalog"))
(define catalog-relative-path-str (path->string catalog-relative-path))
(define catalog-path (build-path config-dir-path catalog-relative-path))
(define link? #f)
(define dirs
(define-values (catalog-path dirs)
(command-line
#:once-each
["--link" "Install packages as links"
(set! link? #t)]
#:args
dir
dir))
(when (file-exists? config-file-path)
(call-with-input-file*
config-file-path
(lambda (i)
(define r (read i))
(define l (hash-ref r 'catalogs #f))
(unless (and (list? l)
((length l) . >= . 1)
(equal? (car l) catalog-relative-path-str))
(error 'pkgs-catalog
(~a "config file exists, but does not have a definition of `catalogs' that starts as expected\n"
" config file: ~a\n"
" expected initial element: ~s\n"
" possible solution: delete the config file")
config-file-path
catalog-relative-path-str)))))
(catalog-path . dir)
(values catalog-path dir)))
;; found: maps each available package name to a directory
(define found (make-hash))
@ -114,7 +93,9 @@
(path->complete-path catalog-path))
(simple-form-path
(path->complete-path dir))))
"?type=static-link"))
(if link?
"?type=static-link"
"")))
(author . ,(string-join (for/list ([r authors])
(if (symbol? r)
(format "~a@racket-lang.org" r)
@ -156,17 +137,3 @@
(unless (and (null? missing-authors) (null? missing-desc))
(error 'link-all "not all packages have description and authors."))
(unless (file-exists? config-file-path)
(printf "Writing ~a\n" config-file-path)
(call-with-output-file*
config-file-path
(lambda (o)
(write (hash 'catalogs
(list catalog-relative-path-str #f)
'installation-name
"development"
'default-scope
"installation")
o)
(newline o))))

View File

@ -0,0 +1,51 @@
#lang racket/base
(require racket/cmdline
racket/format
racket/path)
;; Adjust the configuration to consult a catalog that is
;; expected to map some packages to directory links.
;; Used by the top-level Makefile in the main Racket repository.
(define config-dir-path (build-path "racket" "etc"))
(define config-file-path (build-path config-dir-path "config.rktd"))
(define catalog-relative-path (build-path 'up "share" "pkgs-catalog"))
(define catalog-relative-path-str (path->string catalog-relative-path))
(command-line
#:args
()
(void))
(when (file-exists? config-file-path)
(call-with-input-file*
config-file-path
(lambda (i)
(define r (read i))
(define l (hash-ref r 'catalogs #f))
(unless (and (list? l)
((length l) . >= . 1)
(equal? (car l) catalog-relative-path-str))
(error 'pkgs-catalog
(~a "config file exists, but does not have a definition of `catalogs' that starts as expected\n"
" config file: ~a\n"
" expected initial element: ~s\n"
" possible solution: delete the config file")
config-file-path
catalog-relative-path-str)))))
(unless (file-exists? config-file-path)
(printf "Writing ~a\n" config-file-path)
(call-with-output-file*
config-file-path
(lambda (o)
(write (hash 'catalogs
(list catalog-relative-path-str #f)
'installation-name
"development"
'default-scope
"installation")
o)
(newline o))))