diff options
-rw-r--r-- | .appveyor.yml | 8 | ||||
-rw-r--r-- | .travis.yml | 8 | ||||
-rw-r--r-- | ci/appveyor-install.bat | 4 | ||||
-rw-r--r-- | docs/markdown/Generating-sources.md | 2 | ||||
-rw-r--r-- | docs/markdown/Quick-guide.md | 2 | ||||
-rw-r--r-- | docs/markdown/Reference-manual.md | 2 | ||||
-rw-r--r-- | docs/markdown/Subprojects.md | 2 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 11 | ||||
-rw-r--r-- | mesonbuild/environment.py | 5 | ||||
-rwxr-xr-x | run_tests.py | 6 |
10 files changed, 30 insertions, 20 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 6551445..a78a328 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -49,17 +49,15 @@ branches: only: - master -skip_commits: - files: - - docs/**/* - install: - cmd: set "ORIG_PATH=%PATH%" # Boost 1.56.0: https://www.appveyor.com/docs/build-environment/#boost #- cmd: set "BOOST_ROOT=C:\Libraries\boost" + # Use a Ninja with QuLogic's patch: https://github.com/ninja-build/ninja/issues/1219 + - cmd: set "MESON_FIXED_NINJA=1" + - ps: (new-object net.webclient).DownloadFile('http://nirbheek.in/files/binaries/ninja/win32/ninja.exe', 'C:\projects\meson\ninja.exe') # Use the x86 python only when building for x86 for the cpython tests. # For all other archs (including, say, arm), use the x64 python. - - ps: (new-object net.webclient).DownloadFile('https://www.dropbox.com/s/bbzvepq85hv47x1/ninja.exe?dl=1', 'C:\projects\meson\ninja.exe') - cmd: if %arch%==x86 (set MESON_PYTHON_PATH=C:\python34) else (set MESON_PYTHON_PATH=C:\python34-x64) # Set paths and config for each build type. diff --git a/.travis.yml b/.travis.yml index 724f9ad..662b769 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,9 @@ matrix: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ninja python3; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi + # Use a Ninja with QuLogic's patch: https://github.com/ninja-build/ninja/issues/1219 + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p $HOME/tools; curl -L http://nirbheek.in/files/binaries/ninja/macos/ninja -o $HOME/tools/ninja; chmod +x $HOME/tools/ninja; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull jpakkane/mesonci:zesty; fi - pip3 install codecov - mkdir .coverage @@ -47,9 +49,9 @@ script: ci_env=`bash <(curl -s https://codecov.io/env)` docker run $ci_env -v ${PWD}/.coverage:/root/.coverage \ withgit \ - /bin/sh -c "cd /root && CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX ./run_tests.py --cov -- $MESON_ARGS && chmod -R a+rwX .coverage" + /bin/sh -c "cd /root && mkdir -p tools; wget -c http://nirbheek.in/files/binaries/ninja/linux-amd64/ninja -O /root/tools/ninja; chmod +x /root/tools/ninja; CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX PATH=/root/tools:$PATH MESON_FIXED_NINJA=1 ./run_tests.py --cov -- $MESON_ARGS && chmod -R a+rwX .coverage" fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) OBJC=$CC OBJCXX=$CXX ./run_tests.py --cov --backend=ninja -- $MESON_ARGS ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) OBJC=$CC OBJCXX=$CXX PATH=$HOME/tools:$PATH MESON_FIXED_NINJA=1 ./run_tests.py --cov --backend=ninja -- $MESON_ARGS ; fi after_success: - coverage3 combine diff --git a/ci/appveyor-install.bat b/ci/appveyor-install.bat index becc80a..9eddeac 100644 --- a/ci/appveyor-install.bat +++ b/ci/appveyor-install.bat @@ -1,5 +1,7 @@ set CACHE=C:\cache set CYGWIN_MIRROR="http://cygwin.mirror.constant.com" +set CYGWIN_ADDITIONAL_REPO="http://www.dronecode.org.uk/cygwin/" +set CYGWIN_ADDITIONAL_REPO_KEY="http://www.dronecode.org.uk/cygwin/dronecode.gpg" if _%arch%_ == _x64_ set SETUP=setup-x86_64.exe && set CYGWIN_ROOT=C:\cygwin64 if _%arch%_ == _x86_ set SETUP=setup-x86.exe && set CYGWIN_ROOT=C:\cygwin @@ -7,5 +9,5 @@ if _%arch%_ == _x86_ set SETUP=setup-x86.exe && set CYGWIN_ROOT=C:\cygwin if not exist %CACHE% mkdir %CACHE% echo Updating Cygwin and installing ninja and test prerequisites -%CYGWIN_ROOT%\%SETUP% -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -l "%CACHE%" -g -P "ninja,gcc-objc,gcc-objc++,libglib2.0-devel,zlib-devel,python3-pip" +%CYGWIN_ROOT%\%SETUP% -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -s "%CYGWIN_ADDITIONAL_REPO%" -K "%CYGWIN_ADDITIONAL_REPO_KEY%" -l "%CACHE%" -g -P "ninja,gcc-objc,gcc-objc++,libglib2.0-devel,zlib-devel,python3-pip" echo Install done diff --git a/docs/markdown/Generating-sources.md b/docs/markdown/Generating-sources.md index 8a03945..c251805 100644 --- a/docs/markdown/Generating-sources.md +++ b/docs/markdown/Generating-sources.md @@ -68,7 +68,7 @@ Generators can also generate multiple output files with unknown names: ```meson gen2 = generator(someprog, outputs : ['@BASENAME@.c', '@BASENAME@.h'], - arguments : ['--out_dir=@BUILD_DIR@', '@INPUT@'] + arguments : ['--out_dir=@BUILD_DIR@', '@INPUT@']) ``` In this case you can not use the plain `@OUTPUT@` variable, as it would be ambiguous. This program only needs to know the output directory, it will generate the file names by itself. diff --git a/docs/markdown/Quick-guide.md b/docs/markdown/Quick-guide.md index 5feccbc..32e2b7d 100644 --- a/docs/markdown/Quick-guide.md +++ b/docs/markdown/Quick-guide.md @@ -62,7 +62,7 @@ $ CFLAGS=... CXXFLAGS=... LDFLAGS=.. meson --prefix /usr --buildtype=plain build $ ninja -v -C builddir $ ninja -C builddir test $ DESTDIR=/path/to/staging/root ninja -C builddir install -```` +``` The command line switch `--buildtype=plain` tells Meson not to add its own flags to the command line. This gives the packager total control on used flags. diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index dd77d6d..e45adf6 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -40,7 +40,7 @@ project('foobar', 'c') if compiling_for_osx add_languages('objc') endif -```` +``` Takes one keyword argument, `required`. It defaults to `true`, which means that if any of the languages specified is not found, Meson will halt. Returns true if all languages specified were found and false otherwise. diff --git a/docs/markdown/Subprojects.md b/docs/markdown/Subprojects.md index 2dd012e..85453e3 100644 --- a/docs/markdown/Subprojects.md +++ b/docs/markdown/Subprojects.md @@ -62,7 +62,7 @@ proj_dep = declare_dependency(...) Then you can use the subproject in the master project like this: ```meson -sp_dep = dependency('subproj_pkgconfig_name', fallback : ['subproj_name', 'proj_dep'] +sp_dep = dependency('subproj_pkgconfig_name', fallback : ['subproj_name', 'proj_dep']) ``` This uses the system dependency when available and the self built version if not. If you want to always use the subproject, that is also possible, just use `subproject` and `get_variable` as discussed above to get the dependency object. diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 7f974ee..ece4e8b 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -177,6 +177,9 @@ int dummy; def generate(self, interp): self.interpreter = interp + self.ninja_command = environment.detect_ninja(log=True) + if self.ninja_command is None: + raise MesonException('Could not detect Ninja v1.5 or newer') outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename) tempfilename = outfilename + '~' with open(tempfilename, 'w') as outfile: @@ -210,10 +213,9 @@ int dummy; # http://clang.llvm.org/docs/JSONCompilationDatabase.html def generate_compdb(self): - ninja_exe = environment.detect_ninja() native_compilers = ['%s_COMPILER' % i for i in self.build.compilers] cross_compilers = ['%s_CROSS_COMPILER' % i for i in self.build.cross_compilers] - ninja_compdb = [ninja_exe, '-t', 'compdb'] + native_compilers + cross_compilers + ninja_compdb = [self.ninja_command, '-t', 'compdb'] + native_compilers + cross_compilers builddir = self.environment.get_build_dir() try: jsondb = subprocess.check_output(ninja_compdb, cwd=builddir) @@ -2509,11 +2511,8 @@ rule FORTRAN_DEP_HACK default = 'default all\n\n' outfile.write(default) - ninja_command = environment.detect_ninja() - if ninja_command is None: - raise MesonException('Could not detect Ninja v1.6 or newer') elem = NinjaBuildElement(self.all_outputs, 'clean', 'CUSTOM_COMMAND', 'PHONY') - elem.add_item('COMMAND', [ninja_command, '-t', 'clean']) + elem.add_item('COMMAND', [self.ninja_command, '-t', 'clean']) elem.add_item('description', 'Cleaning.') # If we have custom targets in this project, add all their outputs to diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index b0002a0..b3d72e6 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -89,16 +89,19 @@ def find_coverage_tools(): genhtml_exe = None return gcovr_exe, lcov_exe, genhtml_exe -def detect_ninja(version='1.5'): +def detect_ninja(version='1.5', log=False): for n in ['ninja', 'ninja-build']: try: p, found = Popen_safe([n, '--version'])[0:2] except (FileNotFoundError, PermissionError): # Doesn't exist in PATH or isn't executable continue + found = found.strip() # Perhaps we should add a way for the caller to know the failure mode # (not found or too old) if p.returncode == 0 and mesonlib.version_compare(found, '>=' + version): + if log: + mlog.log('Found ninja-{} at {}'.format(found, shlex.quote(shutil.which(n)))) return n def detect_native_windows_arch(): diff --git a/run_tests.py b/run_tests.py index 040f958..b17e0cb 100755 --- a/run_tests.py +++ b/run_tests.py @@ -104,6 +104,12 @@ def get_backend_commands(backend, debug=False): return cmd, clean_cmd, test_cmd, install_cmd, uninstall_cmd def ensure_backend_detects_changes(backend): + # We're using a ninja with QuLogic's patch for sub-1s resolution timestamps + # and not running on HFS+ which only stores dates in seconds: + # https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#HFSPlusDates + # FIXME: Upgrade Travis image to Apple FS when that becomes available + if 'MESON_FIXED_NINJA' in os.environ and not mesonlib.is_osx(): + return # This is needed to increase the difference between build.ninja's # timestamp and the timestamp of whatever you changed due to a Ninja # bug: https://github.com/ninja-build/ninja/issues/371 |