glib2 2.2.0 → 2.2.1
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.
- checksums.yaml +4 -4
- data/Rakefile +34 -51
- data/ext/glib2/extconf.rb +2 -1
- data/ext/glib2/glib2.def +2 -0
- data/ext/glib2/rbglib.h +1 -1
- data/ext/glib2/rbglib_maincontext.c +5 -351
- data/ext/glib2/rbglib_mainloop.c +27 -2
- data/ext/glib2/rbgobj_boxed.c +20 -4
- data/ext/glib2/rbgobj_object.c +25 -1
- data/ext/glib2/rbgobj_type.c +5 -5
- data/ext/glib2/rbgprivate.h +0 -2
- data/ext/glib2/rbgutil.c +39 -1
- data/ext/glib2/rbgutil.h +2 -1
- data/ext/glib2/rbgutil_callback.c +0 -2
- data/lib/gnome2/rake/external-package.rb +12 -0
- data/lib/gnome2/rake/native-binary-build-task.rb +4 -2
- data/lib/gnome2/rake/package.rb +9 -0
- data/lib/gnome2/rake/win32-binary-build-task.rb +71 -18
- data/lib/mkmf-gnome2.rb +53 -9
- metadata +22 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04730751dce8565060ffd80a06d6a0ff6a15810a
|
|
4
|
+
data.tar.gz: 259e897aa9cd8d7a9ed55fd4d5d46250d8fffefe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 012bb0c94321282d928c856e78861ba209fd043dc89aad1f91e9c452c33e26a894efba8291923dfaa78d2763f8f7e9729c8a7918bb205ea12b8805c8349ebc0b
|
|
7
|
+
data.tar.gz: 570415824340c5482d8ff2673f5b41c64a4dcd11f33c1e01f9ed3c497e4fda0f4e92a9a1a90ff6a9850e8dddcaf32500b1ebe6cd01454fc13cf61a6117975cab
|
data/Rakefile
CHANGED
|
@@ -23,20 +23,43 @@ package = GNOME2Package.new do |_package|
|
|
|
23
23
|
_package.dependency.gem.runtime = [["pkg-config", ">= 0"]]
|
|
24
24
|
_package.dependency.gem.development = [["test-unit", ">= 2"]]
|
|
25
25
|
_package.win32.packages = []
|
|
26
|
-
_package.win32.dependencies = [
|
|
26
|
+
_package.win32.dependencies = []
|
|
27
27
|
_package.external_packages = [
|
|
28
|
+
{
|
|
29
|
+
:name => "libiconv",
|
|
30
|
+
:download_site => :gnu,
|
|
31
|
+
:label => "libiconv",
|
|
32
|
+
:version => "1.14",
|
|
33
|
+
:windows => {
|
|
34
|
+
:built_file => "bin/libiconv-2.dll",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
:name => "gettext",
|
|
39
|
+
:download_site => :gnu,
|
|
40
|
+
:label => "gettext-runtime",
|
|
41
|
+
:version => "0.19.2",
|
|
42
|
+
:base_dir_in_package => "gettext-runtime",
|
|
43
|
+
:windows => {
|
|
44
|
+
:built_file => "bin/libintl-8.dll",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
:name => "libffi",
|
|
49
|
+
:download_base_url => "ftp://sourceware.org/pub/libffi",
|
|
50
|
+
:label => "libffi",
|
|
51
|
+
:version => "3.1",
|
|
52
|
+
:windows => {
|
|
53
|
+
:built_file => "bin/libffi-6.dll",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
28
56
|
{
|
|
29
57
|
:name => "glib",
|
|
30
58
|
:download_site => :gnome,
|
|
31
59
|
:label => "GLib",
|
|
32
|
-
:version => "2.
|
|
60
|
+
:version => "2.42.0",
|
|
33
61
|
:compression_method => "xz",
|
|
34
62
|
:windows => {
|
|
35
|
-
:configure_args => [
|
|
36
|
-
"LIBFFI_CFLAGS=-I#{include_dir}",
|
|
37
|
-
"LIBFFI_LIBS=-L#{libffi_lib_dir} -lffi",
|
|
38
|
-
"--disable-modular-tests",
|
|
39
|
-
],
|
|
40
63
|
:need_autoreconf => true,
|
|
41
64
|
:patches => [
|
|
42
65
|
"glib-2.38.2-add-missing-exeext.diff",
|
|
@@ -46,9 +69,9 @@ package = GNOME2Package.new do |_package|
|
|
|
46
69
|
},
|
|
47
70
|
{
|
|
48
71
|
:name => "gmp",
|
|
49
|
-
:download_base_url => "ftp://ftp.gmplib.org/pub/gmp-
|
|
72
|
+
:download_base_url => "ftp://ftp.gmplib.org/pub/gmp-6.0.0",
|
|
50
73
|
:label => "GNU MP",
|
|
51
|
-
:version => "
|
|
74
|
+
:version => "6.0.0",
|
|
52
75
|
:compression_method => "xz",
|
|
53
76
|
:windows => {
|
|
54
77
|
:configure_args => [
|
|
@@ -72,7 +95,7 @@ package = GNOME2Package.new do |_package|
|
|
|
72
95
|
:name => "gnutls",
|
|
73
96
|
:download_base_url => "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2",
|
|
74
97
|
:label => "GnuTLS",
|
|
75
|
-
:version => "3.2.
|
|
98
|
+
:version => "3.2.18",
|
|
76
99
|
:compression_method => "xz",
|
|
77
100
|
:windows => {
|
|
78
101
|
:configure_args => [
|
|
@@ -88,7 +111,7 @@ package = GNOME2Package.new do |_package|
|
|
|
88
111
|
:name => "glib-networking",
|
|
89
112
|
:download_site => :gnome,
|
|
90
113
|
:label => "glib-networking",
|
|
91
|
-
:version => "2.
|
|
114
|
+
:version => "2.42.0",
|
|
92
115
|
:compression_method => "xz",
|
|
93
116
|
:windows => {
|
|
94
117
|
:configure_args => [
|
|
@@ -107,43 +130,3 @@ package = GNOME2Package.new do |_package|
|
|
|
107
130
|
end
|
|
108
131
|
end
|
|
109
132
|
package.define_tasks
|
|
110
|
-
|
|
111
|
-
namespace :win32 do
|
|
112
|
-
namespace :libffi do
|
|
113
|
-
namespace :header do
|
|
114
|
-
desc "Move libffi headers to include/"
|
|
115
|
-
task :fix do
|
|
116
|
-
libffi_version = "libffi-3.0.6"
|
|
117
|
-
mv(Dir.glob(File.join(libffi_lib_dir, libffi_version, "include", "*.h")),
|
|
118
|
-
include_dir)
|
|
119
|
-
rm_rf(File.join(libffi_lib_dir, libffi_version))
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
namespace :downloader do
|
|
125
|
-
task :after => [
|
|
126
|
-
"win32:libffi:header:fix",
|
|
127
|
-
]
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
namespace :gettext do
|
|
131
|
-
namespace :header do
|
|
132
|
-
desc "Copy gettext headers to include/glib-2.0/"
|
|
133
|
-
task :fix do
|
|
134
|
-
cp(File.join(include_dir, "libintl.h"),
|
|
135
|
-
glib2_include_dir)
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
namespace :builder do
|
|
141
|
-
namespace :build do
|
|
142
|
-
namespace :glib do
|
|
143
|
-
task :after => [
|
|
144
|
-
"win32:gettext:header:fix",
|
|
145
|
-
]
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
data/ext/glib2/extconf.rb
CHANGED
|
@@ -42,7 +42,7 @@ have_func("rb_errinfo", ruby_header)
|
|
|
42
42
|
have_func("rb_sourcefile", ruby_header)
|
|
43
43
|
have_func("rb_sourceline", ruby_header)
|
|
44
44
|
have_func("ruby_set_current_source", ruby_header)
|
|
45
|
-
have_func("
|
|
45
|
+
have_func("rb_thread_call_without_gvl2", ruby_header)
|
|
46
46
|
have_func("ruby_native_thread_p", ruby_header)
|
|
47
47
|
have_func("rb_thread_call_with_gvl", ruby_header)
|
|
48
48
|
have_func("rb_str_new_cstr", ruby_header)
|
|
@@ -68,6 +68,7 @@ end
|
|
|
68
68
|
glib_mkenums(enum_types_prefix, headers, "G_TYPE_", ["glib-object.h"])
|
|
69
69
|
|
|
70
70
|
$defs << "-DRUBY_GLIB2_COMPILATION"
|
|
71
|
+
|
|
71
72
|
create_makefile(module_name)
|
|
72
73
|
|
|
73
74
|
pkg_config_dir = with_config("pkg-config-dir")
|
data/ext/glib2/glib2.def
CHANGED
data/ext/glib2/rbglib.h
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
|
3
|
+
* Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
|
|
4
4
|
* Copyright (C) 2005 Masao Mutoh
|
|
5
5
|
*
|
|
6
6
|
* This library is free software; you can redistribute it and/or
|
|
@@ -21,16 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
#include "rbgprivate.h"
|
|
23
23
|
|
|
24
|
-
#ifndef HAVE_RB_THREAD_BLOCKING_REGION
|
|
25
|
-
# include <version.h>
|
|
26
|
-
# include <rubysig.h>
|
|
27
|
-
# include <node.h>
|
|
28
|
-
# include <time.h>
|
|
29
|
-
# ifdef HAVE_CURR_THREAD
|
|
30
|
-
# define rb_curr_thread curr_thread
|
|
31
|
-
# endif
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
24
|
GStaticPrivate rg_polling_key = G_STATIC_PRIVATE_INIT;
|
|
35
25
|
|
|
36
26
|
/*
|
|
@@ -51,13 +41,6 @@ typedef struct _callback_info_t
|
|
|
51
41
|
/*****************************************/
|
|
52
42
|
static GPollFunc default_poll_func;
|
|
53
43
|
|
|
54
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
|
55
|
-
|
|
56
|
-
/* just for ruby-1.9.0. */
|
|
57
|
-
#if !defined(RUBY_UBF_IO) && defined(RB_UBF_DFL)
|
|
58
|
-
# define RUBY_UBF_IO RB_UBF_DFL
|
|
59
|
-
#endif
|
|
60
|
-
|
|
61
44
|
typedef struct _PollInfo
|
|
62
45
|
{
|
|
63
46
|
GPollFD *ufds;
|
|
@@ -87,7 +70,11 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
|
|
|
87
70
|
info.result = 0;
|
|
88
71
|
|
|
89
72
|
g_static_private_set(&rg_polling_key, GINT_TO_POINTER(TRUE), NULL);
|
|
73
|
+
#ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL2
|
|
74
|
+
rb_thread_call_without_gvl2(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL);
|
|
75
|
+
#else
|
|
90
76
|
rb_thread_blocking_region(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL);
|
|
77
|
+
#endif
|
|
91
78
|
g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL);
|
|
92
79
|
|
|
93
80
|
return info.result;
|
|
@@ -99,20 +86,6 @@ ruby_source_set_priority (G_GNUC_UNUSED VALUE self, G_GNUC_UNUSED VALUE priority
|
|
|
99
86
|
return Qnil;
|
|
100
87
|
}
|
|
101
88
|
|
|
102
|
-
#else
|
|
103
|
-
static gint
|
|
104
|
-
rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
|
|
105
|
-
{
|
|
106
|
-
gint result;
|
|
107
|
-
|
|
108
|
-
TRAP_BEG;
|
|
109
|
-
result = default_poll_func(ufds, nfsd, timeout);
|
|
110
|
-
TRAP_END;
|
|
111
|
-
|
|
112
|
-
return result;
|
|
113
|
-
}
|
|
114
|
-
#endif
|
|
115
|
-
|
|
116
89
|
static void
|
|
117
90
|
restore_poll_func(G_GNUC_UNUSED VALUE data)
|
|
118
91
|
{
|
|
@@ -121,294 +94,6 @@ restore_poll_func(G_GNUC_UNUSED VALUE data)
|
|
|
121
94
|
}
|
|
122
95
|
}
|
|
123
96
|
|
|
124
|
-
#ifndef HAVE_RB_THREAD_BLOCKING_REGION
|
|
125
|
-
static guint ruby_source_id = 0;
|
|
126
|
-
|
|
127
|
-
/* from eval.c */
|
|
128
|
-
#define WAIT_FD (1<<0)
|
|
129
|
-
#define WAIT_SELECT (1<<1)
|
|
130
|
-
#define WAIT_TIME (1<<2)
|
|
131
|
-
#define WAIT_JOIN (1<<3)
|
|
132
|
-
#define WAIT_PID (1<<4)
|
|
133
|
-
|
|
134
|
-
#define DELAY_INFTY 1E30
|
|
135
|
-
|
|
136
|
-
#ifdef RUBY_RELEASE_YEAR
|
|
137
|
-
# define CHECK_RUBY_RELEASE_DATE(year, month, day) \
|
|
138
|
-
(RUBY_RELEASE_YEAR >= (year) && \
|
|
139
|
-
RUBY_RELEASE_MONTH >= (month) && \
|
|
140
|
-
RUBY_RELEASE_DAY >= (day))
|
|
141
|
-
#else
|
|
142
|
-
# define CHECK_RUBY_RELEASE_DATE(year, month, day) 0
|
|
143
|
-
#endif
|
|
144
|
-
|
|
145
|
-
static double
|
|
146
|
-
timeofday(void)
|
|
147
|
-
{
|
|
148
|
-
struct timeval tv;
|
|
149
|
-
#if CHECK_RUBY_RELEASE_DATE(2009, 1, 7)
|
|
150
|
-
/* The following CLOCK_MONOTONIC change was introduced into
|
|
151
|
-
* Ruby 1.8.6 and 1.8.7 at 2009-01-07.
|
|
152
|
-
*
|
|
153
|
-
* 1.8.6:
|
|
154
|
-
* Wed Jan 7 10:06:12 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
155
|
-
*
|
|
156
|
-
* * eval.c (timeofday): use monotonic clock. based on a patch
|
|
157
|
-
* from zimbatm <zimbatm@oree.ch> in [ruby-core:16627].
|
|
158
|
-
*
|
|
159
|
-
* 1.8.7:
|
|
160
|
-
* Wed Jan 7 10:09:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
161
|
-
*
|
|
162
|
-
* * eval.c (timeofday): use monotonic clock. based on a patch
|
|
163
|
-
* from zimbatm <zimbatm@oree.ch> in [ruby-core:16627].
|
|
164
|
-
*/
|
|
165
|
-
# ifdef CLOCK_MONOTONIC
|
|
166
|
-
struct timespec tp;
|
|
167
|
-
|
|
168
|
-
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
|
|
169
|
-
return (double)tp.tv_sec + (double)tp.tv_nsec * 1e-9;
|
|
170
|
-
}
|
|
171
|
-
# endif
|
|
172
|
-
#endif
|
|
173
|
-
gettimeofday(&tv, NULL);
|
|
174
|
-
return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/*****************************************/
|
|
178
|
-
typedef struct _RGSource
|
|
179
|
-
{
|
|
180
|
-
GSource source;
|
|
181
|
-
|
|
182
|
-
GList *poll_fds;
|
|
183
|
-
GList *old_poll_fds;
|
|
184
|
-
gboolean ready;
|
|
185
|
-
} RGSource;
|
|
186
|
-
|
|
187
|
-
static void
|
|
188
|
-
source_cleanup_poll_fds(GSource *source)
|
|
189
|
-
{
|
|
190
|
-
RGSource *rg_source = (RGSource *)source;
|
|
191
|
-
GList *node;
|
|
192
|
-
|
|
193
|
-
for (node = rg_source->old_poll_fds; node; node = g_list_next(node)) {
|
|
194
|
-
GPollFD *poll_fd = node->data;
|
|
195
|
-
|
|
196
|
-
g_source_remove_poll(source, poll_fd);
|
|
197
|
-
g_slice_free(GPollFD, poll_fd);
|
|
198
|
-
}
|
|
199
|
-
g_list_free(rg_source->old_poll_fds);
|
|
200
|
-
rg_source->old_poll_fds = NULL;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
static inline void
|
|
204
|
-
source_prepare_add_poll_fd(GSource *source, gint fd, guchar events)
|
|
205
|
-
{
|
|
206
|
-
GPollFD *poll_fd;
|
|
207
|
-
GList *node;
|
|
208
|
-
RGSource *rg_source = (RGSource *)source;
|
|
209
|
-
|
|
210
|
-
for (node = rg_source->old_poll_fds; node; node = g_list_next(node)) {
|
|
211
|
-
poll_fd = node->data;
|
|
212
|
-
if (poll_fd->fd == fd && poll_fd->events == events) {
|
|
213
|
-
rg_source->old_poll_fds =
|
|
214
|
-
g_list_remove_link(rg_source->old_poll_fds, node);
|
|
215
|
-
rg_source->poll_fds = g_list_concat(rg_source->poll_fds, node);
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
poll_fd = g_slice_new0(GPollFD);
|
|
221
|
-
poll_fd->fd = fd;
|
|
222
|
-
poll_fd->events = events;
|
|
223
|
-
|
|
224
|
-
g_source_add_poll(source, poll_fd);
|
|
225
|
-
rg_source->poll_fds = g_list_prepend(rg_source->poll_fds, poll_fd);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
static inline void
|
|
229
|
-
source_prepare_add_poll(GSource *source, rb_thread_t thread)
|
|
230
|
-
{
|
|
231
|
-
if (thread->wait_for == WAIT_FD) {
|
|
232
|
-
/* The thread is blocked on thread->fd for read. */
|
|
233
|
-
source_prepare_add_poll_fd(source, thread->fd, G_IO_IN);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (thread->wait_for & WAIT_SELECT) {
|
|
238
|
-
/* thread->fd is the maximum fd of the fds in the various sets. Need to
|
|
239
|
-
* check the sets to see which fd's to wait for */
|
|
240
|
-
int fd;
|
|
241
|
-
|
|
242
|
-
for (fd = 0; fd < thread->fd; fd++) {
|
|
243
|
-
gushort events = 0;
|
|
244
|
-
|
|
245
|
-
if (FD_ISSET(fd, &thread->readfds))
|
|
246
|
-
events |= G_IO_IN;
|
|
247
|
-
if (FD_ISSET(fd, &thread->writefds))
|
|
248
|
-
events |= G_IO_OUT;
|
|
249
|
-
if (FD_ISSET(fd, &thread->exceptfds))
|
|
250
|
-
events |= G_IO_PRI | G_IO_ERR | G_IO_HUP;
|
|
251
|
-
|
|
252
|
-
if (events != 0)
|
|
253
|
-
source_prepare_add_poll_fd(source, fd, events);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
static inline gboolean
|
|
259
|
-
source_prepare_setup_poll_fd(GSource *source, gint *timeout)
|
|
260
|
-
{
|
|
261
|
-
RGSource *rg_source = (RGSource *)source;
|
|
262
|
-
rb_thread_t thread;
|
|
263
|
-
gdouble now;
|
|
264
|
-
|
|
265
|
-
g_assert(rg_source->old_poll_fds == NULL);
|
|
266
|
-
rg_source->old_poll_fds = rg_source->poll_fds;
|
|
267
|
-
rg_source->poll_fds = NULL;
|
|
268
|
-
|
|
269
|
-
now = timeofday();
|
|
270
|
-
thread = rb_curr_thread;
|
|
271
|
-
do {
|
|
272
|
-
thread = thread->next;
|
|
273
|
-
|
|
274
|
-
if ((thread->wait_for == 0 && thread->status == THREAD_RUNNABLE &&
|
|
275
|
-
thread != rb_curr_thread) ||
|
|
276
|
-
(thread->wait_for & WAIT_JOIN &&
|
|
277
|
-
thread->join->status == THREAD_KILLED)) {
|
|
278
|
-
rg_source->poll_fds = g_list_concat(rg_source->poll_fds,
|
|
279
|
-
rg_source->old_poll_fds);
|
|
280
|
-
rg_source->old_poll_fds = NULL;
|
|
281
|
-
return TRUE;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (thread->wait_for & WAIT_TIME && thread->delay != DELAY_INFTY) {
|
|
285
|
-
gint delay;
|
|
286
|
-
|
|
287
|
-
delay = (thread->delay - now) * 1000;
|
|
288
|
-
if (delay <= 0) {
|
|
289
|
-
rg_source->poll_fds = g_list_concat(rg_source->poll_fds,
|
|
290
|
-
rg_source->old_poll_fds);
|
|
291
|
-
rg_source->old_poll_fds = NULL;
|
|
292
|
-
return TRUE;
|
|
293
|
-
}
|
|
294
|
-
if (*timeout == -1 || delay < *timeout)
|
|
295
|
-
*timeout = delay;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (thread->wait_for == WAIT_FD || thread->wait_for & WAIT_SELECT)
|
|
299
|
-
source_prepare_add_poll(source, thread);
|
|
300
|
-
} while (thread != rb_curr_thread);
|
|
301
|
-
|
|
302
|
-
source_cleanup_poll_fds(source);
|
|
303
|
-
|
|
304
|
-
return FALSE;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
static gboolean
|
|
308
|
-
source_prepare(GSource *source, gint *timeout)
|
|
309
|
-
{
|
|
310
|
-
RGSource *rg_source = (RGSource *)source;
|
|
311
|
-
|
|
312
|
-
*timeout = -1;
|
|
313
|
-
rg_source->ready = source_prepare_setup_poll_fd(source, timeout);
|
|
314
|
-
|
|
315
|
-
return rg_source->ready;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
static gboolean
|
|
319
|
-
source_check(GSource *source)
|
|
320
|
-
{
|
|
321
|
-
RGSource *rg_source = (RGSource *)source;
|
|
322
|
-
GList *node;
|
|
323
|
-
|
|
324
|
-
if (rg_source->ready)
|
|
325
|
-
return TRUE;
|
|
326
|
-
|
|
327
|
-
for (node = rg_source->poll_fds; node; node = g_list_next(node)) {
|
|
328
|
-
GPollFD *poll_fd = node->data;
|
|
329
|
-
|
|
330
|
-
if (poll_fd->revents)
|
|
331
|
-
return TRUE;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
return FALSE;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
static gboolean
|
|
338
|
-
source_dispatch(G_GNUC_UNUSED GSource *source,
|
|
339
|
-
G_GNUC_UNUSED GSourceFunc callback,
|
|
340
|
-
G_GNUC_UNUSED gpointer user_data)
|
|
341
|
-
{
|
|
342
|
-
TRAP_BEG;
|
|
343
|
-
rb_thread_schedule();
|
|
344
|
-
TRAP_END;
|
|
345
|
-
|
|
346
|
-
return TRUE;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
static void
|
|
350
|
-
source_finalize(GSource *source)
|
|
351
|
-
{
|
|
352
|
-
RGSource *rg_source = (RGSource *)source;
|
|
353
|
-
GList *node;
|
|
354
|
-
|
|
355
|
-
for (node = rg_source->old_poll_fds; node; node = g_list_next(node)) {
|
|
356
|
-
GPollFD *poll_fd = node->data;
|
|
357
|
-
g_slice_free(GPollFD, poll_fd);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
for (node = rg_source->poll_fds; node; node = g_list_next(node)) {
|
|
361
|
-
GPollFD *poll_fd = node->data;
|
|
362
|
-
g_slice_free(GPollFD, poll_fd);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
g_list_free(rg_source->old_poll_fds);
|
|
366
|
-
rg_source->old_poll_fds = NULL;
|
|
367
|
-
|
|
368
|
-
g_list_free(rg_source->poll_fds);
|
|
369
|
-
rg_source->poll_fds = NULL;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
static GSourceFuncs source_funcs = {
|
|
373
|
-
source_prepare,
|
|
374
|
-
source_check,
|
|
375
|
-
source_dispatch,
|
|
376
|
-
source_finalize,
|
|
377
|
-
NULL,
|
|
378
|
-
NULL
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
static GSource *
|
|
382
|
-
ruby_source_new(void)
|
|
383
|
-
{
|
|
384
|
-
GSource *source;
|
|
385
|
-
RGSource *rg_source;
|
|
386
|
-
|
|
387
|
-
source = g_source_new(&source_funcs, sizeof(RGSource));
|
|
388
|
-
g_source_set_can_recurse(source, TRUE);
|
|
389
|
-
|
|
390
|
-
rg_source = (RGSource *)source;
|
|
391
|
-
rg_source->poll_fds = NULL;
|
|
392
|
-
rg_source->old_poll_fds = NULL;
|
|
393
|
-
|
|
394
|
-
return source;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
static VALUE
|
|
398
|
-
ruby_source_set_priority(G_GNUC_UNUSED VALUE self, VALUE priority)
|
|
399
|
-
{
|
|
400
|
-
GSource *ruby_source = NULL;
|
|
401
|
-
|
|
402
|
-
if (ruby_source_id != 0)
|
|
403
|
-
ruby_source = g_main_context_find_source_by_id(NULL, ruby_source_id);
|
|
404
|
-
|
|
405
|
-
if (ruby_source)
|
|
406
|
-
g_source_set_priority(ruby_source, NUM2INT(priority));
|
|
407
|
-
|
|
408
|
-
return Qnil;
|
|
409
|
-
}
|
|
410
|
-
#endif
|
|
411
|
-
|
|
412
97
|
static VALUE
|
|
413
98
|
source_remove(G_GNUC_UNUSED VALUE self, VALUE tag)
|
|
414
99
|
{
|
|
@@ -463,14 +148,6 @@ rg_initialize(VALUE self)
|
|
|
463
148
|
context = g_main_context_new();
|
|
464
149
|
|
|
465
150
|
g_main_context_set_poll_func(context, rg_poll);
|
|
466
|
-
#ifndef HAVE_RB_THREAD_BLOCKING_REGION
|
|
467
|
-
{
|
|
468
|
-
GSource *source;
|
|
469
|
-
source = ruby_source_new();
|
|
470
|
-
g_source_attach(source, context);
|
|
471
|
-
g_source_unref(source);
|
|
472
|
-
}
|
|
473
|
-
#endif
|
|
474
151
|
|
|
475
152
|
G_INITIALIZE(self, context);
|
|
476
153
|
return Qnil;
|
|
@@ -822,17 +499,6 @@ child_watch_add(VALUE self, VALUE pid)
|
|
|
822
499
|
(GChildWatchFunc)child_watch_func, (gpointer)func));
|
|
823
500
|
}
|
|
824
501
|
|
|
825
|
-
#ifndef HAVE_RB_THREAD_BLOCKING_REGION
|
|
826
|
-
static void
|
|
827
|
-
ruby_source_remove(G_GNUC_UNUSED VALUE data)
|
|
828
|
-
{
|
|
829
|
-
if (ruby_source_id != 0) {
|
|
830
|
-
g_source_remove(ruby_source_id);
|
|
831
|
-
ruby_source_id = 0;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
#endif
|
|
835
|
-
|
|
836
502
|
void
|
|
837
503
|
Init_glib_main_context(void)
|
|
838
504
|
{
|
|
@@ -896,16 +562,4 @@ Init_glib_main_context(void)
|
|
|
896
562
|
default_poll_func = g_main_context_get_poll_func(NULL);
|
|
897
563
|
g_main_context_set_poll_func(NULL, rg_poll);
|
|
898
564
|
rb_set_end_proc(restore_poll_func, Qnil);
|
|
899
|
-
|
|
900
|
-
#ifndef HAVE_RB_THREAD_BLOCKING_REGION
|
|
901
|
-
{
|
|
902
|
-
GSource *source;
|
|
903
|
-
|
|
904
|
-
source = ruby_source_new();
|
|
905
|
-
g_source_set_priority(source, G_PRIORITY_DEFAULT_IDLE);
|
|
906
|
-
ruby_source_id = g_source_attach(source, NULL);
|
|
907
|
-
g_source_unref(source);
|
|
908
|
-
rb_set_end_proc(ruby_source_remove, Qnil);
|
|
909
|
-
}
|
|
910
|
-
#endif
|
|
911
565
|
}
|
data/ext/glib2/rbglib_mainloop.c
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
|
3
|
+
* Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
|
|
4
4
|
* Copyright (C) 2005,2006 Masao Mutoh
|
|
5
5
|
*
|
|
6
6
|
* This library is free software; you can redistribute it and/or
|
|
@@ -57,10 +57,35 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
|
|
|
57
57
|
return Qnil;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
static gboolean
|
|
61
|
+
quit_loop(gpointer user_data)
|
|
62
|
+
{
|
|
63
|
+
GMainLoop *loop = user_data;
|
|
64
|
+
g_main_loop_quit(loop);
|
|
65
|
+
return G_SOURCE_REMOVE;
|
|
66
|
+
}
|
|
67
|
+
|
|
60
68
|
static VALUE
|
|
61
69
|
rg_run(VALUE self)
|
|
62
70
|
{
|
|
63
|
-
|
|
71
|
+
GMainLoop *loop;
|
|
72
|
+
GSource *interrupt_source;
|
|
73
|
+
|
|
74
|
+
loop = _SELF(self);
|
|
75
|
+
|
|
76
|
+
interrupt_source = rbg_interrupt_source_new();
|
|
77
|
+
g_source_set_callback(interrupt_source,
|
|
78
|
+
quit_loop,
|
|
79
|
+
loop,
|
|
80
|
+
NULL);
|
|
81
|
+
g_source_attach(interrupt_source,
|
|
82
|
+
g_main_loop_get_context(loop));
|
|
83
|
+
g_main_loop_run(loop);
|
|
84
|
+
g_source_destroy(interrupt_source);
|
|
85
|
+
g_source_unref(interrupt_source);
|
|
86
|
+
|
|
87
|
+
rb_thread_check_ints();
|
|
88
|
+
|
|
64
89
|
return self;
|
|
65
90
|
}
|
|
66
91
|
|
data/ext/glib2/rbgobj_boxed.c
CHANGED
|
@@ -47,7 +47,7 @@ boxed_free(boxed_holder *holder)
|
|
|
47
47
|
if (holder->own && holder->boxed)
|
|
48
48
|
g_boxed_free(holder->type, holder->boxed);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
xfree(holder);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**********************************************************************/
|
|
@@ -71,11 +71,27 @@ rbgobj_boxed_s_allocate(VALUE klass)
|
|
|
71
71
|
return result;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
static
|
|
74
|
+
static VALUE
|
|
75
75
|
rg_initialize(VALUE self)
|
|
76
76
|
{
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
VALUE rb_class;
|
|
78
|
+
|
|
79
|
+
rb_class = CLASS_OF(self);
|
|
80
|
+
if (RVAL2CBOOL(rb_ivar_defined(rb_class, rb_intern("@size")))) {
|
|
81
|
+
const RGObjClassInfo *cinfo;
|
|
82
|
+
gpointer instance;
|
|
83
|
+
gsize instance_size;
|
|
84
|
+
cinfo = rbgobj_lookup_class(rb_class);
|
|
85
|
+
instance_size = NUM2UINT(rb_iv_get(rb_class, "@size"));
|
|
86
|
+
instance = alloca(instance_size);
|
|
87
|
+
memset(instance, 0, instance_size);
|
|
88
|
+
G_INITIALIZE(self, g_boxed_copy(cinfo->gtype, instance));
|
|
89
|
+
} else {
|
|
90
|
+
rb_raise(rb_eTypeError, "can't initialize %s",
|
|
91
|
+
rb_class2name(rb_class));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return Qnil;
|
|
79
95
|
}
|
|
80
96
|
|
|
81
97
|
static VALUE
|
data/ext/glib2/rbgobj_object.c
CHANGED
|
@@ -58,7 +58,7 @@ holder_mark(gobj_holder *holder)
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
static void
|
|
61
|
-
|
|
61
|
+
holder_unref(gobj_holder *holder)
|
|
62
62
|
{
|
|
63
63
|
if (holder->gobj) {
|
|
64
64
|
if (!holder->destroyed) {
|
|
@@ -68,6 +68,12 @@ holder_free(gobj_holder *holder)
|
|
|
68
68
|
}
|
|
69
69
|
holder->gobj = NULL;
|
|
70
70
|
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static void
|
|
74
|
+
holder_free(gobj_holder *holder)
|
|
75
|
+
{
|
|
76
|
+
holder_unref(holder);
|
|
71
77
|
xfree(holder);
|
|
72
78
|
}
|
|
73
79
|
|
|
@@ -608,6 +614,23 @@ rg_inspect(VALUE self)
|
|
|
608
614
|
return result;
|
|
609
615
|
}
|
|
610
616
|
|
|
617
|
+
static VALUE
|
|
618
|
+
rg_unref(VALUE self)
|
|
619
|
+
{
|
|
620
|
+
gobj_holder* holder;
|
|
621
|
+
|
|
622
|
+
Data_Get_Struct(self, gobj_holder, holder);
|
|
623
|
+
|
|
624
|
+
if (holder->destroyed)
|
|
625
|
+
rb_raise(rb_eTypeError, "destroyed GLib::Object");
|
|
626
|
+
if (!holder->gobj)
|
|
627
|
+
rb_raise(rb_eTypeError, "uninitialize GLib::Object");
|
|
628
|
+
|
|
629
|
+
holder_unref(holder);
|
|
630
|
+
|
|
631
|
+
return self;
|
|
632
|
+
}
|
|
633
|
+
|
|
611
634
|
static VALUE
|
|
612
635
|
rg_type_name(VALUE self)
|
|
613
636
|
{
|
|
@@ -842,6 +865,7 @@ Init_gobject_gobject(void)
|
|
|
842
865
|
|
|
843
866
|
RG_DEF_METHOD(initialize, -1);
|
|
844
867
|
rbg_define_method(RG_TARGET_NAMESPACE, "ref_count", gobj_ref_count, 0); /* for debugging */
|
|
868
|
+
RG_DEF_METHOD(unref, 0);
|
|
845
869
|
RG_DEF_METHOD(inspect, 0);
|
|
846
870
|
RG_DEF_METHOD(type_name, 0);
|
|
847
871
|
|
data/ext/glib2/rbgobj_type.c
CHANGED
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
/**********************************************************************/
|
|
27
27
|
/* Type Mapping */
|
|
28
28
|
|
|
29
|
+
#ifndef rb_cMutex
|
|
29
30
|
static VALUE rb_cMutex;
|
|
31
|
+
#endif
|
|
30
32
|
static VALUE lookup_class_mutex;
|
|
31
33
|
|
|
32
34
|
static ID id_new;
|
|
@@ -69,11 +71,7 @@ rbgobj_lookup_class(VALUE klass)
|
|
|
69
71
|
|
|
70
72
|
if (TYPE(klass) == T_CLASS) {
|
|
71
73
|
VALUE super;
|
|
72
|
-
|
|
73
|
-
super = rb_class_real(klass);
|
|
74
|
-
} else {
|
|
75
|
-
super = rb_funcall(klass, id_superclass, 0);
|
|
76
|
-
}
|
|
74
|
+
super = rb_funcall(klass, id_superclass, 0);
|
|
77
75
|
return rbgobj_lookup_class(super);
|
|
78
76
|
}
|
|
79
77
|
|
|
@@ -768,7 +766,9 @@ Init_gobject_gtype(void)
|
|
|
768
766
|
init_typemap();
|
|
769
767
|
|
|
770
768
|
/* type */
|
|
769
|
+
#ifndef rb_cMutex
|
|
771
770
|
rb_cMutex = rb_const_get(rb_cObject, rb_intern("Mutex"));
|
|
771
|
+
#endif
|
|
772
772
|
id_lock = rb_intern("lock");
|
|
773
773
|
id_unlock = rb_intern("unlock");
|
|
774
774
|
lookup_class_mutex = rb_funcall(rb_cMutex, id_new, 0);
|
data/ext/glib2/rbgprivate.h
CHANGED
data/ext/glib2/rbgutil.c
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2011-
|
|
3
|
+
* Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
|
|
4
4
|
* Copyright (C) 2002-2004 Masao Mutoh
|
|
5
5
|
*
|
|
6
6
|
* This library is free software; you can redistribute it and/or
|
|
@@ -133,6 +133,44 @@ rbgutil_key_equal(VALUE rb_key, const char *key)
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
static gboolean
|
|
137
|
+
rbg_interrupt_prepare (G_GNUC_UNUSED GSource *soruce,
|
|
138
|
+
G_GNUC_UNUSED gint *timouet)
|
|
139
|
+
{
|
|
140
|
+
return rb_thread_interrupted(rb_thread_current());
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
static gboolean
|
|
144
|
+
rbg_interrupt_check (G_GNUC_UNUSED GSource *soruce)
|
|
145
|
+
{
|
|
146
|
+
return rb_thread_interrupted(rb_thread_current());
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static gboolean
|
|
150
|
+
rbg_interrupt_dispatch (G_GNUC_UNUSED GSource *soruce,
|
|
151
|
+
GSourceFunc callback,
|
|
152
|
+
gpointer user_data)
|
|
153
|
+
{
|
|
154
|
+
if (callback) {
|
|
155
|
+
return callback(user_data);
|
|
156
|
+
} else {
|
|
157
|
+
return G_SOURCE_REMOVE;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static GSourceFuncs rbg_interrupt_funcs = {
|
|
162
|
+
rbg_interrupt_prepare,
|
|
163
|
+
rbg_interrupt_check,
|
|
164
|
+
rbg_interrupt_dispatch,
|
|
165
|
+
NULL
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
GSource *
|
|
169
|
+
rbg_interrupt_source_new(void)
|
|
170
|
+
{
|
|
171
|
+
return g_source_new(&rbg_interrupt_funcs, sizeof(GSource));
|
|
172
|
+
}
|
|
173
|
+
|
|
136
174
|
void
|
|
137
175
|
Init_gutil(void)
|
|
138
176
|
{
|
data/ext/glib2/rbgutil.h
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2011-
|
|
3
|
+
* Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
|
|
4
4
|
* Copyright (C) 2002,2003 Masao Mutoh
|
|
5
5
|
*
|
|
6
6
|
* This library is free software; you can redistribute it and/or
|
|
@@ -105,6 +105,7 @@ extern VALUE rbgutil_string_set_utf8_encoding(VALUE string);
|
|
|
105
105
|
extern gboolean rbgutil_key_equal(VALUE rb_string, const char *key);
|
|
106
106
|
|
|
107
107
|
extern const gchar *rbg_inspect(VALUE object);
|
|
108
|
+
extern GSource *rbg_interrupt_source_new(void);
|
|
108
109
|
|
|
109
110
|
/*< protected >*/
|
|
110
111
|
RUBY_GLIB2_VAR ID rbgutil_id_module_eval;
|
|
@@ -195,11 +195,9 @@ rbgutil_invoke_callback(VALUE (*func)(VALUE), VALUE arg)
|
|
|
195
195
|
{
|
|
196
196
|
#ifdef HAVE_NATIVETHREAD
|
|
197
197
|
if (ruby_native_thread_p()) {
|
|
198
|
-
# ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
|
199
198
|
if (!GPOINTER_TO_INT(g_static_private_get(&rg_polling_key))) {
|
|
200
199
|
return rbgutil_protect(func, arg);
|
|
201
200
|
}
|
|
202
|
-
# endif
|
|
203
201
|
# ifdef HAVE_RB_THREAD_CALL_WITH_GVL
|
|
204
202
|
{
|
|
205
203
|
CallbackRequest req;
|
|
@@ -26,6 +26,7 @@ module GNOME2
|
|
|
26
26
|
:download_site,
|
|
27
27
|
:download_base_url,
|
|
28
28
|
:compression_method,
|
|
29
|
+
:base_dir_in_package,
|
|
29
30
|
:windows,
|
|
30
31
|
:native,
|
|
31
32
|
:patches,
|
|
@@ -72,6 +73,10 @@ module GNOME2
|
|
|
72
73
|
need_autoreconf
|
|
73
74
|
end
|
|
74
75
|
|
|
76
|
+
def base_dir_in_package
|
|
77
|
+
super || "."
|
|
78
|
+
end
|
|
79
|
+
|
|
75
80
|
def windows
|
|
76
81
|
super || WindowsConfiguration.new({})
|
|
77
82
|
end
|
|
@@ -99,6 +104,8 @@ module GNOME2
|
|
|
99
104
|
base_url = "http://ftp.gnome.org/pub/gnome/sources"
|
|
100
105
|
release_series = version.gsub(/\A(\d+\.\d+)(?:[^\d].*)?\z/, '\1')
|
|
101
106
|
base_url << "/#{name}/#{release_series}"
|
|
107
|
+
when :gnu
|
|
108
|
+
base_url = "http://ftp.gnu.org/pub/gnu/#{name}"
|
|
102
109
|
else
|
|
103
110
|
base_url = nil
|
|
104
111
|
end
|
|
@@ -109,6 +116,7 @@ module GNOME2
|
|
|
109
116
|
:include_paths,
|
|
110
117
|
:library_paths,
|
|
111
118
|
:configure_args,
|
|
119
|
+
:cmake_args,
|
|
112
120
|
:cc_args,
|
|
113
121
|
:patches,
|
|
114
122
|
:built_file,
|
|
@@ -139,6 +147,10 @@ module GNOME2
|
|
|
139
147
|
super || []
|
|
140
148
|
end
|
|
141
149
|
|
|
150
|
+
def cmake_args
|
|
151
|
+
super || []
|
|
152
|
+
end
|
|
153
|
+
|
|
142
154
|
def cc_args
|
|
143
155
|
super || []
|
|
144
156
|
end
|
|
@@ -75,7 +75,7 @@ module GNOME2
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def build_package_task_body(package)
|
|
78
|
-
package_tmp_dir = @package.tmp_dir + package.name
|
|
78
|
+
package_tmp_dir = @package.tmp_dir + "native" + package.name
|
|
79
79
|
rm_rf(package_tmp_dir)
|
|
80
80
|
mkdir_p(package_tmp_dir)
|
|
81
81
|
|
|
@@ -84,7 +84,9 @@ module GNOME2
|
|
|
84
84
|
sh("tar", "xf", tar_full_path.to_s) or exit(false)
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
package_dir_path =
|
|
88
|
+
package_tmp_dir + package.base_name + package.base_dir_in_package
|
|
89
|
+
Dir.chdir(package_dir_path.to_s) do
|
|
88
90
|
package.native.patches.each do |patch|
|
|
89
91
|
sh("patch -p1 < #{@package.patches_dir}/#{patch}")
|
|
90
92
|
end
|
data/lib/gnome2/rake/package.rb
CHANGED
|
@@ -93,7 +93,7 @@ class GNOME2Win32BinaryBuildTask
|
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
def build_package_task_body(package)
|
|
96
|
-
package_tmp_dir = @package.tmp_dir + package.name
|
|
96
|
+
package_tmp_dir = @package.tmp_dir + "windows" + package.name
|
|
97
97
|
rm_rf(package_tmp_dir)
|
|
98
98
|
mkdir_p(package_tmp_dir)
|
|
99
99
|
|
|
@@ -102,25 +102,22 @@ class GNOME2Win32BinaryBuildTask
|
|
|
102
102
|
sh("tar", "xf", tar_full_path.to_s)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
package_dir_path =
|
|
106
|
+
package_tmp_dir + package.base_name + package.base_dir_in_package
|
|
107
|
+
Dir.chdir(package_dir_path.to_s) do
|
|
106
108
|
package.windows.patches.each do |patch|
|
|
107
109
|
sh("patch -p1 < #{@package.patches_dir}/#{patch}")
|
|
108
110
|
end
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"CPPFLAGS=#{cppflags(package)}",
|
|
115
|
-
"LDFLAGS=#{ldflags(package)}",
|
|
116
|
-
"--prefix=#{dist_dir}",
|
|
117
|
-
"--host=#{@package.windows.build_host}",
|
|
118
|
-
*package.windows.configure_args) or exit(false)
|
|
111
|
+
if File.exist?("configure")
|
|
112
|
+
configure(package)
|
|
113
|
+
else
|
|
114
|
+
cmake(package)
|
|
115
|
+
end
|
|
119
116
|
common_make_args = []
|
|
120
117
|
common_make_args << "MAKE=make"
|
|
121
118
|
common_make_args << "GLIB_COMPILE_SCHEMAS=glib-compile-schemas"
|
|
122
119
|
if package.windows.use_cc_environment_variable?
|
|
123
|
-
common_make_args << cc_env
|
|
120
|
+
common_make_args << cc_env(package)
|
|
124
121
|
end
|
|
125
122
|
add_gobject_introspection_make_args(common_make_args)
|
|
126
123
|
build_make_args = common_make_args.dup
|
|
@@ -152,6 +149,43 @@ class GNOME2Win32BinaryBuildTask
|
|
|
152
149
|
end
|
|
153
150
|
end
|
|
154
151
|
|
|
152
|
+
def configure(package)
|
|
153
|
+
sh("./autogen.sh") if package.windows.need_autogen?
|
|
154
|
+
sh("autoreconf --install") if package.windows.need_autoreconf?
|
|
155
|
+
sh("./configure",
|
|
156
|
+
cc_env(package),
|
|
157
|
+
"CPPFLAGS=#{cppflags(package)}",
|
|
158
|
+
"LDFLAGS=#{ldflags(package)}",
|
|
159
|
+
"--prefix=#{dist_dir}",
|
|
160
|
+
"--host=#{@package.windows.build_host}",
|
|
161
|
+
*package.windows.configure_args) or exit(false)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def cmake(package)
|
|
165
|
+
toolchain_cmake_path = "toolchain.cmake"
|
|
166
|
+
File.open(toolchain_cmake_path, "w") do |toolchain|
|
|
167
|
+
toolchain.puts(<<-CMAKE)
|
|
168
|
+
SET(CMAKE_SYSTEM_NAME Windows)
|
|
169
|
+
SET(MSVC_CXX_ARCHITECTURE_ID #{@package.windows.build_architecture})
|
|
170
|
+
SET(CMAKE_SYSTEM_PROCESSOR #{@package.windows.build_architecture})
|
|
171
|
+
|
|
172
|
+
SET(CMAKE_C_COMPILER #{@package.windows.build_host}-gcc)
|
|
173
|
+
SET(CMAKE_CXX_COMPILER #{@package.windows.build_host}-g++)
|
|
174
|
+
SET(CMAKE_RC_COMPILER #{@package.windows.build_host}-windres)
|
|
175
|
+
|
|
176
|
+
SET(CMAKE_FIND_ROOT_PATH #{cmake_root_paths.join(" ")})
|
|
177
|
+
CMAKE
|
|
178
|
+
end
|
|
179
|
+
sh("cmake",
|
|
180
|
+
".",
|
|
181
|
+
"-DCMAKE_TOOLCHAIN_FILE=#{toolchain_cmake_path}",
|
|
182
|
+
*package.windows.cmake_args) or exit(false)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def cc_env(package)
|
|
186
|
+
"CC=#{cc(package)}"
|
|
187
|
+
end
|
|
188
|
+
|
|
155
189
|
def build_packages
|
|
156
190
|
packages = @package.external_packages.select do |package|
|
|
157
191
|
package.windows.build?
|
|
@@ -168,28 +202,36 @@ class GNOME2Win32BinaryBuildTask
|
|
|
168
202
|
dist_dir + "share" + "license"
|
|
169
203
|
end
|
|
170
204
|
|
|
205
|
+
def glib2_binary_base_dir
|
|
206
|
+
@package.glib2_root_dir + "vendor" + "local"
|
|
207
|
+
end
|
|
208
|
+
|
|
171
209
|
def glib2_include_path
|
|
172
|
-
"#{
|
|
210
|
+
"#{glib2_binary_base_dir}/include"
|
|
173
211
|
end
|
|
174
212
|
|
|
175
213
|
def glib2_lib_path
|
|
176
|
-
"#{
|
|
214
|
+
"#{glib2_binary_base_dir}/lib"
|
|
177
215
|
end
|
|
178
216
|
|
|
179
217
|
def rcairo_win32_dir
|
|
180
218
|
@package.project_root_dir.parent + "rcairo.win32"
|
|
181
219
|
end
|
|
182
220
|
|
|
221
|
+
def rcairo_win32_binary_base_dir
|
|
222
|
+
rcairo_win32_dir + "vendor" + "local"
|
|
223
|
+
end
|
|
224
|
+
|
|
183
225
|
def rcairo_win32_pkgconfig_path
|
|
184
|
-
"#{
|
|
226
|
+
"#{rcairo_win32_binary_base_dir}/lib/pkgconfig"
|
|
185
227
|
end
|
|
186
228
|
|
|
187
229
|
def rcairo_win32_include_path
|
|
188
|
-
"#{
|
|
230
|
+
"#{rcairo_win32_binary_base_dir}/include"
|
|
189
231
|
end
|
|
190
232
|
|
|
191
233
|
def rcairo_win32_lib_path
|
|
192
|
-
"#{
|
|
234
|
+
"#{rcairo_win32_binary_base_dir}/lib"
|
|
193
235
|
end
|
|
194
236
|
|
|
195
237
|
def cc(package)
|
|
@@ -230,6 +272,17 @@ class GNOME2Win32BinaryBuildTask
|
|
|
230
272
|
ldflags.join(" ")
|
|
231
273
|
end
|
|
232
274
|
|
|
275
|
+
def cmake_root_paths
|
|
276
|
+
paths = [
|
|
277
|
+
"/usr/#{@package.windows.build_host}",
|
|
278
|
+
rcairo_win32_binary_base_dir.to_path,
|
|
279
|
+
]
|
|
280
|
+
@package.windows.build_dependencies.each do |package|
|
|
281
|
+
paths << "#{@package.project_root_dir}/#{package}/vendor/local"
|
|
282
|
+
end
|
|
283
|
+
paths
|
|
284
|
+
end
|
|
285
|
+
|
|
233
286
|
def add_gobject_introspection_make_args(common_make_args)
|
|
234
287
|
unless @package.windows.build_dependencies.include?("gobject-introspection")
|
|
235
288
|
return
|
data/lib/mkmf-gnome2.rb
CHANGED
|
@@ -16,9 +16,51 @@ require 'glib-mkenums'
|
|
|
16
16
|
|
|
17
17
|
$CFLAGS += " #{ENV['CFLAGS']}" if ENV['CFLAGS']
|
|
18
18
|
|
|
19
|
+
def gcc?
|
|
20
|
+
CONFIG["GCC"] == "yes"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def disable_optimization_build_flag(flags)
|
|
24
|
+
if gcc?
|
|
25
|
+
flags.gsub(/(^|\s)?-O\d(\s|$)?/, '\\1-O0\\2')
|
|
26
|
+
else
|
|
27
|
+
flags
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def enable_debug_build_flag(flags)
|
|
32
|
+
if gcc?
|
|
33
|
+
debug_option_pattern = /(^|\s)?-g\d?(\s|$)?/
|
|
34
|
+
if debug_option_pattern =~ flags
|
|
35
|
+
flags.gsub(debug_option_pattern, '\\1-g3\\2')
|
|
36
|
+
else
|
|
37
|
+
flags + " -g3"
|
|
38
|
+
end
|
|
39
|
+
else
|
|
40
|
+
flags
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
checking_for(checking_message("--enable-debug-build option")) do
|
|
45
|
+
enable_debug_build = enable_config("debug-build", false)
|
|
46
|
+
if enable_debug_build
|
|
47
|
+
$CFLAGS = disable_optimization_build_flag($CFLAGS)
|
|
48
|
+
$CFLAGS = enable_debug_build_flag($CFLAGS)
|
|
49
|
+
|
|
50
|
+
CONFIG["CXXFLAGS"] = disable_optimization_build_flag(CONFIG["CXXFLAGS"])
|
|
51
|
+
CONFIG["CXXFLAGS"] = enable_debug_build_flag(CONFIG["CXXFLAGS"])
|
|
52
|
+
end
|
|
53
|
+
enable_debug_build
|
|
54
|
+
end
|
|
55
|
+
|
|
19
56
|
def try_compiler_option(opt, &block)
|
|
20
57
|
checking_for "#{opt} option to compiler" do
|
|
21
|
-
|
|
58
|
+
if try_compile '', opt + " -Werror", &block
|
|
59
|
+
$CFLAGS += " #{opt}"
|
|
60
|
+
true
|
|
61
|
+
else
|
|
62
|
+
false
|
|
63
|
+
end
|
|
22
64
|
end
|
|
23
65
|
end
|
|
24
66
|
|
|
@@ -52,6 +94,7 @@ try_compiler_option '-Wswitch-enum'
|
|
|
52
94
|
try_compiler_option '-Wundef'
|
|
53
95
|
# NOTE: Incredible amounts of false positives.
|
|
54
96
|
#try_compiler_option '-Wunreachable-code'
|
|
97
|
+
try_compiler_option '-Wout-of-line-declaration'
|
|
55
98
|
try_compiler_option '-Wunsafe-loop-optimizations'
|
|
56
99
|
try_compiler_option '-Wwrite-strings'
|
|
57
100
|
|
|
@@ -457,17 +500,19 @@ def install_missing_native_package(native_package_info)
|
|
|
457
500
|
package = native_package_info[platform]
|
|
458
501
|
return false if package.nil?
|
|
459
502
|
|
|
503
|
+
package_name, *options = package
|
|
504
|
+
package_command_line = [package_name, *options].join(" ")
|
|
460
505
|
need_super_user_priviledge = true
|
|
461
506
|
case platform
|
|
462
507
|
when :debian
|
|
463
|
-
install_command = "apt-get install -V -y #{
|
|
508
|
+
install_command = "apt-get install -V -y #{package_command_line}"
|
|
464
509
|
when :fedora, :redhat
|
|
465
|
-
install_command = "yum install -y #{
|
|
510
|
+
install_command = "yum install -y #{package_command_line}"
|
|
466
511
|
when :homebrew
|
|
467
512
|
need_super_user_priviledge = false
|
|
468
|
-
install_command = "brew install #{
|
|
513
|
+
install_command = "brew install #{package_command_line}"
|
|
469
514
|
when :macports
|
|
470
|
-
install_command = "port install -y #{
|
|
515
|
+
install_command = "port install -y #{package_command_line}"
|
|
471
516
|
else
|
|
472
517
|
return false
|
|
473
518
|
end
|
|
@@ -477,14 +522,14 @@ def install_missing_native_package(native_package_info)
|
|
|
477
522
|
sudo = find_executable("sudo")
|
|
478
523
|
end
|
|
479
524
|
|
|
480
|
-
installing_message = "installing '#{
|
|
525
|
+
installing_message = "installing '#{package_name}' native package... "
|
|
481
526
|
message("%s", installing_message)
|
|
482
527
|
failed_to_get_super_user_priviledge = false
|
|
483
528
|
if have_priviledge
|
|
484
529
|
succeeded = xsystem(install_command)
|
|
485
530
|
else
|
|
486
531
|
if sudo
|
|
487
|
-
prompt = "[sudo] password for %u to install <#{
|
|
532
|
+
prompt = "[sudo] password for %u to install <#{package_name}>: "
|
|
488
533
|
sudo_options = "-p #{Shellwords.escape(prompt)}"
|
|
489
534
|
install_command = "#{sudo} #{sudo_options} #{install_command}"
|
|
490
535
|
succeeded = xsystem(install_command)
|
|
@@ -508,7 +553,7 @@ def install_missing_native_package(native_package_info)
|
|
|
508
553
|
unless succeeded
|
|
509
554
|
if failed_to_get_super_user_priviledge
|
|
510
555
|
error_message = <<-EOM
|
|
511
|
-
'#{
|
|
556
|
+
'#{package_name}' native package is required.
|
|
512
557
|
run the following command as super user to install required native package:
|
|
513
558
|
\# #{install_command}
|
|
514
559
|
EOM
|
|
@@ -557,4 +602,3 @@ check_ruby_func
|
|
|
557
602
|
if /mingw/ =~ RUBY_PLATFORM
|
|
558
603
|
$ruby.gsub!('\\', '/')
|
|
559
604
|
end
|
|
560
|
-
|
metadata
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: glib2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Ruby-GNOME2 Project Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-10-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pkg-config
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: test-unit
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '2'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '2'
|
|
41
41
|
description: Ruby/GLib2 is a Ruby binding of GLib-2.x.
|
|
@@ -47,19 +47,6 @@ extra_rdoc_files: []
|
|
|
47
47
|
files:
|
|
48
48
|
- README
|
|
49
49
|
- Rakefile
|
|
50
|
-
- extconf.rb
|
|
51
|
-
- lib/glib-mkenums.rb
|
|
52
|
-
- lib/glib2.rb
|
|
53
|
-
- lib/glib2/deprecatable.rb
|
|
54
|
-
- lib/gnome2-raketask.rb
|
|
55
|
-
- lib/gnome2/rake/external-package.rb
|
|
56
|
-
- lib/gnome2/rake/native-binary-build-task.rb
|
|
57
|
-
- lib/gnome2/rake/package-task.rb
|
|
58
|
-
- lib/gnome2/rake/package.rb
|
|
59
|
-
- lib/gnome2/rake/source-download-task.rb
|
|
60
|
-
- lib/gnome2/rake/win32-binary-build-task.rb
|
|
61
|
-
- lib/gnome2/rake/win32-binary-download-task.rb
|
|
62
|
-
- lib/mkmf-gnome2.rb
|
|
63
50
|
- ext/glib2/depend
|
|
64
51
|
- ext/glib2/extconf.rb
|
|
65
52
|
- ext/glib2/glib2.def
|
|
@@ -128,6 +115,19 @@ files:
|
|
|
128
115
|
- ext/glib2/rbgutil_list.h
|
|
129
116
|
- ext/glib2/rbgutildeprecated.c
|
|
130
117
|
- ext/glib2/rbgutildeprecated.h
|
|
118
|
+
- extconf.rb
|
|
119
|
+
- lib/glib-mkenums.rb
|
|
120
|
+
- lib/glib2.rb
|
|
121
|
+
- lib/glib2/deprecatable.rb
|
|
122
|
+
- lib/gnome2-raketask.rb
|
|
123
|
+
- lib/gnome2/rake/external-package.rb
|
|
124
|
+
- lib/gnome2/rake/native-binary-build-task.rb
|
|
125
|
+
- lib/gnome2/rake/package-task.rb
|
|
126
|
+
- lib/gnome2/rake/package.rb
|
|
127
|
+
- lib/gnome2/rake/source-download-task.rb
|
|
128
|
+
- lib/gnome2/rake/win32-binary-build-task.rb
|
|
129
|
+
- lib/gnome2/rake/win32-binary-download-task.rb
|
|
130
|
+
- lib/mkmf-gnome2.rb
|
|
131
131
|
- sample/bookmarkfile.rb
|
|
132
132
|
- sample/idle.rb
|
|
133
133
|
- sample/iochannel.rb
|
|
@@ -169,17 +169,17 @@ require_paths:
|
|
|
169
169
|
- lib
|
|
170
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
171
|
requirements:
|
|
172
|
-
- -
|
|
172
|
+
- - ">="
|
|
173
173
|
- !ruby/object:Gem::Version
|
|
174
174
|
version: 1.9.3
|
|
175
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
requirements:
|
|
177
|
-
- -
|
|
177
|
+
- - ">="
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
179
|
version: '0'
|
|
180
180
|
requirements: []
|
|
181
181
|
rubyforge_project:
|
|
182
|
-
rubygems_version: 2.
|
|
182
|
+
rubygems_version: 2.2.2
|
|
183
183
|
signing_key:
|
|
184
184
|
specification_version: 4
|
|
185
185
|
summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
|