summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-05 11:23:28 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:26 +1000
commitcd712dff316b5d1d017c0132ef37e948b17e0608 (patch)
treee92e0baf9105734cd784b376088282693cc7145a /buildtools/wafsamba
parent7ae4372124a7fde2404f9e626054e7856c18f733 (diff)
downloadsamba-cd712dff316b5d1d017c0132ef37e948b17e0608.tar.gz
samba-cd712dff316b5d1d017c0132ef37e948b17e0608.tar.bz2
samba-cd712dff316b5d1d017c0132ef37e948b17e0608.zip
build: simpler symlink_bin and symlink_lib methods
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_install.py42
1 files changed, 20 insertions, 22 deletions
diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py
index 71d6b86122..2fbf5da843 100644
--- a/buildtools/wafsamba/samba_install.py
+++ b/buildtools/wafsamba/samba_install.py
@@ -106,20 +106,17 @@ def install_library(self):
##############################
# handle the creation of links for libraries and binaries in the build tree
-# note that we use a relative symlink path to allow the whole tree
-# to me moved/copied elsewhere without breaking the links
-t = Task.simple_task_type('symlink_lib', 'rm -f ${LINK_TARGET} && ln -s ${LINK_SOURCE} ${LINK_TARGET}',
- shell=True, color='PINK', ext_in='.bin')
-t.quiet = True
@feature('symlink_lib')
@after('apply_link')
def symlink_lib(self):
'''symlink a shared lib'''
- if Options.is_install:
+
+ if self.target.endswith('.inst'):
return
- tsk = self.create_task('symlink_lib', self.link_task.outputs[0])
+ blddir = Utils.g_module.blddir
+ libpath = self.link_task.outputs[0].abspath(self.env)
# calculat the link target and put it in the environment
soext=""
@@ -131,28 +128,29 @@ def symlink_lib(self):
if link_target == '':
link_target = '%s/lib%s.so%s' % (LIB_PATH, self.target, soext)
+ link_target = os.path.join(blddir, link_target)
- link_source = os_path_relpath(self.link_task.outputs[0].abspath(self.env),
- os.path.join(self.env.BUILD_DIRECTORY, link_target))
-
- tsk.env.LINK_TARGET = link_target
- tsk.env.LINK_SOURCE = link_source[3:]
- debug('task_gen: LINK for %s is %s -> %s',
- self.name, tsk.env.LINK_SOURCE, tsk.env.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)
-t = Task.simple_task_type('symlink_bin', 'rm -f ${BIN_TARGET} && ln -s ${SRC} ${BIN_TARGET}',
- shell=True, color='PINK', ext_in='.bin')
-t.quiet = True
@feature('symlink_bin')
@after('apply_link')
def symlink_bin(self):
- '''symlink a binary'''
- if Options.is_install:
+ '''symlink a binary into the build directory'''
+
+ if self.target.endswith('.inst'):
return
- tsk = self.create_task('symlink_bin', self.link_task.outputs[0])
- tsk.env.BIN_TARGET = self.target
- debug('task_gen: BIN_TARGET for %s is %s', self.name, tsk.env.BIN_TARGET)
+ blddir = Utils.g_module.blddir
+ binpath = self.link_task.outputs[0].abspath(self.env)
+ bldpath = os.path.join(blddir, self.target)
+
+ binpath = os_path_relpath(binpath, os.path.dirname(bldpath))
+ if os.path.lexists(bldpath):
+ os.unlink(bldpath)
+ os.symlink(binpath, bldpath)