Skip to content

Commit

Permalink
s4-waf: started adding auto-install of include files
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Tridgell committed Apr 6, 2010
1 parent 11ca0c7 commit 03998d0
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 13 deletions.
42 changes: 42 additions & 0 deletions buildtools/wafsamba/wafsamba.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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


Expand All @@ -185,6 +190,7 @@ def SAMBA_BINARY(bld, binname, source,
deps='',
includes='',
public_headers=None,
header_path=None,
modules=None,
installdir=None,
ldflags=None,
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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

2 changes: 1 addition & 1 deletion codepages/wscript_build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bld.install_files('${DATAROOTDIR}', ['upcase.dat', 'lowcase.dat', 'valid.dat'])
bld.INSTALL_WILDCARD('${DATAROOTDIR}', '*.dat')
3 changes: 2 additions & 1 deletion lib/util/wscript_build
Original file line number Diff line number Diff line change
@@ -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'
)
Expand Down
16 changes: 10 additions & 6 deletions source4/dynconfig/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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}',
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion source4/libcli/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)

Expand Down
5 changes: 3 additions & 2 deletions source4/librpc/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Expand Down Expand Up @@ -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'
)


Expand Down
4 changes: 2 additions & 2 deletions source4/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit 03998d0

Please sign in to comment.