gobject-introspection 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +50 -0
- data/ext/gobject-introspection/extconf.rb +97 -0
- data/ext/gobject-introspection/rb-gi-arg-info.c +151 -0
- data/ext/gobject-introspection/rb-gi-argument.c +223 -0
- data/ext/gobject-introspection/rb-gi-base-info.c +218 -0
- data/ext/gobject-introspection/rb-gi-boxed-info.c +48 -0
- data/ext/gobject-introspection/rb-gi-callable-info.c +124 -0
- data/ext/gobject-introspection/rb-gi-callback-info.c +48 -0
- data/ext/gobject-introspection/rb-gi-constant-info.c +77 -0
- data/ext/gobject-introspection/rb-gi-constructor-info.c +82 -0
- data/ext/gobject-introspection/rb-gi-conversions.h +95 -0
- data/ext/gobject-introspection/rb-gi-enum-info.c +145 -0
- data/ext/gobject-introspection/rb-gi-field-info.c +149 -0
- data/ext/gobject-introspection/rb-gi-flags-info.c +48 -0
- data/ext/gobject-introspection/rb-gi-function-info.c +199 -0
- data/ext/gobject-introspection/rb-gi-interface-info.c +222 -0
- data/ext/gobject-introspection/rb-gi-loader.c +61 -0
- data/ext/gobject-introspection/rb-gi-method-info.c +66 -0
- data/ext/gobject-introspection/rb-gi-object-info.c +345 -0
- data/ext/gobject-introspection/rb-gi-property-info.c +77 -0
- data/ext/gobject-introspection/rb-gi-registered-type-info.c +86 -0
- data/ext/gobject-introspection/rb-gi-repository.c +164 -0
- data/ext/gobject-introspection/rb-gi-signal-info.c +77 -0
- data/ext/gobject-introspection/rb-gi-struct-info.c +183 -0
- data/ext/gobject-introspection/rb-gi-type-info.c +143 -0
- data/ext/gobject-introspection/rb-gi-type-tag.c +43 -0
- data/ext/gobject-introspection/rb-gi-types.h +71 -0
- data/ext/gobject-introspection/rb-gi-union-info.c +206 -0
- data/ext/gobject-introspection/rb-gi-unresolved-info.c +48 -0
- data/ext/gobject-introspection/rb-gi-value-info.c +57 -0
- data/ext/gobject-introspection/rb-gi-vfunc-info.c +91 -0
- data/ext/gobject-introspection/rb-gobject-introspection.c +42 -0
- data/ext/gobject-introspection/rb-gobject-introspection.h +105 -0
- data/extconf.rb +71 -0
- data/lib/gobject-introspection.rb +39 -0
- data/lib/gobject-introspection/collection-reader.rb +34 -0
- data/lib/gobject-introspection/loader.rb +148 -0
- data/lib/gobject-introspection/object-info.rb +33 -0
- data/lib/gobject-introspection/repository.rb +32 -0
- data/lib/gobject-introspection/struct-info.rb +28 -0
- data/sample/clutter-basic-actor.rb +132 -0
- data/sample/clutter.rb +29 -0
- data/test/gobject-introspection-test-utils.rb +26 -0
- data/test/run-test.rb +45 -0
- data/test/test-arg-info.rb +68 -0
- data/test/test-base-info.rb +31 -0
- data/test/test-boxed-info.rb +21 -0
- data/test/test-callable-info.rb +49 -0
- data/test/test-callback-info.rb +29 -0
- data/test/test-constant-info.rb +24 -0
- data/test/test-enum-info.rb +56 -0
- data/test/test-field-type.rb +42 -0
- data/test/test-flags-info.rb +27 -0
- data/test/test-function-info.rb +37 -0
- data/test/test-interface-info.rb +97 -0
- data/test/test-loader.rb +30 -0
- data/test/test-object-info.rb +131 -0
- data/test/test-property-info.rb +38 -0
- data/test/test-registered-type-info.rb +35 -0
- data/test/test-repository.rb +59 -0
- data/test/test-signal-info.rb +37 -0
- data/test/test-struct-info.rb +57 -0
- data/test/test-type-info.rb +62 -0
- data/test/test-type-tag.rb +29 -0
- data/test/test-union-info.rb +21 -0
- data/test/test-value-info.rb +28 -0
- data/test/test-vfunc-info.rb +42 -0
- metadata +162 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rb-gobject-introspection.h"
|
22
|
+
|
23
|
+
#define RG_TUNRESOLVEDET_NAMESPACE rb_cGIUnresolvedInfo
|
24
|
+
|
25
|
+
GType
|
26
|
+
gi_unresolved_info_get_type(void)
|
27
|
+
{
|
28
|
+
static GType type = 0;
|
29
|
+
if (type == 0) {
|
30
|
+
type = g_boxed_type_register_static("GIUnresolvedInfo",
|
31
|
+
(GBoxedCopyFunc)g_base_info_ref,
|
32
|
+
(GBoxedFreeFunc)g_base_info_unref);
|
33
|
+
}
|
34
|
+
return type;
|
35
|
+
}
|
36
|
+
|
37
|
+
void
|
38
|
+
rb_gi_unresolved_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
|
39
|
+
{
|
40
|
+
VALUE RG_TARGET_NAMESPACE;
|
41
|
+
|
42
|
+
RG_TARGET_NAMESPACE =
|
43
|
+
G_DEF_CLASS_WITH_PARENT(GI_TYPE_UNRESOLVED_INFO,
|
44
|
+
"UnresolvedInfo", rb_mGI,
|
45
|
+
rb_cGIBaseInfo);
|
46
|
+
|
47
|
+
(void)RG_TARGET_NAMESPACE; /* suppress a warning. */
|
48
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rb-gobject-introspection.h"
|
22
|
+
|
23
|
+
#define RG_TARGET_NAMESPACE rb_cGIValueInfo
|
24
|
+
#define SELF(self) (RVAL2GI_VALUE_INFO(self))
|
25
|
+
|
26
|
+
GType
|
27
|
+
gi_value_info_get_type(void)
|
28
|
+
{
|
29
|
+
static GType type = 0;
|
30
|
+
if (type == 0) {
|
31
|
+
type = g_boxed_type_register_static("GIValueInfo",
|
32
|
+
(GBoxedCopyFunc)g_base_info_ref,
|
33
|
+
(GBoxedFreeFunc)g_base_info_unref);
|
34
|
+
}
|
35
|
+
return type;
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE
|
39
|
+
rg_value(VALUE self)
|
40
|
+
{
|
41
|
+
GIValueInfo *info;
|
42
|
+
|
43
|
+
info = SELF(self);
|
44
|
+
return LONG2NUM(g_value_info_get_value(info));
|
45
|
+
}
|
46
|
+
|
47
|
+
void
|
48
|
+
rb_gi_value_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
|
49
|
+
{
|
50
|
+
VALUE RG_TARGET_NAMESPACE;
|
51
|
+
|
52
|
+
RG_TARGET_NAMESPACE =
|
53
|
+
G_DEF_CLASS_WITH_PARENT(GI_TYPE_VALUE_INFO, "ValueInfo", rb_mGI,
|
54
|
+
rb_cGIBaseInfo);
|
55
|
+
|
56
|
+
RG_DEF_METHOD(value, 0);
|
57
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rb-gobject-introspection.h"
|
22
|
+
|
23
|
+
#define RG_TARGET_NAMESPACE rb_cGIVFuncInfo
|
24
|
+
#define SELF(self) RVAL2GI_BASE_INFO(self)
|
25
|
+
|
26
|
+
GType
|
27
|
+
gi_vfunc_info_get_type(void)
|
28
|
+
{
|
29
|
+
static GType type = 0;
|
30
|
+
if (type == 0) {
|
31
|
+
type = g_boxed_type_register_static("GIVFuncInfo",
|
32
|
+
(GBoxedCopyFunc)g_base_info_ref,
|
33
|
+
(GBoxedFreeFunc)g_base_info_unref);
|
34
|
+
}
|
35
|
+
return type;
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE
|
39
|
+
rg_flags(VALUE self)
|
40
|
+
{
|
41
|
+
GIVFuncInfo *info;
|
42
|
+
|
43
|
+
info = SELF(self);
|
44
|
+
return GI_VFUNC_INFO_FLAGS2RVAL(g_vfunc_info_get_flags(info));
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
rg_offset(VALUE self)
|
49
|
+
{
|
50
|
+
GIVFuncInfo *info;
|
51
|
+
|
52
|
+
info = SELF(self);
|
53
|
+
return INT2NUM(g_vfunc_info_get_offset(info));
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
rg_signal(VALUE self)
|
58
|
+
{
|
59
|
+
GIVFuncInfo *info;
|
60
|
+
|
61
|
+
info = SELF(self);
|
62
|
+
return GI_BASE_INFO2RVAL_WITH_UNREF(g_vfunc_info_get_signal(info));
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE
|
66
|
+
rg_invoker(VALUE self)
|
67
|
+
{
|
68
|
+
GIVFuncInfo *info;
|
69
|
+
|
70
|
+
info = SELF(self);
|
71
|
+
return GI_BASE_INFO2RVAL_WITH_UNREF(g_vfunc_info_get_invoker(info));
|
72
|
+
}
|
73
|
+
|
74
|
+
void
|
75
|
+
rb_gi_vfunc_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
|
76
|
+
{
|
77
|
+
VALUE RG_TARGET_NAMESPACE;
|
78
|
+
|
79
|
+
RG_TARGET_NAMESPACE =
|
80
|
+
G_DEF_CLASS_WITH_PARENT(GI_TYPE_VFUNC_INFO, "VFuncInfo", rb_mGI,
|
81
|
+
rb_cGICallableInfo);
|
82
|
+
|
83
|
+
rb_define_const(RG_TARGET_NAMESPACE, "UNKNOWN_OFFSET", INT2NUM(0xFFFF));
|
84
|
+
|
85
|
+
RG_DEF_METHOD(flags, 0);
|
86
|
+
RG_DEF_METHOD(offset, 0);
|
87
|
+
RG_DEF_METHOD(signal, 0);
|
88
|
+
RG_DEF_METHOD(invoker, 0);
|
89
|
+
|
90
|
+
G_DEF_CLASS(G_TYPE_IV_FUNC_INFO_FLAGS, "VFuncInfoFlags", rb_mGI);
|
91
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rb-gobject-introspection.h"
|
22
|
+
|
23
|
+
#define RG_TARGET_NAMESPACE rb_mGObjectIntrospection
|
24
|
+
|
25
|
+
void
|
26
|
+
Init_gobject_introspection(void)
|
27
|
+
{
|
28
|
+
VALUE RG_TARGET_NAMESPACE;
|
29
|
+
|
30
|
+
RG_TARGET_NAMESPACE = rb_define_module("GObjectIntrospection");
|
31
|
+
|
32
|
+
rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION",
|
33
|
+
rb_ary_new3(3,
|
34
|
+
INT2FIX(GI_MAJOR_VERSION),
|
35
|
+
INT2FIX(GI_MINOR_VERSION),
|
36
|
+
INT2FIX(GI_MICRO_VERSION)));
|
37
|
+
|
38
|
+
rb_gi_type_tag_init(RG_TARGET_NAMESPACE);
|
39
|
+
rb_gi_base_info_init(RG_TARGET_NAMESPACE);
|
40
|
+
rb_gi_repository_init(RG_TARGET_NAMESPACE);
|
41
|
+
rb_gi_loader_init(RG_TARGET_NAMESPACE);
|
42
|
+
}
|
@@ -0,0 +1,105 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#ifndef RB_GOBJECT_INTROSPECTION_H
|
22
|
+
#define RB_GOBJECT_INTROSPECTION_H
|
23
|
+
|
24
|
+
#include <ruby.h>
|
25
|
+
#include <rbgobject.h>
|
26
|
+
#include <glib-enum-types.h>
|
27
|
+
|
28
|
+
#include <girffi.h>
|
29
|
+
#include "gobject-introspection-enum-types.h"
|
30
|
+
|
31
|
+
#include "rbgiversion.h"
|
32
|
+
|
33
|
+
#include "rb-gi-types.h"
|
34
|
+
#include "rb-gi-conversions.h"
|
35
|
+
|
36
|
+
#ifndef RB_TYPE_P
|
37
|
+
# define RB_TYPE_P(object, type) (TYPE(object) == type)
|
38
|
+
#endif
|
39
|
+
|
40
|
+
#ifndef HAVE_TYPE_ENUM_RUBY_VALUE_TYPE
|
41
|
+
# define RUBY_T_FIXNUM T_FIXNUM
|
42
|
+
#endif
|
43
|
+
|
44
|
+
extern void Init_gobject_introspection(void);
|
45
|
+
|
46
|
+
void rb_gi_type_tag_init (VALUE rb_mGI);
|
47
|
+
void rb_gi_base_info_init (VALUE rb_mGI);
|
48
|
+
void rb_gi_callable_info_init (VALUE rb_mGI,
|
49
|
+
VALUE rb_cGIBaseInfo);
|
50
|
+
void rb_gi_function_info_init (VALUE rb_mGI,
|
51
|
+
VALUE rb_cGICallableInfo);
|
52
|
+
void rb_gi_method_info_init (VALUE rb_mGI,
|
53
|
+
VALUE rb_cGIFunctionInfo);
|
54
|
+
void rb_gi_constructor_info_init (VALUE rb_mGI,
|
55
|
+
VALUE rb_cGIFunctionInfo);
|
56
|
+
void rb_gi_callback_info_init (VALUE rb_mGI,
|
57
|
+
VALUE rb_cGICallableInfo);
|
58
|
+
void rb_gi_registered_type_info_init (VALUE rb_mGI,
|
59
|
+
VALUE rb_cGIBaseInfo);
|
60
|
+
void rb_gi_struct_info_init (VALUE rb_mGI,
|
61
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
62
|
+
void rb_gi_boxed_info_init (VALUE rb_mGI,
|
63
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
64
|
+
void rb_gi_enum_info_init (VALUE rb_mGI,
|
65
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
66
|
+
void rb_gi_flags_info_init (VALUE rb_mGI,
|
67
|
+
VALUE rb_cGIEnumInfo);
|
68
|
+
void rb_gi_object_info_init (VALUE rb_mGI,
|
69
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
70
|
+
void rb_gi_interface_info_init (VALUE rb_mGI,
|
71
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
72
|
+
void rb_gi_constant_info_init (VALUE rb_mGI,
|
73
|
+
VALUE rb_cGIBaseInfo);
|
74
|
+
void rb_gi_union_info_init (VALUE rb_mGI,
|
75
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
76
|
+
void rb_gi_value_info_init (VALUE rb_mGI,
|
77
|
+
VALUE rb_cGIBaseInfo);
|
78
|
+
void rb_gi_signal_info_init (VALUE rb_mGI,
|
79
|
+
VALUE rb_cGICallableInfo);
|
80
|
+
void rb_gi_vfunc_info_init (VALUE rb_mGI,
|
81
|
+
VALUE rb_cGICallableInfo);
|
82
|
+
void rb_gi_property_info_init (VALUE rb_mGI,
|
83
|
+
VALUE rb_cGIBaseInfo);
|
84
|
+
void rb_gi_field_info_init (VALUE rb_mGI,
|
85
|
+
VALUE rb_cGIBaseInfo);
|
86
|
+
void rb_gi_arg_info_init (VALUE rb_mGI,
|
87
|
+
VALUE rb_cGIBaseInfo);
|
88
|
+
void rb_gi_type_info_init (VALUE rb_mGI,
|
89
|
+
VALUE rb_cGIBaseInfo);
|
90
|
+
void rb_gi_unresolved_info_init (VALUE rb_mGI,
|
91
|
+
VALUE rb_cGIBaseInfo);
|
92
|
+
void rb_gi_repository_init (VALUE rb_mGI);
|
93
|
+
void rb_gi_loader_init (VALUE rb_mGI);
|
94
|
+
|
95
|
+
void rb_gi_function_info_invoke_raw (GIFunctionInfo *info,
|
96
|
+
int argc, VALUE *argv,
|
97
|
+
GIArgument *return_value);
|
98
|
+
|
99
|
+
VALUE rb_gi_field_info_get_field_raw (GIFieldInfo *info,
|
100
|
+
gpointer memory);
|
101
|
+
void rb_gi_field_info_set_field_raw (GIFieldInfo *info,
|
102
|
+
gpointer memory,
|
103
|
+
VALUE rb_field_value);
|
104
|
+
|
105
|
+
#endif
|
data/extconf.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
require "pathname"
|
20
|
+
require "mkmf"
|
21
|
+
require "rbconfig"
|
22
|
+
require "fileutils"
|
23
|
+
|
24
|
+
module_name = "gobject_introspection"
|
25
|
+
package = "gobject-introspection"
|
26
|
+
|
27
|
+
base_dir = Pathname(__FILE__).dirname.expand_path
|
28
|
+
ext_dir = base_dir + "ext" + package
|
29
|
+
mkmf_gnome2_dir = base_dir + 'lib'
|
30
|
+
|
31
|
+
if RbConfig.respond_to?(:ruby)
|
32
|
+
ruby = RbConfig.ruby
|
33
|
+
else
|
34
|
+
ruby = File.join(RbConfig::CONFIG['bindir'],
|
35
|
+
RbConfig::CONFIG['ruby_install_name'] +
|
36
|
+
RbConfig::CONFIG["EXEEXT"])
|
37
|
+
end
|
38
|
+
build_dir = Pathname("ext") + package
|
39
|
+
FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
|
40
|
+
extconf_rb_path = ext_dir + "extconf.rb"
|
41
|
+
unless system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV)
|
42
|
+
exit(false)
|
43
|
+
end
|
44
|
+
|
45
|
+
create_makefile(module_name)
|
46
|
+
FileUtils.mv("Makefile", "Makefile.lib")
|
47
|
+
|
48
|
+
File.open("Makefile", "w") do |makefile|
|
49
|
+
makefile.puts(<<-EOM)
|
50
|
+
all:
|
51
|
+
(cd ext/#{package} && $(MAKE))
|
52
|
+
$(MAKE) -f Makefile.lib
|
53
|
+
|
54
|
+
install:
|
55
|
+
(cd ext/#{package} && $(MAKE) install)
|
56
|
+
$(MAKE) -f Makefile.lib install
|
57
|
+
|
58
|
+
site-install:
|
59
|
+
(cd ext/#{package} && $(MAKE) site-install)
|
60
|
+
$(MAKE) -f Makefile.lib site-install
|
61
|
+
|
62
|
+
clean:
|
63
|
+
(cd ext/#{package} && $(MAKE) clean)
|
64
|
+
$(MAKE) -f Makefile.lib clean
|
65
|
+
|
66
|
+
distclean:
|
67
|
+
(cd ext/#{package} && $(MAKE) distclean)
|
68
|
+
$(MAKE) -f Makefile.lib distclean
|
69
|
+
@rm -f Makefile.lib
|
70
|
+
EOM
|
71
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (C) 2012 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "glib2"
|
18
|
+
|
19
|
+
base_dir = Pathname.new(__FILE__).dirname.dirname.dirname.expand_path
|
20
|
+
vendor_dir = base_dir + "vendor" + "local"
|
21
|
+
vendor_bin_dir = vendor_dir + "bin"
|
22
|
+
GLib.prepend_environment_path(vendor_bin_dir)
|
23
|
+
begin
|
24
|
+
major, minor, _ = RUBY_VERSION.split(/\./)
|
25
|
+
require "#{major}.#{minor}/gobject_introspection.so"
|
26
|
+
rescue LoadError
|
27
|
+
require "gobject_introspection.so"
|
28
|
+
end
|
29
|
+
|
30
|
+
module GObjectIntrospection
|
31
|
+
LOG_DOMAIN = "GObjectIntrospection"
|
32
|
+
end
|
33
|
+
|
34
|
+
GLib::Log.set_log_domain(GObjectIntrospection::LOG_DOMAIN)
|
35
|
+
|
36
|
+
require "gobject-introspection/repository"
|
37
|
+
require "gobject-introspection/object-info"
|
38
|
+
require "gobject-introspection/struct-info"
|
39
|
+
require "gobject-introspection/loader"
|