glib2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/glib2/extconf.rb +1 -0
- data/ext/glib2/glib2.def +23 -0
- data/ext/glib2/rbgcompat.h +19 -5
- data/ext/glib2/rbglib.c +607 -160
- data/ext/glib2/rbglib.h +81 -26
- data/ext/glib2/rbglib2conversions.h +57 -0
- data/ext/glib2/rbglib_bookmarkfile.c +117 -107
- data/ext/glib2/rbglib_completion.c +37 -26
- data/ext/glib2/rbglib_convert.c +42 -30
- data/ext/glib2/rbglib_error.c +20 -10
- data/ext/glib2/rbglib_fileutils.c +48 -37
- data/ext/glib2/rbglib_i18n.c +24 -14
- data/ext/glib2/rbglib_int64.c +24 -16
- data/ext/glib2/rbglib_iochannel.c +146 -204
- data/ext/glib2/rbglib_iochannel_win32_socket.c +56 -0
- data/ext/glib2/rbglib_iochannelerror.c +49 -0
- data/ext/glib2/rbglib_keyfile.c +171 -182
- data/ext/glib2/rbglib_maincontext.c +107 -92
- data/ext/glib2/rbglib_mainloop.c +34 -21
- data/ext/glib2/rbglib_messages.c +53 -44
- data/ext/glib2/rbglib_pollfd.c +37 -26
- data/ext/glib2/rbglib_shell.c +29 -22
- data/ext/glib2/rbglib_shellerror.c +34 -0
- data/ext/glib2/rbglib_source.c +49 -36
- data/ext/glib2/rbglib_spawn.c +50 -61
- data/ext/glib2/rbglib_spawnerror.c +53 -0
- data/ext/glib2/rbglib_threads.c +28 -16
- data/ext/glib2/rbglib_timer.c +35 -24
- data/ext/glib2/rbglib_ucs4.c +79 -0
- data/ext/glib2/rbglib_unichar.c +209 -0
- data/ext/glib2/rbglib_unicode.c +34 -584
- data/ext/glib2/rbglib_utf16.c +78 -0
- data/ext/glib2/rbglib_utf8.c +259 -0
- data/ext/glib2/rbglib_utils.c +95 -91
- data/ext/glib2/rbglib_win32.c +52 -45
- data/ext/glib2/rbglibdeprecated.c +56 -0
- data/ext/glib2/rbglibdeprecated.h +34 -0
- data/ext/glib2/rbgobj_boxed.c +40 -33
- data/ext/glib2/rbgobj_closure.c +45 -34
- data/ext/glib2/rbgobj_convert.c +19 -9
- data/ext/glib2/rbgobj_enumflags.c +109 -0
- data/ext/glib2/rbgobj_enums.c +67 -646
- data/ext/glib2/rbgobj_flags.c +522 -0
- data/ext/glib2/rbgobj_fundamental.c +19 -6
- data/ext/glib2/rbgobj_object.c +90 -81
- data/ext/glib2/rbgobj_param.c +78 -83
- data/ext/glib2/rbgobj_paramspecs.c +20 -12
- data/ext/glib2/rbgobj_signal.c +248 -193
- data/ext/glib2/rbgobj_strv.c +20 -10
- data/ext/glib2/rbgobj_type.c +153 -149
- data/ext/glib2/rbgobj_typeinstance.c +49 -39
- data/ext/glib2/rbgobj_typeinterface.c +37 -27
- data/ext/glib2/rbgobj_typemodule.c +39 -29
- data/ext/glib2/rbgobj_typeplugin.c +36 -26
- data/ext/glib2/rbgobj_value.c +41 -11
- data/ext/glib2/rbgobj_valuearray.c +59 -23
- data/ext/glib2/rbgobj_valuetypes.c +27 -17
- data/ext/glib2/rbgobject.c +26 -40
- data/ext/glib2/rbgobject.h +38 -20
- data/ext/glib2/rbgprivate.h +87 -5
- data/ext/glib2/rbgutil.c +52 -238
- data/ext/glib2/rbgutil.h +55 -42
- data/ext/glib2/rbgutil_callback.c +47 -12
- data/ext/glib2/rbgutil_list.c +173 -0
- data/ext/glib2/rbgutil_list.h +85 -0
- data/ext/glib2/rbgutildeprecated.c +252 -0
- data/ext/glib2/rbgutildeprecated.h +63 -0
- data/lib/glib-mkenums.rb +2 -2
- data/lib/glib2.rb +2 -25
- data/lib/glib2/deprecatable.rb +149 -0
- data/lib/gnome2-raketask.rb +45 -15
- data/lib/gnome2-win32-binary-downloader.rb +1 -1
- data/lib/mkmf-gnome2.rb +37 -18
- data/test/test_flags.rb +129 -0
- data/test/test_key_file.rb +6 -2
- data/test/test_spawn.rb +33 -0
- metadata +26 -7
- data/ChangeLog +0 -3513
@@ -0,0 +1,63 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002,2003 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#ifndef __RBGUTILDEPRECATED_H__
|
23
|
+
#define __RBGUTILDEPRECATED_H__
|
24
|
+
|
25
|
+
G_BEGIN_DECLS
|
26
|
+
|
27
|
+
#define G_DEF_SETTER(klass, name) \
|
28
|
+
rb_funcall(klass, rbgutil_id_module_eval, 1, rb_str_new2( \
|
29
|
+
"def " name "=(val); set_" name "(val); val; end\n"))
|
30
|
+
#define G_DEF_SETTERS(klass) rbgutil_def_setters(klass)
|
31
|
+
|
32
|
+
#define GLIST2ARY(list) (rbgutil_glist2ary(list))
|
33
|
+
#define GLIST2ARY_FREE(list) (rbgutil_glist2ary_and_free(list))
|
34
|
+
#define GLIST2ARYF(list) (GLIST2ARY_FREE(list))
|
35
|
+
#define GLIST2ARY2(list, gtype) (rbgutil_glist2ary_boxed(list, gtype))
|
36
|
+
#define GLIST2ARY2F(list, gtype) (rbgutil_glist2ary_boxed_and_free(list, gtype))
|
37
|
+
#define GLIST2ARY_STR(list) (rbgutil_glist2ary_string(list))
|
38
|
+
#define GLIST2ARY_STR_FREE(list) (rbgutil_glist2ary_string_and_free(list))
|
39
|
+
#define GSLIST2ARY(list) (rbgutil_gslist2ary(list))
|
40
|
+
#define GSLIST2ARY_FREE(list) (rbgutil_gslist2ary_and_free(list))
|
41
|
+
#define GSLIST2ARYF(list) (GSLIST2ARY_FREE(list))
|
42
|
+
#define GSLIST2ARY2(list, gtype) (rbgutil_gslist2ary_boxed(list, gtype))
|
43
|
+
#define GSLIST2ARY2F(list, gtype) (rbgutil_gslist2ary_boxed_and_free(list, gtype))
|
44
|
+
|
45
|
+
#define G_SET_SYMBOL_PROPERTY(gtype, name) \
|
46
|
+
rbgobj_register_property_getter(gtype, name, rbgutil_sym_g2r_func)
|
47
|
+
|
48
|
+
#define G_BLOCK_PROC rb_block_proc
|
49
|
+
|
50
|
+
extern VALUE rbgutil_glist2ary(const GList *list);
|
51
|
+
extern VALUE rbgutil_glist2ary_and_free(GList* list);
|
52
|
+
extern VALUE rbgutil_glist2ary_boxed(const GList *list, GType gtype);
|
53
|
+
extern VALUE rbgutil_glist2ary_boxed_and_free(GList *list, GType gtype);
|
54
|
+
extern VALUE rbgutil_glist2ary_string(const GList *list);
|
55
|
+
extern VALUE rbgutil_glist2ary_string_and_free(GList *list);
|
56
|
+
extern VALUE rbgutil_gslist2ary(const GSList *list);
|
57
|
+
extern VALUE rbgutil_gslist2ary_and_free(GSList *list);
|
58
|
+
extern VALUE rbgutil_gslist2ary_boxed(const GSList *list, GType gtype);
|
59
|
+
extern VALUE rbgutil_gslist2ary_boxed_and_free(GSList *list, GType gtype);
|
60
|
+
|
61
|
+
G_END_DECLS
|
62
|
+
|
63
|
+
#endif /* __RBGUTILDEPRECATED_H__ */
|
data/lib/glib-mkenums.rb
CHANGED
@@ -168,7 +168,7 @@ GType #{@enum_name}_get_type (void);
|
|
168
168
|
|
169
169
|
# Create a C source as a String.
|
170
170
|
def create_c
|
171
|
-
ret = "\n/* Generated by glib-mkenums.rb ($Id
|
171
|
+
ret = "\n/* Generated by glib-mkenums.rb ($Id$) */ \n\n"
|
172
172
|
ret << %Q[#include "#{@target_filename}.h"\n]
|
173
173
|
@include_files.each do |file|
|
174
174
|
ret << "#include <#{file}>\n"
|
@@ -184,7 +184,7 @@ GType #{@enum_name}_get_type (void);
|
|
184
184
|
header = "#{@target_filename}.h"
|
185
185
|
const = "__#{File.basename(header).upcase.gsub(/-|\./, '_')}__"
|
186
186
|
|
187
|
-
ret = "\n/* Generated by glib-mkenums.rb ($Id
|
187
|
+
ret = "\n/* Generated by glib-mkenums.rb ($Id$) */ \n\n"
|
188
188
|
ret << "#ifndef #{const}\n"
|
189
189
|
ret << "#define #{const}\n\n"
|
190
190
|
ret << "#include <glib-object.h>\n\n"
|
data/lib/glib2.rb
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
require 'pathname'
|
10
10
|
require 'English'
|
11
11
|
require 'thread'
|
12
|
+
require 'glib2/deprecatable'
|
12
13
|
|
13
14
|
module GLib
|
14
15
|
module_function
|
@@ -215,31 +216,6 @@ GLib::Log.set_log_domain(GLib::Object::LOG_DOMAIN)
|
|
215
216
|
GLib::Log.set_log_domain(GLib::Thread::LOG_DOMAIN)
|
216
217
|
GLib::Log.set_log_domain(GLib::Module::LOG_DOMAIN)
|
217
218
|
|
218
|
-
# Ruby-GetText-Package support
|
219
|
-
begin
|
220
|
-
require 'gettext'
|
221
|
-
rescue LoadError
|
222
|
-
unless defined? GetText
|
223
|
-
module GetText
|
224
|
-
module_function
|
225
|
-
def _(msgid); msgid; end
|
226
|
-
def N_(msgid); msgid; end
|
227
|
-
def n_(msgid, msgid_plural, n)
|
228
|
-
n == 1 ? msgid : msgid_plural
|
229
|
-
end
|
230
|
-
def s_(msgid, div = '|')
|
231
|
-
if index = msgid.rindex(div)
|
232
|
-
msgid = msgid[(index + 1)..-1]
|
233
|
-
else
|
234
|
-
msgid
|
235
|
-
end
|
236
|
-
end
|
237
|
-
def bindtextdomain(domainname, path = nil, locale = nil, charset = nil)
|
238
|
-
end
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
219
|
=begin
|
244
220
|
Don't we need this?
|
245
221
|
ObjectSpace.define_finalizer(GLib) {
|
@@ -247,3 +223,4 @@ ObjectSpace.define_finalizer(GLib) {
|
|
247
223
|
puts "GLib::Log.cancel_handler was called." if $DEBUG
|
248
224
|
}
|
249
225
|
=end
|
226
|
+
|
@@ -0,0 +1,149 @@
|
|
1
|
+
module GLib
|
2
|
+
module Deprecatable
|
3
|
+
unless respond_to?(:define_singleton_method)
|
4
|
+
def define_singleton_method(name, &block)
|
5
|
+
singleton_class = class << self; self; end
|
6
|
+
singleton_class.__send__(:define_method, name, &block)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
@@deprecated_const = {}
|
11
|
+
def define_deprecated_const(deprecated_const, new_const = {})
|
12
|
+
@@deprecated_const[self] ||= {}
|
13
|
+
@@deprecated_const[self][deprecated_const.to_sym] = new_const
|
14
|
+
end
|
15
|
+
|
16
|
+
def define_deprecated_enums(enums, prefix = nil)
|
17
|
+
enums = module_eval(enums.to_s) rescue return
|
18
|
+
enums.constants.each do |const|
|
19
|
+
deprecated_const = prefix ? "#{prefix}_#{const}" : const
|
20
|
+
new_const = [enums, const].join('::')
|
21
|
+
define_deprecated_const(deprecated_const, new_const)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
alias :define_deprecated_flags :define_deprecated_enums
|
25
|
+
|
26
|
+
def define_deprecated_singleton_method(deprecated_method, new_method = {}, &block)
|
27
|
+
__define_deprecated_method__(:singleton, deprecated_method, new_method, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def define_deprecated_method(deprecated_method, new_method = {}, &block)
|
31
|
+
__define_deprecated_method__(:instance, deprecated_method, new_method, &block)
|
32
|
+
end
|
33
|
+
|
34
|
+
def define_deprecated_method_by_hash_args(deprecated_method, old_args, new_args, req_argc = 0, &block)
|
35
|
+
klass = self
|
36
|
+
alias_name = "__deprecatable_#{deprecated_method}__"
|
37
|
+
alias_method alias_name, deprecated_method
|
38
|
+
private alias_name
|
39
|
+
|
40
|
+
define_method(deprecated_method) do |*margs, &mblock|
|
41
|
+
if (margs.size == req_argc) || (margs.size == (req_argc + 1) && margs.last.is_a?(Hash))
|
42
|
+
else
|
43
|
+
margs = block.call(self, *margs, &mblock)
|
44
|
+
msg = "#{caller[0]}: '#{klass}##{deprecated_method}(#{old_args})' style has been deprecated."
|
45
|
+
warn "#{msg} Use '#{klass}##{deprecated_method}(#{new_args})' style."
|
46
|
+
end
|
47
|
+
__send__(alias_name, *margs, &mblock)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
@@deprecated_signal = {}
|
52
|
+
def define_deprecated_signal(deprecated_signal, new_signal = {})
|
53
|
+
@@deprecated_signal[self] ||= {}
|
54
|
+
@@deprecated_signal[self][deprecated_signal.to_s.gsub('_', '-').to_sym] = new_signal
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.extended(class_or_module)
|
58
|
+
GLib::Instantiatable.class_eval do
|
59
|
+
%w(signal_connect signal_connect_after).each do |connect_method|
|
60
|
+
alias_name = "__deprecatable_#{connect_method}__"
|
61
|
+
next if private_method_defined?(alias_name)
|
62
|
+
alias_method alias_name, connect_method
|
63
|
+
private alias_name
|
64
|
+
|
65
|
+
define_method(connect_method) do |signal, *margs, &mblock|
|
66
|
+
signal = signal.to_s.gsub('_', '-').to_sym
|
67
|
+
signals = @@deprecated_signal[self]
|
68
|
+
if new_signal = (signals || {})[signal]
|
69
|
+
msg = "#{caller[0]}: '#{signal}' signal has been deprecated."
|
70
|
+
case new_signal
|
71
|
+
when String, Symbol
|
72
|
+
warn "#{msg} Use '#{new_signal}' signal."
|
73
|
+
signal = new_signal
|
74
|
+
when Hash
|
75
|
+
if new_signal[:raise]
|
76
|
+
raise DeprecatedError.new("#{msg} #{new_signal[:raise]}")
|
77
|
+
elsif new_signal[:warn]
|
78
|
+
warn "#{msg} #{new_signal[:warn]}"
|
79
|
+
else
|
80
|
+
warn "#{msg} Don't use this signal anymore."
|
81
|
+
end
|
82
|
+
return
|
83
|
+
end
|
84
|
+
end
|
85
|
+
__send__(alias_name, signal, *margs, &mblock)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def const_missing(deprecated_const)
|
94
|
+
if new_const = (@@deprecated_const[self] || {})[deprecated_const.to_sym]
|
95
|
+
msg = "#{caller[0]}: '#{[name, deprecated_const].join('::')}' has been deprecated."
|
96
|
+
case new_const
|
97
|
+
when String, Symbol
|
98
|
+
new_const_val = constant_get(new_const)
|
99
|
+
case new_const_val
|
100
|
+
when GLib::Enum, GLib::Flags
|
101
|
+
alt = " or ':#{new_const_val.nick.gsub('-', '_')}'"
|
102
|
+
end
|
103
|
+
warn "#{msg} Use '#{new_const}'#{alt}."
|
104
|
+
return const_set(deprecated_const, new_const_val)
|
105
|
+
when Hash
|
106
|
+
if new_const[:raise]
|
107
|
+
raise DeprecatedError.new("#{msg} #{new_const[:raise]}")
|
108
|
+
elsif new_const[:warn]
|
109
|
+
warn "#{msg} #{new_const[:warn]}"
|
110
|
+
else
|
111
|
+
warn "#{msg} Don't use this constant anymore."
|
112
|
+
end
|
113
|
+
return
|
114
|
+
end
|
115
|
+
end
|
116
|
+
raise NameError.new("uninitialized constant #{[self, deprecated_const].join('::')}")
|
117
|
+
end
|
118
|
+
|
119
|
+
def constant_get(const)
|
120
|
+
const.split('::').inject(Object){|r, c| r.const_get(c)}
|
121
|
+
end
|
122
|
+
|
123
|
+
def __define_deprecated_method__(type, deprecated_method, new_method = {}, &block)
|
124
|
+
def_method = type == :singleton ? :define_singleton_method : :define_method
|
125
|
+
sep = type == :singleton ? '.' : '#'
|
126
|
+
klass = self
|
127
|
+
|
128
|
+
__send__(def_method, deprecated_method) do |*margs, &mblock|
|
129
|
+
msg = "#{caller[0]}: '#{klass}#{sep}#{deprecated_method}' has been deprecated."
|
130
|
+
case new_method
|
131
|
+
when String, Symbol
|
132
|
+
warn "#{msg} Use '#{klass}#{sep}#{new_method}'."
|
133
|
+
__send__(new_method, *margs, &mblock)
|
134
|
+
when Hash
|
135
|
+
if new_method[:raise]
|
136
|
+
raise DeprecatedError.new("#{msg} #{new_method[:raise]}")
|
137
|
+
elsif new_method[:warn]
|
138
|
+
warn "#{msg} #{new_method[:warn]}"
|
139
|
+
block.call(self, *margs, &mblock) if block
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
class DeprecatedError < RuntimeError
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
data/lib/gnome2-raketask.rb
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
require 'find'
|
8
8
|
|
9
9
|
require 'rubygems'
|
10
|
+
require 'rubygems/package_task'
|
10
11
|
require 'rake/extensiontask'
|
11
12
|
|
12
13
|
class GNOME2Package
|
@@ -21,13 +22,19 @@ class GNOME2Package
|
|
21
22
|
@glib2_root = File.expand_path("#{@package_root}/../glib2")
|
22
23
|
@packages = FileList["#{File.dirname(@package_root)}/*"].map{|f| File.directory?(f) ? File.basename(f) : nil}.compact
|
23
24
|
@name = File.basename(@package_root)
|
25
|
+
@cross_compiling_hooks = []
|
24
26
|
yield(self) if block_given?
|
25
27
|
end
|
26
28
|
|
29
|
+
def cross_compiling(&block)
|
30
|
+
@cross_compiling_hooks << block
|
31
|
+
end
|
32
|
+
|
27
33
|
def define_tasks
|
28
34
|
task :default => :build
|
29
|
-
|
35
|
+
define_spec
|
30
36
|
define_win32_tasks
|
37
|
+
define_package_tasks
|
31
38
|
end
|
32
39
|
|
33
40
|
def ruby_gnome2_package?(name)
|
@@ -63,7 +70,7 @@ class GNOME2Package
|
|
63
70
|
@name = ""
|
64
71
|
@summary = ""
|
65
72
|
@description = ""
|
66
|
-
@author = "The Ruby-GNOME2
|
73
|
+
@author = "The Ruby-GNOME2 Project Team"
|
67
74
|
@email = "ruby-gnome2-devel-en@lists.sourceforge.net"
|
68
75
|
@homepage = "http://ruby-gnome2.sourceforge.jp/"
|
69
76
|
end
|
@@ -73,7 +80,7 @@ class GNOME2Package
|
|
73
80
|
@win32_configuration = Win32Configuration.new(self)
|
74
81
|
end
|
75
82
|
|
76
|
-
def
|
83
|
+
def define_spec
|
77
84
|
@spec = Gem::Specification.new do |s|
|
78
85
|
s.name = @name
|
79
86
|
s.summary = @summary
|
@@ -84,18 +91,23 @@ class GNOME2Package
|
|
84
91
|
s.version = version
|
85
92
|
s.extensions = FileList["ext/#{@name}/extconf.rb"]
|
86
93
|
s.require_paths = ["lib"]
|
87
|
-
|
88
|
-
|
89
|
-
|
94
|
+
files = FileList["ChangeLog", "README",
|
95
|
+
"Rakefile", "extconf.rb",
|
96
|
+
"lib/**/*.rb",
|
97
|
+
"{ext,sample,test,test-unit}/**/*"]
|
98
|
+
files.existing!
|
99
|
+
s.files = files
|
90
100
|
s.post_install_message = @post_install_message
|
91
101
|
@dependency_configuration.apply(s)
|
92
102
|
end
|
93
|
-
|
94
|
-
Gem::PackageTask.new(@spec) do |pkg|
|
95
|
-
end
|
96
103
|
end
|
97
104
|
|
98
105
|
def define_win32_tasks
|
106
|
+
define_win32_build_task
|
107
|
+
define_win32_download_task
|
108
|
+
end
|
109
|
+
|
110
|
+
def define_win32_build_task
|
99
111
|
Rake::ExtensionTask.new(@name, @spec) do |ext|
|
100
112
|
ext.cross_compile = true
|
101
113
|
ext.cross_compiling do |spec|
|
@@ -110,19 +122,37 @@ class GNOME2Package
|
|
110
122
|
end
|
111
123
|
spec.files += win32_files
|
112
124
|
end
|
125
|
+
@cross_compiling_hooks.each do |hook|
|
126
|
+
hook.call(spec)
|
127
|
+
end
|
113
128
|
end
|
114
129
|
end
|
115
130
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
131
|
+
def define_win32_download_task
|
132
|
+
namespace :win32 do
|
133
|
+
namespace :downloader do
|
134
|
+
task :before do
|
135
|
+
$LOAD_PATH.unshift("#{@glib2_root}/lib")
|
136
|
+
require 'gnome2-win32-binary-downloader'
|
137
|
+
end
|
138
|
+
task :download do
|
139
|
+
GNOME2Win32BinaryDownloader.download(@win32_configuration.to_hash)
|
140
|
+
end
|
141
|
+
task :after
|
142
|
+
end
|
143
|
+
desc "download Windows binaries"
|
144
|
+
task :download => ["win32:downloader:before",
|
145
|
+
"win32:downloader:download",
|
146
|
+
"win32:downloader:after"]
|
122
147
|
end
|
123
148
|
end
|
124
149
|
end
|
125
150
|
|
151
|
+
def define_package_tasks
|
152
|
+
Gem::PackageTask.new(@spec) do |pkg|
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
126
156
|
class DependencyConfiguration
|
127
157
|
attr_accessor :platform, :ruby
|
128
158
|
def initialize(package)
|
@@ -101,7 +101,7 @@ class GNOME2Win32BinaryDownloader
|
|
101
101
|
escaped_latest_version = Regexp.escape(latest_version)
|
102
102
|
dependencies_page.links.each do |link|
|
103
103
|
case link.href
|
104
|
-
when /\A#{escaped_dependency}(?:-dev)?_#{escaped_latest_version}_win32
|
104
|
+
when /\A#{escaped_dependency}(?:-dev)?_#{escaped_latest_version}_win32\.zip\z/
|
105
105
|
click_zip_link(link)
|
106
106
|
end
|
107
107
|
end
|
data/lib/mkmf-gnome2.rb
CHANGED
@@ -20,27 +20,46 @@ rescue LoadError
|
|
20
20
|
end
|
21
21
|
require 'glib-mkenums'
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
#endif
|
29
|
-
EOP
|
23
|
+
$CFLAGS += " #{ENV['CFLAGS']}" if ENV['CFLAGS']
|
24
|
+
|
25
|
+
def try_compiler_option(opt, &block)
|
26
|
+
checking_for "#{opt} option to compiler" do
|
27
|
+
$CFLAGS += " #{opt}" if try_compile '', opt, &block
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
31
|
+
try_compiler_option '-Wall'
|
32
|
+
try_compiler_option '-Waggregate-return'
|
33
|
+
try_compiler_option '-Wcast-align'
|
34
|
+
# NOTE: Generates way too many false positives.
|
35
|
+
# try_compiler_option '-Wconversion'
|
36
|
+
try_compiler_option '-Wextra'
|
37
|
+
try_compiler_option '-Wformat=2'
|
38
|
+
try_compiler_option '-Winit-self'
|
39
|
+
# NOTE: This generates warnings for functions defined in ruby.h.
|
40
|
+
# try_compiler_option '-Winline'
|
41
|
+
try_compiler_option '-Wlarger-than-65500'
|
42
|
+
try_compiler_option '-Wmissing-declarations'
|
43
|
+
try_compiler_option '-Wmissing-format-attribute'
|
44
|
+
try_compiler_option '-Wmissing-include-dirs'
|
45
|
+
try_compiler_option '-Wmissing-noreturn'
|
46
|
+
try_compiler_option '-Wmissing-prototypes'
|
47
|
+
try_compiler_option '-Wnested-externs'
|
48
|
+
try_compiler_option '-Wold-style-definition'
|
49
|
+
try_compiler_option '-Wpacked'
|
50
|
+
try_compiler_option '-Wp,-D_FORTIFY_SOURCE=2'
|
51
|
+
try_compiler_option '-Wpointer-arith'
|
52
|
+
# NOTE: ruby.h and intern.h have too many of these.
|
53
|
+
# try_compiler_option '-Wredundant-decls'
|
54
|
+
# NOTE: Complains about index, for example.
|
55
|
+
# try_compiler_option '-Wshadow'
|
56
|
+
try_compiler_option '-Wswitch-default'
|
57
|
+
try_compiler_option '-Wswitch-enum'
|
58
|
+
try_compiler_option '-Wundef'
|
59
|
+
# NOTE: Incredible amounts of false positives.
|
60
|
+
#try_compiler_option '-Wunreachable-code'
|
61
|
+
try_compiler_option '-Wunsafe-loop-optimizations'
|
62
|
+
try_compiler_option '-Wwrite-strings'
|
44
63
|
|
45
64
|
if /-Wl,--no-undefined/ =~ $LDFLAGS.to_s
|
46
65
|
$LDFLAGS.gsub!(/-Wl,--no-undefined/, '')
|