From 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:41:38 +0200 Subject: Adding upstream version 1.0.1. Signed-off-by: Daniel Baumann --- .../22 gir link order/fake-gthread/fake-gthread.c | 6 +++ .../22 gir link order/fake-gthread/fake-gthread.h | 6 +++ .../22 gir link order/fake-gthread/meson.build | 12 ++++++ .../22 gir link order/get-prgname/get-prgname.c | 8 ++++ .../22 gir link order/get-prgname/get-prgname.h | 6 +++ .../22 gir link order/get-prgname/meson.build | 13 ++++++ .../frameworks/22 gir link order/meson-sample.c | 48 ++++++++++++++++++++++ .../frameworks/22 gir link order/meson-sample.h | 17 ++++++++ .../frameworks/22 gir link order/meson.build | 41 ++++++++++++++++++ test cases/frameworks/22 gir link order/test.json | 3 ++ 10 files changed, 160 insertions(+) create mode 100644 test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.c create mode 100644 test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.h create mode 100644 test cases/frameworks/22 gir link order/fake-gthread/meson.build create mode 100644 test cases/frameworks/22 gir link order/get-prgname/get-prgname.c create mode 100644 test cases/frameworks/22 gir link order/get-prgname/get-prgname.h create mode 100644 test cases/frameworks/22 gir link order/get-prgname/meson.build create mode 100644 test cases/frameworks/22 gir link order/meson-sample.c create mode 100644 test cases/frameworks/22 gir link order/meson-sample.h create mode 100644 test cases/frameworks/22 gir link order/meson.build create mode 100644 test cases/frameworks/22 gir link order/test.json (limited to 'test cases/frameworks/22 gir link order') diff --git a/test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.c b/test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.c new file mode 100644 index 0000000..fae9c38 --- /dev/null +++ b/test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.c @@ -0,0 +1,6 @@ +#include "fake-gthread.h" + +int fake_gthread_fake_function (void) +{ + return 7; +} diff --git a/test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.h b/test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.h new file mode 100644 index 0000000..52b5472 --- /dev/null +++ b/test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.h @@ -0,0 +1,6 @@ +#ifndef FAKE_GTHREAD_H +#define FAKE_GTHREAD_H + +int fake_gthread_fake_function (void); + +#endif /* FAKE_GTHREAD_H */ diff --git a/test cases/frameworks/22 gir link order/fake-gthread/meson.build b/test cases/frameworks/22 gir link order/fake-gthread/meson.build new file mode 100644 index 0000000..693e8e0 --- /dev/null +++ b/test cases/frameworks/22 gir link order/fake-gthread/meson.build @@ -0,0 +1,12 @@ +fake_gthread_sources = ['fake-gthread.c', 'fake-gthread.h'] +fake_gthread_lib = shared_library( + 'gthread-2.0', + sources : fake_gthread_sources, + install : false, +) + +fake_gthread_includes = include_directories('.') +fake_gthread = declare_dependency( + include_directories : fake_gthread_includes, + link_with : fake_gthread_lib, +) diff --git a/test cases/frameworks/22 gir link order/get-prgname/get-prgname.c b/test cases/frameworks/22 gir link order/get-prgname/get-prgname.c new file mode 100644 index 0000000..356b45e --- /dev/null +++ b/test cases/frameworks/22 gir link order/get-prgname/get-prgname.c @@ -0,0 +1,8 @@ +#include "get-prgname.h" + +#include + +const char *get_prgname_get_name (void) +{ + return g_get_prgname (); +} diff --git a/test cases/frameworks/22 gir link order/get-prgname/get-prgname.h b/test cases/frameworks/22 gir link order/get-prgname/get-prgname.h new file mode 100644 index 0000000..cb5118e --- /dev/null +++ b/test cases/frameworks/22 gir link order/get-prgname/get-prgname.h @@ -0,0 +1,6 @@ +#ifndef GET_PRGNAME_H +#define GET_PRGNAME_H + +const char *get_prgname_get_name (void); + +#endif /* GET_PRGNAME_H */ diff --git a/test cases/frameworks/22 gir link order/get-prgname/meson.build b/test cases/frameworks/22 gir link order/get-prgname/meson.build new file mode 100644 index 0000000..6a7489d --- /dev/null +++ b/test cases/frameworks/22 gir link order/get-prgname/meson.build @@ -0,0 +1,13 @@ +get_prgname_sources = ['get-prgname.c', 'get-prgname.h'] +get_prgname_lib = shared_library( + 'get-prgname', + sources : get_prgname_sources, + dependencies : [glib], + install : false, +) + +get_prgname_includes = include_directories('.') +get_prgname = declare_dependency( + include_directories : get_prgname_includes, + link_with : get_prgname_lib, +) diff --git a/test cases/frameworks/22 gir link order/meson-sample.c b/test cases/frameworks/22 gir link order/meson-sample.c new file mode 100644 index 0000000..7c6442a --- /dev/null +++ b/test cases/frameworks/22 gir link order/meson-sample.c @@ -0,0 +1,48 @@ +#include "meson-sample.h" + +#include "get-prgname.h" +#include "fake-gthread.h" + +struct _MesonSample { + GObject parent_instance; +}; + +G_DEFINE_TYPE (MesonSample, meson_sample, G_TYPE_OBJECT) + +/** + * meson_sample_new: + * + * Allocates a new #MesonSample. + * + * Returns: (transfer full): a #MesonSample. + */ +MesonSample * +meson_sample_new (void) +{ + return g_object_new (MESON_TYPE_SAMPLE, NULL); +} + +static void +meson_sample_class_init (MesonSampleClass *klass) +{ +} + +static void +meson_sample_init (MesonSample *self) +{ +} + +/** + * meson_sample_print_message: + * @self: a #MesonSample. + * + * Prints a message. + */ +void +meson_sample_print_message (MesonSample *self) +{ + g_return_if_fail (MESON_IS_SAMPLE (self)); + + g_print ("Message: %s\n", get_prgname_get_name ()); + g_print ("Message: %d\n", fake_gthread_fake_function ()); +} diff --git a/test cases/frameworks/22 gir link order/meson-sample.h b/test cases/frameworks/22 gir link order/meson-sample.h new file mode 100644 index 0000000..2c28401 --- /dev/null +++ b/test cases/frameworks/22 gir link order/meson-sample.h @@ -0,0 +1,17 @@ +#ifndef MESON_SAMPLE_H +#define MESON_SAMPLE_H + +#include + +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 (void); +void meson_sample_print_message (MesonSample *self); + +G_END_DECLS + +#endif /* MESON_SAMPLE_H */ diff --git a/test cases/frameworks/22 gir link order/meson.build b/test cases/frameworks/22 gir link order/meson.build new file mode 100644 index 0000000..8a714b5 --- /dev/null +++ b/test cases/frameworks/22 gir link order/meson.build @@ -0,0 +1,41 @@ +project('gir link order', 'c') + +if not dependency('glib-2.0', required : false).found() or not find_program('g-ir-scanner', required: false).found() + error('MESON_SKIP_TEST glib not found.') +endif + +gnome = import('gnome') +glib = dependency('glib-2.0') +gobject = dependency('gobject-2.0') + +# get-prgname is a shared library which uses a function from glib-2.0. It is +# used to introduce external -L flags which may cause -L order problems. +subdir('get-prgname') + +# fake-gthread is a shared library which has the same name as gthread-2.0 from +# GLib. This is used to simulate the case where an older or unrelated version +# of a library is already installed on the system. Our meson sample library +# defined below uses a function from fake-gthread. If meson messes up -L order, +# the linker will find libgthread-2.0.so installed on the system and fail to +# find the symbol our meson sample library uses. +subdir('fake-gthread') + +meson_sample_sources = ['meson-sample.c', 'meson-sample.h'] +meson_sample_lib = shared_library( + 'sample', + sources : meson_sample_sources, + dependencies : [gobject, get_prgname, fake_gthread], + install : false, +) + +gnome.generate_gir( + meson_sample_lib, + sources : meson_sample_sources, + nsversion : '1.0', + namespace : 'Meson', + symbol_prefix : 'meson', + identifier_prefix : 'Meson', + includes : ['GObject-2.0'], + install : false, + build_by_default: true, +) diff --git a/test cases/frameworks/22 gir link order/test.json b/test cases/frameworks/22 gir link order/test.json new file mode 100644 index 0000000..a9d74fb --- /dev/null +++ b/test cases/frameworks/22 gir link order/test.json @@ -0,0 +1,3 @@ +{ + "skip_on_jobname": ["azure", "macos", "msys2"] +} -- cgit v1.2.3