aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authors.txt1
-rw-r--r--mesonbuild/backend/ninjabackend.py63
-rw-r--r--mesonbuild/build.py1
-rw-r--r--mesonbuild/compilers.py129
-rw-r--r--mesonbuild/coredata.py1
-rw-r--r--mesonbuild/interpreter.py17
-rw-r--r--mesonbuild/mesonmain.py6
-rw-r--r--mesonbuild/modules/gnome.py10
-rw-r--r--mesonbuild/modules/i18n.py44
-rw-r--r--mesonbuild/scripts/gettext.py65
-rw-r--r--mesonbuild/scripts/gtkdochelper.py12
-rw-r--r--mesonbuild/scripts/meson_install.py14
-rw-r--r--mesonbuild/scripts/scanbuild.py39
-rw-r--r--test cases/common/42 string formatting/meson.build4
-rw-r--r--test cases/frameworks/10 gtk-doc/doc/meson.build2
-rw-r--r--test cases/frameworks/10 gtk-doc/meson.build4
-rw-r--r--test cases/frameworks/6 gettext/meson.build2
-rw-r--r--test cases/frameworks/6 gettext/po/intltest.pot4
-rw-r--r--test cases/frameworks/6 gettext/po/meson.build3
19 files changed, 244 insertions, 177 deletions
diff --git a/authors.txt b/authors.txt
index d8b0abc..d628368 100644
--- a/authors.txt
+++ b/authors.txt
@@ -33,3 +33,4 @@ Nicolas Schneider
Luke Adams
Rogiel Sulzbach
Tim-Philipp Müller
+Emmanuele Bassi
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index c299a5c..bd6f4db 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -176,9 +176,6 @@ int dummy;
self.generate_phony(outfile)
outfile.write('# Build rules for targets\n\n')
[self.generate_target(t, outfile) for t in self.build.get_targets().values()]
- if len(self.build.pot) > 0:
- outfile.write('# Build rules for localisation.\n\n')
- self.generate_po(outfile)
outfile.write('# Test rules\n\n')
self.generate_tests(outfile)
outfile.write('# Install rules\n\n')
@@ -188,6 +185,7 @@ int dummy;
outfile.write('# Coverage rules\n\n')
self.generate_coverage_rules(outfile)
outfile.write('# Suffix\n\n')
+ self.generate_utils(outfile)
self.generate_ending(outfile)
# Only ovewrite the old build file after the new one has been
# fully created.
@@ -427,24 +425,6 @@ int dummy;
elem.write(outfile)
self.processed_targets[target.name + target.type_suffix()] = True
- def generate_po(self, outfile):
- for p in self.build.pot:
- (packagename, languages, subdir) = p
- input_file = os.path.join(subdir, 'POTFILES')
- elem = NinjaBuildElement(self.all_outputs, 'pot', 'GEN_POT', [])
- elem.add_item('PACKAGENAME', packagename)
- elem.add_item('OUTFILE', packagename + '.pot')
- elem.add_item('FILELIST', os.path.join(self.environment.get_source_dir(), input_file))
- elem.add_item('OUTDIR', os.path.join(self.environment.get_source_dir(), subdir))
- elem.write(outfile)
- for l in languages:
- infile = os.path.join(self.environment.get_source_dir(), subdir, l + '.po')
- outfilename = os.path.join(subdir, l + '.gmo')
- lelem = NinjaBuildElement(self.all_outputs, outfilename, 'GEN_GMO', infile)
- lelem.add_item('INFILE', infile)
- lelem.add_item('OUTFILE', outfilename)
- lelem.write(outfile)
-
def generate_coverage_rules(self, outfile):
(gcovr_exe, lcov_exe, genhtml_exe) = environment.find_coverage_tools()
added_rule = False
@@ -495,7 +475,6 @@ int dummy;
self.generate_header_install(d)
self.generate_man_install(d)
self.generate_data_install(d)
- self.generate_po_install(d, elem)
self.generate_custom_install_script(d)
self.generate_subdir_install(d)
elem.write(outfile)
@@ -503,17 +482,6 @@ int dummy;
ofile = open(install_data_file, 'wb')
pickle.dump(d, ofile)
- def generate_po_install(self, d, elem):
- for p in self.build.pot:
- (package_name, languages, subdir) = p
- # FIXME: assumes only one po package per source
- d.po_package_name = package_name
- for lang in languages:
- rel_src = os.path.join(subdir, lang + '.gmo')
- src_file = os.path.join(self.environment.get_build_dir(), rel_src)
- d.po.append((src_file, self.environment.coredata.get_builtin_option('localedir'), lang))
- elem.add_dep(rel_src)
-
def generate_target_install(self, d):
libdir = self.environment.get_libdir()
bindir = self.environment.get_bindir()
@@ -657,25 +625,6 @@ int dummy;
outfile.write(" command = %s %s %s %s %s %s --backend ninja\n" % c)
outfile.write(' description = Regenerating build files\n')
outfile.write(' generator = 1\n\n')
- if len(self.build.pot) > 0:
- self.generate_gettext_rules(outfile)
- outfile.write('\n')
-
- def generate_gettext_rules(self, outfile):
- rule = 'rule GEN_POT\n'
- command = " command = xgettext --package-name=$PACKAGENAME -p $OUTDIR -f $FILELIST -D '%s' -k_ -o $OUTFILE\n" % \
- self.environment.get_source_dir()
- desc = " description = Creating pot file for package $PACKAGENAME.\n"
- outfile.write(rule)
- outfile.write(command)
- outfile.write(desc)
- outfile.write('\n')
- rule = 'rule GEN_GMO\n'
- command = ' command = msgfmt $INFILE -o $OUTFILE\n'
- desc = ' description = Generating gmo file $OUTFILE\n'
- outfile.write(rule)
- outfile.write(command)
- outfile.write(desc)
outfile.write('\n')
def generate_phony(self, outfile):
@@ -1797,6 +1746,16 @@ rule FORTRAN_DEP_HACK
other_deps.append(outfilename)
return (src_deps, other_deps)
+ # For things like scan-build and other helper tools we might have.
+ def generate_utils(self, outfile):
+ cmd = [sys.executable, self.environment.get_build_command(),
+ '--internal', 'scanbuild', self.environment.source_dir, self.environment.build_dir,
+ sys.executable, self.environment.get_build_command()]
+ elem = NinjaBuildElement(self.all_outputs, 'scan-build', 'CUSTOM_COMMAND', 'PHONY')
+ elem.add_item('COMMAND', cmd)
+ elem.add_item('pool', 'console')
+ elem.write(outfile)
+
def generate_ending(self, outfile):
targetlist = [self.get_target_filename(t) for t in self.build.get_targets().values()\
if not isinstance(t, build.RunTarget)]
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 105fb0b..1e9a1bb 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -95,7 +95,6 @@ class Build:
self.data = []
self.static_linker = None
self.static_cross_linker = None
- self.pot = []
self.subprojects = {}
self.install_scripts = []
self.postconf_scripts = []
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 492b790..27a49a7 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -414,29 +414,31 @@ class CCompiler(Compiler):
def get_linker_search_args(self, dirname):
return ['-L'+dirname]
- def sanity_check(self, work_dir):
- mlog.debug('Sanity testing C compiler:', ' '.join(self.exelist))
+ def sanity_check_impl(self, work_dir, sname, code):
+ mlog.debug('Sanity testing ' + self.language + ' compiler:', ' '.join(self.exelist))
mlog.debug('Is cross compiler: %s.' % str(self.is_cross))
- source_name = os.path.join(work_dir, 'sanitycheckc.c')
+ extra_flags = []
+ source_name = os.path.join(work_dir, sname)
+ binname = sname.rsplit('.', 1)[0]
if self.is_cross:
- binname = 'sanitycheckc_cross'
- else:
- binname = 'sanitycheckc'
+ binname += '_cross'
+ if self.exe_wrapper is None:
+ # Linking cross built apps is painful. You can't really
+ # tell if you should use -nostdlib or not and for example
+ # on OSX the compiler binary is the same but you need
+ # a ton of compiler flags to differentiate between
+ # arm and x86_64. So just compile.
+ extra_flags = self.get_compile_only_args()
+ # Is a valid executable output for all toolchains and platforms
+ binname += '.exe'
+ # Write binary check source
binary_name = os.path.join(work_dir, binname)
ofile = open(source_name, 'w')
- ofile.write('int main(int argc, char **argv) { int class=0; return class; }\n')
+ ofile.write(code)
ofile.close()
- if self.is_cross and self.exe_wrapper is None:
- # Linking cross built apps is painful. You can't really
- # tell if you should use -nostdlib or not and for example
- # on OSX the compiler binary is the same but you need
- # a ton of compiler flags to differentiate between
- # arm and x86_64. So just compile.
- extra_flags = ['-c']
- else:
- extra_flags = []
- cmdlist = self.exelist + extra_flags + [source_name, '-o', binary_name]
+ # 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)
(stdo, stde) = pc.communicate()
stdo = stdo.decode()
@@ -448,7 +450,8 @@ class CCompiler(Compiler):
mlog.debug(stde)
mlog.debug('-----')
if pc.returncode != 0:
- raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())
+ raise EnvironmentException('Compiler {0} can not compile programs.'.format(self.name_string()))
+ # Run sanity check
if self.is_cross:
if self.exe_wrapper is None:
# Can't check if the binaries run so we have to assume they do
@@ -460,7 +463,11 @@ class CCompiler(Compiler):
pe = subprocess.Popen(cmdlist)
pe.wait()
if pe.returncode != 0:
- raise EnvironmentException('Executables created by C compiler %s are not runnable.' % self.name_string())
+ raise EnvironmentException('Executables created by {0} compiler {1} are not runnable.'.format(self.language, self.name_string()))
+
+ def sanity_check(self, work_dir):
+ code = 'int main(int argc, char **argv) { int class=0; return class; }\n'
+ return self.sanity_check_impl(work_dir, 'sanitycheckc.c', code)
def has_header(self, hname, extra_args=[]):
templ = '''#include<%s>
@@ -692,6 +699,7 @@ int main(int argc, char **argv) {
# Then, undef the symbol to get rid of it completely.
templ = '''
#define {1} meson_disable_define_of_{1}
+ #include <limits.h>
{0}
#undef {1}
'''
@@ -709,6 +717,8 @@ int main(int argc, char **argv) {
# glibc defines functions that are not available on Linux as stubs that
# fail with ENOSYS (such as e.g. lchmod). In this case we want to fail
# instead of detecting the stub as a valid symbol.
+ # We always include limits.h above to ensure that these are defined for
+ # stub functions.
stubs_fail = '''
#if defined __stub_{1} || defined __stub___{1}
fail fail fail this function is not going to work
@@ -808,42 +818,8 @@ class CPPCompiler(CCompiler):
return False
def sanity_check(self, work_dir):
- source_name = os.path.join(work_dir, 'sanitycheckcpp.cc')
- binary_name = os.path.join(work_dir, 'sanitycheckcpp')
- ofile = open(source_name, 'w')
- ofile.write('class breakCCompiler;int main(int argc, char **argv) { return 0; }\n')
- ofile.close()
- if self.is_cross and self.exe_wrapper is None:
- # Skipping link because of the same reason as for C.
- # The comment in CCompiler explains why this is done.
- extra_flags = ['-c']
- else:
- extra_flags = []
- cmdlist = self.exelist + extra_flags + [source_name, '-o', binary_name]
- pc = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- (stdo, stde) = pc.communicate()
- stdo = stdo.decode()
- stde = stde.decode()
- mlog.debug('Sanity check compiler command line:', ' '.join(cmdlist))
- mlog.debug('Sanity check compile stdout:')
- mlog.debug(stdo)
- mlog.debug('-----\nSanity check compile stderr:')
- mlog.debug(stde)
- mlog.debug('-----')
- pc.wait()
- if pc.returncode != 0:
- raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())
- if self.is_cross:
- if self.exe_wrapper is None:
- # Can't check if the binaries run so we have to assume they do
- return
- cmdlist = self.exe_wrapper + [binary_name]
- else:
- cmdlist = [binary_name]
- pe = subprocess.Popen(cmdlist)
- pe.wait()
- if pe.returncode != 0:
- raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string())
+ code = 'class breakCCompiler;int main(int argc, char **argv) { return 0; }\n'
+ return self.sanity_check_impl(work_dir, 'sanitycheckcpp.cc', code)
class ObjCCompiler(CCompiler):
def __init__(self, exelist, version, is_cross, exe_wrap):
@@ -1386,24 +1362,6 @@ class VisualStudioCCompiler(CCompiler):
objname = os.path.splitext(pchname)[0] + '.obj'
return (objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname ])
- def sanity_check(self, work_dir):
- source_name = 'sanitycheckc.c'
- binary_name = 'sanitycheckc'
- ofile = open(os.path.join(work_dir, source_name), 'w')
- ofile.write('int main(int argc, char **argv) { return 0; }\n')
- ofile.close()
- pc = subprocess.Popen(self.exelist + [source_name, '/Fe' + binary_name],
- stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL,
- cwd=work_dir)
- pc.wait()
- if pc.returncode != 0:
- raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())
- pe = subprocess.Popen(os.path.join(work_dir, binary_name))
- pe.wait()
- if pe.returncode != 0:
- raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string())
-
def build_rpath_args(self, build_dir, rpath_paths, install_rpath):
return []
@@ -1468,24 +1426,6 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler):
return True
return False
- def sanity_check(self, work_dir):
- source_name = 'sanitycheckcpp.cpp'
- binary_name = 'sanitycheckcpp'
- ofile = open(os.path.join(work_dir, source_name), 'w')
- ofile.write('class BreakPlainC;int main(int argc, char **argv) { return 0; }\n')
- ofile.close()
- pc = subprocess.Popen(self.exelist + [source_name, '/Fe' + binary_name],
- stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL,
- cwd=work_dir)
- pc.wait()
- if pc.returncode != 0:
- raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())
- pe = subprocess.Popen(os.path.join(work_dir, binary_name))
- pe.wait()
- if pe.returncode != 0:
- raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string())
-
def get_options(self):
return {'cpp_eh' : coredata.UserComboOption('cpp_eh',
'C++ exception handling type.',
@@ -1742,7 +1682,10 @@ class GnuCPPCompiler(CPPCompiler):
def get_options(self):
opts = {'cpp_std' : coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none', 'c++03', 'c++11', 'c++14'],
- 'none')}
+ 'none'),
+ 'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
+ 'STL debug mode',
+ False)}
if self.gcc_type == GCC_MINGW:
opts.update({
'cpp_winlibs': coredata.UserStringArrayOption('c_winlibs', 'Standard Win libraries to link against',
@@ -1755,6 +1698,8 @@ class GnuCPPCompiler(CPPCompiler):
std = options['cpp_std']
if std.value != 'none':
args.append('-std=' + std.value)
+ if options['cpp_debugstl'].value:
+ args.append('-D_GLIBCXX_DEBUG=1')
return args
def get_option_link_args(self, options):
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 39e0da6..8227340 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -229,4 +229,5 @@ forbidden_target_names = {'clean': None,
'benchmark': None,
'install': None,
'build.ninja': None,
+ 'scan-build': None,
}
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index aeebaf0..fb3e601 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1052,6 +1052,7 @@ 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)
@@ -1285,15 +1286,7 @@ class Interpreter():
@stringArgs
def func_gettext(self, nodes, args, kwargs):
- if len(args) != 1:
- raise InterpreterException('Gettext requires one positional argument (package name).')
- packagename = args[0]
- languages = kwargs.get('languages', None)
- check_stringlist(languages, 'Argument languages must be a list of strings.')
- # TODO: check that elements are strings
- if len(self.build.pot) > 0:
- raise InterpreterException('More than one gettext definition currently not supported.')
- self.build.pot.append((packagename, languages, self.subdir))
+ raise InterpreterException('Gettext() function has been moved to module i18n. Import it and use i18n.gettext() instead')
def func_option(self, nodes, args, kwargs):
raise InterpreterException('Tried to call option() in build description file. All options must be in the option file.')
@@ -2109,6 +2102,12 @@ class Interpreter():
return int(obj)
except Exception:
raise InterpreterException('String can not be converted to int: ' + obj)
+ elif method_name == 'join':
+ if len(posargs) != 1:
+ raise InterpreterException('Join() takes exactly one argument.')
+ strlist = posargs[0]
+ check_stringlist(strlist)
+ return obj.join(strlist)
raise InterpreterException('Unknown method "%s" for a string.' % method_name)
def to_native(self, arg):
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 052c178..4f8314c 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -196,9 +196,15 @@ def run_script_command(args):
elif cmdname == 'symbolextractor':
import mesonbuild.scripts.symbolextractor as abc
cmdfunc = abc.run
+ elif cmdname == 'scanbuild':
+ import mesonbuild.scripts.scanbuild as abc
+ cmdfunc = abc.run
elif cmdname == 'vcstagger':
import mesonbuild.scripts.vcstagger as abc
cmdfunc = abc.run
+ elif cmdname == 'gettext':
+ import mesonbuild.scripts.gettext as abc
+ cmdfunc = abc.run
else:
raise MesonException('Unknown internal command {}.'.format(cmdname))
return cmdfunc(cmdargs)
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 39a6ff7..2c37655 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -289,11 +289,21 @@ class GnomeModule:
'--modulename=' + modulename]
args += self.unpack_args('--htmlargs=', 'html_args', kwargs)
args += self.unpack_args('--scanargs=', 'scan_args', kwargs)
+ args += self.unpack_args('--fixxrefargs=', 'fixxref_args', kwargs)
res = [build.RunTarget(targetname, command[0], command[1:] + args, state.subdir)]
if kwargs.get('install', True):
res.append(build.InstallScript(command + args))
return res
+ def gtkdoc_html_dir(self, state, args, kwarga):
+ if len(args) != 1:
+ raise MesonException('Must have exactly one argument.')
+ modulename = args[0]
+ if not isinstance(modulename, str):
+ raise MesonException('Argument must be a string')
+ return os.path.join('share/gtkdoc/html', modulename)
+
+
def unpack_args(self, arg, kwarg_name, kwargs):
try:
new_args = kwargs[kwarg_name]
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
new file mode 100644
index 0000000..51668cb
--- /dev/null
+++ b/mesonbuild/modules/i18n.py
@@ -0,0 +1,44 @@
+# Copyright 2016 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, mesonlib, build
+import sys
+
+class I18nModule:
+
+ def gettext(self, state, args, kwargs):
+ if len(args) != 1:
+ raise coredata.MesonException('Gettext requires one positional argument (package name).')
+ packagename = args[0]
+ 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]
+ 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)
+ installcmd = [sys.executable,
+ state.environment.get_build_command(),
+ '--internal',
+ 'gettext',
+ 'install',
+ state.subdir,
+ packagename,
+ state.environment.coredata.get_builtin_option('localedir'),
+ ] + languages
+ iscript = build.InstallScript(installcmd)
+ return [pottarget, gmotarget, iscript]
+
+def initialize():
+ return I18nModule()
diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py
new file mode 100644
index 0000000..adc4483
--- /dev/null
+++ b/mesonbuild/scripts/gettext.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+
+# Copyright 2016 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.
+
+import os, subprocess, shutil
+
+def run_potgen(src_sub, pkgname, langs):
+ 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])
+
+def gen_gmo(src_sub, bld_sub, langs):
+ for l in langs:
+ subprocess.check_call(['msgfmt', os.path.join(src_sub, l + '.po'),
+ '-o', os.path.join(bld_sub, l + '.gmo')])
+ return 0
+
+def do_install(src_sub, bld_sub, dest, pkgname, langs):
+ for l in langs:
+ srcfile = os.path.join(bld_sub, l + '.gmo')
+ outfile = os.path.join(dest, l, 'LC_MESSAGES',
+ pkgname + '.mo')
+ os.makedirs(os.path.split(outfile)[0], exist_ok=True)
+ shutil.copyfile(srcfile, outfile)
+ shutil.copystat(srcfile, outfile)
+ print('Installing %s to %s.' % (srcfile, outfile))
+ return 0
+
+def run(args):
+ subcmd = args[0]
+ if subcmd == 'pot':
+ src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR'])
+ bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], os.environ['MESON_SUBDIR'])
+ return run_potgen(src_sub, args[1], args[2:])
+ elif subcmd == 'gen_gmo':
+ src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR'])
+ bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], os.environ['MESON_SUBDIR'])
+ return gen_gmo(src_sub, bld_sub, args[1:])
+ elif subcmd == 'install':
+ subdir = args[1]
+ pkgname = args[2]
+ instsubdir = args[3]
+ langs = args[4:]
+ src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], subdir)
+ bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], subdir)
+ dest = os.environ.get('DESTDIR') + os.path.join(os.environ['MESON_INSTALL_PREFIX'], instsubdir)
+ if gen_gmo(src_sub, bld_sub, langs) != 0:
+ return 1
+ do_install(src_sub, bld_sub, dest, pkgname, langs)
+ else:
+ print('Unknown subcommand.')
+ return 1
diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py
index 68be8f2..d920b61 100644
--- a/mesonbuild/scripts/gtkdochelper.py
+++ b/mesonbuild/scripts/gtkdochelper.py
@@ -28,9 +28,10 @@ parser.add_argument('--mainfile', dest='mainfile')
parser.add_argument('--modulename', dest='modulename')
parser.add_argument('--htmlargs', dest='htmlargs', default='')
parser.add_argument('--scanargs', dest='scanargs', default='')
+parser.add_argument('--fixxrefargs', dest='fixxrefargs', default='')
def build_gtkdoc(source_root, build_root, doc_subdir, src_subdir,
- main_file, module, html_args, scan_args):
+ main_file, module, html_args, scan_args, fixxref_args):
abs_src = os.path.join(source_root, src_subdir)
abs_out = os.path.join(build_root, doc_subdir)
htmldir = os.path.join(abs_out, 'html')
@@ -76,7 +77,7 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdir,
subprocess.check_call(mkhtml_cmd, cwd=os.path.join(abs_out, 'html'), shell=False)
fixref_cmd = ['gtkdoc-fixxref',
'--module=' + module,
- '--module-dir=html']
+ '--module-dir=html'] + fixxref_args
# print(fixref_cmd)
# sys.exit(1)
subprocess.check_call(fixref_cmd, cwd=abs_out)
@@ -97,6 +98,10 @@ def run(args):
scanargs = options.scanargs.split('@@')
else:
scanargs = []
+ if len(options.fixxrefargs) > 0:
+ fixxrefargs = options.fixxrefargs.split('@@')
+ else:
+ fixxrefargs = []
build_gtkdoc(options.sourcedir,
options.builddir,
options.subdir,
@@ -104,7 +109,8 @@ def run(args):
options.mainfile,
options.modulename,
htmlargs,
- scanargs)
+ scanargs,
+ fixxrefargs)
if 'MESON_INSTALL_PREFIX' in os.environ:
if 'DESTDIR' in os.environ:
diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py
index cc86b62..20a50f7 100644
--- a/mesonbuild/scripts/meson_install.py
+++ b/mesonbuild/scripts/meson_install.py
@@ -33,7 +33,6 @@ def do_install(datafilename):
install_headers(d)
install_man(d)
install_data(d)
- install_po(d)
run_install_script(d)
def install_subdirs(d):
@@ -51,19 +50,6 @@ def install_subdirs(d):
shutil.copytree(src_dir, final_dst, symlinks=True)
print('Installing subdir %s to %s.' % (src_dir, dst_dir))
-def install_po(d):
- packagename = d.po_package_name
- for f in d.po:
- srcfile = f[0]
- localedir = f[1]
- languagename = f[2]
- outfile = os.path.join(d.fullprefix, localedir, languagename, 'LC_MESSAGES',
- packagename + '.mo')
- os.makedirs(os.path.split(outfile)[0], exist_ok=True)
- shutil.copyfile(srcfile, outfile)
- shutil.copystat(srcfile, outfile)
- print('Installing %s to %s.' % (srcfile, outfile))
-
def install_data(d):
for i in d.data:
fullfilename = i[0]
diff --git a/mesonbuild/scripts/scanbuild.py b/mesonbuild/scripts/scanbuild.py
new file mode 100644
index 0000000..f90c3c7
--- /dev/null
+++ b/mesonbuild/scripts/scanbuild.py
@@ -0,0 +1,39 @@
+# Copyright 2016 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.
+
+import sys, os
+import subprocess
+import shutil
+import tempfile
+
+def scanbuild(srcdir, blddir, privdir, logdir, args):
+ with tempfile.TemporaryDirectory(dir=privdir) as scandir:
+ meson_cmd = ['scan-build'] + args
+ build_cmd = ['scan-build', '-o', logdir, 'ninja']
+ rc = subprocess.call(meson_cmd + [srcdir, scandir])
+ if rc != 0:
+ return rc
+ return subprocess.call(build_cmd)
+
+def run(args):
+ srcdir = args[0]
+ blddir = args[1]
+ meson_cmd = args[2:]
+ privdir = os.path.join(blddir, 'meson-private')
+ logdir = os.path.join(blddir, 'meson-logs/scanbuild')
+ shutil.rmtree(logdir, ignore_errors=True)
+ if not shutil.which('scan-build'):
+ print('Scan-build not installed')
+ return 1
+ return scanbuild(srcdir, blddir, privdir, logdir, meson_cmd)
diff --git a/test cases/common/42 string formatting/meson.build b/test cases/common/42 string formatting/meson.build
index c2ee151..0d17448 100644
--- a/test cases/common/42 string formatting/meson.build
+++ b/test cases/common/42 string formatting/meson.build
@@ -51,3 +51,7 @@ assert(false.to_string() == 'false', 'bool string conversion failed')
assert(true.to_string('yes', 'no') == 'yes', 'bool string conversion with args failed')
assert(false.to_string('yes', 'no') == 'no', 'bool string conversion with args failed')
assert('@0@'.format(true) == 'true', 'bool string formatting failed')
+
+assert(' '.join(['a', 'b', 'c']) == 'a b c', 'join() array broken')
+assert(''.join(['a', 'b', 'c']) == 'abc', 'empty join() broken')
+assert(' '.join(['a']) == 'a', 'single join broken')
diff --git a/test cases/frameworks/10 gtk-doc/doc/meson.build b/test cases/frameworks/10 gtk-doc/doc/meson.build
index 3172b42..5f08e89 100644
--- a/test cases/frameworks/10 gtk-doc/doc/meson.build
+++ b/test cases/frameworks/10 gtk-doc/doc/meson.build
@@ -1,5 +1,3 @@
-gnome = import('gnome')
-
cdata = configuration_data()
cdata.set('VERSION', '1.0')
configure_file(input : 'version.xml.in',
diff --git a/test cases/frameworks/10 gtk-doc/meson.build b/test cases/frameworks/10 gtk-doc/meson.build
index 9712f21..c6881ab 100644
--- a/test cases/frameworks/10 gtk-doc/meson.build
+++ b/test cases/frameworks/10 gtk-doc/meson.build
@@ -1,5 +1,9 @@
project('gtkdoctest', 'c')
+gnome = import('gnome')
+
+assert(gnome.gtkdoc_html_dir('foobar') == 'share/gtkdoc/html/foobar', 'Gtkdoc install dir is incorrect.')
+
inc = include_directories('include')
# We have to disable this test until this bug fix has landed to
diff --git a/test cases/frameworks/6 gettext/meson.build b/test cases/frameworks/6 gettext/meson.build
index 4384978..6bba7e0 100644
--- a/test cases/frameworks/6 gettext/meson.build
+++ b/test cases/frameworks/6 gettext/meson.build
@@ -1,4 +1,6 @@
project('gettext example', 'c')
+i18n = import('i18n')
+
subdir('po')
subdir('src')
diff --git a/test cases/frameworks/6 gettext/po/intltest.pot b/test cases/frameworks/6 gettext/po/intltest.pot
index 05da67d..d65e2c1 100644
--- a/test cases/frameworks/6 gettext/po/intltest.pot
+++ b/test cases/frameworks/6 gettext/po/intltest.pot
@@ -1,6 +1,6 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
+# This file is distributed under the same license as the intltest package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: intltest\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-12 19:04+0300\n"
+"POT-Creation-Date: 2016-03-28 19:59+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/test cases/frameworks/6 gettext/po/meson.build b/test cases/frameworks/6 gettext/po/meson.build
index 3376c84..8ea2c11 100644
--- a/test cases/frameworks/6 gettext/po/meson.build
+++ b/test cases/frameworks/6 gettext/po/meson.build
@@ -1,4 +1,3 @@
langs = ['fi', 'de']
-gettext('intltest',
-languages : langs)
+i18n.gettext('intltest', languages : langs)