build: for unbundled libraries install devel link too
[samba.git] / buildtools / wafsamba / samba_install.py
index 6da44932189a125d3a3254bd31eb6f5fcfd68a9a..74730dd3b26839447a52c6089e845329850819a9 100644 (file)
@@ -82,6 +82,8 @@ def install_library(self):
 
     t.env.append_value('LINKFLAGS', install_ldflags)
 
+    dev_link     = None
+
     if self.samba_realname:
         install_name = self.samba_realname
         install_link = None
@@ -91,6 +93,9 @@ def install_library(self):
         install_name = 'lib%s.so.%s' % (self.target, self.vnum)
         install_link = 'lib%s.so.%s' % (self.target, vnum_base)
         inst_name    = 'lib%s.so' % t.target
+        if self.target == self.name:
+            # only generate the dev link for non-bundled libs
+            dev_link     = 'lib%s.so' % self.target
     else:
         install_name = 'lib%s.so' % self.target
         install_link = None
@@ -103,6 +108,9 @@ def install_library(self):
         # and the symlink if needed
         bld.symlink_as(os.path.join(install_path, install_link),
                        install_name)
+    if dev_link:
+        bld.symlink_as(os.path.join(install_path, dev_link),
+                       install_name)
 
 
 
@@ -133,8 +141,7 @@ def symlink_lib(self):
     link_target = os.path.join(blddir, link_target)
 
     if os.path.lexists(link_target):
-        old_link = os.readlink(link_target)
-        if libpath == old_link:
+        if os.path.islink(link_target) and os.readlink(link_target) == libpath:
             return
         os.unlink(link_target)
     os.symlink(libpath, link_target)
@@ -153,8 +160,7 @@ def symlink_bin(self):
     bldpath = os.path.join(self.bld.env.BUILD_DIRECTORY, self.link_task.outputs[0].name)
 
     if os.path.lexists(bldpath):
-        old_link = os.readlink(bldpath)
-        if binpath == old_link:
+        if os.path.islink(bldpath) and os.readlink(bldpath) == binpath:
             return
         os.unlink(bldpath)
     os.symlink(binpath, bldpath)