diff options
30 files changed, 387 insertions, 38 deletions
diff --git a/docs/markdown/Creating-releases.md b/docs/markdown/Creating-releases.md new file mode 100644 index 0000000..b0149a6 --- /dev/null +++ b/docs/markdown/Creating-releases.md @@ -0,0 +1,15 @@ +--- +short-description: Creating releases +... + +# Creating releases + +In addition to development, almost all projects provide periodical source releases. These are standalone packages (usually either in tar or zip format) of the source code. They do not contain any revision control metadata, only the source code. + +Meson provides a simple way of generating these. It consists of a single command: + + ninja dist + +This creates a file called `projectname-version.tar.xz` in the build tree subdirectory `meson-dist`. This archive contains the full contents of the latest commit in revision control including all the submodules. All revision control metadata is removed. Meson then takes this archive and tests that it works by doing a full compile + test + install cycle. If all these pass, Meson will then create a SHA-256 checksum file next to the archive. + +**Note**: Meson behaviour is different from Autotools. The Autotools "dist" target packages up the current source tree. Meson packages the latest revision control commit. The reason for this is that it prevents developers from doing accidental releases where the distributed archive does not match any commit in revision control (especially the one tagged for the release). diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index b20c14a..62c0fb3 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -137,7 +137,7 @@ These are all the supported keyword arguments: Create a custom top level build target. The only positional argument is the name of this target and the keyword arguments are the following. -- `input` list of source files +- `input` list of source files. As of 0.41.0 the list will be flattened. - `output` list of output files - `command` command to run to create outputs from inputs. The command may be strings or the return of `find_program()` or `executable()` (note: always specify commands in array form `['commandname', '-arg1', '-arg2']` rather than as a string `'commandname -arg1 -arg2'` as the latter will *not* work) - `install` when true, this target is installed during the install step @@ -228,8 +228,8 @@ With the Ninja backend, Meson will create a build-time [order-only dependency](h Executable supports the following keyword arguments. Note that just like the positional arguments above, these keyword arguments can also be passed to [shared and static libraries](#library). -- `link_with`, one or more shared or static libraries (built by this project) that this target should be linked with -- `link_whole` links all contents of the given static libraries whether they are used by not, equivalent to the `-Wl,--whole-archive` argument flag of GCC, available since 0.40.0 +- `link_with`, one or more shared or static libraries (built by this project) that this target should be linked with, If passed a list this list will be flattened as of 0.41.0. +- `link_whole` links all contents of the given static libraries whether they are used by not, equivalent to the `-Wl,--whole-archive` argument flag of GCC, available since 0.40.0. As of 0.41.0 if passed a list that list will be flattened. - `<languagename>_pch` precompiled header file to use for the given language - `<languagename>_args` compiler flags to use for the given language; eg: `cpp_args` for C++ - `link_args` flags to use during linking. You can use UNIX-style flags here for all platforms. @@ -582,7 +582,7 @@ Builds a shared library with the given sources. Positional and keyword arguments - `version` a string specifying the version of this shared library, such as `1.1.0`. On Linux and OS X, this is used to set the shared library version in the filename, such as `libfoo.so.1.1.0` and `libfoo.1.1.0.dylib`. If this is not specified, `soversion` is used instead (see below). - `soversion` a string specifying the soversion of this shared library, such as `0`. On Linux and Windows this is used to set the soversion (or equivalent) in the filename. For example, if `soversion` is `4`, a Windows DLL will be called `foo-4.dll` and one of the aliases of the Linux shared library would be `libfoo.so.4`. If this is not specified, the first part of `version` is used instead. For example, if `version` is `3.6.0` and `soversion` is not defined, it is set to `3`. -- `vs_module_defs` a string pointing to a file or a File object that contains Visual Studio symbol export definitions. +- `vs_module_defs` a string pointing to a file or a File object that is a Microsoft module definition file for controlling symbol exports, etc., on platforms where that is possible (e.g. Windows). ### shared_module() diff --git a/docs/markdown/Release-notes-for-0.41.0.md b/docs/markdown/Release-notes-for-0.41.0.md index 8a7f263..a96ded0 100644 --- a/docs/markdown/Release-notes-for-0.41.0.md +++ b/docs/markdown/Release-notes-for-0.41.0.md @@ -38,3 +38,21 @@ pkg.generate(libraries : libs, description : 'A simple demo library.', variables : ['datadir=${prefix}/data']) ``` + +## A target for creating tarballs + +Creating distribution tarballs is simple: + + ninja dist + +This will create a `.tar.xz` archive of the source code including +submodules without any revision control information. This command also +verifies that the resulting archive can be built, tested and +installed. This is roughly equivalent to the `distcheck` target in +other build systems. Currently this only works for projects using Git +and only with the Ninja backend. + + +## Support for passing arguments to Rust compiler + +Targets for building rust now take a `rust_args` keyword. diff --git a/docs/sitemap.txt b/docs/sitemap.txt index c4bb0d4..9dceb05 100644 --- a/docs/sitemap.txt +++ b/docs/sitemap.txt @@ -42,6 +42,7 @@ index.md Build-system-converters.md Configuring-a-build-directory.md Run-targets.md + Creating-releases.md Creating-OSX-packages.md Creating-Linux-binaries.md Reference-manual.md diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index e5af9fd..f7e84dc 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -195,6 +195,7 @@ int dummy; self.generate_tests(outfile) outfile.write('# Install rules\n\n') self.generate_install(outfile) + self.generate_dist(outfile) if 'b_coverage' in self.environment.coredata.base_options and \ self.environment.coredata.base_options['b_coverage'].value: outfile.write('# Coverage rules\n\n') @@ -232,6 +233,9 @@ int dummy; for src in genlist.get_outputs(): if self.environment.is_header(src): header_deps.append(self.get_target_generated_dir(target, genlist, src)) + if 'vala' in target.compilers and not isinstance(target, build.Executable): + vala_header = File.from_built_file(self.get_target_dir(target), target.vala_header) + header_deps.append(vala_header) # Recurse and find generated headers for dep in target.link_targets: if isinstance(dep, (build.StaticLibrary, build.SharedLibrary)): @@ -1080,7 +1084,7 @@ int dummy; args += ['--library=' + target.name] # Outputted header hname = os.path.join(self.get_target_dir(target), target.vala_header) - args += ['-H', hname] + args += ['-H', hname, '--use-header'] valac_outputs.append(hname) # Outputted vapi file vapiname = os.path.join(self.get_target_dir(target), target.vala_vapi) @@ -1149,6 +1153,7 @@ int dummy; args += rustc.get_buildtype_args(self.get_option_for_target('buildtype', target)) depfile = os.path.join(target.subdir, target.name + '.d') args += ['--emit', 'dep-info={}'.format(depfile), '--emit', 'link'] + args += target.get_extra_args('rust') 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() @@ -2169,6 +2174,9 @@ rule FORTRAN_DEP_HACK if isinstance(target, build.Executable): # Currently only used with the Swift compiler to add '-emit-executable' commands += linker.get_std_exe_link_args() + # If gui_app, and that's significant on this platform + if target.gui_app and hasattr(linker, 'get_gui_app_args'): + commands += linker.get_gui_app_args() elif isinstance(target, build.SharedLibrary): if isinstance(target, build.SharedModule): commands += linker.get_std_shared_module_link_args() @@ -2180,10 +2188,10 @@ rule FORTRAN_DEP_HACK commands += linker.get_soname_args(target.prefix, target.name, target.suffix, abspath, target.soversion, isinstance(target, build.SharedModule)) - # This is only visited when using the Visual Studio toolchain + # This is only visited when building for Windows using either GCC or Visual Studio if target.vs_module_defs and hasattr(linker, 'gen_vs_module_defs_args'): commands += linker.gen_vs_module_defs_args(target.vs_module_defs.rel_to_builddir(self.build_to_src)) - # This is only visited when building for Windows using either MinGW/GCC or Visual Studio + # This is only visited when building for Windows using either GCC or Visual Studio if target.import_filename: commands += linker.gen_import_library_args(os.path.join(target.subdir, target.import_filename)) elif isinstance(target, build.StaticLibrary): @@ -2376,6 +2384,19 @@ rule FORTRAN_DEP_HACK # affect behavior in any other way. return sorted(cmds) + def generate_dist(self, outfile): + elem = NinjaBuildElement(self.all_outputs, 'dist', 'CUSTOM_COMMAND', 'PHONY') + elem.add_item('DESC', 'Creating source packages') + elem.add_item('COMMAND', [sys.executable, + self.environment.get_build_command(), + '--internal', 'dist', + self.environment.source_dir, + self.environment.build_dir, + sys.executable, + self.environment.get_build_command()]) + elem.add_item('pool', 'console') + elem.write(outfile) + # For things like scan-build and other helper tools we might have. def generate_utils(self, outfile): cmd = [sys.executable, self.environment.get_build_command(), diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 0d58394..ce6405b 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -34,6 +34,7 @@ known_basic_kwargs = {'install': True, 'fortran_args': True, 'd_args': True, 'java_args': True, + 'rust_args': True, 'link_args': True, 'link_depends': True, 'link_with': True, @@ -632,15 +633,17 @@ class BuildTarget(Target): if not isinstance(fortranlist, list): fortranlist = [fortranlist] self.add_compiler_args('fortran', fortranlist) + rustlist = kwargs.get('rust_args', []) + if not isinstance(rustlist, list): + rustlist = [rustlist] + self.add_compiler_args('rust', rustlist) if not isinstance(self, Executable): self.vala_header = kwargs.get('vala_header', self.name + '.h') self.vala_vapi = kwargs.get('vala_vapi', self.name + '.vapi') self.vala_gir = kwargs.get('vala_gir', None) dlist = stringlistify(kwargs.get('d_args', [])) self.add_compiler_args('d', dlist) - self.link_args = kwargs.get('link_args', []) - if not isinstance(self.link_args, list): - self.link_args = [self.link_args] + self.link_args = flatten(kwargs.get('link_args', [])) for i in self.link_args: if not isinstance(i, str): raise InvalidArguments('Link_args arguments must be strings.') @@ -813,9 +816,7 @@ You probably should put it in link_with instead.''') return self.external_deps def link(self, target): - if not isinstance(target, list): - target = [target] - for t in target: + for t in flatten(target): if hasattr(t, 'held_object'): t = t.held_object if not isinstance(t, (StaticLibrary, SharedLibrary)): @@ -829,9 +830,7 @@ You probably should put it in link_with instead.''') self.link_targets.append(t) def link_whole(self, target): - if not isinstance(target, list): - target = [target] - for t in target: + for t in flatten(target): if hasattr(t, 'held_object'): t = t.held_object if not isinstance(t, StaticLibrary): @@ -1443,8 +1442,7 @@ class CustomTarget(Target): def process_kwargs(self, kwargs): super().process_kwargs(kwargs) self.sources = kwargs.get('input', []) - if not isinstance(self.sources, list): - self.sources = [self.sources] + self.sources = flatten(self.sources) if 'output' not in kwargs: raise InvalidArguments('Missing keyword argument "output".') self.outputs = kwargs['output'] diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index a36f184..fa06ae9 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -146,10 +146,10 @@ java_buildtype_args = {'plain': [], } rust_buildtype_args = {'plain': [], - 'debug': ['-g'], - 'debugoptimized': ['-g', '--opt-level', '2'], - 'release': ['--opt-level', '3'], - 'minsize': [], + 'debug': ['-C', 'debuginfo=2'], + 'debugoptimized': ['-C', 'debuginfo=2', '-C', 'opt-level=2'], + 'release': ['-C', 'opt-level=3'], + 'minsize': [], # In a future release: ['-C', 'opt-level=s'], } d_gdc_buildtype_args = {'plain': [], @@ -2451,6 +2451,20 @@ class GnuCompiler: def get_link_whole_for(self, args): return ['-Wl,--whole-archive'] + args + ['-Wl,--no-whole-archive'] + def gen_vs_module_defs_args(self, defsfile): + if not isinstance(defsfile, str): + raise RuntimeError('Module definitions file should be str') + # On Windows targets, .def files may be specified on the linker command + # line like an object file. + if self.gcc_type in (GCC_CYGWIN, GCC_MINGW): + return [defsfile] + # For other targets, discard the .def file. + return [] + + def get_gui_app_args(self): + if self.gcc_type in (GCC_CYGWIN, GCC_MINGW): + return ['-mwindows'] + return [] class GnuCCompiler(GnuCompiler, CCompiler): def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None): diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 6c091c8..a336278 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -347,4 +347,6 @@ forbidden_target_names = {'clean': None, 'build.ninja': None, 'scan-build': None, 'reconfigure': None, + 'dist': None, + 'distcheck': None, } diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 54e8016..6937502 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -203,7 +203,7 @@ def classify_unity_sources(compilers, sources): def flatten(item): if not isinstance(item, list): - return item + return [item] result = [] for i in item: if isinstance(i, list): diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index bce0965..282df36 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -246,6 +246,9 @@ def run_script_command(args): elif cmdname == 'uninstall': import mesonbuild.scripts.uninstall as abc cmdfunc = abc.run + elif cmdname == 'dist': + import mesonbuild.scripts.dist as abc + cmdfunc = abc.run else: raise MesonException('Unknown internal command {}.'.format(cmdname)) return cmdfunc(cmdargs) diff --git a/mesonbuild/scripts/dist.py b/mesonbuild/scripts/dist.py new file mode 100644 index 0000000..ba6df7d --- /dev/null +++ b/mesonbuild/scripts/dist.py @@ -0,0 +1,148 @@ +# Copyright 2017 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. + + +import os, sys +import shutil +import argparse +import subprocess +import pickle +import hashlib +import tarfile, zipfile +import tempfile +from glob import glob +from mesonbuild.environment import detect_ninja + +def create_hash(fname): + hashname = fname + '.sha256sum' + m = hashlib.sha256() + m.update(open(fname, 'rb').read()) + with open(hashname, 'w') as f: + f.write('%s %s\n' % (m.hexdigest(), os.path.split(fname)[-1])) + +def create_zip(zipfilename, packaging_dir): + prefix = os.path.split(packaging_dir)[0] + removelen = len(prefix) + 1 + with zipfile.ZipFile(zipfilename, + 'w', + compression=zipfile.ZIP_DEFLATED, + allowZip64=True) as zf: + zf.write(packaging_dir, packaging_dir[removelen:]) + for root, dirs, files in os.walk(packaging_dir): + for d in dirs: + dname = os.path.join(root, d) + zf.write(dname, dname[removelen:]) + for f in files: + fname = os.path.join(root, f) + zf.write(fname, fname[removelen:]) + +def del_gitfiles(dirname): + for f in glob(os.path.join(dirname, '.git*')): + if os.path.isdir(f) and not os.path.islink(f): + shutil.rmtree(f) + else: + os.unlink(f) + +def process_submodules(dirname): + module_file = os.path.join(dirname, '.gitmodules') + if not os.path.exists(module_file): + return + subprocess.check_call(['git', 'submodule', 'update', '--init'], cwd=dirname) + for line in open(module_file): + line = line.strip() + if '=' not in line: + continue + k, v = line.split('=', 1) + k = k.strip() + v = v.strip() + if k != 'path': + continue + del_gitfiles(os.path.join(dirname, v)) + +def create_dist(dist_name, src_root, bld_root, dist_sub): + distdir = os.path.join(dist_sub, dist_name) + if os.path.exists(distdir): + shutil.rmtree(distdir) + os.makedirs(distdir) + subprocess.check_call(['git', 'clone', '--shared', src_root, distdir]) + process_submodules(distdir) + del_gitfiles(distdir) + xzname = distdir + '.tar.xz' + # Should use shutil but it got xz support only in 3.5. + with tarfile.open(xzname, 'w:xz') as tf: + tf.add(distdir, os.path.split(distdir)[1]) + # Create only .tar.xz for now. + #zipname = distdir + '.zip' + #create_zip(zipname, distdir) + shutil.rmtree(distdir) + return (xzname, ) + +def check_dist(packagename, meson_command): + print('Testing distribution package %s.' % packagename) + unpackdir = tempfile.mkdtemp() + builddir = tempfile.mkdtemp() + installdir = tempfile.mkdtemp() + ninja_bin = detect_ninja() + try: + tf = tarfile.open(packagename) + tf.extractall(unpackdir) + srcdir = glob(os.path.join(unpackdir, '*'))[0] + if subprocess.call(meson_command + ['--backend=ninja', srcdir, builddir]) != 0: + print('Running Meson on distribution package failed') + return 1 + if subprocess.call([ninja_bin], cwd=builddir) != 0: + print('Compiling the distribution package failed.') + return 1 + if subprocess.call([ninja_bin, 'test'], cwd=builddir) != 0: + print('Running unit tests on the distribution package failed.') + return 1 + myenv = os.environ.copy() + myenv['DESTDIR'] = installdir + if subprocess.call([ninja_bin, 'install'], cwd=builddir, env=myenv) != 0: + print('Installing the distribution package failed.') + return 1 + finally: + shutil.rmtree(srcdir) + shutil.rmtree(builddir) + shutil.rmtree(installdir) + print('Distribution package %s tested.' % packagename) + return 0 + +def run(args): + src_root = args[0] + bld_root = args[1] + meson_command = args[2:] + priv_dir = os.path.join(bld_root, 'meson-private') + dist_sub = os.path.join(bld_root, 'meson-dist') + + buildfile = os.path.join(priv_dir, 'build.dat') + + build = pickle.load(open(buildfile, 'rb')) + + dist_name = build.project_name + '-' + build.project_version + + if not os.path.isdir(os.path.join(src_root, '.git')): + print('Dist currently only works with Git repos.') + return 1 + names = create_dist(dist_name, src_root, bld_root, dist_sub) + if names is None: + return 1 + error_count = 0 + for name in names: + rc = check_dist(name, meson_command) # Check only one. + rc = 0 + if rc == 0: + create_hash(name) + error_count += rc + return rc diff --git a/run_unittests.py b/run_unittests.py index 86e5a98..ec9d53b 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -331,6 +331,7 @@ class BasePlatformTests(unittest.TestCase): self.prefix = '/usr' self.libdir = os.path.join(self.prefix, 'lib') self.installdir = os.path.join(self.builddir, 'install') + self.distdir = os.path.join(self.builddir, 'meson-dist') # Get the backend # FIXME: Extract this from argv? self.backend = getattr(Backend, os.environ.get('MESON_UNIT_TEST_BACKEND', 'ninja')) @@ -1065,6 +1066,47 @@ class AllPlatformTests(BasePlatformTests): self.build() self.run_tests() + def test_dist(self): + if not shutil.which('git'): + raise unittest.SkipTest('Git not found') + try: + self.dist_impl() + except PermissionError: + # When run under Windows CI, something (virus scanner?) + # holds on to the git files so cleaning up the dir + # fails sometimes. + pass + + def dist_impl(self): + # Create this on the fly because having rogue .git directories inside + # the source tree leads to all kinds of trouble. + with tempfile.TemporaryDirectory() as project_dir: + with open(os.path.join(project_dir, 'meson.build'), 'w') as ofile: + ofile.write('''project('disttest', 'c', version : '1.4.3') +e = executable('distexe', 'distexe.c') +test('dist test', e) +''') + with open(os.path.join(project_dir, 'distexe.c'), 'w') as ofile: + ofile.write('''#include<stdio.h> + +int main(int argc, char **argv) { + printf("I am a distribution test.\\n"); + return 0; +} +''') + subprocess.check_call(['git', 'init'], cwd=project_dir) + subprocess.check_call(['git', 'config', + 'user.name', 'Author Person'], cwd=project_dir) + subprocess.check_call(['git', 'config', + 'user.email', 'teh_coderz@example.com'], cwd=project_dir) + subprocess.check_call(['git', 'add', 'meson.build', 'distexe.c'], cwd=project_dir) + subprocess.check_call(['git', 'commit', '-a', '-m', 'I am a project'], cwd=project_dir) + self.init(project_dir) + self.build('dist') + distfile = os.path.join(self.distdir, 'disttest-1.4.3.tar.xz') + checksumfile = distfile + '.sha256sum' + self.assertTrue(os.path.exists(distfile)) + self.assertTrue(os.path.exists(checksumfile)) class WindowsTests(BasePlatformTests): ''' @@ -63,6 +63,7 @@ setup(name='meson', url='http://mesonbuild.com', license=' Apache License, Version 2.0', packages=['mesonbuild', + 'mesonbuild.dependencies', 'mesonbuild.modules', 'mesonbuild.scripts', 'mesonbuild.backend', diff --git a/test cases/common/150 nested links/meson.build b/test cases/common/150 nested links/meson.build new file mode 100644 index 0000000..0821b03 --- /dev/null +++ b/test cases/common/150 nested links/meson.build @@ -0,0 +1,8 @@ +project('test', 'c') + +libxserver_dri3 = [] +libxserver = [ libxserver_dri3 ] + +executable('Xephyr', 'xephyr.c', link_with: [ libxserver ]) + +executable('Zephyr', 'xephyr.c', link_args: [[], []]) diff --git a/test cases/common/150 nested links/xephyr.c b/test cases/common/150 nested links/xephyr.c new file mode 100644 index 0000000..33c14ce --- /dev/null +++ b/test cases/common/150 nested links/xephyr.c @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/test cases/common/151 list of file sources/foo b/test cases/common/151 list of file sources/foo new file mode 100644 index 0000000..7b57bd2 --- /dev/null +++ b/test cases/common/151 list of file sources/foo @@ -0,0 +1 @@ +some text diff --git a/test cases/common/151 list of file sources/gen.py b/test cases/common/151 list of file sources/gen.py new file mode 100644 index 0000000..2337d3d --- /dev/null +++ b/test cases/common/151 list of file sources/gen.py @@ -0,0 +1,7 @@ +import shutil +import sys + +if __name__ == '__main__': + if len(sys.argv) != 3: + raise Exception('Requires exactly 2 args') + shutil.copy2(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/151 list of file sources/meson.build b/test cases/common/151 list of file sources/meson.build new file mode 100644 index 0000000..819509d --- /dev/null +++ b/test cases/common/151 list of file sources/meson.build @@ -0,0 +1,12 @@ +project('test', 'c') + +mod_py = import('python3') +python = mod_py.find_python() + +test_target = custom_target( + 'test_target', + input : [files('gen.py'), files('foo')], + output : 'bar', + command : [python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'], + build_by_default : true, +) diff --git a/test cases/rust/1 basic/meson.build b/test cases/rust/1 basic/meson.build index 076d86b..3919279 100644 --- a/test cases/rust/1 basic/meson.build +++ b/test cases/rust/1 basic/meson.build @@ -1,6 +1,9 @@ project('rustprog', 'rust') -e = executable('program', 'prog.rs', install : true) +e = executable('program', 'prog.rs', + rust_args : ['-C', 'lto'], # Just a test + install : true +) test('rusttest', e) subdir('subdir') diff --git a/test cases/vala/16 mixed dependence/app.vala b/test cases/vala/16 mixed dependence/app.vala new file mode 100644 index 0000000..5b54543 --- /dev/null +++ b/test cases/vala/16 mixed dependence/app.vala @@ -0,0 +1,7 @@ +namespace App { + public static int main(string[] args) { + var mixer = new Mixer(); + print("Current volume is %u\n", mixer.get_volume()); + return 0; + } +} diff --git a/test cases/vala/16 mixed dependence/meson.build b/test cases/vala/16 mixed dependence/meson.build new file mode 100644 index 0000000..e6967be --- /dev/null +++ b/test cases/vala/16 mixed dependence/meson.build @@ -0,0 +1,12 @@ +project('mixed dependence', 'vala', 'c') + +deps = [dependency('glib-2.0'), dependency('gobject-2.0')] + +mixer = static_library('mixer', 'mixer.vala', 'mixer-glue.c', + dependencies : deps) + +app = executable('app', 'app.vala', + link_with : mixer, + dependencies : deps) + +test('valamixeddependencetest', app) diff --git a/test cases/vala/16 mixed dependence/mixer-glue.c b/test cases/vala/16 mixed dependence/mixer-glue.c new file mode 100644 index 0000000..d6c0c37 --- /dev/null +++ b/test cases/vala/16 mixed dependence/mixer-glue.c @@ -0,0 +1,5 @@ +#include "mixer.h" + +guint mixer_get_volume(Mixer *mixer) { + return 11; +} diff --git a/test cases/vala/16 mixed dependence/mixer.vala b/test cases/vala/16 mixed dependence/mixer.vala new file mode 100644 index 0000000..f207132 --- /dev/null +++ b/test cases/vala/16 mixed dependence/mixer.vala @@ -0,0 +1,3 @@ +public class Mixer : Object { + public extern uint get_volume(); +} diff --git a/test cases/vala/17 plain consumer/app.c b/test cases/vala/17 plain consumer/app.c new file mode 100644 index 0000000..c8d0010 --- /dev/null +++ b/test cases/vala/17 plain consumer/app.c @@ -0,0 +1,11 @@ +#include "badger.h" + +int main(int argc, char *argv[]) { + Badger *badger; + + badger = g_object_new(TYPE_BADGER, NULL); + g_print("Badger whose name is '%s'\n", badger_get_name(badger)); + g_object_unref(badger); + + return 0; +} diff --git a/test cases/vala/17 plain consumer/badger.vala b/test cases/vala/17 plain consumer/badger.vala new file mode 100644 index 0000000..1aaeda6 --- /dev/null +++ b/test cases/vala/17 plain consumer/badger.vala @@ -0,0 +1,10 @@ +public class Badger : Object { + public string name { + get; + construct; + } + + Badger() { + Object(name: "Joe"); + } +} diff --git a/test cases/vala/17 plain consumer/meson.build b/test cases/vala/17 plain consumer/meson.build new file mode 100644 index 0000000..e98bca1 --- /dev/null +++ b/test cases/vala/17 plain consumer/meson.build @@ -0,0 +1,12 @@ +project('plain consumer', 'vala', 'c') + +deps = [dependency('glib-2.0'), dependency('gobject-2.0')] + +badger = static_library('badger', 'badger.vala', + dependencies : deps) + +app = executable('app', 'app.c', + link_with : badger, + dependencies : deps) + +test('valaplainconsumertest', app) diff --git a/test cases/windows/10 vs module defs generated/meson.build b/test cases/windows/10 vs module defs generated/meson.build index 5ce1a20..7728ca7 100644 --- a/test cases/windows/10 vs module defs generated/meson.build +++ b/test cases/windows/10 vs module defs generated/meson.build @@ -1,7 +1,5 @@ project('generated_dll_module_defs', 'c') -if meson.get_compiler('c').get_id() == 'msvc' - subdir('subdir') - exe = executable('prog', 'prog.c', link_with : shlib) - test('runtest', exe) -endif +subdir('subdir') +exe = executable('prog', 'prog.c', link_with : shlib) +test('runtest', exe) diff --git a/test cases/windows/10 vs module defs generated/subdir/somedll.c b/test cases/windows/10 vs module defs generated/subdir/somedll.c index df255e3..b23d8fe 100644 --- a/test cases/windows/10 vs module defs generated/subdir/somedll.c +++ b/test cases/windows/10 vs module defs generated/subdir/somedll.c @@ -1,5 +1,3 @@ -#ifdef _MSC_VER int somedllfunc() { return 42; } -#endif diff --git a/test cases/windows/6 vs module defs/meson.build b/test cases/windows/6 vs module defs/meson.build index 4b9e735..fb59028 100644 --- a/test cases/windows/6 vs module defs/meson.build +++ b/test cases/windows/6 vs module defs/meson.build @@ -1,7 +1,5 @@ project('dll_module_defs', 'c') -if meson.get_compiler('c').get_id() == 'msvc' - subdir('subdir') - exe = executable('prog', 'prog.c', link_with : shlib) - test('runtest', exe) -endif +subdir('subdir') +exe = executable('prog', 'prog.c', link_with : shlib) +test('runtest', exe) diff --git a/test cases/windows/6 vs module defs/subdir/somedll.c b/test cases/windows/6 vs module defs/subdir/somedll.c index df255e3..b23d8fe 100644 --- a/test cases/windows/6 vs module defs/subdir/somedll.c +++ b/test cases/windows/6 vs module defs/subdir/somedll.c @@ -1,5 +1,3 @@ -#ifdef _MSC_VER int somedllfunc() { return 42; } -#endif |