tech-pkg archive

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

Re: USE_FEATURES: static library vs. "inplace" hack



On Fri, 22 Feb 2008 22:23:27 +0200
Aleksey Cheusov <cheusov%tut.by@localhost> wrote:

> Several months ago USE_FEATURES framework were introduced.
> I think idea is cool. API is easy. But I still don't understand why
> libnbcompat library should be built again and again
> instead of building a static library once.
> That is why "inplace" method was implemented instead of
> linking with statically linked library built and installed once.

I am working on a somewhat different scheme. Building the whole static
compat library and linking every binary in the package with it is too
crude.

I want to be able to instead supply the package with a list of object
files that are needed to get the requested features (=functions).

Say the package has:

USE_FEATURES+= asprintf getopt_long

Then my preliminary features framework will provide these variables to
the package:

# Individual variables for every requested feature
FEATURE_OBJS.asprintf = /path/to/asprintf.o
FEATURE_OBJS.getopt_long = /path/to/getopt_long.o
FEATURE_OBJS = # A list containing both of the above
# a on-the-fly created static archive for convenience
FEATURE_LDFLAGS = -L/path/to -lpkgfeatures

All of the above can be empty if the operating system has the requested
features.

It will then be up to the package to add one or more of these
to MAKE_ENV (if using patched makefiles) or LDFLAGS if that works.

It is possible that I will end up implementing something like a
libpkgfeatures instead of libnbcompat because the libnbcompat headers
require too much patching (USE_NBCOMPAT_H and so on ...)

I also want to implement support for requesting PIC objects. This way
features can be linked into shared libraries/modules, like perl
modules, with appropriate symbol hiding on platforms that support it.

And before anyone suggests to make the features library shared:
I don't think that is a good idea because it alters the ABI for
dependent packages and spells trouble for IRIX and AIX.

Getting back to your original question, I don't see any reason
why objects couldn't be built once and reused later.

I should have some patches ready soon ...

-Tobias



Home | Main Index | Thread Index | Old Index