tech-pkg archive

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

Re: CVS commit: pkgsrc/www/c-icap



Michael Bäuerle <michael.baeuerle%mailbox.org@localhost> writes:

>> Given how compilers are, a package failing to probe for and set --std is
>> an upstream bug.
>
> I don't agree.
>
> "--std" is not supported by all C compilers, e.g. the POSIX
> C compiler use its name to select the language ("c99" or c17").
> Probing for nonstandard or undocumented options looks error prone.
>
> If the package does not use GNU autotools, CMake or meson, it may
> be an enormous amount of work to implement such probing for little
> benefit (it will cover only a few compilers known to the author).
> I would expect it to work only with mainstream compilers like GCC
> and Clang.
>
> I think the job of the author is to document what language (version)
> is required. And it is the job of the user (not the build system) to
> prepare an environment that provides a suitable compiler and suitable
> flags for it.
>
> pkgsrc supports multiple compilers and its infrastructure would be
> a good place to switch the mode (instead of doing it in the build
> systems again and again -- likely wrong every time for non-mainstream
> compilers).

I can see this as reasonable, assuming this means:

  It is an usptream bug unless the compiler requirements are clearly
  documented in README (or some BUILDING-ish file *in the tarball*
  pointed to by README).

  The compiler requirements must include "This program is written in
  <dialect>." implying "a C compiler capable of supporting <dialect>".

  If upstream build does not search for and add --std=dialect, then it
  must state that the compiler in the build environment, when called
  without --std, must interpret programs as being in dialect, not
  seomthing else.


and it means

  pkgsrc should arrange that when a compiler is invoked without --std,
  then the std in use is a reasonable default chosen by pkgsrc, not an
  aggressive default chosen by the compiler

Simply picking c99 or gnu99 when there is no --std would likely solve
99% of the "old program written before C changed so much" problems.



Home | Main Index | Thread Index | Old Index