diff options
-rw-r--r-- | cross/ubuntu-armhf.txt | 2 | ||||
-rw-r--r-- | cross/ubuntu-faketarget.txt | 2 | ||||
-rw-r--r-- | cross/ubuntu-mingw.txt | 4 | ||||
-rw-r--r-- | environment.py | 4 | ||||
-rw-r--r-- | interpreter.py | 10 | ||||
-rw-r--r-- | ninjabackend.py | 2 | ||||
-rw-r--r-- | test cases/common/31 find program/meson.build | 2 | ||||
-rw-r--r-- | test cases/common/38 run program/meson.build | 4 | ||||
-rw-r--r-- | test cases/common/55 file grabber/meson.build | 2 | ||||
-rw-r--r-- | test cases/common/59 object generator/meson.build | 2 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/golib.c | 94 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/golib.h | 41 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/meson-sample.c | 124 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/meson-sample.h | 21 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/meson.build | 39 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/prog.c | 33 | ||||
-rwxr-xr-x | test cases/frameworks/7 gnome/gir/prog.py | 6 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/installed_files.txt | 1 | ||||
-rw-r--r-- | test cases/objc/2 nsstring/meson.build | 2 | ||||
-rw-r--r-- | test cases/prebuilt object/1 basic/meson.build | 2 |
20 files changed, 214 insertions, 183 deletions
diff --git a/cross/ubuntu-armhf.txt b/cross/ubuntu-armhf.txt index 73e3f67..196f2bf 100644 --- a/cross/ubuntu-armhf.txt +++ b/cross/ubuntu-armhf.txt @@ -22,6 +22,6 @@ has_function_printf = true has_function_hfkerhisadf = false [host_machine] -name = 'linux' +system = 'linux' cpu = 'arm' endian = 'little' diff --git a/cross/ubuntu-faketarget.txt b/cross/ubuntu-faketarget.txt index 1ea0977..37e5033 100644 --- a/cross/ubuntu-faketarget.txt +++ b/cross/ubuntu-faketarget.txt @@ -7,6 +7,6 @@ # binaries directly. [target_machine] -name = 'linux' +system = 'linux' cpu = 'mips' endian = 'little' diff --git a/cross/ubuntu-mingw.txt b/cross/ubuntu-mingw.txt index 2f2fa34..c0cfa69 100644 --- a/cross/ubuntu-mingw.txt +++ b/cross/ubuntu-mingw.txt @@ -12,11 +12,11 @@ strip = '/usr/bin/i686-w64-mingw32-strip' root = '/usr/i686-w64-mingw32' [host_machine] -name = 'windows' +system = 'windows' cpu = 'x86' endian = 'little' [target_machine] -name = 'darwin' +system = 'darwin' cpu = 'arm' endian = 'little' diff --git a/environment.py b/environment.py index c594776..abacbe0 100644 --- a/environment.py +++ b/environment.py @@ -91,7 +91,7 @@ class Environment(): cross = self.is_cross_build() if (not cross and mesonlib.is_windows()) \ - or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['name'] == 'windows'): + or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'windows'): self.exe_suffix = 'exe' self.import_lib_suffix = 'lib' self.shared_lib_suffix = 'dll' @@ -102,7 +102,7 @@ class Environment(): else: self.exe_suffix = '' if (not cross and mesonlib.is_osx()) or \ - (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['name'] == 'darwin'): + (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'darwin'): self.shared_lib_suffix = 'dylib' else: self.shared_lib_suffix = 'so' diff --git a/interpreter.py b/interpreter.py index 4202496..f270948 100644 --- a/interpreter.py +++ b/interpreter.py @@ -305,7 +305,7 @@ class GeneratedListHolder(InterpreterObject): class BuildMachine(InterpreterObject): def __init__(self): InterpreterObject.__init__(self) - self.methods.update({'name' : self.name_method, + self.methods.update({'system' : self.system_method, 'cpu' : self.cpu_method, 'endian' : self.endian_method, }) @@ -326,7 +326,7 @@ class BuildMachine(InterpreterObject): # Add fixes here as bugs are reported. return trial - def name_method(self, args, kwargs): + def system_method(self, args, kwargs): return platform.system().lower() def endian_method(self, args, kwargs): @@ -338,13 +338,13 @@ class CrossMachineInfo(InterpreterObject): def __init__(self, cross_info): InterpreterObject.__init__(self) self.info = cross_info - self.methods.update({'name' : self.name_method, + self.methods.update({'system' : self.system_method, 'cpu' : self.cpu_method, 'endian' : self.endian_method, }) - def name_method(self, args, kwargs): - return self.info['name'] + def system_method(self, args, kwargs): + return self.info['system'] def cpu_method(self, args, kwargs): return self.info['cpu'] diff --git a/ninjabackend.py b/ninjabackend.py index a51ea5f..6f10e38 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -1290,7 +1290,7 @@ rule FORTRAN_DEP_HACK symname = os.path.join(targetdir, target_name + '.symbols') elem = NinjaBuildElement(symname, 'SHSYM', target_name) if self.environment.is_cross_build() and self.environment.cross_info.need_cross_compiler(): - elem.add_item('CROSS', '--cross-host=' + self.environment.cross_info.config['host_machine']['name']) + elem.add_item('CROSS', '--cross-host=' + self.environment.cross_info.config['host_machine']['system']) elem.write(outfile) def generate_link(self, target, outfile, outname, obj_list, linker, extra_args=[]): diff --git a/test cases/common/31 find program/meson.build b/test cases/common/31 find program/meson.build index cc3bba7..ae71703 100644 --- a/test cases/common/31 find program/meson.build +++ b/test cases/common/31 find program/meson.build @@ -1,6 +1,6 @@ project('find program', 'c') -if build_machine.name() == 'windows' +if build_machine.system() == 'windows' # Things Windows does not provide: # - an executable to copy files without prompting # - working command line quoting diff --git a/test cases/common/38 run program/meson.build b/test cases/common/38 run program/meson.build index f0bc9ce..20a8107 100644 --- a/test cases/common/38 run program/meson.build +++ b/test cases/common/38 run program/meson.build @@ -1,6 +1,6 @@ project('run command', 'c') -if build_machine.name() == 'windows' +if build_machine.system() == 'windows' c = run_command('cmd', '/c', 'echo', 'hello') else c = run_command('echo', 'hello') @@ -24,7 +24,7 @@ endif # Now the same with a script. -if build_machine.name() == 'windows' +if build_machine.system() == 'windows' cs = run_command('scripts/hello.bat') else cs = run_command('scripts/hello.sh') diff --git a/test cases/common/55 file grabber/meson.build b/test cases/common/55 file grabber/meson.build index d9ee2d3..e332c0b 100644 --- a/test cases/common/55 file grabber/meson.build +++ b/test cases/common/55 file grabber/meson.build @@ -9,7 +9,7 @@ project('grabber', 'c') # acceptable to you, then we're certainly not going to stop you. Just don't # file bugs when it fails. :) -if build_machine.name() == 'windows' +if build_machine.system() == 'windows' c = run_command('grabber.bat') grabber = find_program('grabber2.bat') else diff --git a/test cases/common/59 object generator/meson.build b/test cases/common/59 object generator/meson.build index ffdc1b9..761ef77 100644 --- a/test cases/common/59 object generator/meson.build +++ b/test cases/common/59 object generator/meson.build @@ -6,7 +6,7 @@ python = find_program('python3') # Code will not be rebuilt if it changes. comp = '@0@/@1@'.format(meson.current_source_dir(), 'obj_generator.py') -if host_machine.name() == 'windows' +if host_machine.system() == 'windows' outputname = '@BASENAME@.obj' else outputname = '@BASENAME@.o' diff --git a/test cases/frameworks/7 gnome/gir/golib.c b/test cases/frameworks/7 gnome/gir/golib.c deleted file mode 100644 index 8d70649..0000000 --- a/test cases/frameworks/7 gnome/gir/golib.c +++ /dev/null @@ -1,94 +0,0 @@ -#include "golib.h" -#include <stdio.h> - -G_DEFINE_TYPE (MesonSample, meson_sample, G_TYPE_OBJECT) - -#define MESON_SAMPLE_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), MESON_SAMPLE_TYPE, MesonSamplePrivate)) - -struct _MesonSamplePrivate { - gchar *msg; -}; - -enum { - PROP_0, - PROP_MSG, - N_PROPERTIES -}; - -static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, }; - -static void meson_sample_init (MesonSample *object) -{ - MesonSamplePrivate *priv = MESON_SAMPLE_GET_PRIVATE (object); - priv->msg = NULL; -} -static void meson_sample_finalize (GObject *object) -{ - MesonSamplePrivate *priv = MESON_SAMPLE_GET_PRIVATE (object); - g_free (priv->msg); - G_OBJECT_CLASS (meson_sample_parent_class)->finalize (object); -} - -static void meson_sample_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) { - MesonSamplePrivate *priv = MESON_SAMPLE_GET_PRIVATE (object); - switch (property_id) { - case PROP_MSG: - g_free (priv->msg); - priv->msg = g_value_dup_string (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void meson_sample_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) { - MesonSamplePrivate *priv = MESON_SAMPLE_GET_PRIVATE (object); - switch (property_id) { - case PROP_MSG: - g_value_set_string (value, priv->msg); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void meson_sample_class_init (MesonSampleClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->set_property = meson_sample_set_property; - object_class->get_property = meson_sample_get_property; - object_class->finalize = meson_sample_finalize; - - obj_properties[PROP_MSG] = - g_param_spec_string ("msg", - "Msg", - "The message to print.", - "propertytext", - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT); - g_object_class_install_properties (object_class, - N_PROPERTIES, - obj_properties); - g_type_class_add_private (object_class, sizeof (MesonSamplePrivate)); -} - -MesonSample* meson_sample_new () { - MesonSample *sample; - sample = g_object_new(MESON_SAMPLE_TYPE, NULL); - return sample; -} - -void meson_sample_func (MesonSample *sample) { - MesonSamplePrivate *priv; - g_return_if_fail (sample != NULL); - priv = MESON_SAMPLE_GET_PRIVATE(sample); - printf("GObject introspection is working, %s!\n", priv->msg); -} diff --git a/test cases/frameworks/7 gnome/gir/golib.h b/test cases/frameworks/7 gnome/gir/golib.h deleted file mode 100644 index 272d65c..0000000 --- a/test cases/frameworks/7 gnome/gir/golib.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef GOLIB_H -#define GOLIB_H - -#if !defined (MESON_TEST) -#error "MESON_TEST not defined." -#endif - -#include <glib.h> -#include <glib-object.h> - -#define MESON_SAMPLE_TYPE \ - (meson_sample_get_type()) -#define MESON_SAMPLE(o) \ - (G_TYPE_CHECK_INSTANCE_CAST ((o), MESON_SAMPLE_TYPE, MesonSample)) -#define MESON_SAMPLE_CLASS(c) \ - (G_TYPE_CHECK_CLASS_CAST ((c), MESON_SAMPLE_TYPE, MesonSampleClass)) -#define MESON_IS_SAMPLE(o) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((o), MESON_SAMPLE_TYPE)) -#define MESON_IS_SAMPLE_CLASS(c) \ - (G_TYPE_CHECK_CLASS_TYPE ((c), MESON_SAMPLE_TYPE)) -#define MESON_SAMPLE_GET_CLASS(o) \ - (G_TYPE_INSTANCE_GET_CLASS ((o), MESON_SAMPLE_TYPE, MesonSampleClass)) - -typedef struct _MesonSample MesonSample; -typedef struct _MesonSamplePrivate MesonSamplePrivate; -typedef struct _MesonSampleClass MesonSampleClass; - -struct _MesonSample { - GObject parent; -}; - -struct _MesonSampleClass { - GObjectClass parent; -}; - -GType meson_sample_get_type () G_GNUC_CONST; -MesonSample* meson_sample_new (void); - -void meson_sample_func (MesonSample *sample); - -#endif diff --git a/test cases/frameworks/7 gnome/gir/meson-sample.c b/test cases/frameworks/7 gnome/gir/meson-sample.c new file mode 100644 index 0000000..dbf3625 --- /dev/null +++ b/test cases/frameworks/7 gnome/gir/meson-sample.c @@ -0,0 +1,124 @@ +#include "meson-sample.h" + +struct _MesonSample +{ + GObject parent_instance; + + gchar *msg; +}; + +G_DEFINE_TYPE (MesonSample, meson_sample, G_TYPE_OBJECT) + +enum { + PROP_0, + PROP_MSG, + LAST_PROP +}; + +static GParamSpec *gParamSpecs [LAST_PROP]; + +/** + * meson_sample_new: + * @msg: The message to set. + * + * Allocates a new #MesonSample. + * + * Returns: (transfer full): a #MesonSample. + */ +MesonSample * +meson_sample_new (const gchar *msg) +{ + g_return_val_if_fail (msg != NULL, NULL); + + return g_object_new (MESON_TYPE_SAMPLE, + "message", msg, + NULL); +} + +static void +meson_sample_finalize (GObject *object) +{ + MesonSample *self = (MesonSample *)object; + + g_clear_pointer (&self->msg, g_free); + + G_OBJECT_CLASS (meson_sample_parent_class)->finalize (object); +} + +static void +meson_sample_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + MesonSample *self = MESON_SAMPLE (object); + + switch (prop_id) + { + case PROP_MSG: + g_value_set_string (value, self->msg); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sample_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + MesonSample *self = MESON_SAMPLE (object); + + switch (prop_id) + { + case PROP_MSG: + self->msg = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sample_class_init (MesonSampleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = meson_sample_finalize; + object_class->get_property = meson_sample_get_property; + object_class->set_property = meson_sample_set_property; + + gParamSpecs [PROP_MSG] = + g_param_spec_string ("message", + "Message", + "The message to print.", + NULL, + (G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs); +} + +static void +meson_sample_init (MesonSample *self) +{ +} + +/** + * meson_sample_print_message: + * @self: a #MesonSample. + * + * Prints the message. + * + * Returns: Nothing. + */ +void +meson_sample_print_message (MesonSample *self) +{ + g_return_if_fail (MESON_IS_SAMPLE (self)); + + g_print ("Message: %s\n", self->msg); +} diff --git a/test cases/frameworks/7 gnome/gir/meson-sample.h b/test cases/frameworks/7 gnome/gir/meson-sample.h new file mode 100644 index 0000000..cd2bbc6 --- /dev/null +++ b/test cases/frameworks/7 gnome/gir/meson-sample.h @@ -0,0 +1,21 @@ +#ifndef MESON_SAMPLE_H +#define MESON_SAMPLE_H + +#if !defined (MESON_TEST) +#error "MESON_TEST not defined." +#endif + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define MESON_TYPE_SAMPLE (meson_sample_get_type()) + +G_DECLARE_FINAL_TYPE (MesonSample, meson_sample, MESON, SAMPLE, GObject) + +MesonSample *meson_sample_new (const gchar *msg); +void meson_sample_print_message (MesonSample *self); + +G_END_DECLS + +#endif /* MESON_SAMPLE_H */ diff --git a/test cases/frameworks/7 gnome/gir/meson.build b/test cases/frameworks/7 gnome/gir/meson.build index dcc0ad8..32884db 100644 --- a/test cases/frameworks/7 gnome/gir/meson.build +++ b/test cases/frameworks/7 gnome/gir/meson.build @@ -1,17 +1,32 @@ +libsources = ['meson-sample.c', 'meson-sample.h'] -libsources = ['golib.c', 'golib.h'] +girlib = shared_library( + 'girlib', + sources : libsources, + dependencies : gobj, + install : true +) -girexe = executable('girprog', libsources, 'prog.c', -dependencies : [glib, gobj, gir, gmod]) +girexe = executable( + 'girprog', + sources : 'prog.c', + dependencies : [glib, gobj, gir], + link_with : girlib +) -gnome.generate_gir(girexe, -sources : libsources, -nsversion : '1.0', -namespace : 'Meson', -symbol_prefix : 'meson_', -identifier_prefix : 'Meson', -includes : ['GObject-2.0', 'Gio-2.0'], -install : true +gnome.generate_gir( + girlib, + sources : libsources, + nsversion : '1.0', + namespace : 'Meson', + symbol_prefix : 'meson_', + identifier_prefix : 'Meson', + includes : ['GObject-2.0'], + install : true ) -test('gobject introspection', girexe) +test('gobject introspection/c', girexe) +test('gobject introspection/py', find_program('prog.py'), + env : ['GI_TYPELIB_PATH=@0@'.format(meson.current_build_dir()), + 'LD_LIBRARY_PATH=@0@'.format(meson.current_build_dir()), + ]) diff --git a/test cases/frameworks/7 gnome/gir/prog.c b/test cases/frameworks/7 gnome/gir/prog.c index 71584d6..1116285 100644 --- a/test cases/frameworks/7 gnome/gir/prog.c +++ b/test cases/frameworks/7 gnome/gir/prog.c @@ -1,24 +1,23 @@ -#include"golib.h" +#include <girepository.h> -#include<girepository.h> +#include "meson-sample.h" -int main(int argc, char *argv[]) { - GOptionContext *ctx; - GError *error = NULL; - MesonSample *i; +gint +main (gint argc, + gchar *argv[]) +{ + g_autoptr(GError) error = NULL; - ctx = g_option_context_new(NULL); - g_option_context_add_group(ctx, g_irepository_get_option_group ()); + g_autoptr(GOptionContext) ctx = g_option_context_new (NULL); + g_option_context_add_group (ctx, g_irepository_get_option_group ()); - if (!g_option_context_parse(ctx, &argc, &argv, &error)) { - g_print("sample: %s\n", error->message); - return 1; - } + if (!g_option_context_parse (ctx, &argc, &argv, &error)) { + g_print ("sample: %s\n", error->message); + return 1; + } - i = meson_sample_new(); - meson_sample_func(i); - g_object_unref(G_OBJECT(i)); + g_autoptr(MesonSample) i = meson_sample_new ("Hello, meson/c!"); + meson_sample_print_message (i); - return 0; + return 0; } - diff --git a/test cases/frameworks/7 gnome/gir/prog.py b/test cases/frameworks/7 gnome/gir/prog.py new file mode 100755 index 0000000..717d08a --- /dev/null +++ b/test cases/frameworks/7 gnome/gir/prog.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 +from gi.repository import Meson + +if __name__ == "__main__": + s = Meson.Sample.new("Hello, meson/py!") + s.print_message() diff --git a/test cases/frameworks/7 gnome/installed_files.txt b/test cases/frameworks/7 gnome/installed_files.txt index 8464839..741d9b8 100644 --- a/test cases/frameworks/7 gnome/installed_files.txt +++ b/test cases/frameworks/7 gnome/installed_files.txt @@ -1,3 +1,4 @@ usr/lib/girepository-1.0/Meson-1.0.typelib +usr/lib/libgirlib.so usr/share/gir-1.0/Meson-1.0.gir usr/share/glib-2.0/schemas/com.github.meson.gschema.xml diff --git a/test cases/objc/2 nsstring/meson.build b/test cases/objc/2 nsstring/meson.build index 8bb06cb..bc997bc 100644 --- a/test cases/objc/2 nsstring/meson.build +++ b/test cases/objc/2 nsstring/meson.build @@ -1,6 +1,6 @@ project('nsstring', 'objc') -if host_machine.name() == 'darwin' +if host_machine.system() == 'darwin' dep = dependency('appleframeworks', modules : 'foundation') else dep = dependency('gnustep') diff --git a/test cases/prebuilt object/1 basic/meson.build b/test cases/prebuilt object/1 basic/meson.build index befb764..92f966b 100644 --- a/test cases/prebuilt object/1 basic/meson.build +++ b/test cases/prebuilt object/1 basic/meson.build @@ -9,7 +9,7 @@ project('prebuilt object', 'c') -if host_machine.name() == 'windows' +if host_machine.system() == 'windows' prebuilt = 'prebuilt.obj' else prebuilt = 'prebuilt.o' |