From d469265a6e60b4632457ca6a35163746e9464bdf Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 26 Apr 2017 15:58:09 -0600 Subject: [PATCH] Makefile: support both cross-platform and non-cross installers In non-cross mode, `-C` needs to go after `-G` and `-X` when setting up a "bundle" directory to turn into an installer, because that mode needs to use foreign libraries (such as SQLite) at build time, and it can use the instances that are being set up for the installer. Meanwhile, improve the advice for setting `PLAIN_RACKET` to use `-C` for a cross-platform build mode, even though things tend to work anyway without it. --- INSTALL.txt | 12 ++++++++---- Makefile | 2 +- pkgs/racket-doc/scribblings/reference/startup.scrbl | 4 +++- racket/src/racket/cmdline.inc | 12 +++++++----- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index f65d5c5d4a..7c389e522d 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -196,10 +196,14 @@ libraries. See the documentation for `raco setup' for information on the options. For cross compilation, add configuration options to -`CONFIGURE_ARGS_qq="..."' as described in the "README" of "racket/src", -but also add a `PLAIN_RACKET=...' argument for the top-level makefile -to specify the same executable as in an `--enable-racket=...' for -`configure'. +`CONFIGURE_ARGS_qq="..."' as described in the "README" of +"racket/src", but also add a `PLAIN_RACKET=...' argument for the +top-level makefile to specify the same executable as in an +`--enable-racket=...' for `configure'. In general, the `PLAIN_RACKET` +setting should have the form `PLAIN_RACKET="... -C"` to ensure that +cross-compilation mode is used and that any foreign libraries needed +for build time can be found, but many cross-compilation scenarios work +without `-C`. Installing Packages ------------------- diff --git a/Makefile b/Makefile index aea6d189b7..3604fc4d29 100644 --- a/Makefile +++ b/Makefile @@ -335,7 +335,7 @@ REMOTE_USER_AUTO = --catalog $(SVR_CAT) $(USER_AUTO_OPTIONS) REMOTE_INST_AUTO = --catalog $(SVR_CAT) --scope installation $(X_AUTO_OPTIONS) CONFIG_MODE_q = "$(CONFIG)" "$(CONFIG_MODE)" BUNDLE_CONFIG = bundle/racket/etc/config.rktd -BUNDLE_RACO_FLAGS = -C -G bundle/racket/etc -X bundle/racket/collects -A bundle/user -l raco +BUNDLE_RACO_FLAGS = -G bundle/racket/etc -X bundle/racket/collects -C -A bundle/user -l raco BUNDLE_RACO = $(PLAIN_RACKET) $(BUNDLE_RACO_FLAGS) WIN32_BUNDLE_RACO = $(WIN32_PLAIN_RACKET) $(BUNDLE_RACO_FLAGS) IN_BUNDLE_RACO = bundle/racket/bin/raco diff --git a/pkgs/racket-doc/scribblings/reference/startup.scrbl b/pkgs/racket-doc/scribblings/reference/startup.scrbl index 1b07c97c55..67ed1ae730 100644 --- a/pkgs/racket-doc/scribblings/reference/startup.scrbl +++ b/pkgs/racket-doc/scribblings/reference/startup.scrbl @@ -313,7 +313,9 @@ flags: @racket[(find-system-path 'config-dir)] and @racket[(find-system-path 'collects-dir)] to be the results of @racket[(find-system-path 'host-config-dir)] and - @racket[(find-system-path 'host-collects-dir)], respectively.} + @racket[(find-system-path 'host-collects-dir)], respectively. + If @FlagFirst{C} or @DFlagFirst{cross} is provided multiple + times, only the first instance has an effect.} @item{@FlagFirst{N} @nonterm{file} or @DFlagFirst{name} @nonterm{file} : sets the name of the executable as reported diff --git a/racket/src/racket/cmdline.inc b/racket/src/racket/cmdline.inc index 87c61379f0..571645d158 100644 --- a/racket/src/racket/cmdline.inc +++ b/racket/src/racket/cmdline.inc @@ -1311,11 +1311,13 @@ static int run_from_cmd_line(int argc, char *_argv[], was_config_flag = 1; break; case 'C': - cross_compile = 1; - scheme_set_cross_compile_mode(1); - was_config_flag = 1; - host_config_path = config_path; - host_collects_path = collects_path; + if (!cross_compile) { + cross_compile = 1; + scheme_set_cross_compile_mode(1); + was_config_flag = 1; + host_config_path = config_path; + host_collects_path = collects_path; + } break; case 'U': scheme_set_ignore_user_paths(1);