Add manpages argument to SAMBA_LIBRARY().
[samba.git] / buildtools / wafsamba / wafsamba.py
index fd6a5523e99ce4cb33f0391ca68059e07bf57dc2..00ebe5351416a7d7ac506a225785d2f349bbf5cc 100644 (file)
@@ -9,6 +9,7 @@ from samba_utils import SUBST_VARS_RECURSIVE
 # bring in the other samba modules
 from samba_optimisation import *
 from samba_utils import *
+from samba_version import *
 from samba_autoconf import *
 from samba_patterns import *
 from samba_pidl import *
@@ -114,6 +115,8 @@ def SAMBA_LIBRARY(bld, libname, source,
                   abi_file=None,
                   abi_match=None,
                   hide_symbols=False,
+                  is_bundled=False,
+                  manpages=None,
                   enabled=True):
     '''define a Samba library'''
 
@@ -162,8 +165,11 @@ def SAMBA_LIBRARY(bld, libname, source,
     deps = TO_LIST(deps)
     deps.append(obj_target)
 
-    if target_type == 'PYTHON' or realname:
-        bundled_name = libname
+    if target_type == 'PYTHON' or realname or not is_bundled:
+        # Sanitize the library name
+        bundled_name = libname.lower().replace('_', '-')
+        while bundled_name.startswith("lib"):
+            bundled_name = bundled_name[3:]
     else:
         bundled_name = BUNDLED_NAME(bld, libname, bundled_extension)
 
@@ -191,7 +197,7 @@ def SAMBA_LIBRARY(bld, libname, source,
         vnum            = vnum,
         install_path    = None,
         samba_inst_path = install_path,
-        name           = libname,
+        name            = libname,
         samba_realname  = realname,
         samba_install   = install,
         abi_file        = abi_file,
@@ -207,6 +213,18 @@ def SAMBA_LIBRARY(bld, libname, source,
     if pc_files is not None:
         bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
 
+    if manpages is not None and 'XSLTPROC' in bld.env:
+        bld.env.MAN_XSL = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
+        for m in manpages.split():
+            source = m + '.xml'
+            bld.SAMBA_GENERATOR(m,
+                                source=source,
+                                target=m,
+                                rule='${XSLTPROC} -o ${TGT} ${MAN_XSL} ${SRC}'
+                                )
+            bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
+
+
 Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
 
 
@@ -294,6 +312,17 @@ def SAMBA_BINARY(bld, binname, source,
     if subsystem_name is not None:
         bld.TARGET_ALIAS(subsystem_name, binname)
 
+    if manpages is not None and 'XSLTPROC' in bld.env:
+        bld.env.MAN_XSL = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
+        for m in manpages.split():
+            source = m + '.xml'
+            bld.SAMBA_GENERATOR(m,
+                                source=source,
+                                target=m,
+                                rule='${XSLTPROC} -o ${TGT} ${MAN_XSL} ${SRC}'
+                                )
+            bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
+
 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY