coredata.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. # Copyright 2012-2018 The Meson development team
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. # http://www.apache.org/licenses/LICENSE-2.0
  6. # Unless required by applicable law or agreed to in writing, software
  7. # distributed under the License is distributed on an "AS IS" BASIS,
  8. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. # See the License for the specific language governing permissions and
  10. # limitations under the License.
  11. from . import mlog
  12. import pickle, os, uuid, shlex
  13. import sys
  14. from pathlib import PurePath
  15. from collections import OrderedDict
  16. from .mesonlib import MesonException
  17. from .mesonlib import default_libdir, default_libexecdir, default_prefix
  18. import ast
  19. import argparse
  20. version = '0.47.0.dev1'
  21. backendlist = ['ninja', 'vs', 'vs2010', 'vs2015', 'vs2017', 'xcode']
  22. default_yielding = False
  23. class UserOption:
  24. def __init__(self, name, description, choices, yielding):
  25. super().__init__()
  26. self.name = name
  27. self.choices = choices
  28. self.description = description
  29. if yielding is None:
  30. yielding = default_yielding
  31. if not isinstance(yielding, bool):
  32. raise MesonException('Value of "yielding" must be a boolean.')
  33. self.yielding = yielding
  34. # Check that the input is a valid value and return the
  35. # "cleaned" or "native" version. For example the Boolean
  36. # option could take the string "true" and return True.
  37. def validate_value(self, value):
  38. raise RuntimeError('Derived option class did not override validate_value.')
  39. def set_value(self, newvalue):
  40. self.value = self.validate_value(newvalue)
  41. class UserStringOption(UserOption):
  42. def __init__(self, name, description, value, choices=None, yielding=None):
  43. super().__init__(name, description, choices, yielding)
  44. self.set_value(value)
  45. def validate_value(self, value):
  46. if not isinstance(value, str):
  47. raise MesonException('Value "%s" for string option "%s" is not a string.' % (str(value), self.name))
  48. return value
  49. class UserBooleanOption(UserOption):
  50. def __init__(self, name, description, value, yielding=None):
  51. super().__init__(name, description, [True, False], yielding)
  52. self.set_value(value)
  53. def __bool__(self):
  54. return self.value
  55. def validate_value(self, value):
  56. if isinstance(value, bool):
  57. return value
  58. if value.lower() == 'true':
  59. return True
  60. if value.lower() == 'false':
  61. return False
  62. raise MesonException('Value %s is not boolean (true or false).' % value)
  63. class UserIntegerOption(UserOption):
  64. def __init__(self, name, description, min_value, max_value, value, yielding=None):
  65. super().__init__(name, description, [True, False], yielding)
  66. self.min_value = min_value
  67. self.max_value = max_value
  68. self.set_value(value)
  69. c = []
  70. if min_value is not None:
  71. c.append('>=' + str(min_value))
  72. if max_value is not None:
  73. c.append('<=' + str(max_value))
  74. self.choices = ', '.join(c)
  75. def validate_value(self, value):
  76. if isinstance(value, str):
  77. value = self.toint(value)
  78. if not isinstance(value, int):
  79. raise MesonException('New value for integer option is not an integer.')
  80. if self.min_value is not None and value < self.min_value:
  81. raise MesonException('New value %d is less than minimum value %d.' % (value, self.min_value))
  82. if self.max_value is not None and value > self.max_value:
  83. raise MesonException('New value %d is more than maximum value %d.' % (value, self.max_value))
  84. return value
  85. def toint(self, valuestring):
  86. try:
  87. return int(valuestring)
  88. except ValueError:
  89. raise MesonException('Value string "%s" is not convertable to an integer.' % valuestring)
  90. class UserUmaskOption(UserIntegerOption):
  91. def __init__(self, name, description, value, yielding=None):
  92. super().__init__(name, description, 0, 0o777, value, yielding)
  93. self.choices = ['preserve', '0000-0777']
  94. def validate_value(self, value):
  95. if value is None or value == 'preserve':
  96. return None
  97. return super().validate_value(value)
  98. def toint(self, valuestring):
  99. try:
  100. return int(valuestring, 8)
  101. except ValueError as e:
  102. raise MesonException('Invalid mode: {}'.format(e))
  103. class UserComboOption(UserOption):
  104. def __init__(self, name, description, choices, value, yielding=None):
  105. super().__init__(name, description, choices, yielding)
  106. if not isinstance(self.choices, list):
  107. raise MesonException('Combo choices must be an array.')
  108. for i in self.choices:
  109. if not isinstance(i, str):
  110. raise MesonException('Combo choice elements must be strings.')
  111. self.set_value(value)
  112. def validate_value(self, value):
  113. if value not in self.choices:
  114. optionsstring = ', '.join(['"%s"' % (item,) for item in self.choices])
  115. raise MesonException('Value "%s" for combo option "%s" is not one of the choices. Possible choices are: %s.' % (value, self.name, optionsstring))
  116. return value
  117. class UserArrayOption(UserOption):
  118. def __init__(self, name, description, value, shlex_split=False, user_input=False, **kwargs):
  119. super().__init__(name, description, kwargs.get('choices', []), yielding=kwargs.get('yielding', None))
  120. self.shlex_split = shlex_split
  121. self.value = self.validate_value(value, user_input=user_input)
  122. def validate_value(self, value, user_input=True):
  123. # User input is for options defined on the command line (via -D
  124. # options). Users can put their input in as a comma separated
  125. # string, but for defining options in meson_options.txt the format
  126. # should match that of a combo
  127. if not user_input and isinstance(value, str) and not value.startswith('['):
  128. raise MesonException('Value does not define an array: ' + value)
  129. if isinstance(value, str):
  130. if value.startswith('['):
  131. newvalue = ast.literal_eval(value)
  132. elif value == '':
  133. newvalue = []
  134. else:
  135. if self.shlex_split:
  136. newvalue = shlex.split(value)
  137. else:
  138. newvalue = [v.strip() for v in value.split(',')]
  139. elif isinstance(value, list):
  140. newvalue = value
  141. else:
  142. raise MesonException('"{0}" should be a string array, but it is not'.format(str(newvalue)))
  143. if len(set(newvalue)) != len(newvalue):
  144. msg = 'Duplicated values in array option "%s" is deprecated. ' \
  145. 'This will become a hard error in the future.' % (self.name)
  146. mlog.log(mlog.red('DEPRECATION:'), msg)
  147. for i in newvalue:
  148. if not isinstance(i, str):
  149. raise MesonException('String array element "{0}" is not a string.'.format(str(newvalue)))
  150. if self.choices:
  151. bad = [x for x in newvalue if x not in self.choices]
  152. if bad:
  153. raise MesonException('Options "{}" are not in allowed choices: "{}"'.format(
  154. ', '.join(bad), ', '.join(self.choices)))
  155. return newvalue
  156. class UserFeatureOption(UserComboOption):
  157. static_choices = ['enabled', 'disabled', 'auto']
  158. def __init__(self, name, description, value, yielding=None):
  159. super().__init__(name, description, self.static_choices, value, yielding)
  160. def is_enabled(self):
  161. return self.value == 'enabled'
  162. def is_disabled(self):
  163. return self.value == 'disabled'
  164. def is_auto(self):
  165. return self.value == 'auto'
  166. # This class contains all data that must persist over multiple
  167. # invocations of Meson. It is roughly the same thing as
  168. # cmakecache.
  169. class CoreData:
  170. def __init__(self, options):
  171. self.lang_guids = {
  172. 'default': '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942',
  173. 'c': '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942',
  174. 'cpp': '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942',
  175. 'test': '3AC096D0-A1C2-E12C-1390-A8335801FDAB',
  176. 'directory': '2150E333-8FDC-42A3-9474-1A3956D46DE8',
  177. }
  178. self.test_guid = str(uuid.uuid4()).upper()
  179. self.regen_guid = str(uuid.uuid4()).upper()
  180. self.target_guids = {}
  181. self.version = version
  182. self.init_builtins()
  183. self.backend_options = {}
  184. self.user_options = {}
  185. self.compiler_options = {}
  186. self.base_options = {}
  187. self.external_preprocess_args = {} # CPPFLAGS only
  188. self.cross_file = self.__load_cross_file(options.cross_file)
  189. self.wrap_mode = options.wrap_mode
  190. self.compilers = OrderedDict()
  191. self.cross_compilers = OrderedDict()
  192. self.deps = OrderedDict()
  193. # Only to print a warning if it changes between Meson invocations.
  194. self.pkgconf_envvar = os.environ.get('PKG_CONFIG_PATH', '')
  195. @staticmethod
  196. def __load_cross_file(filename):
  197. """Try to load the cross file.
  198. If the filename is None return None. If the filename is an absolute
  199. (after resolving variables and ~), return that absolute path. Next,
  200. check if the file is relative to the current source dir. If the path
  201. still isn't resolved do the following:
  202. Windows:
  203. - Error
  204. *:
  205. - $XDG_DATA_HOME/meson/cross (or ~/.local/share/meson/cross if
  206. undefined)
  207. - $XDG_DATA_DIRS/meson/cross (or
  208. /usr/local/share/meson/cross:/usr/share/meson/cross if undefined)
  209. - Error
  210. Non-Windows follows the Linux path and will honor XDG_* if set. This
  211. simplifies the implementation somewhat.
  212. """
  213. if filename is None:
  214. return None
  215. filename = os.path.expanduser(os.path.expandvars(filename))
  216. if os.path.isabs(filename):
  217. return filename
  218. path_to_try = os.path.abspath(filename)
  219. if os.path.isfile(path_to_try):
  220. return path_to_try
  221. if sys.platform != 'win32':
  222. paths = [
  223. os.environ.get('XDG_DATA_HOME', os.path.expanduser('~/.local/share')),
  224. ] + os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
  225. for path in paths:
  226. path_to_try = os.path.join(path, 'meson', 'cross', filename)
  227. if os.path.isfile(path_to_try):
  228. return path_to_try
  229. raise MesonException('Cannot find specified cross file: ' + filename)
  230. raise MesonException('Cannot find specified cross file: ' + filename)
  231. def sanitize_prefix(self, prefix):
  232. if not os.path.isabs(prefix):
  233. raise MesonException('prefix value {!r} must be an absolute path'
  234. ''.format(prefix))
  235. if prefix.endswith('/') or prefix.endswith('\\'):
  236. # On Windows we need to preserve the trailing slash if the
  237. # string is of type 'C:\' because 'C:' is not an absolute path.
  238. if len(prefix) == 3 and prefix[1] == ':':
  239. pass
  240. # If prefix is a single character, preserve it since it is
  241. # the root directory.
  242. elif len(prefix) == 1:
  243. pass
  244. else:
  245. prefix = prefix[:-1]
  246. return prefix
  247. def sanitize_dir_option_value(self, prefix, option, value):
  248. '''
  249. If the option is an installation directory option and the value is an
  250. absolute path, check that it resides within prefix and return the value
  251. as a path relative to the prefix.
  252. This way everyone can do f.ex, get_option('libdir') and be sure to get
  253. the library directory relative to prefix.
  254. '''
  255. if option.endswith('dir') and os.path.isabs(value) and \
  256. option not in builtin_dir_noprefix_options:
  257. # Value must be a subdir of the prefix
  258. # commonpath will always return a path in the native format, so we
  259. # must use pathlib.PurePath to do the same conversion before
  260. # comparing.
  261. if os.path.commonpath([value, prefix]) != str(PurePath(prefix)):
  262. m = 'The value of the {!r} option is {!r} which must be a ' \
  263. 'subdir of the prefix {!r}.\nNote that if you pass a ' \
  264. 'relative path, it is assumed to be a subdir of prefix.'
  265. raise MesonException(m.format(option, value, prefix))
  266. # Convert path to be relative to prefix
  267. skip = len(prefix) + 1
  268. value = value[skip:]
  269. return value
  270. def init_builtins(self):
  271. # Create builtin options with default values
  272. self.builtins = {}
  273. prefix = get_builtin_option_default('prefix')
  274. for key in get_builtin_options():
  275. value = get_builtin_option_default(key, prefix)
  276. args = [key] + builtin_options[key][1:-1] + [value]
  277. self.builtins[key] = builtin_options[key][0](*args)
  278. def init_backend_options(self, backend_name):
  279. if backend_name == 'ninja':
  280. self.backend_options['backend_max_links'] = \
  281. UserIntegerOption(
  282. 'backend_max_links',
  283. 'Maximum number of linker processes to run or 0 for no '
  284. 'limit',
  285. 0, None, 0)
  286. elif backend_name.startswith('vs'):
  287. self.backend_options['backend_startup_project'] = \
  288. UserStringOption(
  289. 'backend_startup_project',
  290. 'Default project to execute in Visual Studio',
  291. '')
  292. def get_builtin_option(self, optname):
  293. if optname in self.builtins:
  294. return self.builtins[optname].value
  295. raise RuntimeError('Tried to get unknown builtin option %s.' % optname)
  296. def set_builtin_option(self, optname, value):
  297. if optname == 'prefix':
  298. value = self.sanitize_prefix(value)
  299. elif optname in self.builtins:
  300. prefix = self.builtins['prefix'].value
  301. value = self.sanitize_dir_option_value(prefix, optname, value)
  302. else:
  303. raise RuntimeError('Tried to set unknown builtin option %s.' % optname)
  304. self.builtins[optname].set_value(value)
  305. def validate_option_value(self, option_name, override_value):
  306. for opts in (self.builtins, self.base_options, self.compiler_options, self.user_options):
  307. if option_name in opts:
  308. opt = opts[option_name]
  309. return opt.validate_value(override_value)
  310. raise MesonException('Tried to validate unknown option %s.' % option_name)
  311. def get_external_args(self, lang):
  312. return self.compiler_options[lang + '_args'].value
  313. def get_external_link_args(self, lang):
  314. return self.compiler_options[lang + '_link_args'].value
  315. def get_external_preprocess_args(self, lang):
  316. return self.external_preprocess_args[lang]
  317. def merge_user_options(self, options):
  318. for (name, value) in options.items():
  319. if name not in self.user_options:
  320. self.user_options[name] = value
  321. else:
  322. oldval = self.user_options[name]
  323. if type(oldval) != type(value):
  324. self.user_options[name] = value
  325. def set_options(self, options, subproject=''):
  326. # Set prefix first because it's needed to sanitize other options
  327. prefix = self.builtins['prefix'].value
  328. if 'prefix' in options:
  329. prefix = self.sanitize_prefix(options['prefix'])
  330. self.builtins['prefix'].set_value(prefix)
  331. for key in builtin_dir_noprefix_options:
  332. if key not in options:
  333. self.builtins[key].set_value(get_builtin_option_default(key, prefix))
  334. unknown_options = []
  335. for k, v in options.items():
  336. if k == 'prefix':
  337. pass
  338. elif k in self.builtins:
  339. tgt = self.builtins[k]
  340. tgt.set_value(self.sanitize_dir_option_value(prefix, k, v))
  341. elif k in self.backend_options:
  342. tgt = self.backend_options[k]
  343. tgt.set_value(v)
  344. elif k in self.user_options:
  345. tgt = self.user_options[k]
  346. tgt.set_value(v)
  347. elif k in self.compiler_options:
  348. tgt = self.compiler_options[k]
  349. tgt.set_value(v)
  350. elif k in self.base_options:
  351. tgt = self.base_options[k]
  352. tgt.set_value(v)
  353. else:
  354. unknown_options.append(k)
  355. if unknown_options:
  356. unknown_options = ', '.join(sorted(unknown_options))
  357. sub = 'In subproject {}: '.format(subproject) if subproject else ''
  358. mlog.warning('{}Unknown options: "{}"'.format(sub, unknown_options))
  359. def load(build_dir):
  360. filename = os.path.join(build_dir, 'meson-private', 'coredata.dat')
  361. load_fail_msg = 'Coredata file {!r} is corrupted. Try with a fresh build tree.'.format(filename)
  362. try:
  363. with open(filename, 'rb') as f:
  364. obj = pickle.load(f)
  365. except pickle.UnpicklingError:
  366. raise MesonException(load_fail_msg)
  367. if not isinstance(obj, CoreData):
  368. raise MesonException(load_fail_msg)
  369. if obj.version != version:
  370. raise MesonException('Build directory has been generated with Meson version %s, which is incompatible with current version %s.\nPlease delete this build directory AND create a new one.' %
  371. (obj.version, version))
  372. return obj
  373. def save(obj, build_dir):
  374. filename = os.path.join(build_dir, 'meson-private', 'coredata.dat')
  375. prev_filename = filename + '.prev'
  376. tempfilename = filename + '~'
  377. if obj.version != version:
  378. raise MesonException('Fatal version mismatch corruption.')
  379. if os.path.exists(filename):
  380. import shutil
  381. shutil.copyfile(filename, prev_filename)
  382. with open(tempfilename, 'wb') as f:
  383. pickle.dump(obj, f)
  384. f.flush()
  385. os.fsync(f.fileno())
  386. os.replace(tempfilename, filename)
  387. return filename
  388. def get_builtin_options():
  389. return list(builtin_options.keys())
  390. def is_builtin_option(optname):
  391. return optname in get_builtin_options()
  392. def get_builtin_option_choices(optname):
  393. if is_builtin_option(optname):
  394. if builtin_options[optname][0] == UserComboOption:
  395. return builtin_options[optname][2]
  396. elif builtin_options[optname][0] == UserBooleanOption:
  397. return [True, False]
  398. elif builtin_options[optname][0] == UserFeatureOption:
  399. return UserFeatureOption.static_choices
  400. else:
  401. return None
  402. else:
  403. raise RuntimeError('Tried to get the supported values for an unknown builtin option \'%s\'.' % optname)
  404. def get_builtin_option_description(optname):
  405. if is_builtin_option(optname):
  406. return builtin_options[optname][1]
  407. else:
  408. raise RuntimeError('Tried to get the description for an unknown builtin option \'%s\'.' % optname)
  409. def get_builtin_option_action(optname):
  410. default = builtin_options[optname][2]
  411. if default is True:
  412. return 'store_false'
  413. elif default is False:
  414. return 'store_true'
  415. return None
  416. def get_builtin_option_default(optname, prefix=''):
  417. if is_builtin_option(optname):
  418. o = builtin_options[optname]
  419. if o[0] == UserComboOption:
  420. return o[3]
  421. if o[0] == UserIntegerOption:
  422. return o[4]
  423. try:
  424. return builtin_dir_noprefix_options[optname][prefix]
  425. except KeyError:
  426. pass
  427. return o[2]
  428. else:
  429. raise RuntimeError('Tried to get the default value for an unknown builtin option \'%s\'.' % optname)
  430. def get_builtin_option_cmdline_name(name):
  431. if name == 'warning_level':
  432. return '--warnlevel'
  433. else:
  434. return '--' + name.replace('_', '-')
  435. def add_builtin_argument(p, name):
  436. kwargs = {}
  437. c = get_builtin_option_choices(name)
  438. b = get_builtin_option_action(name)
  439. h = get_builtin_option_description(name)
  440. if not b:
  441. h = h.rstrip('.') + ' (default: %s).' % get_builtin_option_default(name)
  442. else:
  443. kwargs['action'] = b
  444. if c and not b:
  445. kwargs['choices'] = c
  446. kwargs['default'] = argparse.SUPPRESS
  447. kwargs['dest'] = name
  448. cmdline_name = get_builtin_option_cmdline_name(name)
  449. p.add_argument(cmdline_name, help=h, **kwargs)
  450. def register_builtin_arguments(parser):
  451. for n in builtin_options:
  452. add_builtin_argument(parser, n)
  453. parser.add_argument('-D', action='append', dest='projectoptions', default=[], metavar="option",
  454. help='Set the value of an option, can be used several times to set multiple options.')
  455. def create_options_dict(options):
  456. result = {}
  457. for o in options:
  458. try:
  459. (key, value) = o.split('=', 1)
  460. except ValueError:
  461. raise MesonException('Option {!r} must have a value separated by equals sign.'.format(o))
  462. result[key] = value
  463. return result
  464. def parse_cmd_line_options(args):
  465. args.cmd_line_options = create_options_dict(args.projectoptions)
  466. # Merge builtin options set with --option into the dict.
  467. for name in builtin_options:
  468. value = getattr(args, name, None)
  469. if value is not None:
  470. if name in args.cmd_line_options:
  471. cmdline_name = get_builtin_option_cmdline_name(name)
  472. raise MesonException(
  473. 'Got argument {0} as both -D{0} and {1}. Pick one.'.format(name, cmdline_name))
  474. args.cmd_line_options[name] = value
  475. delattr(args, name)
  476. builtin_options = {
  477. 'buildtype': [UserComboOption, 'Build type to use.', ['plain', 'debug', 'debugoptimized', 'release', 'minsize'], 'debug'],
  478. 'strip': [UserBooleanOption, 'Strip targets on install.', False],
  479. 'unity': [UserComboOption, 'Unity build.', ['on', 'off', 'subprojects'], 'off'],
  480. 'prefix': [UserStringOption, 'Installation prefix.', default_prefix()],
  481. 'libdir': [UserStringOption, 'Library directory.', default_libdir()],
  482. 'libexecdir': [UserStringOption, 'Library executable directory.', default_libexecdir()],
  483. 'bindir': [UserStringOption, 'Executable directory.', 'bin'],
  484. 'sbindir': [UserStringOption, 'System executable directory.', 'sbin'],
  485. 'includedir': [UserStringOption, 'Header file directory.', 'include'],
  486. 'datadir': [UserStringOption, 'Data file directory.', 'share'],
  487. 'mandir': [UserStringOption, 'Manual page directory.', 'share/man'],
  488. 'infodir': [UserStringOption, 'Info page directory.', 'share/info'],
  489. 'localedir': [UserStringOption, 'Locale data directory.', 'share/locale'],
  490. 'sysconfdir': [UserStringOption, 'Sysconf data directory.', 'etc'],
  491. 'localstatedir': [UserStringOption, 'Localstate data directory.', 'var'],
  492. 'sharedstatedir': [UserStringOption, 'Architecture-independent data directory.', 'com'],
  493. 'werror': [UserBooleanOption, 'Treat warnings as errors.', False],
  494. 'warning_level': [UserComboOption, 'Compiler warning level to use.', ['1', '2', '3'], '1'],
  495. 'layout': [UserComboOption, 'Build directory layout.', ['mirror', 'flat'], 'mirror'],
  496. 'default_library': [UserComboOption, 'Default library type.', ['shared', 'static', 'both'], 'shared'],
  497. 'backend': [UserComboOption, 'Backend to use.', backendlist, 'ninja'],
  498. 'stdsplit': [UserBooleanOption, 'Split stdout and stderr in test logs.', True],
  499. 'errorlogs': [UserBooleanOption, "Whether to print the logs from failing tests.", True],
  500. 'install_umask': [UserUmaskOption, 'Default umask to apply on permissions of installed files.', '022'],
  501. 'auto_features': [UserFeatureOption, "Override value of all 'auto' features.", 'auto'],
  502. }
  503. # Special prefix-dependent defaults for installation directories that reside in
  504. # a path outside of the prefix in FHS and common usage.
  505. builtin_dir_noprefix_options = {
  506. 'sysconfdir': {'/usr': '/etc'},
  507. 'localstatedir': {'/usr': '/var', '/usr/local': '/var/local'},
  508. 'sharedstatedir': {'/usr': '/var/lib', '/usr/local': '/var/local/lib'},
  509. }
  510. forbidden_target_names = {'clean': None,
  511. 'clean-ctlist': None,
  512. 'clean-gcno': None,
  513. 'clean-gcda': None,
  514. 'coverage': None,
  515. 'coverage-text': None,
  516. 'coverage-xml': None,
  517. 'coverage-html': None,
  518. 'phony': None,
  519. 'PHONY': None,
  520. 'all': None,
  521. 'test': None,
  522. 'benchmark': None,
  523. 'install': None,
  524. 'uninstall': None,
  525. 'build.ninja': None,
  526. 'scan-build': None,
  527. 'reconfigure': None,
  528. 'dist': None,
  529. 'distcheck': None,
  530. }