tech-pkg archive

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

Re: Packages not honouring CFLAGS



		Hi Thomas, tech-pkg@,

On 08/07/15 13:31, Thomas Klausner wrote:
> On Thu, Aug 06, 2015 at 09:32:59PM +0100, Jonathan Perkin wrote:
>> What we might want to do similarly is route pkgsrc CFLAGS and LDFLAGS
>> directly into _WRAP_EXTRA_ARGS/CWRAPPERS_APPEND to ensure they are
>> always passed through, as I fear patching all packages to honour
>> CFLAGS and LDFLAGS is going to be a huge effort and will need constant
>> updating.

It certainly does look like a lot of work:
- everything using GNU autoconf seems to be fine already;
- I think I have a decent (if not straightforward) solution for
  packages using imake (that's about 160 of them) by using
  MAKE_FLAGS+=CDEBUGFLAGS=${CFLAGS:Q}
- for those using regular Makefiles it should ideally be a matter of
  MAKE_FLAGS+=CFLAGS=${CFLAGS:Q} but I expect many headaches there :(

Not every package gets updated every quarter though, and even then most
do not switch build systems for every release. Therefore I believe it
should be possible to clear this up quite a bit without using wrappers.

Using wrappers does make a lot of sense, since quite a few packages may
well end up with contradictory flags - and this is harder to fix than
just adding CFLAGS. But even then, paving the way for proper
CFLAGS/LDFLAGS support should also relieve the wrappers from dealing
with situations with flags mixing compilers, platforms or whatnot.

Just to say I think we should both use wrappers and keep fixing
CFLAGS/LDFLAGS.

> That sounds like a great plan. While many packages are good about it,
> quite a lot aren't, and you only notice if you have special settings
> in your CFLAGS.
> 
> Can you come up with a patch, please?

This is what I am currently using to enforce LDFLAGS for executables only:
http://git.edgebsd.org/gitweb/?p=edgebsd-pkgsrc.git;a=commitdiff;h=3f735cc249c8d61b9679156f414efc6d4e99e0b4

This wrapper around GCC detects if the current operation seems to be
about linking an executable file specifically. It is integrated with the
existing "wrapper" framework.

It is not fully ready for integration yet though, since the relevant
flags are currently hard-coded in the GCC wrapper itself,
"cmd-sink-netbsd-gcc" (with the flags being "-Wl,-pie -shared-libgcc").
I believe this might be a way to enforce both CFLAGS and LDFLAGS
unilaterally though.

Note that I did not have a look at cwrappers at this point; there might
be a better solution there.

Cheers,
-- 
khorben



Home | Main Index | Thread Index | Old Index