summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-17 21:53:29 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:40 +1000
commit7ed65d2e126161f269ea823d2fa02e79b779fc63 (patch)
tree614ee0cf71a12bbcd6c6f5a7d6b45a4055b32c61 /buildtools/wafsamba
parent36e6d11dceb7af9cccdff3c631745427e31b8835 (diff)
downloadsamba-7ed65d2e126161f269ea823d2fa02e79b779fc63.tar.gz
samba-7ed65d2e126161f269ea823d2fa02e79b779fc63.tar.bz2
samba-7ed65d2e126161f269ea823d2fa02e79b779fc63.zip
build: result of hack session with ita
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_autoconf.py8
-rw-r--r--buildtools/wafsamba/samba_patterns.py65
-rw-r--r--buildtools/wafsamba/samba_pidl.py44
-rw-r--r--buildtools/wafsamba/samba_utils.py8
-rw-r--r--buildtools/wafsamba/wafsamba.py103
5 files changed, 100 insertions, 128 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index e6f5985e15..3d18d2e250 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -124,6 +124,14 @@ def ADD_CFLAGS(conf, flags):
conf.env['EXTRA_CFLAGS'] = []
conf.env['EXTRA_CFLAGS'].extend(flags.split())
+##############################################################
+# add some extra include directories to all builds
+@conf
+def ADD_EXTRA_INCLUDES(conf, includes):
+ if not 'EXTRA_INCLUDES' in conf.env:
+ conf.env['EXTRA_INCLUDES'] = []
+ conf.env['EXTRA_INCLUDES'].extend(includes.split())
+
##############################################################
# work out the current flags. local flags are added first
diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
index ca19d8d09a..868aa2874e 100644
--- a/buildtools/wafsamba/samba_patterns.py
+++ b/buildtools/wafsamba/samba_patterns.py
@@ -21,68 +21,3 @@ def process_et(self, node):
self.create_task('et', node, [c_node, h_node])
self.allnodes.append(c_node)
-
-
-
-# this was my (awful) attempt at a ASN1 rule, i plan on moving it to samba_asn1.py,
-# like I did for the PIDL rules, and conver to a make-like rule
-
-################################################################################
-# a asn1 task which calls out to asn1_compile_wrapper.sh to do the work
-Task.simple_task_type('asn1',
- '''
-# this is the rule for now - ie. an embedded shell script!! like
-# I showed you previously, the ASN1 compiler generates weird names,
-# we need to fix the names, and add config.h header
-
-# shell script to convert ASN1 to C. This could be separated out if we want to
-set -e
-compiler=${TGT[0].compiler}
-destdir=${TGT[0].destdir}
-wrapper=${TGT[0].asn1wrapper}
-srcfile=${SRC[0].abspath(env)}
-asn1name=${TGT[0].asn1name}
-options="${TGT[0].asn1options}"
-
-# run the wrapper
-$wrapper . $destdir $compiler $srcfile $asn1name ${options} --one-code-file
-
-# that generated 3 files:
-# ${asn1name}.hx
-# asn1_${asn1name}.x
-# ${asn1name}_files
-
-
-hxfile=$destdir/$asn1name.hx
-xfile=$destdir/asn1_$asn1name.x
-listfilee=$destdir/"$asn1name"_files
-
-cfile=${TGT[0].abspath(env)}
-hfile=${TGT[1].abspath(env)}
-
-cp $hxfile $hfile
-echo '#include "config.h"' > $cfile
-cat $xfile >> $cfile
-rm -f $listfile
-
-''',
- color='BLUE',
- ext_out='.c',
- shell = True)
-
-@extension('.asn1')
-def process_asn1(self, node):
-
- asn1name = string.replace(node.file(), '.', '_')
- c_node = NEW_NODE(node, 'asn1_%s.c' % asn1name)
- h_node = NEW_NODE(node, '%s.h' % asn1name)
-
- c_node.destdir = "default/source4/heimdal/" + self.asn1directory
- c_node.asn1options = self.asn1options
- c_node.asn1name = asn1name
- c_node.asn1wrapper = "../heimdal_build/asn1_compile_wrapper.sh"
- c_node.compiler = "default/source4/heimdal_build/asn1_compile"
-
- self.create_task('asn1', node, [c_node, h_node])
- self.allnodes.append(c_node)
-
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index 9269566111..bea97acf03 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -40,33 +40,51 @@ def SAMBA_PIDL(bld, pname, source, options=''):
t.env.OPTIONS = options
t.env.OUTPUTDIR = bld.BUILD_PATH(gen_ndr_dir)
- # I'm creating the list of headers for the tables rule here.
- # then the tables rule itself is below
- #t.collect_headers = [bld.path.find_or_declare(out_files[1])] #, bld.path.find_or_declare(out_files[6])]
- #if name.rfind('PIDL') > -1:
- # print name, "t.coll", t.collect_headers
- #print name, "so bld.PIDL_STUFF is defined", id(bld)
try:
bld.PIDL_STUFF[name] = [bld.path.find_or_declare(out_files[1])]
except AttributeError:
bld.PIDL_STUFF = {}
bld.PIDL_STUFF[name] = [bld.path.find_or_declare(out_files[1])]
- # I think I need to build this list as absolute paths, then
- # re-do as relative paths in the tables rule
t.more_includes = '#' + bld.path.relpath_gen(bld.srcnode)
- #if not 'PIDL_HEADERS' in bld.env:
- # bld.env.PIDL_HEADERS = []
- #bld.env.PIDL_HEADERS.append(gen_ndr_dir + 'ndr_%s.h' % bname)
+Build.BuildContext.SAMBA_PIDL = SAMBA_PIDL
+def SAMBA_PIDL_TDR(bld, pname, source, options=''):
+ '''Build a IDL file using pidl.
+ This will only produce the header and tdr parser'''
-Build.BuildContext.SAMBA_PIDL = SAMBA_PIDL
+ bname = source[0:-4];
+ name = "PIDL_%s" % bname.upper()
+
+ if not SET_TARGET_TYPE(bld, name, 'PIDL'):
+ return
+
+ bld.SET_BUILD_GROUP('build_source')
+
+ out_files = []
+ out_files.append('tdr_%s.c' % bname)
+ out_files.append('tdr_%s.h' % bname)
+
+ pidl = bld.srcnode.find_resource('pidl/pidl').relpath_gen(bld.path)
+ t = bld(rule='${PIDL} ${PIDL_BUILD_TYPES} ${OPTIONS} --outputdir ${TGT[0].parent.abspath(env)} -- ${SRC[0].abspath(env)}',
+ ext_out = '.c',
+ before = 'cc',
+ shell = False,
+ source=source,
+ target = out_files,
+ name=name)
+
+ t.env.PIDL = "../../pidl/pidl"
+ t.env.PIDL_BUILD_TYPES = '--header --tdr-parser'
+ t.env.OPTIONS = options
+
+Build.BuildContext.SAMBA_PIDL_TDR = SAMBA_PIDL_TDR
#################################################################
# define a set of Samba PIDL targets
-def SAMBA_PIDL_LIST(bld, name, source, options=''):
+def SAMBA_PIDL_LIST(bld, name, source,options=''):
for p in source.split():
bld.SAMBA_PIDL(name, p, options)
Build.BuildContext.SAMBA_PIDL_LIST = SAMBA_PIDL_LIST
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index bdbd3c7b93..529505d317 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -157,8 +157,8 @@ def ADD_COMMAND(opt, name, function):
Options.Handler.ADD_COMMAND = ADD_COMMAND
-@feature('cprogram','cc','cshlib')
-@before('apply_core')
+@feature('*')
+@before('apply_core','exec_rule')
def process_depends_on(self):
'''The new depends_on attribute for build rules
allow us to specify a dependency on output from
@@ -204,8 +204,8 @@ Build.BuildContext.FIND_TASKGEN = FIND_TASKGEN
def ENABLE_MAGIC_ORDERING(bld):
'''enable automatic build order constraint calculation
see page 35 of the waf book'''
- print "Enabling magic ordering"
- bld.use_the_magic()
+ print "NOT Enabling magic ordering"
+ #bld.use_the_magic()
Build.BuildContext.ENABLE_MAGIC_ORDERING = ENABLE_MAGIC_ORDERING
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 932b9e3bd0..83f61d4962 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -12,6 +12,8 @@ from samba_utils import *
from samba_autoconf import *
from samba_patterns import *
from samba_pidl import *
+from samba_asn1 import *
+from samba_autoproto import *
LIB_PATH="shared"
@@ -71,10 +73,10 @@ def CHECK_DEPENDENCIES(bld):
for t in cache:
deps = CHECK_TARGET_DEPENDENCY(bld, t)
for d in deps:
- #if not d in target_cache:
- # print "Dependency '%s' of target '%s' not declared" % (d, t)
- ASSERT(bld, d in target_cache,
- "Dependency '%s' of target '%s' not declared" % (d, t))
+ if not d in target_cache:
+ print "WARNING: Dependency '%s' of target '%s' not declared" % (d, t)
+ #ASSERT(bld, d in target_cache,
+ # "Dependency '%s' of target '%s' not declared" % (d, t))
debug("deps: Dependencies checked for %u targets" % len(target_cache))
Build.BuildContext.CHECK_DEPENDENCIES = CHECK_DEPENDENCIES
@@ -176,6 +178,8 @@ def SAMBA_LIBRARY_INCLUDE_LIST(bld, deps):
for l in deps.split():
if l in cache:
ret = ret + cache[l] + ' '
+ if 'EXTRA_INCLUDES' in bld.env:
+ ret += ' ' + ' '.join(bld.env['EXTRA_INCLUDES'])
return ret
Build.BuildContext.SAMBA_LIBRARY_INCLUDE_LIST = SAMBA_LIBRARY_INCLUDE_LIST
@@ -184,13 +188,14 @@ Build.BuildContext.SAMBA_LIBRARY_INCLUDE_LIST = SAMBA_LIBRARY_INCLUDE_LIST
def SAMBA_LIBRARY(bld, libname, source,
deps='',
public_deps='',
- include_list='.',
+ includes='.',
public_headers=None,
vnum=None,
cflags='',
output_type=None,
realname=None,
autoproto=None,
+ group='main',
depends_on=''):
if not SET_TARGET_TYPE(bld, libname, 'LIBRARY'):
return
@@ -202,9 +207,12 @@ def SAMBA_LIBRARY(bld, libname, source,
(sysdeps, localdeps, add_objects) = ADD_DEPENDENCIES(bld, libname, deps)
- ilist = bld.SAMBA_LIBRARY_INCLUDE_LIST(deps) + bld.SUBDIR(bld.curdir, include_list)
+ ilist = bld.SUBDIR(bld.curdir, includes) + ' ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps)
ilist = bld.NORMPATH(ilist)
- bld.SET_BUILD_GROUP('main')
+
+ # this print below should show that we're runnig this code
+ print "Setting build group for library %s to %s" % (libname, group), bld.path
+ bld.SET_BUILD_GROUP(group) # <- here
bld(
features = 'cc cshlib',
source = source,
@@ -213,32 +221,37 @@ def SAMBA_LIBRARY(bld, libname, source,
uselib = sysdeps,
add_objects = add_objects,
ccflags = CURRENT_CFLAGS(bld, cflags),
- includes='. ' + bld.env['BUILD_DIRECTORY'] + '/default ' + ilist,
+ includes=ilist + ' . #',
depends_on=depends_on,
vnum=vnum)
+ # I have to set it each time? I expect it to be still
+ # set from the few lines above
+
# put a link to the library in bin/shared
soext=""
if vnum is not None:
soext = '.' + vnum.split('.')[0]
- bld.SET_BUILD_GROUP('final')
- bld(
+
+ t = bld(
source = 'lib%s.so' % libname,
- rule = 'ln -sf ../${SRC}%s %s/lib%s.so%s' %
- (soext, LIB_PATH, libname, soext),
+ rule = 'ln -sf ../${SRC}%s %s/lib%s.so%s' % (soext, LIB_PATH, libname, soext),
+# rule = 'ln -sf ../%s.so%s %s/lib%s.so%s' % (libname, soext, LIB_PATH, libname, soext),
shell = True,
after = 'cc_link',
+ always = True,
+ name = 'fff' + libname,
)
+ #print t.rule
LOCAL_CACHE_SET(bld, 'INCLUDE_LIST', libname, ilist)
Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
-
#################################################################
# define a Samba binary
def SAMBA_BINARY(bld, binname, source,
deps='',
- include_list='',
+ includes='',
public_headers=None,
modules=None,
installdir=None,
@@ -249,7 +262,7 @@ def SAMBA_BINARY(bld, binname, source,
compiler=None,
group='main',
manpages=None):
- ilist = '. ' + bld.env['BUILD_DIRECTORY'] + '/default ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps) + ' ' + include_list
+ ilist = includes + ' ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps)
ilist = bld.NORMPATH(ilist)
if not SET_TARGET_TYPE(bld, binname, 'BINARY'):
@@ -271,17 +284,21 @@ def SAMBA_BINARY(bld, binname, source,
target = binname,
uselib_local = localdeps,
uselib = sysdeps,
- includes = ilist,
+ includes = ilist + ' . #',
ccflags = CURRENT_CFLAGS(bld, cflags),
add_objects = add_objects,
top=True)
- # put a link to the binary in bin/
+
if not Options.is_install:
bld(
source = binname,
rule = 'rm -f %s && cp ${SRC} .' % (binname),
shell = True,
- after = 'cc_link'
+ after = 'cc_link',
+ always = True,
+ ext_in = '.bin',
+ name = binname + ".copy",
+ depends_on = binname
)
Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
@@ -301,32 +318,13 @@ def SAMBA_PYTHON(bld, name, source,
return
Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
-
-
-#################################################################
-# define a Samba ASN1 target
-def SAMBA_ASN1(bld, name, source,
- options='',
- directory=''):
- if not SET_TARGET_TYPE(bld, name, 'ASN1'):
- return
- bld.SET_BUILD_GROUP('build_source')
- bld(
- features = 'cc',
- source = source,
- target = name,
- asn1options = options,
- asn1directory = directory
- )
-Build.BuildContext.SAMBA_ASN1 = SAMBA_ASN1
-
-
-
#################################################################
# define a Samba ET target
def SAMBA_ERRTABLE(bld, name, source,
options='',
directory=''):
+# print "Skipping ERRTABLE rule for %s with source=%s" % (name, source)
+# return
if not SET_TARGET_TYPE(bld, name, 'ET'):
return
bld.SET_BUILD_GROUP('build_source')
@@ -357,7 +355,7 @@ Build.BuildContext.AUTOPROTO = AUTOPROTO
# define a Samba module.
def SAMBA_MODULE(bld, modname, source,
deps='',
- include_list='.',
+ includes='.',
subsystem=None,
init_function=None,
autoproto=None,
@@ -375,7 +373,7 @@ def SAMBA_MODULE(bld, modname, source,
(sysdeps, localdeps, add_objects) = ADD_DEPENDENCIES(bld, modname, deps)
- ilist = bld.SAMBA_LIBRARY_INCLUDE_LIST(deps) + bld.SUBDIR(bld.curdir, include_list)
+ ilist = bld.SUBDIR(bld.curdir, includes) + ' ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps)
ilist = bld.NORMPATH(ilist)
bld.SET_BUILD_GROUP('main')
bld(
@@ -383,7 +381,7 @@ def SAMBA_MODULE(bld, modname, source,
source = source,
target=modname,
ccflags = CURRENT_CFLAGS(bld, cflags),
- includes='. ' + bld.env['BUILD_DIRECTORY'] + '/default ' + ilist)
+ includes=ilist + ' . #')
Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
@@ -392,13 +390,15 @@ Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
def SAMBA_SUBSYSTEM(bld, modname, source,
deps='',
public_deps='',
- include_list='.',
+ includes='.',
public_headers=None,
- autoproto=None,
cflags='',
group='main',
config_option=None,
init_function_sentinal=None,
+ heimdal_autoproto=None,
+ heimdal_autoproto_private=None,
+ autoproto=None,
depends_on=''):
if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
@@ -416,7 +416,7 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
(sysdeps, localdeps, add_objects) = ADD_DEPENDENCIES(bld, modname, deps)
- ilist = bld.SAMBA_LIBRARY_INCLUDE_LIST(deps) + bld.SUBDIR(bld.curdir, include_list)
+ ilist = bld.SUBDIR(bld.curdir, includes) + ' ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps)
ilist = bld.NORMPATH(ilist)
bld.SET_BUILD_GROUP(group)
t = bld(
@@ -424,9 +424,18 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
source = source,
target=modname,
ccflags = CURRENT_CFLAGS(bld, cflags),
- includes='. ' + bld.env['BUILD_DIRECTORY'] + '/default ' + ilist,
+ includes=ilist + ' . #',
depends_on=depends_on)
+ LOCAL_CACHE_SET(bld, 'INCLUDE_LIST', modname, ilist)
+
+ if heimdal_autoproto is not None:
+ bld.HEIMDAL_AUTOPROTO(heimdal_autoproto, source)
+ if heimdal_autoproto_private is not None:
+ bld.HEIMDAL_AUTOPROTO_PRIVATE(heimdal_autoproto_private, source)
+ if autoproto is not None:
+ bld.SAMBA_AUTOPROTO(autoproto, source)
return t
+
Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
@@ -457,8 +466,10 @@ Options.Handler.ADD_COMMAND = ADD_COMMAND
# phases happen consecutively
@runonce
def SETUP_BUILD_GROUPS(bld):
+ bld.p_ln = bld.srcnode # we do want to see all targets!
bld.env['USING_BUILD_GROUPS'] = True
bld.add_group('setup')
+ bld.add_group('base_libraries')
bld.add_group('build_compilers')
bld.add_group('build_source')
bld.add_group('prototypes')