Bug 1375798 - Limit the SO_VERSION option to openbsd builds. r?mshal draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 23 Jun 2017 14:58:05 +0900
changeset 601157 cab645f04d6efacf5e17e53da8991fbdae12dece
parent 601156 c578ed51c99dd5c74687b3d7189c699fb9134430
child 601158 19ce46f12494713c6127a1215583d4a8f0499c77
push id65973
push userbmo:mh+mozilla@glandium.org
push dateWed, 28 Jun 2017 05:39:17 +0000
reviewersmshal
bugs1375798
milestone56.0a1
Bug 1375798 - Limit the SO_VERSION option to openbsd builds. r?mshal SO_VERSION has only an impact on those builds. Also set the default at the option level, instead of doing that in the library_name_info function.
moz.configure
--- a/moz.configure
+++ b/moz.configure
@@ -138,19 +138,28 @@ include('build/moz.configure/toolchain.c
         when='--enable-compile-environment')
 include('build/moz.configure/memory.configure',
         when='--enable-compile-environment')
 include('build/moz.configure/headers.configure',
         when='--enable-compile-environment')
 include('build/moz.configure/warnings.configure',
         when='--enable-compile-environment')
 
-option(env='SO_VERSION', nargs=1, help='Shared library version for OpenBSD systems')
+@depends(target)
+def is_openbsd(target):
+    return target.kernel == 'OpenBSD'
 
-@depends(target, target_is_windows, target_is_darwin, c_compiler, 'SO_VERSION')
+option(env='SO_VERSION', nargs=1, default='1.0', when=is_openbsd,
+       help='Shared library version for OpenBSD systems')
+
+@depends('SO_VERSION', when=is_openbsd)
+def so_version(value):
+    return value
+
+@depends(target, target_is_windows, target_is_darwin, c_compiler, so_version)
 def library_name_info(target, is_windows, is_darwin, c_compiler, so_version):
     dll_prefix = 'lib'
     dll_suffix = '.so'
     lib_prefix = 'lib'
     lib_suffix = 'a'
     rust_lib_prefix = 'lib'
     rust_lib_suffix = 'a'
     obj_suffix = 'o'
@@ -169,21 +178,18 @@ def library_name_info(target, is_windows
             import_lib_suffix = 'a'
         else:
             import_lib_suffix = 'lib'
             lib_prefix = ''
             lib_suffix = 'lib'
             obj_suffix = 'obj'
     elif is_darwin:
         dll_suffix = '.dylib'
-    elif target.kernel == 'OpenBSD':
-        if so_version:
-            dll_suffix = '.so.%s' % so_version
-        else:
-            dll_suffix = '.so.1.0'
+    elif so_version:
+        dll_suffix = '.so.%s' % so_version
 
     assert dll_suffix[0] == '.'
     assert obj_suffix[0] != '.'
     assert lib_suffix[0] != '.'
     assert rust_lib_suffix[0] != '.'
 
     return namespace(
         dll_prefix=dll_prefix,