aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authors.txt1
-rw-r--r--cross/ubuntu-mingw.txt1
-rw-r--r--mesonbuild/backend/backends.py8
-rw-r--r--mesonbuild/backend/ninjabackend.py22
-rw-r--r--mesonbuild/compilers.py31
-rw-r--r--mesonbuild/coredata.py6
-rw-r--r--mesonbuild/mconf.py2
-rw-r--r--mesonbuild/mesonmain.py2
-rw-r--r--mesonbuild/scripts/meson_install.py2
-rw-r--r--mesonbuild/scripts/meson_test.py1
10 files changed, 53 insertions, 23 deletions
diff --git a/authors.txt b/authors.txt
index 54e3412..68bdb24 100644
--- a/authors.txt
+++ b/authors.txt
@@ -28,3 +28,4 @@ Yoav Alon
Martin Ejdestig
Rémi Nicole
Damián Nohales
+Nirbheek Chauhan
diff --git a/cross/ubuntu-mingw.txt b/cross/ubuntu-mingw.txt
index 2373565..4c8fcac 100644
--- a/cross/ubuntu-mingw.txt
+++ b/cross/ubuntu-mingw.txt
@@ -7,6 +7,7 @@ c = '/usr/bin/i686-w64-mingw32-gcc'
cpp = '/usr/bin/i686-w64-mingw32-g++'
ar = '/usr/bin/i686-w64-mingw32-ar'
strip = '/usr/bin/i686-w64-mingw32-strip'
+pkgconfig = '/usr/bin/mingw32-pkg-config'
[properties]
root = '/usr/i686-w64-mingw32'
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index cab3b8f..052603a 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -83,7 +83,9 @@ class Backend():
targetdir = self.get_target_dir(target)
fname = target.get_filename()
if isinstance(fname, list):
- fname = fname[0] # HORROR, HORROR! Fix this.
+ # FIXME FIXME FIXME: build.CustomTarget has multiple output files
+ # and get_filename() returns them all
+ fname = fname[0]
filename = os.path.join(targetdir, fname)
return filename
@@ -245,7 +247,9 @@ class Backend():
if isinstance(target, build.SharedLibrary):
commands += compiler.get_pic_args()
for dep in target.get_external_deps():
- commands += dep.get_compile_args()
+ # Cflags required by external deps might have UNIX-specific flags,
+ # so filter them out if needed
+ commands += compiler.unix_compile_flags_to_native(dep.get_compile_args())
if isinstance(target, build.Executable):
commands += dep.get_exe_args()
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 7581f27..f5c06dc 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1681,7 +1681,7 @@ rule FORTRAN_DEP_HACK
custom_target_libraries = self.get_custom_target_provided_libraries(target)
commands += extra_args
commands += custom_target_libraries
- commands = linker.unixtype_flags_to_native(commands)
+ commands = linker.unix_link_flags_to_native(commands)
dep_targets = [self.get_dependency_filename(t) for t in dependencies]
dep_targets += [os.path.join(self.environment.source_dir,
target.subdir, t) for t in target.link_depends]
@@ -1717,16 +1717,18 @@ rule FORTRAN_DEP_HACK
def generate_shlib_aliases(self, target, outdir):
basename = target.get_filename()
aliases = target.get_aliaslist()
- if not mesonlib.is_windows():
- for alias in aliases:
- aliasfile = os.path.join(self.environment.get_build_dir(), outdir, alias)
- try:
- os.remove(aliasfile)
- except Exception:
- pass
+ for alias in aliases:
+ aliasfile = os.path.join(self.environment.get_build_dir(), outdir, alias)
+ try:
+ os.remove(aliasfile)
+ except Exception:
+ pass
+ try:
os.symlink(basename, aliasfile)
- else:
- mlog.debug("Library versioning disabled because host does not support symlinks.")
+ except NotImplementedError:
+ mlog.debug("Library versioning disabled because symlinks are not supported.")
+ except OSError:
+ mlog.debug("Library versioning disabled because we do not have symlink creation privileges.")
def generate_gcov_clean(self, outfile):
gcno_elem = NinjaBuildElement(self.all_outputs, 'clean-gcno', 'CUSTOM_COMMAND', 'PHONY')
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 0f29808..1a51e21 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -61,7 +61,7 @@ gnulike_buildtype_args = {'plain' : [],
msvc_buildtype_args = {'plain' : [],
'debug' : ["/MDd", "/ZI", "/Ob0", "/Od", "/RTC1"],
- 'debugoptimized' : ["/MD", "/Zi", "/O2", "/Ob1", "/D"],
+ 'debugoptimized' : ["/MD", "/Zi", "/O2", "/Ob1"],
'release' : ["/MD", "/O2", "/Ob2"]}
gnulike_buildtype_linker_args = {}
@@ -184,7 +184,10 @@ class Compiler():
def has_function(self, *args, **kwargs):
raise EnvironmentException('Language %s does not support function checks.' % self.language)
- def unixtype_flags_to_native(self, args):
+ def unix_link_flags_to_native(self, args):
+ return args
+
+ def unix_compile_flags_to_native(self, args):
return args
class CCompiler(Compiler):
@@ -896,6 +899,7 @@ class ValaCompiler(Compiler):
self.version = version
self.id = 'unknown'
self.language = 'vala'
+ self.is_cross = False
def name_string(self):
return ' '.join(self.exelist)
@@ -1128,7 +1132,7 @@ class VisualStudioCCompiler(CCompiler):
return ['/OUT:' + outputname]
def get_pic_args(self):
- return ['/LD']
+ return [] # PIC is handled by the loader on Windows
def get_std_shared_lib_link_args(self):
return ['/DLL']
@@ -1174,7 +1178,7 @@ class VisualStudioCCompiler(CCompiler):
def get_option_link_args(self, options):
return options['c_winlibs'].value
- def unixtype_flags_to_native(self, args):
+ def unix_link_flags_to_native(self, args):
result = []
for i in args:
if i.startswith('-L'):
@@ -1182,6 +1186,15 @@ class VisualStudioCCompiler(CCompiler):
result.append(i)
return result
+ def unix_compile_flags_to_native(self, args):
+ result = []
+ for i in args:
+ # -mms-bitfields is specific to MinGW-GCC
+ if i == '-mms-bitfields':
+ continue
+ result.append(i)
+ return result
+
def get_include_args(self, path, is_system):
if path == '':
path = '.'
@@ -1799,7 +1812,10 @@ class VisualStudioLinker():
def get_option_link_args(self, options):
return []
- def unixtype_flags_to_native(self, args):
+ def unix_link_flags_to_native(self, args):
+ return args
+
+ def unix_compile_flags_to_native(self, args):
return args
class ArLinker():
@@ -1845,5 +1861,8 @@ class ArLinker():
def get_option_link_args(self, options):
return []
- def unixtype_flags_to_native(self, args):
+ def unix_link_flags_to_native(self, args):
+ return args
+
+ def unix_compile_flags_to_native(self, args):
return args
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 72e3414..c12477f 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -61,8 +61,10 @@ class UserStringOption(UserOption):
def validate(self, value):
if not isinstance(value, str):
raise MesonException('Value "%s" for string option "%s" is not a string.' % (str(newvalue), self.name))
- if self.name == 'prefix' and not os.path.isabs(value):
- raise MesonException('Prefix option must be an absolute path.')
+ if self.name == 'prefix':
+ if not os.path.isabs(value):
+ if len(value) >= 2 and value[1] != ':':
+ raise MesonException('Prefix option value \'{0}\' must be an absolute path.'.format(value))
if self.name in ('libdir', 'bindir', 'includedir', 'datadir', 'mandir', 'localedir') \
and os.path.isabs(value):
raise MesonException('Option %s must not be an absolute path.' % self.name)
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index f174425..67f2a91 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -182,7 +182,7 @@ class Conf:
def run(args):
args = mesonlib.expand_arguments(args)
if not args:
- sys.exit(1)
+ args = [os.getcwd()]
options = parser.parse_args(args)
if len(options.directory) > 1:
print('%s <build directory>' % args[0])
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 2686818..5379955 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -82,7 +82,7 @@ class MesonApp():
def __init__(self, dir1, dir2, script_file, handshake, options):
(self.source_dir, self.build_dir) = self.validate_dirs(dir1, dir2, handshake)
if not os.path.isabs(options.prefix):
- raise RuntimeError('--prefix must be an absolute path.')
+ raise RuntimeError('--prefix value \'{0}\' must be an absolute path: '.format(options.prefix))
if options.prefix.endswith('/') or options.prefix.endswith('\\'):
options.prefix = options.prefix[:-1]
self.meson_script_file = script_file
diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py
index 7e43efd..792af6c 100644
--- a/mesonbuild/scripts/meson_install.py
+++ b/mesonbuild/scripts/meson_install.py
@@ -194,7 +194,7 @@ def install_targets(d):
except FileNotFoundError:
pass
os.symlink(os.path.split(fname)[-1], symlinkfilename)
- except NotImplementedError:
+ except (NotImplementedError, OSError):
if not printed_symlink_error:
print("Symlink creation does not work on this platform.")
printed_symlink_error = True
diff --git a/mesonbuild/scripts/meson_test.py b/mesonbuild/scripts/meson_test.py
index 23abd6e..453ea61 100644
--- a/mesonbuild/scripts/meson_test.py
+++ b/mesonbuild/scripts/meson_test.py
@@ -223,6 +223,7 @@ def run_tests(options, datafilename):
def run(args):
global tests_failed
+ tests_failed = [] # To avoid state leaks when invoked multiple times (running tests in-process)
options = parser.parse_args(args)
if len(options.args) != 1:
print('Test runner for Meson. Do not run on your own, mmm\'kay?')