Add racketrc file to the etc/ folder.
This commit is contained in:
parent
b62d0c80e4
commit
bd1ceb21d6
6
Makefile
6
Makefile
|
@ -66,6 +66,7 @@ ALL_PLT_SETUP_OPTIONS = $(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)
|
|||
plain-in-place:
|
||||
$(MAKE) base
|
||||
$(MAKE) pkgs-catalog
|
||||
$(MAKE) rc-config
|
||||
$(RUN_RACO) pkg update $(UPDATE_PKGS_ARGS)
|
||||
$(RUN_RACO) pkg install $(INSTALL_PKGS_ARGS)
|
||||
$(RUN_RACO) setup --only-foreign-libs $(ALL_PLT_SETUP_OPTIONS)
|
||||
|
@ -74,6 +75,7 @@ plain-in-place:
|
|||
win32-in-place:
|
||||
$(MAKE) win32-base
|
||||
$(MAKE) win32-pkgs-catalog SRC_CATALOG="$(SRC_CATALOG)"
|
||||
$(MAKE) rc-config
|
||||
$(WIN32_RUN_RACO) pkg update $(UPDATE_PKGS_ARGS)
|
||||
$(WIN32_RUN_RACO) pkg install $(INSTALL_PKGS_ARGS)
|
||||
$(WIN32_RUN_RACO) setup --only-foreign-libs $(ALL_PLT_SETUP_OPTIONS)
|
||||
|
@ -344,12 +346,16 @@ WIN32_BUNDLE_RACO = $(WIN32_PLAIN_RACKET) $(BUNDLE_RACO_FLAGS)
|
|||
|
||||
PKGS_CATALOG = -U -G build/config -l- pkg/dirs-catalog --link --check-metadata
|
||||
PKGS_CONFIG = -U -G build/config racket/src/pkgs-config.rkt
|
||||
RC_CONFIG = -U -G build/config racket/src/rc-config.rkt
|
||||
|
||||
pkgs-catalog:
|
||||
$(RUN_RACKET) $(PKGS_CATALOG) racket/share/pkgs-catalog pkgs
|
||||
$(RUN_RACKET) $(PKGS_CONFIG) "$(DEFAULT_SRC_CATALOG)" "$(SRC_CATALOG)"
|
||||
$(RUN_RACKET) racket/src/pkgs-check.rkt racket/share/pkgs-catalog
|
||||
|
||||
rc-config:
|
||||
$(RUN_RACKET) $(RC_CONFIG)
|
||||
|
||||
COPY_PKGS_ARGS = PLAIN_RACKET="$(WIN32_PLAIN_RACKET)" SRC_CATALOG="$(SRC_CATALOG)"
|
||||
|
||||
win32-pkgs-catalog:
|
||||
|
|
31
racket/src/rc-config.rkt
Normal file
31
racket/src/rc-config.rkt
Normal file
|
@ -0,0 +1,31 @@
|
|||
#lang racket/base
|
||||
|
||||
(require racket/format
|
||||
racket/path)
|
||||
|
||||
(define config-dir-path (build-path "racket" "etc"))
|
||||
(define config-rc-path (build-path config-dir-path "racketrc"))
|
||||
|
||||
(when (file-exists? config-rc-path)
|
||||
(call-with-input-file* config-rc-path
|
||||
(lambda (i)
|
||||
(define r (read i))
|
||||
(define xrepl?
|
||||
(equal? r
|
||||
'(when (collection-file-path "main.rkt" "xrepl"
|
||||
#:fail (lambda _ #f))
|
||||
(dynamic-require 'xrepl #f))))
|
||||
(unless xrepl?
|
||||
(error 'racketrc
|
||||
(~a "Global racketrc file exists, but is mismatched.\n"
|
||||
" possible solution: delete the racketrc file"))))))
|
||||
|
||||
(unless (file-exists? config-rc-path)
|
||||
(printf "Writing ~a\n" config-rc-path)
|
||||
(call-with-output-file*
|
||||
config-rc-path
|
||||
(lambda (o)
|
||||
(write '(when (collection-file-path "main.rkt" "xrepl"
|
||||
#:fail (lambda _ #f))
|
||||
(dynamic-require 'xrepl #f)) o)
|
||||
(newline o))))
|
Loading…
Reference in New Issue
Block a user