--- lib/ldb/wscript.orig	2019-02-26 17:14:29 UTC
+++ lib/ldb/wscript
@@ -139,9 +139,15 @@ def build(bld):
     bld.RECURSE('lib/tdb')
 
     if bld.env.standalone_ldb:
+        if not 'PACKAGE_VERSION' in bld.env:
+            bld.env.PACKAGE_VERSION = VERSION
+        bld.env.PKGCONFIGDIR = '%%PKGCONFIGDIR%%'
         private_library = False
     else:
         private_library = True
+    # we're not currently linking against the ldap libs, but ldb.pc.in
+    # has @LDAP_LIBS@
+    bld.env.LDAP_LIBS = ''
 
     LDB_MAP_SRC = bld.SUBDIR('ldb_map',
                              'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
@@ -162,13 +168,6 @@ def build(bld):
     if bld.PYTHON_BUILD_IS_ENABLED():
         if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
             for env in bld.gen_python_environments(['PKGCONFIGDIR']):
-                # we're not currently linking against the ldap libs, but ldb.pc.in
-                # has @LDAP_LIBS@
-                bld.env.LDAP_LIBS = ''
-
-                if not 'PACKAGE_VERSION' in bld.env:
-                    bld.env.PACKAGE_VERSION = VERSION
-                    bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
 
                 name = bld.pyembed_libname('pyldb-util')
                 bld.SAMBA_LIBRARY(name,
@@ -337,7 +336,7 @@ def build(bld):
 
         LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
         for t in LDB_TOOLS.split():
-            bld.SAMBA_BINARY(t, 'tools/%s.c' % t, deps='ldb-cmdline ldb',
+            bld.SAMBA_BINARY('samba-%s' % t, 'tools/%s.c' % t, deps='ldb-cmdline ldb',
                              manpages='man/%s.1' % t)
 
         # ldbtest doesn't get installed
@@ -345,7 +344,7 @@ def build(bld):
                          install=False)
 
         # ldbdump doesn't get installed
-        bld.SAMBA_BINARY('ldbdump', 'tools/ldbdump.c', deps='ldb-cmdline ldb',
+        bld.SAMBA_BINARY('samba-ldbdump', 'tools/ldbdump.c', deps='ldb-cmdline ldb',
                          install=False)
 
         bld.SAMBA_LIBRARY('ldb-cmdline',
@@ -364,10 +363,6 @@ def build(bld):
                          deps='cmocka ldb',
                          install=False)
 
-        bld.SAMBA_BINARY('ldb_match_test',
-                         source='tests/ldb_match_test.c',
-                         deps='cmocka ldb',
-                         install=False)
 
 def test(ctx):
     '''run ldb testsuite'''
@@ -397,8 +392,7 @@ def test(ctx):
 
     cmocka_ret = 0
     for test_exe in ['ldb_tdb_mod_op_test',
-                     'ldb_msg_test',
-                     'ldb_match_test']:
+                     'ldb_msg_test']:
             cmd = os.path.join(Utils.g_module.blddir, test_exe)
             cmocka_ret = cmocka_ret or samba_utils.RUN_COMMAND(cmd)