summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/28 gir link order 2
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/frameworks/28 gir link order 2')
-rw-r--r--test cases/frameworks/28 gir link order 2/meson-sample.c42
-rw-r--r--test cases/frameworks/28 gir link order 2/meson-sample.h17
-rw-r--r--test cases/frameworks/28 gir link order 2/meson.build35
-rw-r--r--test cases/frameworks/28 gir link order 2/samelibname/dummy.c0
-rw-r--r--test cases/frameworks/28 gir link order 2/samelibname/meson.build5
-rw-r--r--test cases/frameworks/28 gir link order 2/test.json3
6 files changed, 102 insertions, 0 deletions
diff --git a/test cases/frameworks/28 gir link order 2/meson-sample.c b/test cases/frameworks/28 gir link order 2/meson-sample.c
new file mode 100644
index 0000000..d743b2d
--- /dev/null
+++ b/test cases/frameworks/28 gir link order 2/meson-sample.c
@@ -0,0 +1,42 @@
+#include "meson-sample.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));
+}
diff --git a/test cases/frameworks/28 gir link order 2/meson-sample.h b/test cases/frameworks/28 gir link order 2/meson-sample.h
new file mode 100644
index 0000000..2c28401
--- /dev/null
+++ b/test cases/frameworks/28 gir link order 2/meson-sample.h
@@ -0,0 +1,17 @@
+#ifndef MESON_SAMPLE_H
+#define MESON_SAMPLE_H
+
+#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 (void);
+void meson_sample_print_message (MesonSample *self);
+
+G_END_DECLS
+
+#endif /* MESON_SAMPLE_H */
diff --git a/test cases/frameworks/28 gir link order 2/meson.build b/test cases/frameworks/28 gir link order 2/meson.build
new file mode 100644
index 0000000..a26531b
--- /dev/null
+++ b/test cases/frameworks/28 gir link order 2/meson.build
@@ -0,0 +1,35 @@
+project('gir link order 2', 'c')
+
+if not dependency('gobject-2.0', required : false).found() or not find_program('g-ir-scanner', required: false).found()
+ error('MESON_SKIP_TEST gobject not found.')
+endif
+
+gnome = import('gnome')
+gobject = dependency('gobject-2.0')
+
+# This builds a dummy libsample under samelibname that's not really used
+subdir('samelibname')
+
+# This builds the real libsample
+meson_sample_sources = ['meson-sample.c', 'meson-sample.h']
+meson_sample_lib = shared_library(
+ 'sample',
+ sources : meson_sample_sources,
+ dependencies : [gobject],
+ link_with: [samelibname],
+ install : false,
+)
+
+# g-ir-scanner should get the linker paths in the right order so it links first
+# against the target libsample and not the dummy one that's just a dependency
+# https://github.com/mesonbuild/meson/pull/5423
+gnome.generate_gir(
+ meson_sample_lib,
+ sources : meson_sample_sources,
+ nsversion : '1.0',
+ namespace : 'Meson',
+ symbol_prefix : 'meson',
+ identifier_prefix : 'Meson',
+ install : false,
+ build_by_default: true,
+)
diff --git a/test cases/frameworks/28 gir link order 2/samelibname/dummy.c b/test cases/frameworks/28 gir link order 2/samelibname/dummy.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/frameworks/28 gir link order 2/samelibname/dummy.c
diff --git a/test cases/frameworks/28 gir link order 2/samelibname/meson.build b/test cases/frameworks/28 gir link order 2/samelibname/meson.build
new file mode 100644
index 0000000..dd923d7
--- /dev/null
+++ b/test cases/frameworks/28 gir link order 2/samelibname/meson.build
@@ -0,0 +1,5 @@
+samelibname = shared_library(
+ 'sample',
+ sources : 'dummy.c',
+ install : false,
+)
diff --git a/test cases/frameworks/28 gir link order 2/test.json b/test cases/frameworks/28 gir link order 2/test.json
new file mode 100644
index 0000000..a9d74fb
--- /dev/null
+++ b/test cases/frameworks/28 gir link order 2/test.json
@@ -0,0 +1,3 @@
+{
+ "skip_on_jobname": ["azure", "macos", "msys2"]
+}