aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml2
-rw-r--r--README.md11
-rw-r--r--authors.txt1
-rwxr-xr-xmeson.py14
-rw-r--r--mesonbuild/backend/backends.py21
-rw-r--r--mesonbuild/backend/ninjabackend.py3
6 files changed, 45 insertions, 7 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index d5e0fbf..09f67e4 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -10,8 +10,6 @@ branches:
- master
install:
- - ps: (new-object net.webclient).DownloadFile('https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi', 'python-3.4.4.msi')
- - ps: msiexec /i python-3.4.4.msi /quiet /qn /norestart
- ps: (new-object net.webclient).DownloadFile('https://dl.dropboxusercontent.com/u/37517477/ninja.exe', 'c:\python34\ninja.exe')
- cmd: copy c:\python34\python.exe c:\python34\python3.exe
- '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86'
diff --git a/README.md b/README.md
index 95915b0..273398f 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,17 @@ pip will download the package automatically). The exact command to
type to install with pip can very between systems, be sure to use the
Python 3 version of pip.
+#### Creating a standalone script
+
+Meson can be run as a [Python zip
+app](https://docs.python.org/3/library/zipapp.html). To generate the
+executable run the following command:
+
+ python3 -m zipapp -p '/usr/bin/env python3' -m meson:main -o meson <source checkout>
+
+Note that the source checkout may not be `meson` because it would
+clash with the generated binary name.
+
####Running
Meson requires that you have a source directory and a build directory
diff --git a/authors.txt b/authors.txt
index fbac571..f0c2006 100644
--- a/authors.txt
+++ b/authors.txt
@@ -45,3 +45,4 @@ Elliott Sales de Andrade
Patrick Griffis
Iain Lane
Daniel Brendle
+Franz Zapata
diff --git a/meson.py b/meson.py
index b977368..fbca883 100755
--- a/meson.py
+++ b/meson.py
@@ -17,8 +17,14 @@
from mesonbuild import mesonmain
import sys, os
-thisfile = __file__
-if not os.path.isabs(thisfile):
- thisfile = os.path.normpath(os.path.join(os.getcwd(), thisfile))
+def main():
+ thisfile = __file__
+ if not os.path.isabs(thisfile):
+ thisfile = os.path.normpath(os.path.join(os.getcwd(), thisfile))
+ if __package__ == '':
+ thisfile = os.path.dirname(thisfile)
-sys.exit(mesonmain.run(thisfile, sys.argv[1:]))
+ sys.exit(mesonmain.run(thisfile, sys.argv[1:]))
+
+if __name__ == '__main__':
+ main()
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 4139ace..5681f7c 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -630,3 +630,24 @@ class Backend():
for s in self.build.postconf_scripts:
cmd = s['exe'].get_command() + s['args']
subprocess.check_call(cmd, env=child_env)
+
+ # Subprojects of subprojects may cause the same dep args to be used
+ # multiple times. Remove duplicates here. Note that we can't dedup
+ # libraries based on name alone, because "-lfoo -lbar -lfoo" is
+ # a completely valid (though pathological) sequence and removing the
+ # latter may fail. Usually only applies to static libs, though.
+ def dedup_arguments(self, commands):
+ includes = {}
+ final_commands = []
+ previous = '-fsuch_arguments=woof'
+ for c in commands:
+ if c.startswith(('-I' '-L', '/LIBPATH')):
+ if c in includes:
+ continue
+ includes[c] = True
+ if previous == c:
+ continue
+ previous = c
+ final_commands.append(c)
+ return final_commands
+
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 251f7ee..41f96f1 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1674,6 +1674,7 @@ rule FORTRAN_DEP_HACK
element.add_orderdep(d)
element.add_orderdep(pch_dep)
element.add_orderdep(extra_orderdeps)
+ commands = self.dedup_arguments(commands)
for i in self.get_fortran_orderdeps(target, compiler):
element.add_orderdep(i)
element.add_item('DEPFILE', dep_file)
@@ -1836,7 +1837,7 @@ rule FORTRAN_DEP_HACK
custom_target_libraries = self.get_custom_target_provided_libraries(target)
commands += extra_args
commands += custom_target_libraries
- commands = linker.unix_link_flags_to_native(commands)
+ commands = linker.unix_link_flags_to_native(self.dedup_arguments(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]