aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Creating-OSX-packages.md6
-rw-r--r--docs/markdown/Reference-manual.md2
-rw-r--r--mesonbuild/backend/backends.py9
-rw-r--r--mesonbuild/backend/ninjabackend.py8
-rw-r--r--mesonbuild/coredata.py8
-rw-r--r--mesonbuild/interpreter.py2
-rw-r--r--mesonbuild/mconf.py21
-rw-r--r--mesonbuild/mesonmain.py4
-rw-r--r--mesonbuild/msetup.py5
-rw-r--r--mesonbuild/munstable_coredata.py126
-rw-r--r--test cases/common/97 test workdir/meson.build2
-rwxr-xr-xtest cases/common/97 test workdir/subdir/checker.py5
-rw-r--r--test cases/common/97 test workdir/subdir/meson.build4
13 files changed, 178 insertions, 24 deletions
diff --git a/docs/markdown/Creating-OSX-packages.md b/docs/markdown/Creating-OSX-packages.md
index 14b2af8..bda06a3 100644
--- a/docs/markdown/Creating-OSX-packages.md
+++ b/docs/markdown/Creating-OSX-packages.md
@@ -53,10 +53,8 @@ install_data('Info.plist', install_dir : 'Contents')
```
The format of `Info.plist` can be found in the link or the sample
-project linked above. Be careful, the sample code on the linked page
-is malformed, it is missing a less than character (<) before
-`!DOCTYPE`. The simplest way to get an icon in the `icns` format is to
-save your image as a tiff an then use the `tiff2icns` helper
+project linked above. The simplest way to get an icon in the `icns`
+format is to save your image as a tiff an then use the `tiff2icns` helper
application that comes with XCode.
Some applications assume that the working directory of the app process
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 0ddd4a9..1e0a11c 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -565,6 +565,8 @@ be passed to [shared and static libraries](#library).
- `d_module_versions` list of module version identifiers set when compiling D sources
- `d_debug` list of module debug identifiers set when compiling D sources
- `pie` *(added 0.49.0)* build a position-independent executable
+- `native`, is a boolean controlling whether the target is compiled for the
+ build or host machines. Defaults to false, building for the host machine.
The list of `sources`, `objects`, and `dependencies` is always
flattened, which means you can freely nest and add lists while
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 39aa365..0637905 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -725,7 +725,7 @@ class Backend:
elif isinstance(a, str):
cmd_args.append(a)
elif isinstance(a, build.Target):
- cmd_args.append(self.get_target_filename(a))
+ cmd_args.append(self.construct_target_rel_path(a, t.workdir))
else:
raise MesonException('Bad object in test command.')
ts = TestSerialisation(t.get_name(), t.project_name, t.suite, cmd, is_cross,
@@ -737,6 +737,13 @@ class Backend:
def write_test_serialisation(self, tests, datafile):
pickle.dump(self.create_test_serialisation(tests), datafile)
+ def construct_target_rel_path(self, a, workdir):
+ if workdir is None:
+ return self.get_target_filename(a)
+ assert(os.path.isabs(workdir))
+ abs_path = self.get_target_filename_abs(a)
+ return os.path.relpath(abs_path, workdir)
+
def generate_depmf_install(self, d):
if self.build.dep_manifest_name is None:
return
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 3688f29..debb4fb 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1473,7 +1473,7 @@ int dummy;
command_template = ' command = {executable} $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing\n'
command = command_template.format(
executable=' '.join(compiler.get_linker_exelist()),
- cross_args=' '.join(cross_args),
+ cross_args=' '.join([quote_func(i) for i in cross_args]),
output_args=' '.join(compiler.get_linker_output_args('$out'))
)
description = ' description = Linking target $out.\n'
@@ -1601,7 +1601,7 @@ rule FORTRAN_DEP_HACK%s
command_template = ' command = {executable} $ARGS {cross_args} {output_args} {compile_only_args} $in\n'
command = command_template.format(
executable=' '.join([ninja_quote(i) for i in compiler.get_exelist()]),
- cross_args=' '.join(compiler.get_cross_extra_flags(self.environment, False)) if is_cross else '',
+ cross_args=' '.join([quote_func(i) for i in compiler.get_cross_extra_flags(self.environment, False)]) if is_cross else '',
output_args=' '.join(compiler.get_output_args('$out')),
compile_only_args=' '.join(compiler.get_compile_only_args())
)
@@ -1659,7 +1659,7 @@ rule FORTRAN_DEP_HACK%s
command_template = ' command = {executable} $ARGS {cross_args} {dep_args} {output_args} {compile_only_args} $in\n'
command = command_template.format(
executable=' '.join([ninja_quote(i) for i in compiler.get_exelist()]),
- cross_args=' '.join(cross_args),
+ cross_args=' '.join([quote_func(i) for i in cross_args]),
dep_args=' '.join(quoted_depargs),
output_args=' '.join(compiler.get_output_args('$out')),
compile_only_args=' '.join(compiler.get_compile_only_args())
@@ -1703,7 +1703,7 @@ rule FORTRAN_DEP_HACK%s
output = ' '.join(compiler.get_output_args('$out'))
command = " command = {executable} $ARGS {cross_args} {dep_args} {output_args} {compile_only_args} $in\n".format(
executable=' '.join(compiler.get_exelist()),
- cross_args=' '.join(cross_args),
+ cross_args=' '.join([quote_func(i) for i in cross_args]),
dep_args=' '.join(quoted_depargs),
output_args=output,
compile_only_args=' '.join(compiler.get_compile_only_args())
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 6262011..8c9d513 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -43,6 +43,9 @@ class UserOption:
raise MesonException('Value of "yielding" must be a boolean.')
self.yielding = yielding
+ def printable_value(self):
+ return self.value
+
# Check that the input is a valid value and return the
# "cleaned" or "native" version. For example the Boolean
# option could take the string "true" and return True.
@@ -114,6 +117,11 @@ class UserUmaskOption(UserIntegerOption):
super().__init__(name, description, 0, 0o777, value, yielding)
self.choices = ['preserve', '0000-0777']
+ def printable_value(self):
+ if self.value == 'preserve':
+ return self.value
+ return format(self.value, '04o')
+
def validate_value(self, value):
if value is None or value == 'preserve':
return 'preserve'
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 07af41d..9ebce70 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2034,7 +2034,7 @@ class Interpreter(InterpreterBase):
for cur_opt_name, cur_opt_value in option_type.items():
if (def_opt_name == cur_opt_name and
def_opt_value != cur_opt_value.value):
- yield (def_opt_name, def_opt_value, cur_opt_value.value)
+ yield (def_opt_name, def_opt_value, cur_opt_value)
def build_func_dict(self):
self.funcs.update({'add_global_arguments': self.func_add_global_arguments,
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index 59ecfcb..b8fb3c6 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -23,6 +23,15 @@ def add_arguments(parser):
help='Clear cached state (e.g. found dependencies)')
+def make_lower_case(val):
+ if isinstance(val, bool):
+ return str(val).lower()
+ elif isinstance(val, list):
+ return [make_lower_case(i) for i in val]
+ else:
+ return str(val)
+
+
class ConfException(mesonlib.MesonException):
pass
@@ -50,14 +59,6 @@ class Conf:
@staticmethod
def print_aligned(arr):
- def make_lower_case(val):
- if isinstance(val, bool):
- return str(val).lower()
- elif isinstance(val, list):
- return [make_lower_case(i) for i in val]
- else:
- return str(val)
-
if not arr:
return
@@ -104,10 +105,8 @@ class Conf:
for k in sorted(options):
o = options[k]
d = o.description
- v = o.value
+ v = o.printable_value()
c = o.choices
- if isinstance(o, coredata.UserUmaskOption):
- v = v if isinstance(v, str) else format(v, '04o')
arr.append({'name': k, 'descr': d, 'value': v, 'choices': c})
self.print_aligned(arr)
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index c11d044..7236d1a 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -20,7 +20,7 @@ import argparse
from . import mesonlib
from . import mlog
-from . import mconf, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects
+from . import mconf, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata
from .mesonlib import MesonException
from .environment import detect_msys2_arch
from .wrap import wraptool
@@ -57,6 +57,8 @@ class CommandLineParser:
help=argparse.SUPPRESS)
self.add_command('runpython', self.add_runpython_arguments, self.run_runpython_command,
help=argparse.SUPPRESS)
+ self.add_command('unstable-coredata', munstable_coredata.add_arguments, munstable_coredata.run,
+ help=argparse.SUPPRESS)
def add_command(self, name, add_arguments_func, run_func, help):
# FIXME: Cannot have hidden subparser:
diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py
index da7fce1..023afdb 100644
--- a/mesonbuild/msetup.py
+++ b/mesonbuild/msetup.py
@@ -24,6 +24,7 @@ from . import environment, interpreter, mesonlib
from . import build
from . import mlog, coredata
from . import mintro
+from .mconf import make_lower_case
from .mesonlib import MesonException
def add_arguments(parser):
@@ -196,8 +197,8 @@ class MesonApp:
# Print all default option values that don't match the current value
for def_opt_name, def_opt_value, cur_opt_value in intr.get_non_matching_default_options():
mlog.log('Option', mlog.bold(def_opt_name), 'is:',
- mlog.bold(str(cur_opt_value)),
- '[default: {}]'.format(str(def_opt_value)))
+ mlog.bold(make_lower_case(cur_opt_value.printable_value())),
+ '[default: {}]'.format(make_lower_case(def_opt_value)))
try:
dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat')
# We would like to write coredata as late as possible since we use the existence of
diff --git a/mesonbuild/munstable_coredata.py b/mesonbuild/munstable_coredata.py
new file mode 100644
index 0000000..78f3f34
--- /dev/null
+++ b/mesonbuild/munstable_coredata.py
@@ -0,0 +1,126 @@
+# Copyright 2019 The Meson development team
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+from . import coredata as cdata
+
+import os.path
+import pprint
+import textwrap
+
+def add_arguments(parser):
+ parser.add_argument('--all', action='store_true', dest='all', default=False,
+ help='Show data not used by current backend.')
+
+ parser.add_argument('builddir', nargs='?', default='.', help='The build directory')
+
+
+def dump_compilers(compilers):
+ for lang, compiler in compilers.items():
+ print(' ' + lang + ':')
+ print(' Id: ' + compiler.id)
+ print(' Command: ' + ' '.join(compiler.exelist))
+ print(' Full version: ' + compiler.full_version)
+ print(' Detected version: ' + compiler.version)
+ print(' Detected type: ' + repr(compiler.compiler_type))
+ #pprint.pprint(compiler.__dict__)
+
+
+def dump_guids(d):
+ for name, value in d.items():
+ print(' ' + name + ': ' + value)
+
+
+def run(options):
+ datadir = 'meson-private'
+ if options.builddir is not None:
+ datadir = os.path.join(options.builddir, datadir)
+ if not os.path.isdir(datadir):
+ print('Current directory is not a build dir. Please specify it or '
+ 'change the working directory to it.')
+ return 1
+
+ all = options.all
+
+ print('This is a dump of the internal unstable cache of meson. This is for debugging only.')
+ print('Do NOT parse, this will change from version to version in incompatible ways')
+ print('')
+
+ coredata = cdata.load(options.builddir)
+ backend = coredata.get_builtin_option('backend')
+ for k, v in sorted(coredata.__dict__.items()):
+ if k in ('backend_options', 'base_options', 'builtins', 'compiler_options', 'user_options'):
+ # use `meson configure` to view these
+ pass
+ elif k in ['install_guid', 'test_guid', 'regen_guid']:
+ if all or backend.startswith('vs'):
+ print(k + ': ' + v)
+ elif k == 'target_guids':
+ if all or backend.startswith('vs'):
+ print(k + ':')
+ dump_guids(v)
+ elif k in ['lang_guids']:
+ if all or backend.startswith('vs') or backend == 'xcode':
+ print(k + ':')
+ dump_guids(v)
+ elif k == 'meson_command':
+ if all or backend.startswith('vs'):
+ print('Meson command used in build file regeneration: ' + ' '.join(v))
+ elif k == 'pkgconf_envvar':
+ print('Last seen PKGCONFIG enviroment variable value: ' + v)
+ elif k == 'version':
+ print('Meson version: ' + v)
+ elif k == 'cross_file':
+ print('Cross File: ' + (v or 'None'))
+ elif k == 'config_files':
+ if v:
+ print('Native File: ' + ' '.join(v))
+ elif k == 'compilers':
+ print('Cached native compilers:')
+ dump_compilers(v)
+ elif k == 'cross_compilers':
+ print('Cached cross compilers:')
+ dump_compilers(v)
+ elif k == 'deps':
+ native = []
+ cross = []
+ for dep_key, dep in sorted(v.items()):
+ if dep_key[2]:
+ cross.append((dep_key, dep))
+ else:
+ native.append((dep_key, dep))
+
+ def print_dep(dep_key, dep):
+ print(' ' + dep_key[0] + ": ")
+ print(' compile args: ' + repr(dep.get_compile_args()))
+ print(' link args: ' + repr(dep.get_link_args()))
+ if dep.get_sources():
+ print(' sources: ' + repr(dep.get_sources()))
+ print(' version: ' + repr(dep.get_version()))
+
+ if native:
+ print('Cached native dependencies:')
+ for dep_key, dep in native:
+ print_dep(dep_key, dep)
+ if cross:
+ print('Cached dependencies:')
+ for dep_key, dep in cross:
+ print_dep(dep_key, dep)
+ elif k == 'external_preprocess_args':
+ for lang, opts in v.items():
+ if opts:
+ print('Preprocessor args for ' + lang + ': ' + ' '.join(opts))
+ else:
+ print(k + ':')
+ print(textwrap.indent(pprint.pformat(v), ' '))
diff --git a/test cases/common/97 test workdir/meson.build b/test cases/common/97 test workdir/meson.build
index 1323a17..a8290f7 100644
--- a/test cases/common/97 test workdir/meson.build
+++ b/test cases/common/97 test workdir/meson.build
@@ -4,3 +4,5 @@ exe = executable('opener', 'opener.c')
test('basic', exe, workdir : meson.source_root())
test('shouldfail', exe, should_fail : true)
+
+subdir('subdir')
diff --git a/test cases/common/97 test workdir/subdir/checker.py b/test cases/common/97 test workdir/subdir/checker.py
new file mode 100755
index 0000000..66e287d
--- /dev/null
+++ b/test cases/common/97 test workdir/subdir/checker.py
@@ -0,0 +1,5 @@
+#!/usr/bin/env python3
+
+import sys
+
+data = open(sys.argv[1], 'rb').read()
diff --git a/test cases/common/97 test workdir/subdir/meson.build b/test cases/common/97 test workdir/subdir/meson.build
new file mode 100644
index 0000000..687a1cf
--- /dev/null
+++ b/test cases/common/97 test workdir/subdir/meson.build
@@ -0,0 +1,4 @@
+exe2 = executable('dummy', '../opener.c')
+test('subdir', find_program('checker.py'),
+ workdir : meson.source_root(),
+ args: [exe2])