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

CDBS DEB_CONFIGURE_SCRIPT_ENV with/versus LDFLAGS/CFLAGS



        Hi,

 (This is not a question, just a two cents trick for people using CDBS
 in gnomish packages.)

 Today, I had to add CFLAGS and LDFLAGS to a package's build process.
 The package had the --as-needed clob in its debian/rules:
    DEB_CONFIGURE_SCRIPT_ENV += LDFLAGS="-Wl,-O1 -Wl,--as-needed"

 I could have added the LDFLAGS I needed at the end of the above line,
 even with CFLAGS, but it wouldn't have been very maintainable or simply
 readable.
   Digging up the DEB_CONFIGURE_SCRIPT_ENV usage, I think it makes more
 sense to simply set LDFLAGS:
    # drop unneeded ELF deps
    LDFLAGS += -Wl,-O1 -Wl,--as-needed
 (DEB_CONFIGURE_SCRIPT_ENV contains LDFLAGS="$(LDFLAGS)" by default)

 Adding or removing options is then as simple as adding or
 removing/commenting CFLAGS / LDFLAGS lines:
    # build with TCP wrappers
    LDFLAGS += -lwrap
    CFLAGS += -DUSE_LIBWRAP

 Make sure you always use "+=".

 As a side effect, any LDFLAGS set by CDBS isn't overwritten anymore.


 There's a high number of DEB_CONFIGURE_SCRIPT_ENV occurrences in
 pkg-gnome so I thought this is a common pattern.  In the interest of
 readability, I suggest that people start updating their packages to
 augment LDFLAGS or CFLAGS directly.  Thanks for your attention!

   Cheers,
-- 
Loïc Minier <lool@dooz.org>
 "I have no strong feelings one way or the other." -- Neutral President



Reply to: