WAF support for OpenBSD

Brad Smith brad at comstyle.com
Thu Jan 23 22:19:38 MST 2014


On 20/01/14 1:44 AM, Brad Smith wrote:
> Looking for any assistance with trying to fix WAF on OpenBSD...

Anyone familiar with Samba's WAF be able to help out porting the
diff below?

> ----- Forwarded message from Brad Smith <brad at comstyle.com> -----
>
> Date: Fri, 13 Dec 2013 02:48:43 -0500
> From: Brad Smith <brad at comstyle.com>
> To: mat at matws.net
> Subject: WAF support for OpenBSD
> User-Agent: Mutt/1.5.22 (2013-10-16)
>
> Hi Matthieu,
>
> I came across this post while looking through the Samba mailing lists.
>
> http://marc.info/?l=samba-technical&m=137961606432749&w=2
>
> I was working with Thomas to try and fix WAF building shared libraries on OpenBSD
> as we ran into issues with WAF not properly building and installing shared libs
> when I was trying to update Samba and some of the other componnents like talloc,
> tevent, and tdb. As far as I know of all of the issues I had run into have been
> fixed upstream with WAF 1.7, but Samba uses WAF 1.5 still. Would you be able to
> assist with backporting the functional changes from the diff below which is
> against WAF 1.7?
>
>
> diff -upr ./Tools/ccroot.py /home/brad/waf/waflib/Tools/ccroot.py
> --- ./Tools/ccroot.py	Sat May 25 08:55:40 2013
> +++ /home/brad/waf/waflib/Tools/ccroot.py	Thu Dec 12 22:16:12 2013
> @@ -146,11 +146,14 @@ class link_task(Task.Task):
>   				pattern = '%s'
>   			folder, name = os.path.split(target)
>
> -			if self.__class__.__name__.find('shlib') > 0:
> -				if self.env.DEST_BINFMT == 'pe' and getattr(self.generator, 'vnum', None):
> +			if self.__class__.__name__.find('shlib') > 0 and getattr(self.generator, 'vnum', None):
> +				nums = self.generator.vnum.split('.')
> +				if self.env.DEST_BINFMT == 'pe':
>   					# include the version in the dll file name,
>   					# the import lib file name stays unversionned.
> -					name = name + '-' + self.generator.vnum.split('.')[0]
> +					name = name + '-' + nums[0]
> +				elif self.env.DEST_OS == 'openbsd':
> +					pattern = '%s.%s.%s' % (pattern, nums[0], nums[1])
>
>   			tmp = folder + os.sep + pattern % name
>   			target = self.generator.path.find_or_declare(tmp)
> @@ -499,16 +502,23 @@ def apply_vnum(self):
>   		self.env.append_value('LINKFLAGS', v.split())
>
>   	# the following task is just to enable execution from the build dir :-/
> -	self.create_task('vnum', node, [node.parent.find_or_declare(name2), node.parent.find_or_declare(name3)])
>
> +	if self.env.DEST_OS != 'openbsd':
> +		self.create_task('vnum', node, [node.parent.find_or_declare(name2), node.parent.find_or_declare(name3)])
> +
>   	if getattr(self, 'install_task', None):
>   		self.install_task.hasrun = Task.SKIP_ME
>   		bld = self.bld
>   		path = self.install_task.dest
> -		t1 = bld.install_as(path + os.sep + name3, node, env=self.env, chmod=self.link_task.chmod)
> -		t2 = bld.symlink_as(path + os.sep + name2, name3)
> -		t3 = bld.symlink_as(path + os.sep + libname, name3)
> -		self.vnum_install_task = (t1, t2, t3)
> +		if self.env.DEST_OS == 'openbsd':
> +			libname = self.link_task.outputs[0].name
> +			t1 = bld.install_as('%s%s%s' % (path, os.sep, libname), node, env=self.env, chmod=self.link_task.chmod)
> +			self.vnum_install_task = (t1,)
> +		else:
> +			t1 = bld.install_as(path + os.sep + name3, node, env=self.env, chmod=self.link_task.chmod)
> +			t2 = bld.symlink_as(path + os.sep + name2, name3)
> +			t3 = bld.symlink_as(path + os.sep + libname, name3)
> +			self.vnum_install_task = (t1, t2, t3)
>
>   	if '-dynamiclib' in self.env['LINKFLAGS']:
>   		# this requires after(propagate_uselib_vars)
> diff -upr ./Tools/gcc.py /home/brad/waf/waflib/Tools/gcc.py
> --- ./Tools/gcc.py	Sun Apr 28 04:11:17 2013
> +++ /home/brad/waf/waflib/Tools/gcc.py	Thu Dec 12 22:16:12 2013
> @@ -8,8 +8,6 @@
>   gcc/llvm detection.
>   """
>
> -import os, sys
> -from waflib import Configure, Options, Utils
>   from waflib.Tools import ccroot, ar
>   from waflib.Configure import conf
>
> @@ -126,6 +124,10 @@ def gcc_modifier_hpux(conf):
>   	v['STLIB_MARKER']        = '-Bstatic'
>   	v['CFLAGS_cshlib']       = ['-fPIC','-DPIC']
>   	v['cshlib_PATTERN']      = 'lib%s.sl'
> +
> + at conf
> +def gcc_modifier_openbsd(conf):
> +	conf.env.SONAME_ST = []
>
>   @conf
>   def gcc_modifier_platform(conf):
> diff -upr ./Tools/gxx.py /home/brad/waf/waflib/Tools/gxx.py
> --- ./Tools/gxx.py	Sun Apr 28 04:11:17 2013
> +++ /home/brad/waf/waflib/Tools/gxx.py	Thu Dec 12 22:16:12 2013
> @@ -8,8 +8,6 @@
>   g++/llvm detection.
>   """
>
> -import os, sys
> -from waflib import Configure, Options, Utils
>   from waflib.Tools import ccroot, ar
>   from waflib.Configure import conf
>
> @@ -127,6 +125,10 @@ def gxx_modifier_hpux(conf):
>   	v['STLIB_MARKER']        = '-Bstatic'
>   	v['CFLAGS_cxxshlib']     = ['-fPIC','-DPIC']
>   	v['cxxshlib_PATTERN']    = 'lib%s.sl'
> +
> + at conf
> +def gxx_modifier_openbsd(conf):
> +	conf.env.SONAME_ST = []
>
>   @conf
>   def gxx_modifier_platform(conf):
>
> ----- End forwarded message -----
>


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the samba-technical mailing list