diff --git a/Makefile b/Makefile index fde73a4428..247c26dcf3 100644 --- a/Makefile +++ b/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: diff --git a/racket/src/rc-config.rkt b/racket/src/rc-config.rkt new file mode 100644 index 0000000000..89c872ef53 --- /dev/null +++ b/racket/src/rc-config.rkt @@ -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))))