Allow development configure options to be stored in Git#8995
Allow development configure options to be stored in Git#8995gasche merged 2 commits intoocaml:trunkfrom
Conversation
There was a problem hiding this comment.
(I haven't reviewed the actual code, just glanced at the diff.)
This sounds generally reasonable to me: it's not an invasive change and it makes some people's life easier.
This is a small risk of making the provenance of configuration more opaque/surprising. Do we get a notification in the configure.log of some sort when this feature affects the configuration options?
|
Thanks, @gasche - there is a message, yes: Obviously, that message is at the start - I could do similar to autoconf and ensure that the message is displayed at the end of the script (cf. the last 4 lines of |
|
Having at the start is fine (especially if it gives the most natural implementation), and it's nice that the log shows the full options that are running. On the other hand, |
|
Rebased and messages improved. It now looks like: |
|
I like the new interface and I'm in favor of the feature. I looked at the implementation briefly. I think it's reasonable, but I wonder whether some of the scripting logic could be moved away from an EOF embedding into |
|
I too had wondered about the fragment once it grew (even just wanting syntax highlighting, which you of course don't get in a heredoc). I've moved to a script of its own - I've put it at the root since you can now run which you don't get if it's in On the basis that |
|
Sorry to nitpick, but I would prefer if the script could be in (If we wanted to be really perfectionist about the usability of this assumed usage pattern (but we don't have to!), we could have the not-in-a-git-directory case print a readable message like |
|
I had out-of-tree builds in mind when I added the |
|
I am satiated with nitpicking and I don't see anything else to do than merge when the CI comes back green. Thanks! |
|
(Well actually, what about the commit history? Would you like me to squash-and-merge? Urgh.) |
|
Thanks. @gasche - I'll mention the stuff in |
|
Rebased and history tidied up - I added notes about the two options to |
|
I would recommend having a Changes entry for this new (development) feature, to make it more discoverable by contributors who don't just re-read HACKING periodically. |
The Git configuration value ocaml.configure is now passed to the configure script's arguments before $@ if (and only if) OCaml is being configured from a Git clone. This allows, for example: - Developer-specific preferences (e.g. `--disable-ocamldoc` or `--disable-debug-runtime`) - Automatic use of autoconf cach files (-C option) It is implemented by inserting a test at the top of `configure`, which is bypassed if `.git` doesn't exist.
The Git configuration value ocaml.configure-cache can be used to specify a directory to keep autoconf cache files in, relative to the worktree root (so `git config ocaml.configure-cache .` enables the feature, and `git config --global ocaml.configure-cache ..` enables it for all worktrees, assuming they're at the same level). autoconf's --cache-file option speeds up future runs of configure by caching the results of previous tests. The cache is invalidated if any environment variables differ (e.g. LDFLAGS) or if the build-host-target triplet differs. This is a nuisance on Windows, where configure is both very slow and it's also common to build with multiple different --host values. This PR allows a tree to be quickly reconfigured from one Windows port to another.
|
Howzat? 🙂 |
|
Having each commit contribute to the change entry to say what's in the commit itself? We should have medals for those PRs. |
|
🏅 |
This PR proposes some pre-processing in the
configurescript solely for Git checkouts (i.e. for compiler developers, not compiler users).If (and only if) the directory from which
configureis executed contains.git(i.e. it's a Git clone), then two Git configuration values are queried.ocaml.configure- this value is inserted (expanded) before the command line arguments passed toconfigureocaml.configure-cache- specifies a directory relative to theconfigurescript where host-specific cache files should be read/writtenThe first (
ocaml.configure) is the simplest. This allows options one might want all the time (for example, I know @stedolan is a fan of-C, which turns on caching and @mshinwell usually configures with--disable-ocamldoc). The insertion of these options before those passed toconfiguremeans that./configure --enable-ocamldocstill has the meaning expected. Usefully,autoconfdisplays warnings only for--enableand--withoptions which don't exist, so one can set this even if working with multiple versions of OCaml. The use of Git configuration variables of course allows you to set--globalbut then override it in a specific clone (or even worktree).The second (
ocaml.configure-cache) is a little more complicated, but would certainly make my Windows development life less painful (cc @nojb and @shindere). A Windows developer is hugely motivated to use./configure -Cgiven that on my machine,./configure --build=i686-pc-cygwin --host=x86_64-pc-windows -Ctakes 77 seconds the first time and "only" 22 seconds subsequently (and, for reference,make -j32 world.optonly takes 260 seconds, so that extra 55 seconds inconfigureis a significant chunk). Now if, like me, you have a lot of worktrees, it becomes tempting to share theconfig.cachefile which you can do by specifying--cache-file=instead of-C. However, the cache is only valid if the build-host-target triplet and any precious environment variables (CFLAGS, etc.) are identical. So you now have to remember which cache file to use. That's a bit much for someone as forgetful as me, hence this feature. On my machine, with all the worktrees in the same directory, I can now issuegit config --global ocaml.configure-cache ..and now./configure --build=i686-pc-cygwin --host=x86_64-pc-windowswill add--cache-file ../ocaml-x86_64-pc-windows.cacheto the invocation. If I suddenly want to reconfigure the tree for mingw, I don't get an error message about a stale cache (which I would with-C). If--hostis not specified thendefaultis used.Various observations on the safety of this:
.gitentry. The tarballs could be hardened even further by not including the alteredconfigurescript (i.e. the release procedure could involve runningautoconf --forceand distributing the resultingconfigureinstead).If this change is accepted, I'll push a change to
HACKING.adocto advertise its availability.