summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-08 21:46:20 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-08 22:11:49 +1000
commit4ca46c6b8dfd9d7450096fc16c6edd7a08f369e5 (patch)
tree8d32526234eecdb5187869ba4c0b6093047d5442 /buildtools
parenteb9b7d0363669574de8ec380089407890f15eac2 (diff)
downloadsamba-4ca46c6b8dfd9d7450096fc16c6edd7a08f369e5.tar.gz
samba-4ca46c6b8dfd9d7450096fc16c6edd7a08f369e5.tar.bz2
samba-4ca46c6b8dfd9d7450096fc16c6edd7a08f369e5.zip
build: make the handling of relative paths a bit saner
This should fix a problem that Anatoliy has struck with the PIDL rules. It also brings us much closer to a working build for a true out of tree build (ie. with waf configure -b /tmp/build)
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_autoproto.py8
-rw-r--r--buildtools/wafsamba/samba_deps.py2
-rw-r--r--buildtools/wafsamba/samba_install.py10
-rw-r--r--buildtools/wafsamba/samba_pidl.py10
-rw-r--r--buildtools/wafsamba/samba_utils.py2
-rw-r--r--buildtools/wafsamba/wafsamba.py2
6 files changed, 16 insertions, 18 deletions
diff --git a/buildtools/wafsamba/samba_autoproto.py b/buildtools/wafsamba/samba_autoproto.py
index 5a6460c89a..2a903d9f1f 100644
--- a/buildtools/wafsamba/samba_autoproto.py
+++ b/buildtools/wafsamba/samba_autoproto.py
@@ -9,12 +9,13 @@ def HEIMDAL_AUTOPROTO(bld, header, source, options=None, group='prototypes'):
if options is None:
options='-q -P comment -o'
SET_TARGET_TYPE(bld, header, 'PROTOTYPE')
- t = bld(rule='${PERL} ../heimdal/cf/make-proto.pl ${OPTIONS} ${TGT[0].abspath(env)} ${SRC}',
+ t = bld(rule='${PERL} ${HEIMDAL}/cf/make-proto.pl ${OPTIONS} ${TGT[0].abspath(env)} ${SRC}',
source=source,
target=header,
on_results=True,
ext_out='.c',
before='cc')
+ t.env.HEIMDAL = os.path.join(bld.srcnode.abspath(), 'source4/heimdal')
t.env.OPTIONS = options
Build.BuildContext.HEIMDAL_AUTOPROTO = HEIMDAL_AUTOPROTO
@@ -29,13 +30,14 @@ def SAMBA_AUTOPROTO(bld, header, source):
'''rule for samba prototype generation'''
bld.SET_BUILD_GROUP('prototypes')
SET_TARGET_TYPE(bld, header, 'PROTOTYPE')
- bld(
+ t = bld(
source = source,
target = header,
on_results=True,
ext_out='.c',
before ='cc',
- rule = '../script/mkproto.pl --srcdir=.. --builddir=. --public=/dev/null --private=${TGT} ${SRC}'
+ rule = '${SCRIPT}/mkproto.pl --srcdir=.. --builddir=. --public=/dev/null --private=${TGT} ${SRC}'
)
+ t.env.SCRIPT = os.path.join(bld.srcnode.abspath(), 'source4/script')
Build.BuildContext.SAMBA_AUTOPROTO = SAMBA_AUTOPROTO
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index be77d2c611..c52275e813 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -240,7 +240,7 @@ def check_duplicate_sources(bld, tgt_list):
for t in tgt_list:
obj_sources = getattr(t, 'source', '')
- tpath = os_path_relpath(t.path.abspath(bld.env), t.env['BUILD_DIRECTORY'] + '/default')
+ tpath = os_path_relpath(t.path.abspath(bld.env), t.env.BUILD_DIRECTORY + '/default')
obj_sources = bld.SUBDIR(tpath, obj_sources)
t.samba_source_set = set(TO_LIST(obj_sources))
diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py
index 30b607bf4c..fee456a8dd 100644
--- a/buildtools/wafsamba/samba_install.py
+++ b/buildtools/wafsamba/samba_install.py
@@ -117,7 +117,7 @@ def symlink_lib(self):
if self.target.endswith('.inst'):
return
- blddir = Utils.g_module.blddir
+ blddir = os.path.dirname(self.bld.srcnode.abspath(self.bld.env))
libpath = self.link_task.outputs[0].abspath(self.env)
# calculat the link target and put it in the environment
@@ -132,8 +132,6 @@ def symlink_lib(self):
link_target = os.path.join(blddir, link_target)
- libpath = os_path_relpath(libpath, os.path.dirname(link_target))
-
if os.path.lexists(link_target):
os.unlink(link_target)
os.symlink(libpath, link_target)
@@ -147,11 +145,9 @@ def symlink_bin(self):
if self.target.endswith('.inst'):
return
- blddir = Utils.g_module.blddir
+ blddir = os.path.dirname(self.bld.srcnode.abspath(self.bld.env))
binpath = self.link_task.outputs[0].abspath(self.env)
- bldpath = os.path.join(blddir, os.path.basename(self.target))
-
- binpath = os_path_relpath(binpath, os.path.dirname(bldpath))
+ bldpath = os.path.join(self.bld.env.BUILD_DIRECTORY, self.target)
if os.path.lexists(bldpath):
os.unlink(bldpath)
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index ff2b527458..0b149cc252 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -69,7 +69,7 @@ def SAMBA_PIDL(bld, pname, source,
# prime the list of nodes we are dependent on with the cached pidl sources
t.allnodes = pidl_src_nodes
- t.env.PIDL = "../pidl/pidl"
+ t.env.PIDL = os.path.join(bld.srcnode.abspath(), 'pidl/pidl')
t.env.OPTIONS = TO_LIST(options)
# this rather convoluted set of path calculations is to cope with the possibility
@@ -77,15 +77,14 @@ def SAMBA_PIDL(bld, pname, source,
# gen_ndr directory we end up generating identical output in gen_ndr for the old
# build system and the new one. That makes keeping things in sync much easier.
# eventually we should drop the gen_ndr files in git, but in the meanwhile this works
- outdir = bld.bldnode.name + '/' + bld.path.find_dir(output_dir).bldpath(t.env)
+ outdir = bld.path.find_dir(output_dir).abspath(t.env)
- if not os.path.lexists(outdir):
+ if symlink and not os.path.lexists(outdir):
link_source = os.path.normpath(os.path.join(bld.curdir,output_dir))
- link_source = os_path_relpath(link_source, os.path.dirname(outdir))
os.symlink(link_source, outdir)
real_outputdir = os.path.realpath(outdir)
- t.env.OUTPUTDIR = os_path_relpath(real_outputdir, bld.bldnode.name + '/..')
+ t.env.OUTPUTDIR = os_path_relpath(real_outputdir, os.path.dirname(bld.env.BUILD_DIRECTORY))
if table_header_idx is not None:
pidl_headers = LOCAL_CACHE(bld, 'PIDL_HEADERS')
@@ -134,5 +133,6 @@ def SAMBA_PIDL_TABLES(bld, name, target):
source = '../../librpc/tables.pl',
target = target,
name = name)
+ t.env.LIBRPC = os.path.join(bld.srcnode.abspath(), 'librpc')
Build.BuildContext.SAMBA_PIDL_TABLES = SAMBA_PIDL_TABLES
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index a527e811fa..1df70fdbf5 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -72,7 +72,7 @@ def install_rpath(bld):
def build_rpath(bld):
'''the rpath value for build'''
- rpath = os.path.normpath('%s/%s' % (bld.env['BUILD_DIRECTORY'], LIB_PATH))
+ rpath = os.path.normpath('%s/%s' % (bld.env.BUILD_DIRECTORY, LIB_PATH))
bld.env['RPATH'] = []
bld.env['RPATH_ST'] = []
if bld.env.RPATH_ON_BUILD:
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 75639d47ab..08d3d20137 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -38,7 +38,7 @@ os.putenv('PYTHONUNBUFFERED', '1')
@conf
def SAMBA_BUILD_ENV(conf):
'''create the samba build environment'''
- conf.env['BUILD_DIRECTORY'] = conf.blddir
+ conf.env.BUILD_DIRECTORY = conf.blddir
mkdir_p(os.path.join(conf.blddir, LIB_PATH))
mkdir_p(os.path.join(conf.blddir, 'python/samba/dcerpc'))
# this allows all of the bin/shared and bin/python targets