1 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 include('build/moz.configure/init.configure')
10 # - Gecko-specific options and rules should go in toolkit/moz.configure.
11 # - Firefox-specific options and rules should go in browser/moz.configure.
12 # - Fennec-specific options and rules should go in
13 # mobile/android/moz.configure.
14 # - Spidermonkey-specific options and rules should go in js/moz.configure.
17 # Multiprocess Firefox Testing UI - Nightly and Aurora
18 # To be removed in Bug 1003313
20 def e10s_testing_only(milestone):
21 if not milestone.is_release:
24 set_config('E10S_TESTING_ONLY', e10s_testing_only)
25 set_define('E10S_TESTING_ONLY', e10s_testing_only)
28 option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
29 help='Download and use prebuilt binary artifacts.')
31 @depends('--enable-artifact-builds')
32 def artifact_builds(value):
36 set_config('MOZ_ARTIFACT_BUILDS', artifact_builds)
38 @depends('--enable-artifact-builds')
39 def imply_disable_compile_environment(value):
43 imply_option('--enable-compile-environment', imply_disable_compile_environment)
45 option('--disable-compile-environment',
46 help='Disable compiler/library checks')
48 @depends('--disable-compile-environment')
49 def compile_environment(compile_env):
53 set_config('COMPILE_ENVIRONMENT', compile_environment)
54 add_old_configure_assignment('COMPILE_ENVIRONMENT', compile_environment)
56 js_option('--disable-tests',
57 help='Do not build test libraries & programs')
59 @depends('--disable-tests')
60 def enable_tests(value):
64 set_config('ENABLE_TESTS', enable_tests)
65 set_define('ENABLE_TESTS', enable_tests)
67 @depends(enable_tests)
68 def gtest_has_rtti(value):
72 set_define('GTEST_HAS_RTTI', gtest_has_rtti)
74 @depends(target, enable_tests)
75 def linux_gtest_defines(target, enable_tests):
76 if enable_tests and target.os == 'Android':
77 return namespace(os_linux_android=True,
78 use_own_tr1_tuple=True,
81 set_define('GTEST_OS_LINUX_ANDROID',
82 delayed_getattr(linux_gtest_defines, 'os_linux_android'))
83 set_define('GTEST_USE_OWN_TR1_TUPLE',
84 delayed_getattr(linux_gtest_defines, 'use_own_tr1_tuple'))
85 set_define('GTEST_HAS_CLONE',
86 delayed_getattr(linux_gtest_defines, 'has_clone'))
88 js_option('--enable-debug',
90 help='Enable building with developer debug info '
91 '(using the given compiler flags).')
93 add_old_configure_assignment('MOZ_DEBUG',
94 depends('--enable-debug')(lambda v: bool(v)))
96 @depends('--disable-compile-environment', '--help')
97 def toolchain_include(compile_env, help):
99 return 'build/moz.configure/toolchain.configure'
101 include(toolchain_include)
103 @depends('--disable-compile-environment', '--help')
104 def memory_include(compile_env, help):
106 return 'build/moz.configure/memory.configure'
108 include(memory_include)
112 @imports(_from='mozbuild.backend', _import='backends')
113 def build_backends_choices(help):
114 return tuple(backends)
117 @deprecated_option('--enable-build-backend', nargs='+',
118 choices=build_backends_choices)
119 def build_backend(backends):
121 return tuple('+%s' % b for b in backends)
123 imply_option('--build-backends', build_backend)
126 @depends('--enable-artifact-builds', '--disable-compile-environment', '--help')
128 def build_backend_defaults(artifact_builds, compile_environment, _):
130 all_backends = ['FasterMake+RecursiveMake']
132 all_backends = ['RecursiveMake', 'FasterMake']
133 # Normally, we'd use target.os == 'WINNT', but a dependency on target
134 # would require target to depend on --help, as well as host and shell,
135 # and this is not a can of worms we can open at the moment.
136 if sys.platform == 'win32' and compile_environment:
137 all_backends.append('VisualStudio')
138 return tuple(all_backends)
140 option('--build-backends', nargs='+', default=build_backend_defaults,
141 choices=build_backends_choices, help='Build backends to generate')
143 @depends('--build-backends')
144 def build_backends(backends):
147 set_config('BUILD_BACKENDS', build_backends)
151 # ==============================================================
152 awk = check_prog('AWK', ('gawk', 'mawk', 'nawk', 'awk'))
154 # Until the AWK variable is not necessary in old-configure
156 def awk_for_old_configure(value):
159 add_old_configure_assignment('AWK', awk_for_old_configure)
163 # ==============================================================
164 perl = check_prog('PERL', ('perl5', 'perl'))
166 # Until the PERL variable is not necessary in old-configure
168 def perl_for_old_configure(value):
171 add_old_configure_assignment('PERL', perl_for_old_configure)
174 def perl_version_check(min_version):
176 @checking('for minimum required perl version >= %s' % min_version)
177 def get_perl_version(perl):
178 return Version(check_cmd_output(
179 perl, '-e', 'print $]',
180 onerror=lambda: die('Failed to get perl version.')
183 @depends(get_perl_version)
184 def check_perl_version(version):
185 if version < min_version:
186 die('Perl %s or higher is required.', min_version)
189 @checking('for full perl installation')
190 @imports('subprocess')
191 def has_full_perl_installation(perl):
192 ret = subprocess.call(
193 [perl, '-e', 'use Config; exit(!-d $Config{archlib})'])
196 @depends(has_full_perl_installation)
197 def require_full_perl_installation(has_full_perl_installation):
198 if not has_full_perl_installation:
199 die('Cannot find Config.pm or $Config{archlib}. '
200 'A full perl installation is required.')
202 perl_version_check('5.006')
205 # Miscellaneous programs
206 # ==============================================================
207 check_prog('DOXYGEN', ('doxygen',), allow_missing=True)
208 check_prog('XARGS', ('xargs',))
211 def extra_programs(target):
212 if target.kernel == 'Darwin':
214 DSYMUTIL=('dsymutil', 'llvm-dsymutil'),
215 GENISOIMAGE=('genisoimage',),
217 if target.os == 'GNU' and target.kernel == 'Linux':
218 return namespace(RPMBUILD=('rpmbuild',))
220 check_prog('DSYMUTIL', delayed_getattr(extra_programs, 'DSYMUTIL'),
222 check_prog('GENISOIMAGE', delayed_getattr(extra_programs, 'GENISOIMAGE'),
224 check_prog('RPMBUILD', delayed_getattr(extra_programs, 'RPMBUILD'),
227 option('--enable-system-hunspell',
228 help="Use system hunspell (located with pkgconfig)")
230 @depends('--enable-system-hunspell', compile_environment)
231 def check_for_hunspell(value, compile_env):
232 return value and compile_env
234 system_hunspell = pkg_check_modules('MOZ_HUNSPELL', 'hunspell',
237 set_config('MOZ_SYSTEM_HUNSPELL', system_hunspell)
239 # Fallthrough to autoconf-based configure
240 include('build/moz.configure/old.configure')
241 # Please do not add anything after the include of old.configure.