--- a/moz.configure
+++ b/moz.configure
@@ -138,69 +138,83 @@ 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')
-@depends(target)
-def is_openbsd(target):
- return target.kernel == 'OpenBSD'
+
+@depends(target, host)
+def is_openbsd(target, host):
+ return target.kernel == 'OpenBSD' or host.kernel == 'OpenBSD'
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, c_compiler, so_version)
-def library_name_info(target, c_compiler, so_version):
- if target.kernel == 'WINNT':
- # There aren't artifacts for mingw builds, so it's OK that the results
- # are inaccurate in that case.
- if c_compiler and c_compiler.type not in ('msvc', 'clang-cl'):
+@template
+def library_name_info_template(host_or_target):
+ assert host_or_target in (host, target)
+ compiler = {
+ host: host_c_compiler,
+ target: c_compiler,
+ }[host_or_target]
+
+ @depends(host_or_target, compiler, so_version)
+ def library_name_info_impl(host_or_target, compiler, so_version):
+ if host_or_target.kernel == 'WINNT':
+ # There aren't artifacts for mingw builds, so it's OK that the
+ # results are inaccurate in that case.
+ if compiler and compiler.type not in ('msvc', 'clang-cl'):
+ return namespace(
+ dll=namespace(prefix='', suffix='.dll'),
+ lib=namespace(prefix='lib', suffix='a'),
+ import_lib=namespace(prefix='lib', suffix='a'),
+ rust_lib=namespace(prefix='', suffix='lib'),
+ obj=namespace(prefix='', suffix='o'),
+ )
+
return namespace(
dll=namespace(prefix='', suffix='.dll'),
+ lib=namespace(prefix='', suffix='lib'),
+ import_lib=namespace(prefix='', suffix='lib'),
+ rust_lib=namespace(prefix='', suffix='lib'),
+ obj=namespace(prefix='', suffix='obj'),
+ )
+
+ elif host_or_target.kernel == 'Darwin':
+ return namespace(
+ dll=namespace(prefix='lib', suffix='.dylib'),
lib=namespace(prefix='lib', suffix='a'),
- import_lib=namespace(prefix='lib', suffix='a'),
- rust_lib=namespace(prefix='', suffix='lib'),
+ import_lib=namespace(prefix=None, suffix=''),
+ rust_lib=namespace(prefix='lib', suffix='a'),
obj=namespace(prefix='', suffix='o'),
)
+ elif so_version:
+ so = '.so.%s' % so_version
+ else:
+ so = '.so'
return namespace(
- dll=namespace(prefix='', suffix='.dll'),
- lib=namespace(prefix='', suffix='lib'),
- import_lib=namespace(prefix='', suffix='lib'),
- rust_lib=namespace(prefix='', suffix='lib'),
- obj=namespace(prefix='', suffix='obj'),
- )
-
- elif target.kernel == 'Darwin':
- return namespace(
- dll=namespace(prefix='lib', suffix='.dylib'),
+ dll=namespace(prefix='lib', suffix=so),
lib=namespace(prefix='lib', suffix='a'),
import_lib=namespace(prefix=None, suffix=''),
rust_lib=namespace(prefix='lib', suffix='a'),
obj=namespace(prefix='', suffix='o'),
)
- elif so_version:
- so = '.so.%s' % so_version
- else:
- so = '.so'
+
+ return library_name_info_impl
- return namespace(
- dll=namespace(prefix='lib', suffix=so),
- lib=namespace(prefix='lib', suffix='a'),
- import_lib=namespace(prefix=None, suffix=''),
- rust_lib=namespace(prefix='lib', suffix='a'),
- obj=namespace(prefix='', suffix='o'),
- )
+host_library_name_info = library_name_info_template(host)
+library_name_info = library_name_info_template(target)
set_config('DLL_PREFIX', library_name_info.dll.prefix)
set_config('DLL_SUFFIX', library_name_info.dll.suffix)
set_config('LIB_PREFIX', library_name_info.lib.prefix)
set_config('LIB_SUFFIX', library_name_info.lib.suffix)
set_config('RUST_LIB_PREFIX', library_name_info.rust_lib.prefix)
set_config('RUST_LIB_SUFFIX', library_name_info.rust_lib.suffix)
set_config('OBJ_SUFFIX', library_name_info.obj.suffix)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -691,17 +691,17 @@ with only_when(building_stylo_bindgen):
To compile Stylo, please install version {} or greater of
Clang + LLVM and ensure that the 'llvm-config' from that
installation is first on your path.
You can verify this by typing 'llvm-config --version'.
'''.format(version, min_version)))
@depends(llvm_config, '--with-libclang-path', '--with-clang-path',
- library_name_info, host)
+ host_library_name_info, host)
@imports('os.path')
@imports(_from='textwrap', _import='dedent')
def bindgen_config_paths(llvm_config, libclang_path, clang_path,
library_name_info, host):
def search_for_libclang(path):
# Try to ensure that the clang shared library that bindgen is going
# to look for is actually present. The files that we search for
# mirror the logic in clang-sys/build.rs.