aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authors.txt1
-rw-r--r--mesonbuild/backend/ninjabackend.py4
-rw-r--r--mesonbuild/scripts/__init__.py22
-rw-r--r--mesonbuild/scripts/gettext.py4
-rw-r--r--mesonbuild/scripts/gtkdochelper.py7
-rw-r--r--mesonbuild/scripts/meson_install.py14
-rwxr-xr-xtest cases/common/103 manygen/subdir/manygen.py15
7 files changed, 42 insertions, 25 deletions
diff --git a/authors.txt b/authors.txt
index eadd2ff..08c046d 100644
--- a/authors.txt
+++ b/authors.txt
@@ -35,3 +35,4 @@ Rogiel Sulzbach
Tim-Philipp Müller
Emmanuele Bassi
Martin Hostettler
+Sam Thursfield
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index b3f3f17..9ceee32 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -772,7 +772,7 @@ int dummy;
if hasattr(i, 'fname'):
i = i.fname
if i.endswith('vala'):
- vapiname = os.path.splitext(os.path.split(i)[1])[0] + '.vapi'
+ vapiname = dep.name + '.vapi'
fullname = os.path.join(self.get_target_dir(dep), vapiname)
result.append(fullname)
break
@@ -790,7 +790,7 @@ int dummy;
vala_input_files.append(s.rel_to_builddir(self.build_to_src))
if len(src) == 0:
raise InvalidArguments('Vala library has no Vala source files.')
- namebase = os.path.splitext(os.path.split(src[0].fname)[1])[0]
+ namebase = target.name
base_h = namebase + '.h'
base_vapi = namebase + '.vapi'
hname = os.path.normpath(os.path.join(self.get_target_dir(target), base_h))
diff --git a/mesonbuild/scripts/__init__.py b/mesonbuild/scripts/__init__.py
index e69de29..19c4fc7 100644
--- a/mesonbuild/scripts/__init__.py
+++ b/mesonbuild/scripts/__init__.py
@@ -0,0 +1,22 @@
+#!/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.
+
+def destdir_join(d1, d2):
+ # c:\destdir + c:\prefix must produce c:\destdir\prefix
+ if len(d1) > 1 and d1[1] == ':' and \
+ len(d2) > 1 and d2[1] == ':':
+ return d1 + d2[2:]
+ return d1 + d2
diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py
index d8b2a9c..4677d5f 100644
--- a/mesonbuild/scripts/gettext.py
+++ b/mesonbuild/scripts/gettext.py
@@ -15,6 +15,7 @@
# limitations under the License.
import os, subprocess, shutil
+from mesonbuild.scripts import destdir_join
def run_potgen(src_sub, pkgname, args):
listfile = os.path.join(src_sub, 'POTFILES')
@@ -56,7 +57,8 @@ def run(args):
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)
+ destdir = os.environ.get('DESTDIR', '')
+ dest = destdir_join(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)
diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py
index d920b61..cc06f7b 100644
--- a/mesonbuild/scripts/gtkdochelper.py
+++ b/mesonbuild/scripts/gtkdochelper.py
@@ -17,6 +17,7 @@ import sys, os
import subprocess
import shutil
import argparse
+from mesonbuild.scripts import destdir_join
parser = argparse.ArgumentParser()
@@ -113,10 +114,8 @@ def run(args):
fixxrefargs)
if 'MESON_INSTALL_PREFIX' in os.environ:
- if 'DESTDIR' in os.environ:
- installdir = os.environ['DESTDIR'] + os.environ['MESON_INSTALL_PREFIX']
- else:
- installdir = os.environ['MESON_INSTALL_PREFIX']
+ destdir = os.environ.get('DESTDIR', '')
+ installdir = destdir_join(destdir, os.environ['MESON_INSTALL_PREFIX'])
install_gtkdoc(options.builddir,
options.subdir,
installdir,
diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py
index 0be1e18..3a87f2d 100644
--- a/mesonbuild/scripts/meson_install.py
+++ b/mesonbuild/scripts/meson_install.py
@@ -17,6 +17,7 @@
import sys, pickle, os, shutil, subprocess, gzip, platform
from glob import glob
from mesonbuild.scripts import depfixer
+from mesonbuild.scripts import destdir_join
def do_copy(from_file, to_file):
try:
@@ -27,21 +28,10 @@ def do_copy(from_file, to_file):
shutil.copyfile(from_file, to_file)
shutil.copystat(from_file, to_file)
-def destdir_join(d1, d2):
- # c:\destdir + c:\prefix must produce c:\destdir\prefix
- if len(d1) > 1 and d1[1] == ':' and \
- len(d2) > 1 and d2[1] == ':':
- return d1 + d2[2:]
- return d1 + d2
-
def do_install(datafilename):
ifile = open(datafilename, 'rb')
d = pickle.load(ifile)
- destdir_var = 'DESTDIR'
- if destdir_var in os.environ:
- d.destdir = os.environ[destdir_var]
- else:
- d.destdir = ''
+ d.destdir = os.environ.get('DESTDIR', '')
d.fullprefix = destdir_join(d.destdir, d.prefix)
install_subdirs(d) # Must be first, because it needs to delete the old subtree.
diff --git a/test cases/common/103 manygen/subdir/manygen.py b/test cases/common/103 manygen/subdir/manygen.py
index 3c692ee..4411183 100755
--- a/test cases/common/103 manygen/subdir/manygen.py
+++ b/test cases/common/103 manygen/subdir/manygen.py
@@ -13,7 +13,15 @@ if not os.path.isdir(outdir):
print('Outdir does not exist.')
sys.exit(1)
-if shutil.which('cl'):
+# Emulate the environment.detect_c_compiler() logic
+compiler = os.environ.get('CC', None)
+if not compiler:
+ compiler = shutil.which('cl') or \
+ shutil.which('gcc') or \
+ shutil.which('clang') or \
+ shutil.which('cc')
+
+if 'cl' in os.path.basename(compiler):
libsuffix = '.lib'
is_vs = True
compiler = 'cl'
@@ -22,11 +30,6 @@ else:
libsuffix = '.a'
is_vs = False
linker = 'ar'
- compiler = shutil.which('gcc')
- if compiler is None:
- compiler = shutil.which('clang')
- if compiler is None:
- compiler = shutil.which('cc')
if compiler is None:
print('No known compilers found.')
sys.exit(1)