aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml18
-rw-r--r--README.md5
-rw-r--r--mesonbuild/backend/ninjabackend.py4
-rw-r--r--mesonbuild/build.py4
-rw-r--r--mesonbuild/compilers.py2
-rw-r--r--mesonbuild/interpreter.py50
-rw-r--r--mesonbuild/modules/i18n.py3
-rw-r--r--mesonbuild/scripts/gettext.py6
-rw-r--r--mesonbuild/scripts/meson_install.py18
-rwxr-xr-xrun_tests.py8
10 files changed, 87 insertions, 31 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..8b13401
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,18 @@
+sudo: required
+
+language: c
+
+services:
+ - docker
+
+before_install:
+ - docker pull jpakkane/mesonci:xenial
+
+# We need to copy the current checkout inside the container,
+# because it has the MR id to be tested checked out.
+
+script:
+ - echo FROM jpakkane/mesonci:xenial > Dockerfile
+ - echo ADD . /root >> Dockerfile
+ - docker build -t withgit .
+ - docker run withgit /bin/sh -c "cd /root && ./run_tests.py"
diff --git a/README.md b/README.md
index 82ee3f7..70f67a2 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,11 @@
MesonĀ® is a project to create the best possible next-generation
build system.
+####Build status
+
+<a href="https://travis-ci.org/mesonbuild/meson"><img
+src="https://travis-ci.org/mesonbuild/meson.svg?branch=master"></a>
+
####Dependencies
- [Python](http://python.org) (version 3.4 or newer)
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 44c53d6..3bec19d 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1384,7 +1384,7 @@ rule FORTRAN_DEP_HACK
def get_cross_stdlib_args(self, target, compiler):
if not target.is_cross:
return []
- if self.environment.cross_info.has_stdlib(compiler.language):
+ if not self.environment.cross_info.has_stdlib(compiler.language):
return []
return compiler.get_no_stdinc_args()
@@ -1613,6 +1613,8 @@ rule FORTRAN_DEP_HACK
linker_rule = linker_base + crstr + '_LINKER'
abspath = os.path.join(self.environment.get_build_dir(), target.subdir)
commands = []
+ if not isinstance(target, build.StaticLibrary):
+ commands += self.build.get_global_link_args(linker)
commands += self.get_cross_stdlib_link_args(target, linker)
commands += linker.get_linker_always_args()
if not isinstance(target, build.StaticLibrary):
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 9de556c..fcf1ac6 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -88,6 +88,7 @@ class Build:
self.compilers = []
self.cross_compilers = []
self.global_args = {}
+ self.global_link_args = {}
self.tests = []
self.benchmarks = []
self.headers = []
@@ -151,6 +152,9 @@ class Build:
def get_global_args(self, compiler):
return self.global_args.get(compiler.get_language(), [])
+ def get_global_link_args(self, compiler):
+ return self.global_link_args.get(compiler.get_language(), [])
+
class IncludeDirs():
def __init__(self, curdir, dirs, is_system, extra_build_dirs=None):
self.curdir = curdir
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 458a579..1fc936a 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -445,7 +445,7 @@ class CCompiler(Compiler):
ofile.close()
# Compile sanity check
cmdlist = self.exelist + extra_flags + [source_name] + self.get_output_args(binary_name)
- pc = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ pc = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=work_dir)
(stdo, stde) = pc.communicate()
stdo = stdo.decode()
stde = stde.decode()
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index f269c2f..c785e88 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1003,6 +1003,7 @@ class Interpreter():
'configure_file' : self.func_configure_file,
'include_directories' : self.func_include_directories,
'add_global_arguments' : self.func_add_global_arguments,
+ 'add_global_link_arguments' : self.func_add_global_link_arguments,
'add_languages' : self.func_add_languages,
'find_program' : self.func_find_program,
'find_library' : self.func_find_library,
@@ -1052,7 +1053,6 @@ class Interpreter():
raise InterpreterException('Tried to create target %s which already exists.' % v.name)
self.build.targets[v.name] = v
elif isinstance(v, build.InstallScript):
- print('x')
self.build.install_scripts.append(v)
elif isinstance(v, build.Data):
self.build.data.append(v)
@@ -1920,6 +1920,20 @@ class Interpreter():
else:
self.build.global_args[lang] = args
+ @stringArgs
+ def func_add_global_link_arguments(self, node, args, kwargs):
+ if self.subproject != '':
+ raise InvalidCode('Global arguments can not be set in subprojects because there is no way to make that reliable.')
+ if self.global_args_frozen:
+ raise InvalidCode('Tried to set global arguments after a build target has been declared.\nThis is not permitted. Please declare all global arguments before your targets.')
+ if not 'language' in kwargs:
+ raise InvalidCode('Missing language definition in add_global_arguments')
+ lang = kwargs['language'].lower()
+ if lang in self.build.global_link_args:
+ self.build.global_link_args[lang] += args
+ else:
+ self.build.global_link_args[lang] = args
+
def flatten(self, args):
if isinstance(args, mparser.StringNode):
return args.value
@@ -1954,6 +1968,8 @@ class Interpreter():
return results
def add_target(self, name, tobj):
+ if name == '':
+ raise InterpreterException('Target name must not be empty.')
if name in coredata.forbidden_target_names:
raise InvalidArguments('Target name "%s" is reserved for Meson\'s internal use. Please rename.'\
% name)
@@ -2080,23 +2096,23 @@ class Interpreter():
obj = self.to_native(obj)
(posargs, _) = self.reduce_arguments(args)
if method_name == 'to_string':
- if len(posargs) == 0:
- if obj == True:
- return 'true'
- else:
- return 'false'
- elif len(posargs) == 2 and isinstance(posargs[0], str) and isinstance(posargs[1], str):
- if obj == True:
- return posargs[0]
- else:
- return posargs[1]
- else:
- raise InterpreterException('bool.to_string() must have either no arguments or exactly two string arguments.')
+ if len(posargs) == 0:
+ if obj == True:
+ return 'true'
+ else:
+ return 'false'
+ elif len(posargs) == 2 and isinstance(posargs[0], str) and isinstance(posargs[1], str):
+ if obj == True:
+ return posargs[0]
+ else:
+ return posargs[1]
+ else:
+ raise InterpreterException('bool.to_string() must have either no arguments or exactly two string arguments.')
elif method_name == 'to_int':
- if obj == True:
- return 1
- else:
- return 0
+ if obj == True:
+ return 1
+ else:
+ return 0
else:
raise InterpreterException('Unknown method "%s" for a boolean.' % method_name)
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
index 51668cb..4b529c7 100644
--- a/mesonbuild/modules/i18n.py
+++ b/mesonbuild/modules/i18n.py
@@ -24,7 +24,8 @@ class I18nModule:
languages = mesonlib.stringlistify(kwargs.get('languages', []))
if len(languages) == 0:
raise coredata.MesonException('List of languages empty.')
- potargs = [state.environment.get_build_command(), '--internal', 'gettext', 'pot', packagename]
+ extra_args = mesonlib.stringlistify(kwargs.get('args', []))
+ potargs = [state.environment.get_build_command(), '--internal', 'gettext', 'pot', packagename] + extra_args
pottarget = build.RunTarget(packagename + '-pot', sys.executable, potargs, state.subdir)
gmoargs = [state.environment.get_build_command(), '--internal', 'gettext', 'gen_gmo'] + languages
gmotarget = build.RunTarget(packagename + '-gmo', sys.executable, gmoargs, state.subdir)
diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py
index adc4483..d8b2a9c 100644
--- a/mesonbuild/scripts/gettext.py
+++ b/mesonbuild/scripts/gettext.py
@@ -16,11 +16,11 @@
import os, subprocess, shutil
-def run_potgen(src_sub, pkgname, langs):
+def run_potgen(src_sub, pkgname, args):
listfile = os.path.join(src_sub, 'POTFILES')
ofile = os.path.join(src_sub, pkgname + '.pot')
- return subprocess.call(['xgettext', '--package-name=' + pkgname, '-p', src_sub, listfile,
- '-D', os.environ['MESON_SOURCE_ROOT'], '-k_', '-o', ofile])
+ return subprocess.call(['xgettext', '--package-name=' + pkgname, '-p', src_sub, '-f', listfile,
+ '-D', os.environ['MESON_SOURCE_ROOT'], '-k_', '-o', ofile] + args)
def gen_gmo(src_sub, bld_sub, langs):
for l in langs:
diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py
index 20a50f7..1065d0a 100644
--- a/mesonbuild/scripts/meson_install.py
+++ b/mesonbuild/scripts/meson_install.py
@@ -18,6 +18,13 @@ import sys, pickle, os, shutil, subprocess, gzip, platform
from glob import glob
from mesonbuild.scripts import depfixer
+def destdir_join(d1, d2):
+ # c:\destdir + c:\prefix must produce c:\destdir\prefix
+ if len(d1) > 1 and d1[1] == ':' and \
+ len(d2) > 1 and d2[1] == ':':
+ return d1 + d2[2:]
+ return d1 + d2
+
def do_install(datafilename):
ifile = open(datafilename, 'rb')
d = pickle.load(ifile)
@@ -26,7 +33,7 @@ def do_install(datafilename):
d.destdir = os.environ[destdir_var]
else:
d.destdir = ''
- d.fullprefix = d.destdir + d.prefix
+ d.fullprefix = destdir_join(d.destdir, d.prefix)
install_subdirs(d) # Must be first, because it needs to delete the old subtree.
install_targets(d)
@@ -38,7 +45,7 @@ def do_install(datafilename):
def install_subdirs(d):
for (src_dir, dst_dir) in d.install_subdirs:
if os.path.isabs(dst_dir):
- dst_dir = d.destdir + dst_dir
+ dst_dir = destdir_join(d.destdir, dst_dir)
else:
dst_dir = d.fullprefix + dst_dir
# Python's copytree works in strange ways.
@@ -55,8 +62,8 @@ def install_data(d):
fullfilename = i[0]
outfilename = i[1]
if os.path.isabs(outfilename):
- outdir = d.destdir + os.path.split(outfilename)[0]
- outfilename = d.destdir + outfilename
+ outdir = destdir_join(d.destdir, os.path.split(outfilename)[0])
+ outfilename = destdir_join(d.destdir, outfilename)
else:
outdir = os.path.join(d.fullprefix, os.path.split(outfilename)[0])
outfilename = os.path.join(outdir, os.path.split(outfilename)[1])
@@ -103,7 +110,7 @@ def run_install_script(d):
print('Running custom install script %s' % script)
suffix = os.path.splitext(script)[1].lower()
if platform.system().lower() == 'windows' and suffix != '.bat':
- first_line = open(script).readline().strip()
+ first_line = open(script, encoding='latin_1', errors='ignore').readline().strip()
if first_line.startswith('#!'):
if shutil.which(first_line[2:]):
commands = [first_line[2:]]
@@ -111,7 +118,6 @@ def run_install_script(d):
commands = first_line[2:].split('#')[0].strip().split()
commands[0] = shutil.which(commands[0].split('/')[-1])
if commands[0] is None:
- commands
raise RuntimeError("Don't know how to run script %s." % script)
final_command = commands + [script] + i.cmd_arr[1:]
else:
diff --git a/run_tests.py b/run_tests.py
index ad2450e..1317380 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -157,7 +157,7 @@ def validate_install(srcdir, installdir):
return ''
def log_text_file(logfile, testdir, stdo, stde):
- global stop
+ global stop, executor, futures
logfile.write('%s\nstdout\n\n---\n' % testdir)
logfile.write(stdo)
logfile.write('\n\n---\n\nstderr\n\n---\n')
@@ -167,6 +167,10 @@ def log_text_file(logfile, testdir, stdo, stde):
print(stdo)
print(stde, file=sys.stderr)
if stop:
+ print("Aborting..")
+ for f in futures:
+ f[2].cancel()
+ executor.shutdown()
raise StopException()
def run_configure_inprocess(commandlist):
@@ -300,7 +304,7 @@ def detect_tests_to_run():
return all_tests
def run_tests(extra_args):
- global passing_tests, failing_tests, stop
+ global passing_tests, failing_tests, stop, executor, futures
all_tests = detect_tests_to_run()
logfile = open('meson-test-run.txt', 'w', encoding="utf_8")
junit_root = ET.Element('testsuites')