tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

USE_LANGUAGES and wrappers



nia <nia%mailfence.com@localhost> writes:

> I really respect that USE_LANGUAGES is confusingly named, and
> misunderstood by many pkgsrc developers as a result (including clearly
> some senior developers) -- it should really be WRAP_LANGUAGES and it
> does not pull in any kind of dependency.

(I've been unable to keep up with mail for a few days so going way
back.)

First, thank you for having a good discussion about a way forward and
ending up with USE_CXX_FEATURES etc. that seems to do what ~everyone
thinks is reasonable.


There are of course infinite things to improve, but USE_LANGUAGES and
changing wrapper behavior is in my view fairly high in terms of fixing
confusion.


Historically, USE_LANGUAGES+=foo meant "this package needs a foo
compile", and that there should be a build dependency on it (perhaps
builtin of course).   One example is c++, but another is fortran.

This caused the wrappers to fail if a language wasn't in USE_LANGUAGES,
in the spirit of bl3 where trying to include or link against something
that isn't a declared dependency should fail, even if it is installed.

Then things got messy with c++11 etc with setting --std, which can be
viewed both as "set --std because the package is buggy and doesn't) and
"force a hard fail early if the compiler doesn't do c++11" (on the
theory that a compiler must fail if passed --std=foo for some foo not
implemented).

I think it's widely viewed that this force-std conflation isn't really
right.


I don't understand the wrapper implementation, so I'm not going to try
to do this, but I think we should do something like:

  1) Stop having USE_LANGUAGES=c++17 change wrappers.  Or perhaps do
  step 2 and warn for now.

  2) Add a variable FORCE_CXX_VERSION which if e.g. set to c++17 causes
  "--std=c++17" to be added by the wrappers.  Basically what
  USE_LANGUAGES=c++17 does now.  Maybe -- but I really don't like it --
  cause that to get added to USE_CXX_FEATURES.

(I acknowledge that steps 1 and 2 are a cleanup of variable semantics
and don't change how things really behave.)

  3) Adjust wrappers so that if e.g. c++17 is not in USE_CXX_FEATURES,
  then any invocation with --std=c++17 will fail.

  4) Adjust wrappers to figure out the highest c++ version in
  USE_CXX_FEATURES (c++03 if none).  For any invocation *without* an
  explicit --std, add --std with that version.  Thus, any program that
  is USE_LANGUAGES=c++ but with no c++NN, --std=c++03 will get added.

(Steps 3 and 4 will cause programs that only happen to build because the
default comiler is good enough, to instead fail.  This should cause
correct labeling even by people that test on modern systems.

What do people think of this?  If you don't like it, do you think we
should ensure somehow that packages don't build by relying on
better-than-declared, and if so how?


Home | Main Index | Thread Index | Old Index