s4-waf: started adding auto-install of include files
authorAndrew Tridgell <tridge@samba.org>
Fri, 26 Mar 2010 22:46:50 +0000 (09:46 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:09 +0000 (20:27 +1000)
buildtools/wafsamba/wafsamba.py
codepages/wscript_build
lib/util/wscript_build
source4/dynconfig/wscript
source4/libcli/wscript_build
source4/librpc/wscript_build
source4/wscript_build

index 098053d5739fcf72941ced3aadb5cd90abb152fa..9763d9a2e83346cdbec8882271f4a9ab40c079c0 100644 (file)
@@ -59,6 +59,7 @@ def SAMBA_LIBRARY(bld, libname, source,
                   public_deps='',
                   includes='',
                   public_headers=None,
+                  header_path=None,
                   vnum=None,
                   cflags='',
                   external_library=False,
@@ -97,6 +98,7 @@ def SAMBA_LIBRARY(bld, libname, source,
                         public_deps    = public_deps,
                         includes       = includes,
                         public_headers = public_headers,
+                        header_path    = header_path,
                         cflags         = cflags,
                         group          = group,
                         autoproto      = autoproto,
@@ -176,6 +178,9 @@ def SAMBA_LIBRARY(bld, libname, source,
     if autoproto is not None:
         bld.SAMBA_AUTOPROTO(autoproto, source)
 
+    if public_headers is not None:
+        bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
+
 Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
 
 
@@ -185,6 +190,7 @@ def SAMBA_BINARY(bld, binname, source,
                  deps='',
                  includes='',
                  public_headers=None,
+                 header_path=None,
                  modules=None,
                  installdir=None,
                  ldflags=None,
@@ -290,6 +296,8 @@ def SAMBA_BINARY(bld, binname, source,
 
     if autoproto is not None:
         bld.SAMBA_AUTOPROTO(autoproto, source)
+    if public_headers is not None:
+        bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
 
 
@@ -367,6 +375,7 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
                     public_deps='',
                     includes='',
                     public_headers=None,
+                    header_path=None,
                     cflags='',
                     cflags_end=None,
                     group='main',
@@ -428,8 +437,11 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
         bld.HEIMDAL_AUTOPROTO_PRIVATE(heimdal_autoproto_private, source)
     if autoproto is not None:
         bld.SAMBA_AUTOPROTO(autoproto, source + ' ' + autoproto_extra_source)
+    if public_headers is not None:
+        bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
     return t
 
+
 Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
 
 
@@ -610,3 +622,33 @@ def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
 
 Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
 
+
+def INSTALL_FILES(bld, destdir, files, chmod=0644, flat=False,
+                  python_fixup=False):
+    '''install a set of files'''
+    destdir = bld.EXPAND_VARIABLES(destdir)
+    bld.install_files(destdir, files, chmod=chmod, relative_trick=not flat)
+Build.BuildContext.INSTALL_FILES = INSTALL_FILES
+
+
+def INSTALL_WILDCARD(bld, destdir, pattern, chmod=0644, flat=False,
+                     python_fixup=False):
+    '''install a set of files matching a wildcard pattern'''
+    files=bld.path.ant_glob(pattern)
+    INSTALL_FILES(bld, destdir, files, chmod=chmod, flat=flat)
+Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD
+
+
+def PUBLIC_HEADERS(bld, public_headers, header_path=None):
+    '''install some headers'''
+    dest = '${INCLUDEDIR}'
+    if header_path:
+        dest += '/' + header_path
+    for h in TO_LIST(public_headers):
+        if header_path is None and h.find('/gen_ndr/') != -1:
+            # a special hack for gen_ndr headers
+            INSTALL_FILES(bld, '${INCLUDEDIR}/gen_ndr', h, flat=True)
+        else:
+            INSTALL_FILES(bld, dest, h, flat=True)
+Build.BuildContext.PUBLIC_HEADERS = PUBLIC_HEADERS
+
index b31ef8d478caf9d7aaf6747470e914d49828b69f..b3eafcc8dc3145b79dcca34d4021444320b13319 100644 (file)
@@ -1 +1 @@
-bld.install_files('${DATAROOTDIR}', ['upcase.dat', 'lowcase.dat', 'valid.dat'])
+bld.INSTALL_WILDCARD('${DATAROOTDIR}', '*.dat')
index bf4f3250143372ad32465c505cd8b3f152244637..ac6b2270128d43d2b96206e67058f491dae828aa 100644 (file)
@@ -1,7 +1,8 @@
 bld.SAMBA_LIBRARY('LIBSAMBA-UTIL',
        source='xfile.c debug.c fault.c signal.c system.c time.c genrand.c dprintf.c util_str.c rfc1738.c substitute.c util_strlist.c util_file.c data_blob.c util.c blocking.c util_net.c fsusage.c ms_fnmatch.c mutex.c idtree.c become_daemon.c rbtree.c talloc_stack.c smb_threads.c params.c parmlist.c util_id.c',
        public_deps='talloc LIBCRYPTO LIBREPLACE_NETWORK CHARSET execinfo UID_WRAPPER',
-       public_headers='util.h dlinklist.h attr.h byteorder.h data_blob.h debug.h memory.h mutex.h safe_string.h time.h util_ldb.h talloc_stack.h xfile.h',
+       public_headers='attr.h byteorder.h data_blob.h debug.h memory.h mutex.h safe_string.h time.h talloc_stack.h xfile.h',
+        header_path='util',
         local_include=False,
        vnum='0.0.1'
        )
index 3b645036771f1ff0042b6790af549ba8d2c04d4c..1f0c6c0372a0523516c77ae68ef1874e0f9a387e 100644 (file)
@@ -26,6 +26,7 @@ dyn_cflags = {
     'PRIVATE_DIR'                    : '${PRIVATEDIR}',
     'MODULESDIR'                     : '${PREFIX}/modules',
     'SETUPDIR'                       : '${DATADIR}/setup',
+    'INCLUDEDIR'                     : '${PREFIX}/include',
     'WINBINDD_PRIVILEGED_SOCKET_DIR' : '${WINBINDD_PRIVILEGED_SOCKET_DIR}',
     'WINBINDD_SOCKET_DIR'            : '${WINBINDD_SOCKET_DIR}',
     'NTP_SIGND_SOCKET_DIR'           : '${NTP_SIGND_SOCKET_DIR}',
@@ -61,16 +62,19 @@ def configure(conf):
         conf.ASSERT(varname not in conf.env, "Variable %s already defined" % varname)
         conf.env[varname] = value
 
+    for f in dyn_cflags.keys():
+        # substitute twice, as we could have substitutions containing variables
+        v = Utils.subst_vars(dyn_cflags[f], conf.env)
+        v = Utils.subst_vars(v, conf.env)
+        conf.ASSERT(v != '', "Empty dynconfig value for %s" % f)
+        conf.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
+        conf.env[f] = v
+
 def dynconfig_cflags(bld):
     '''work out the extra CFLAGS for dynconfig.c'''
     cflags = []
     for f in dyn_cflags.keys():
-        # substitute twice, as we could have substitutions containing variables
-        v = Utils.subst_vars(dyn_cflags[f], bld.env)
-        v = Utils.subst_vars(v, bld.env)
-        bld.ASSERT(v != '', "Empty dynconfig value for %s" % f)
-        bld.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
-        cflags.append('-D%s="%s"' % (f, v))
+        cflags.append('-D%s="%s"' % (f, bld.env[f]))
     return cflags
 
 def build(bld):
index bded7da4ca5e604208ec3747bab4e513295a506d..537faf5950c05f5151944b77c9ca0042e24ff38b 100644 (file)
@@ -4,7 +4,7 @@ bld.BUILD_SUBDIR('wbclient')
 
 bld.SAMBA_SUBSYSTEM('LIBSAMBA-ERRORS',
        source='../../libcli/util/doserr.c util/errormap.c util/nterr.c',
-       public_headers='../../libcli/util/error.h ../../testprogs/win32/spoolss/error.h ../../libcli/util/ntstatus.h ../../libcli/util/doserr.h ../../libcli/util/werror.h',
+       public_headers='../../libcli/util/error.h ../../libcli/util/ntstatus.h ../../libcli/util/doserr.h ../../libcli/util/werror.h',
         deps='talloc'
        )
 
index 48bdecd3b3cf69cb2ab206477392af4d61da7b1a..f85f95ff4fe0d97294ed3919c9455083b3176205 100644 (file)
@@ -5,7 +5,8 @@ bld.SAMBA_LIBRARY('LIBNDR',
        source='ndr/ndr_string.c ../../librpc/ndr/ndr_basic.c ../../librpc/ndr/uuid.c ../../librpc/ndr/ndr.c ../../librpc/ndr/ndr_misc.c ../../librpc/gen_ndr/ndr_misc.c',
        # PC_FILES='../librpc/ndr.pc',
        public_deps='LIBSAMBA-ERRORS talloc LIBSAMBA-UTIL CHARSET LIBSAMBA-HOSTCONFIG',
-       public_headers='../../librpc/ndr/libndr.h PIDL_COMMON/misc.h PIDL_COMMON/ndr_misc.h',
+       public_headers='../../librpc/gen_ndr/misc.h ../../librpc/gen_ndr/ndr_misc.h',
+        header_path='gen_ndr',
         depends_on='PIDL_MISC',
        vnum='0.0.1'
        )
@@ -327,7 +328,7 @@ bld.SAMBA_LIBRARY('NDR_STANDARD',
        # PC_FILES='../librpc/ndr_standard.pc',
        deps='NDR_SECURITY',
        public_deps='LIBNDR',
-       public_headers='../../librpc/gen_ndr/samr.h ../../librpc/gen_ndr/ndr_samr.h ../rpc_server/lsa/lsa.h ../torture/rpc/netlogon.h ../../librpc/gen_ndr/atsvc.h ../../librpc/gen_ndr/ndr_atsvc.h ../../librpc/ndr/ndr_svcctl.h ../../librpc/gen_ndr/ndr_svcctl.h ../../librpc/gen_ndr/svcctl.h'
+       public_headers='../../librpc/gen_ndr/samr.h ../../librpc/gen_ndr/ndr_samr.h ../rpc_server/lsa/lsa.h ../torture/rpc/netlogon.h ../../librpc/gen_ndr/atsvc.h ../../librpc/gen_ndr/ndr_atsvc.h ../../librpc/gen_ndr/ndr_svcctl.h ../../librpc/gen_ndr/svcctl.h'
        )
 
 
index 5d46ca48b8b67d558406c1226c439c10a19508cc..e0b942b274acf82ef25a84684a4ad7819a1a2b95 100644 (file)
@@ -113,5 +113,5 @@ bld.BUILD_SUBDIR('../libcli/named_pipe_auth')
 bld.BUILD_SUBDIR('heimdal_build')
 bld.BUILD_SUBDIR('lib/smbreadline')
 bld.BUILD_SUBDIR('../codepages')
-
-
+bld.BUILD_SUBDIR('setup')
+bld.BUILD_SUBDIR('scripting')