[Pkg-samba-maint] ldb merge

Andrew Bartlett abartlet at samba.org
Tue Mar 29 00:06:45 BST 2022


On Mon, 2022-03-28 at 19:34 +0300, Michael Tokarev wrote:
> 28.03.2022 12:32, Michael Tokarev wrote:
> > There are a few interesting surprises here.
> > 
> > The first one is:
> > 
> > $ ldd libldb2/usr/lib/x86_64-linux-gnu/libldb.so.2
> >      libreplace-samba4.so.0 => not found
> > 
> > oops.
> > 
> > When building libldb separately, this libreplace
> > library is linked directly into libldb.so.
> 
> The only symbol libldb uses from libreplace is
> rep_memset_s() which comes from the ZERO_STRUCT
> macro in lib/replace/replace.h, which uses memset_s().
> I created a simple patch to replace memset_s()
> here with bzero() (which is available in glibc), -
> with that, libldb.so does not depend on libreplace
> anymore and becomes more or less independent.
> At least not dependent from samba-libs.
> 
> Maybe it's better to link libreplace statically,
> let's see.

Yes, libreplace is a good candidate for --bundled-libs. 

> ...libldb modules...
> > all the actual modules went to samba-dsdb-modules package,
> > since they were in usr/lib/x86_64-linux-gnu/samba/ldb/.
> > Having some more understanding of waf-the-buildsystem
> > I probably can make it put stuff into separate dir.
> > Because else we'll have to expand the wildcard in
> > debian/samba-dsdb-modules.install.
> 
> So I ended up explicitly listing all modules in both
> samba-dsdb-modules.install and in libldb2.install
> 
> 
> > The include files are in /usr/include/samba-4.0/ldb.h etc.
> > Maybe this is right.
> 
> Thinking about this, it should be okay, since libldb is
> very tightly tied with samba. The include path is in
> pkg-config so should be easy to have it.

So I think we need to patch Samba to make these public.  Mostly just a
matter of setting a variable - long term that should go upstream, it is
actually one of the few cases where a debian-specific patch makes
sense, as we need to demonstrate the concept.

There are a few bits of lib/ldb/wscript that depend on
bld.env.standalone_ldb that need to be carefully looked at (and changed
with a variable controlled by a --with-public-ldb option), but this is
the key one:

    if bld.env.standalone_ldb:
        if not 'PACKAGE_VERSION' in bld.env:
            bld.env.PACKAGE_VERSION = VERSION
        bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
        private_library = False
    else:
        private_library = True

Changing the private_library variable is the most important, but I note
that we may need to tweak the pkgconfig stuff.

I'm a broken record, but thanks again and lets keep making this happen!

Andrew,

-- 
Andrew Bartlett (he/him)       https://samba.org/~abartlet/
Samba Team Member (since 2001) https://samba.org
Samba Team Lead, Catalyst IT   https://catalyst.net.nz/services/samba

Samba Development and Support, Catalyst IT - Expert Open Source
Solutions




More information about the Pkg-samba-maint mailing list