Skip to content

ocamlbuild: use ocamlfind to discover camlp4 path#117

Merged
gasche merged 1 commit intoocaml:trunkfrom
vbgl:ocamlbuild
Nov 28, 2015
Merged

ocamlbuild: use ocamlfind to discover camlp4 path#117
gasche merged 1 commit intoocaml:trunkfrom
vbgl:ocamlbuild

Conversation

@vbgl
Copy link
Copy Markdown
Contributor

@vbgl vbgl commented Nov 12, 2014

Fixes issue 6605.

The idea is to use ocamlfind to discover where camlp4 is actually installed. And so even if the -use-ocamlfind option is not given, for compatibility reasons.

In case the call to ocamlfind fails, the default value of +camlp4 is used. So a working install of camlp4 without ocamlfind is still possible.

The query to ocamlfind is done lazily, only when a rule requires camlp4.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use Lazy.from_fun instead of simply the following?

  lazy Findlib.(
    try (query "camlp4").location
    with Findlib_error _ -> "+camlp4"
  )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably bad state. Thanks for your comment. I’ll correct that. You may also have an opinion about the !! shortcut…

BTW, I am not sure this is lazy at all…

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The !! shortcut looks reasonable to me, but indeed what you are doing is not really lazy because you're immediately forcing the lazy value.
At this point, I'd drop the lazy stuff unless you have a good reason to try for laziness.

@vbgl
Copy link
Copy Markdown
Contributor Author

vbgl commented Nov 18, 2014

Thanks again for your advice. I therefore gave up on doing things lazily (although I think it would be better if possible, except that I don’t know how to do it).

The downside is that ocamlbuild outputs warnings about ocamlfind or camlp4 being unavailable.

@gasche
Copy link
Copy Markdown
Member

gasche commented Nov 19, 2014

It would be better if we could use ocamlbuild without ocamlfind (that is still a use-case some people care about). Could we just take the +camlp4 fallback without printing any warning if ocamlfind is not available?

(Also it would be nice to let users overload the discovery heuristic by providing a way to set this explicitly in Options. So if users have a non-standard setup they can always be explicit about it in the myocamlbuild.ml. But maybe that can be left to a future pull-request.)

@vbgl
Copy link
Copy Markdown
Contributor Author

vbgl commented Feb 2, 2015

Here is an additional check that should not print any warning. However, I don’t know how portable this is.

@gasche
Copy link
Copy Markdown
Member

gasche commented Nov 22, 2015

@vbgl , I would like to move to merge this pull-request. Could you add a Changes entry, indexed as PR#6605, GPR#117:, in the OCamlbuild section?

@vbgl
Copy link
Copy Markdown
Contributor Author

vbgl commented Nov 28, 2015

Done. Thank you.

gasche added a commit that referenced this pull request Nov 28, 2015
ocamlbuild: use ocamlfind to discover camlp4 path
@gasche gasche merged commit 1b68fcc into ocaml:trunk Nov 28, 2015
@gasche
Copy link
Copy Markdown
Member

gasche commented Nov 28, 2015

... and congratulations for the defense :-)

gasche added a commit to ocaml/ocamlbuild that referenced this pull request Jan 4, 2016
…r setup

This supersedes the ocamlfind-dependent logic of ocaml/ocaml#117,
which raised warning messages in an ocamlfind-less setting.
chambart pushed a commit to chambart/ocaml-1 that referenced this pull request Aug 4, 2021
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Oct 5, 2021
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Mar 21, 2023
c703f5f Incorporate upstream comments into type-variable refactor (ocaml#121)
362ba23 Constrain curry modes to increase along applications (ocaml#108)
b1f0cf9 Simplify the extension handling (ocaml#114)
4fd53a1 Remove pat_mode from typedtree (ocaml#105)
cf6fcbc Handle attributes on lambdas with locally abstract types (ocaml#120)
5fa80fe Don't track attributes inside attributes for warning 53 (ocaml#115)
8a69777 Handle unclosed `[: ... :]` patterns (via `Generic_array` machinery) (ocaml#117)
b0737f4 Add promote-one Makefile target (ocaml#118)
c6ad684 Refactoring and fixes around module lookup (ocaml#107)
b0a6495 Add documentation for global constructor arguments (ocaml#69)
dd79aec Print `nlocal` in the `-d(raw)lambda` output (ocaml#112)
8035026 Fix `nlocal` in the generated Lambda for list comprehensions (ocaml#113)
afbcdf0 Immutable arrays (ocaml#47)
bfe1490 fix several issues when removing exp_mode (ocaml#110)
8f46060 Better error message for under-applied functions (ocaml#74)
27331d8 Consistently use Lmutvar or Lvar in comprehensions (ocaml#111)
01e965b Skip failing test for now
0131357 Fix test case to use comprehensions_experimental
22a7368 Temporarily disable list comprehensions tests due to locals bug
e08377d Make `comprehensions` into `comprehensions_experimental` for now (ocaml#109)
947cf89 List and array comprehensions (ocaml#46)
bd9e051 remove exp_mode from typedtree (ocaml#100)
a9268d2 Fix misplaced attribute warning when using external parser (and some cleanup) (ocaml#101)
2b33f24 Refactor toplevel local escape check (ocaml#104)
ed2aec6 Comment functions exported from TyVarEnv.
87838ba Move new variable creation into TyVarEnv.
a3f60ab Encapsulate functions that work with tyvars
43d83a6 Prevent possibility of forgetting to re-widen
2f3dd34 Encapsulate context when narrowing type env't
d78ff6d Make immediate64 things mode cross (ocaml#97)
aa25ab9 Fix version number (ocaml#94)
d01ffa0 Fix .depend file (ocaml#93)
942f2ab Bootstrap (ocaml#92)
05f7e38 Check Menhir version (ocaml#91)
1569b58 Move the CI jobs from 4.12 to 4.14. (ocaml#90)

git-subtree-dir: ocaml
git-subtree-split: c703f5f
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants