aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authors.txt1
-rw-r--r--mesonbuild/backend/ninjabackend.py6
-rw-r--r--mesonbuild/build.py8
-rw-r--r--mesonbuild/compilers.py5
-rw-r--r--mesonbuild/interpreter.py10
-rwxr-xr-xtest cases/common/16 configure file/generator-without-input-file.py14
-rw-r--r--test cases/common/16 configure file/installed_files.txt1
-rw-r--r--test cases/common/16 configure file/meson.build10
-rw-r--r--test cases/rust/1 basic/installed_files.txt3
-rw-r--r--test cases/rust/1 basic/meson.build4
-rw-r--r--test cases/rust/1 basic/subdir/meson.build2
-rw-r--r--test cases/rust/1 basic/subdir/prog.rs3
12 files changed, 48 insertions, 19 deletions
diff --git a/authors.txt b/authors.txt
index 02ba5e3..bb6d3cd 100644
--- a/authors.txt
+++ b/authors.txt
@@ -70,3 +70,4 @@ Marc Becker
Michal Sojka
Aaron Small
Joe Baldino
+Peter Harris
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 8486060..f29a7be 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1089,9 +1089,9 @@ int dummy;
raise InvalidArguments('Unknown target type for rustc.')
args.append(cratetype)
args += rustc.get_buildtype_args(self.environment.coredata.get_builtin_option('buildtype'))
- depfile = target.name + '.d'
- args += ['--out-dir', target.subdir]
- args += ['--emit', 'dep-info', '--emit', 'link']
+ depfile = os.path.join(target.subdir, target.name + '.d')
+ args += ['--emit', 'dep-info={}'.format(depfile), '--emit', 'link']
+ args += ['-o', os.path.join(target.subdir, target.get_filename())]
orderdeps = [os.path.join(t.subdir, t.get_filename()) for t in target.link_targets]
linkdirs = OrderedDict()
for d in target.link_targets:
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 2806331..41e21e3 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -479,14 +479,6 @@ class BuildTarget(Target):
# CSharp and Java targets can't contain any other file types
assert(len(self.compilers) == 1)
return
- if 'rust' in self.compilers:
- firstname = self.sources[0]
- if isinstance(firstname, File):
- firstname = firstname.fname
- first = os.path.split(firstname)[1]
- (base, suffix) = os.path.splitext(first)
- if suffix != '.rs' or self.name != base:
- raise InvalidArguments('In Rust targets, the first source file must be named projectname.rs.')
def get_original_kwargs(self):
return self.kwargs
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 7f1897c..f16a05f 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -3055,9 +3055,8 @@ class VisualStudioLinker(StaticLinker):
return VisualStudioCCompiler.unix_args_to_native(args)
def get_link_debugfile_args(self, targetfile):
- pdbarr = targetfile.split('.')[:-1]
- pdbarr += ['pdb']
- return ['/DEBUG', '/PDB:' + '.'.join(pdbarr)]
+ # Static libraries do not have PDB files
+ return []
class ArLinker(StaticLinker):
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 4ee0485..7ee4bb9 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2280,6 +2280,7 @@ class Interpreter(InterpreterBase):
'they are mutually exclusive.')
# Validate input
inputfile = None
+ ifile_abs = None
if 'input' in kwargs:
inputfile = kwargs['input']
if isinstance(inputfile, list):
@@ -2290,8 +2291,8 @@ class Interpreter(InterpreterBase):
if not isinstance(inputfile, (str, mesonlib.File)):
raise InterpreterException('Input must be a string or a file')
ifile_abs = os.path.join(self.environment.source_dir, self.subdir, inputfile)
- elif 'command' in kwargs:
- raise InterpreterException('Required keyword argument \'input\' missing')
+ elif 'command' in kwargs and '@INPUT@' in kwargs['command']:
+ raise InterpreterException('@INPUT@ used as command argument, but no input file specified.')
# Validate output
output = kwargs['output']
if not isinstance(output, str):
@@ -2320,7 +2321,10 @@ class Interpreter(InterpreterBase):
# We use absolute paths for input and output here because the cwd
# that the command is run from is 'unspecified', so it could change.
# Currently it's builddir/subdir for in_builddir else srcdir/subdir.
- values = mesonlib.get_filenames_templates_dict([ifile_abs], [ofile_abs])
+ if ifile_abs:
+ values = mesonlib.get_filenames_templates_dict([ifile_abs], [ofile_abs])
+ else:
+ values = mesonlib.get_filenames_templates_dict(None, [ofile_abs])
# Substitute @INPUT@, @OUTPUT@, etc here.
cmd = mesonlib.substitute_values(kwargs['command'], values)
mlog.log('Configuring', mlog.bold(output), 'with command')
diff --git a/test cases/common/16 configure file/generator-without-input-file.py b/test cases/common/16 configure file/generator-without-input-file.py
new file mode 100755
index 0000000..2ee059e
--- /dev/null
+++ b/test cases/common/16 configure file/generator-without-input-file.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+
+import sys, os
+from pathlib import Path
+
+if len(sys.argv) != 2:
+ print("Wrong amount of parameters.")
+
+build_dir = Path(os.environ['MESON_BUILD_ROOT'])
+subdir = Path(os.environ['MESON_SUBDIR'])
+outputf = Path(sys.argv[1])
+
+with outputf.open('w') as ofile:
+ ofile.write("#define ZERO_RESULT 0\n")
diff --git a/test cases/common/16 configure file/installed_files.txt b/test cases/common/16 configure file/installed_files.txt
index d9fee12..542516e 100644
--- a/test cases/common/16 configure file/installed_files.txt
+++ b/test cases/common/16 configure file/installed_files.txt
@@ -1,3 +1,4 @@
usr/share/appdir/config2.h
+usr/share/appdir/config2b.h
usr/share/appdireh/config2-1.h
usr/share/appdirok/config2-2.h
diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build
index bff041b..8271ca3 100644
--- a/test cases/common/16 configure file/meson.build
+++ b/test cases/common/16 configure file/meson.build
@@ -36,6 +36,16 @@ configure_file(input : 'dummy.dat',
install_dir : 'share/appdir')
run_command(check_file, join_paths(meson.current_build_dir(), 'config2.h'))
+# Same again as before, but an input file should not be required in
+# this case where we use a command/script to generate the output file.
+genscript2b = '@0@/generator-without-input-file.py'.format(meson.current_source_dir())
+ofile2b = '@0@/config2b.h'.format(meson.current_build_dir())
+configure_file(
+ output : 'config2b.h',
+ command : [genprog, genscript2b, ofile2b],
+ install_dir : 'share/appdir')
+run_command(check_file, join_paths(meson.current_build_dir(), 'config2b.h'))
+
found_script = find_program('generator.py')
# More configure_file tests in here
subdir('subdir')
diff --git a/test cases/rust/1 basic/installed_files.txt b/test cases/rust/1 basic/installed_files.txt
index c7dab9f..9dea55f 100644
--- a/test cases/rust/1 basic/installed_files.txt
+++ b/test cases/rust/1 basic/installed_files.txt
@@ -1 +1,2 @@
-usr/bin/prog?exe
+usr/bin/program?exe
+usr/bin/program2?exe
diff --git a/test cases/rust/1 basic/meson.build b/test cases/rust/1 basic/meson.build
index 7cd84b6..076d86b 100644
--- a/test cases/rust/1 basic/meson.build
+++ b/test cases/rust/1 basic/meson.build
@@ -1,4 +1,6 @@
project('rustprog', 'rust')
-e = executable('prog', 'prog.rs', install : true)
+e = executable('program', 'prog.rs', install : true)
test('rusttest', e)
+
+subdir('subdir')
diff --git a/test cases/rust/1 basic/subdir/meson.build b/test cases/rust/1 basic/subdir/meson.build
new file mode 100644
index 0000000..51b385b
--- /dev/null
+++ b/test cases/rust/1 basic/subdir/meson.build
@@ -0,0 +1,2 @@
+e = executable('program2', 'prog.rs', install : true)
+test('rusttest2', e)
diff --git a/test cases/rust/1 basic/subdir/prog.rs b/test cases/rust/1 basic/subdir/prog.rs
new file mode 100644
index 0000000..b171a80
--- /dev/null
+++ b/test cases/rust/1 basic/subdir/prog.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("rust compiler is working");
+}