ocaml / ocaml/dune

Support conditional compilation inside (libraries ) stanza

Open
#6,237 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build config
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

I have a project that may be augmented by counters to estimate it's performance. This counters are loaded in a specific library. I want to link it with my test programs, if counters measurement is enabled and don't link if not. I tried to read external file in libraries stanza using a read variable, but it looks like it is not really supported.

File "lib2/dune", line 56, characters 49-66:
56 |  (libraries ppx_show.runtime ppxlib Types_common %{read:/asdf.cfg})
                                                      ^^^^^^^^^^^^^^^^^
Error: Atom or quoted string expected
  1. What should be a current workaround for that? The select stanza?
  2. Any chance this we can fix dune to expect variables in the list of libraries?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib2/dune at line 56 and inspect how the libraries stanza parses atoms and %{read:...} variables. Compare this behavior with the select stanza and any existing variable-expansion handling in Dune. Done means the issue's requested conditional library selection has a documented, tested behavior or a clearly supported workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.