glib2 1.2.6 → 2.0.0
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 +59 -24
- data/ext/glib2/extconf.rb +1 -1
- data/ext/glib2/glib2.def +1 -0
- data/ext/glib2/rbglib.h +3 -3
- data/lib/glib2.rb +11 -10
- data/lib/gnome2-raketask.rb +4 -226
- data/lib/gnome2/rake/external-package.rb +198 -0
- data/lib/gnome2/rake/native-binary-build-task.rb +108 -0
- data/lib/gnome2/rake/package-task.rb +244 -0
- data/lib/gnome2/rake/package.rb +122 -0
- data/lib/gnome2/rake/source-download-task.rb +81 -0
- data/lib/gnome2/rake/win32-binary-build-task.rb +223 -0
- data/lib/{gnome2-win32-binary-download-task.rb → gnome2/rake/win32-binary-download-task.rb} +7 -7
- data/lib/mkmf-gnome2.rb +3 -2
- metadata +9 -4
- data/lib/gnome2-win32-binary-build-task.rb +0 -250
data/Rakefile
CHANGED
@@ -3,12 +3,14 @@
|
|
3
3
|
$LOAD_PATH.unshift("./lib")
|
4
4
|
require 'gnome2-raketask'
|
5
5
|
|
6
|
+
include_dir = nil
|
7
|
+
glib2_include_dir = nil
|
6
8
|
libffi_lib_dir = nil
|
7
|
-
libffi_include_dir = nil
|
8
9
|
|
9
10
|
package = GNOME2Package.new do |_package|
|
10
|
-
|
11
|
-
|
11
|
+
include_dir = (_package.windows.absolute_binary_dir + "include").to_s
|
12
|
+
glib2_include_dir = File.join(include_dir, "glib-2.0")
|
13
|
+
libffi_lib_dir = (_package.windows.absolute_binary_dir + "lib").to_s
|
12
14
|
|
13
15
|
_package.summary = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
|
14
16
|
_package.description = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
|
@@ -16,58 +18,69 @@ package = GNOME2Package.new do |_package|
|
|
16
18
|
_package.dependency.gem.development = [["test-unit", ">= 2"]]
|
17
19
|
_package.win32.packages = []
|
18
20
|
_package.win32.dependencies = ["zlib", "libffi", "gettext-runtime"]
|
19
|
-
_package.
|
21
|
+
_package.external_packages = [
|
20
22
|
{
|
21
23
|
:name => "glib",
|
22
24
|
:download_site => :gnome,
|
23
25
|
:label => "GLib",
|
24
26
|
:version => "2.36.0",
|
25
|
-
:configure_args => [
|
26
|
-
"LIBFFI_CFLAGS=-I#{libffi_include_dir}",
|
27
|
-
"LIBFFI_LIBS=-L#{libffi_lib_dir} -lffi",
|
28
|
-
"--disable-modular-tests",
|
29
|
-
],
|
30
27
|
:compression_method => "xz",
|
28
|
+
:windows => {
|
29
|
+
:configure_args => [
|
30
|
+
"LIBFFI_CFLAGS=-I#{include_dir}",
|
31
|
+
"LIBFFI_LIBS=-L#{libffi_lib_dir} -lffi",
|
32
|
+
"--disable-modular-tests",
|
33
|
+
],
|
34
|
+
},
|
31
35
|
},
|
32
36
|
{
|
33
37
|
:name => "gmp",
|
34
38
|
:download_base_url => "ftp://ftp.gmplib.org/pub/gmp-5.1.0",
|
35
39
|
:label => "GNU MP",
|
36
40
|
:version => "5.1.0",
|
37
|
-
:configure_args => [
|
38
|
-
"--disable-static",
|
39
|
-
"--enable-shared",
|
40
|
-
],
|
41
41
|
:compression_method => "bz2",
|
42
|
+
:windows => {
|
43
|
+
:configure_args => [
|
44
|
+
"--disable-static",
|
45
|
+
"--enable-shared",
|
46
|
+
],
|
47
|
+
},
|
42
48
|
},
|
43
49
|
{
|
44
50
|
:name => "nettle",
|
45
51
|
:download_base_url => "http://www.lysator.liu.se/~nisse/archive",
|
46
52
|
:label => "Nettle",
|
47
53
|
:version => "2.5",
|
48
|
-
:
|
54
|
+
:windows => {
|
55
|
+
:configure_args => [],
|
56
|
+
},
|
49
57
|
},
|
50
58
|
{
|
51
59
|
:name => "gnutls",
|
52
60
|
:download_base_url => "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1",
|
53
61
|
:label => "GnuTLS",
|
54
62
|
:version => "3.1.10",
|
55
|
-
:configure_args => [
|
56
|
-
"--with-libnettle-prefix=#{_package.win32.absolute_binary_dir}"
|
57
|
-
],
|
58
63
|
:compression_method => "xz",
|
64
|
+
:windows => {
|
65
|
+
:configure_args => [
|
66
|
+
"--with-libnettle-prefix=#{_package.win32.absolute_binary_dir}"
|
67
|
+
],
|
68
|
+
:use_cc_environment_variable => false,
|
69
|
+
},
|
59
70
|
},
|
60
71
|
{
|
61
72
|
:name => "glib-networking",
|
62
73
|
:download_site => :gnome,
|
63
74
|
:label => "glib-networking",
|
64
75
|
:version => "2.36.0",
|
65
|
-
:configure_args => [
|
66
|
-
"--without-libproxy",
|
67
|
-
"--without-gnome-proxy",
|
68
|
-
"--without-ca-certificates",
|
69
|
-
],
|
70
76
|
:compression_method => "xz",
|
77
|
+
:windows => {
|
78
|
+
:configure_args => [
|
79
|
+
"--without-libproxy",
|
80
|
+
"--without-gnome-proxy",
|
81
|
+
"--without-ca-certificates",
|
82
|
+
],
|
83
|
+
},
|
71
84
|
},
|
72
85
|
]
|
73
86
|
end
|
@@ -80,13 +93,35 @@ namespace :win32 do
|
|
80
93
|
task :fix do
|
81
94
|
libffi_version = "libffi-3.0.6"
|
82
95
|
mv(Dir.glob(File.join(libffi_lib_dir, libffi_version, "include", "*.h")),
|
83
|
-
|
96
|
+
include_dir)
|
84
97
|
rm_rf(File.join(libffi_lib_dir, libffi_version))
|
85
98
|
end
|
86
99
|
end
|
87
100
|
end
|
88
101
|
|
89
102
|
namespace :downloader do
|
90
|
-
task :after => [
|
103
|
+
task :after => [
|
104
|
+
"win32:libffi:header:fix",
|
105
|
+
]
|
106
|
+
end
|
107
|
+
|
108
|
+
namespace :gettext do
|
109
|
+
namespace :header do
|
110
|
+
desc "Copy gettext headers to include/glib-2.0/"
|
111
|
+
task :fix do
|
112
|
+
cp(File.join(include_dir, "libintl.h"),
|
113
|
+
glib2_include_dir)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
namespace :buildler do
|
119
|
+
namespace :build do
|
120
|
+
namespace :glib do
|
121
|
+
task :after => [
|
122
|
+
"win32:gettext:header:fix",
|
123
|
+
]
|
124
|
+
end
|
125
|
+
end
|
91
126
|
end
|
92
127
|
end
|
data/ext/glib2/extconf.rb
CHANGED
@@ -57,7 +57,7 @@ include_paths = PKGConfig.cflags_only_I("glib-2.0")
|
|
57
57
|
headers = include_paths.split.inject([]) do |result, path|
|
58
58
|
result + Dir.glob(File.join(path.sub(/^-I/, ""), "glib", "*.h"))
|
59
59
|
end.reject do |file|
|
60
|
-
/g(iochannel|scanner)\.h/ =~ file
|
60
|
+
/g(iochannel|main|scanner)\.h/ =~ file
|
61
61
|
end
|
62
62
|
include_paths = PKGConfig.cflags_only_I("gobject-2.0")
|
63
63
|
headers = include_paths.split.inject(headers) do |result, path|
|
data/ext/glib2/glib2.def
CHANGED
data/ext/glib2/rbglib.h
CHANGED
@@ -33,9 +33,9 @@
|
|
33
33
|
extern "C" {
|
34
34
|
#endif /* __cplusplus */
|
35
35
|
|
36
|
-
#define RBGLIB_MAJOR_VERSION
|
37
|
-
#define RBGLIB_MINOR_VERSION
|
38
|
-
#define RBGLIB_MICRO_VERSION
|
36
|
+
#define RBGLIB_MAJOR_VERSION 2
|
37
|
+
#define RBGLIB_MINOR_VERSION 0
|
38
|
+
#define RBGLIB_MICRO_VERSION 0
|
39
39
|
|
40
40
|
#ifndef RSTRING_PTR
|
41
41
|
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
data/lib/glib2.rb
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
# glib2.rb
|
3
3
|
# Copyright(C) 2005-2010 Ruby-GNOME2 Project.
|
4
4
|
#
|
5
|
-
# This program is licenced under the same
|
6
|
-
# license of Ruby-GNOME2.
|
7
|
-
#
|
5
|
+
# This program is licenced under the same license of Ruby-GNOME2.
|
8
6
|
|
9
7
|
require 'pathname'
|
10
8
|
require 'English'
|
@@ -15,11 +13,11 @@ module GLib
|
|
15
13
|
module_function
|
16
14
|
def check_binding_version?(major, minor, micro)
|
17
15
|
BINDING_VERSION[0] > major ||
|
18
|
-
(BINDING_VERSION[0] == major &&
|
16
|
+
(BINDING_VERSION[0] == major &&
|
19
17
|
BINDING_VERSION[1] > minor) ||
|
20
|
-
(BINDING_VERSION[0] == major &&
|
18
|
+
(BINDING_VERSION[0] == major &&
|
21
19
|
BINDING_VERSION[1] == minor &&
|
22
|
-
BINDING_VERSION[2] >= micro)
|
20
|
+
BINDING_VERSION[2] >= micro)
|
23
21
|
end
|
24
22
|
|
25
23
|
def exit_application(exception, status)
|
@@ -72,13 +70,12 @@ module GLib
|
|
72
70
|
end
|
73
71
|
end
|
74
72
|
|
75
|
-
def
|
73
|
+
def prepend_path_to_environment_variable(path, environment_name)
|
76
74
|
path = Pathname(path) unless path.is_a?(Pathname)
|
77
75
|
if path.exist?
|
78
|
-
environment_name = "PATH"
|
79
76
|
separator = ::File::PATH_SEPARATOR
|
80
77
|
|
81
|
-
paths = (ENV[environment_name] || '').split(/#{separator}/)
|
78
|
+
paths = (ENV[environment_name] || '').split(/#{Regexp.escape(separator)}/)
|
82
79
|
dir = path.to_s
|
83
80
|
dir = dir.gsub(/\//, ::File::ALT_SEPARATOR) if ::File::ALT_SEPARATOR
|
84
81
|
unless paths.include?(dir)
|
@@ -87,12 +84,16 @@ module GLib
|
|
87
84
|
end
|
88
85
|
end
|
89
86
|
end
|
87
|
+
|
88
|
+
def prepend_dll_path(path)
|
89
|
+
prepend_path_to_environment_variable(path, "PATH")
|
90
|
+
end
|
90
91
|
end
|
91
92
|
|
92
93
|
|
93
94
|
base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
|
94
95
|
vendor_dir = base_dir + "vendor" + "local"
|
95
|
-
GLib.
|
96
|
+
GLib.prepend_dll_path(vendor_dir + "bin")
|
96
97
|
begin
|
97
98
|
major, minor, _ = RUBY_VERSION.split(/\./)
|
98
99
|
require "#{major}.#{minor}/glib2.so"
|
data/lib/gnome2-raketask.rb
CHANGED
@@ -1,230 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
# Copyright(C) 2011 Ruby-GNOME2 Project.
|
1
|
+
# Copyright(C) 2013 Ruby-GNOME2 Project.
|
4
2
|
#
|
5
3
|
# This program is licenced under the same license of Ruby-GNOME2.
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
require 'rubygems'
|
10
|
-
require 'rubygems/package_task'
|
11
|
-
require 'rake/extensiontask'
|
12
|
-
require 'gnome2-win32-binary-download-task'
|
13
|
-
require 'gnome2-win32-binary-build-task'
|
14
|
-
|
15
|
-
class GNOME2Package
|
16
|
-
include Rake::DSL
|
17
|
-
|
18
|
-
attr_accessor :name, :summary, :description, :author, :email, :homepage, :required_ruby_version, :post_install_message
|
19
|
-
attr_reader :root_dir
|
20
|
-
def initialize
|
21
|
-
initialize_variables
|
22
|
-
initialize_configurations
|
23
|
-
file, line, method = caller[1].scan(/^(.*):(\d+)(?::.*`(.*)')?\Z/).first
|
24
|
-
@root_dir = File.dirname(file)
|
25
|
-
@glib2_root_dir = File.expand_path("#{@root_dir}/../glib2")
|
26
|
-
@packages = FileList["#{File.dirname(@root_dir)}/*"].map{|f| File.directory?(f) ? File.basename(f) : nil}.compact
|
27
|
-
@name = File.basename(@root_dir)
|
28
|
-
@cross_compiling_hooks = []
|
29
|
-
yield(self) if block_given?
|
30
|
-
end
|
31
|
-
|
32
|
-
def cross_compiling(&block)
|
33
|
-
@cross_compiling_hooks << block
|
34
|
-
end
|
35
|
-
|
36
|
-
def define_tasks
|
37
|
-
task :default => :build
|
38
|
-
define_spec
|
39
|
-
define_win32_tasks
|
40
|
-
define_package_tasks
|
41
|
-
end
|
42
|
-
|
43
|
-
def ruby_gnome2_package?(name)
|
44
|
-
@packages.include?(name)
|
45
|
-
end
|
46
|
-
|
47
|
-
def dependency
|
48
|
-
@dependency_configuration
|
49
|
-
end
|
50
|
-
|
51
|
-
def win32
|
52
|
-
@win32_configuration
|
53
|
-
end
|
54
|
-
|
55
|
-
def version
|
56
|
-
ENV["VERSION"] || guess_version
|
57
|
-
end
|
58
|
-
|
59
|
-
def guess_version
|
60
|
-
versions = {}
|
61
|
-
File.open("#{@glib2_root_dir}/ext/glib2/rbglib.h") do |rbglib_h|
|
62
|
-
rbglib_h.each_line do |line|
|
63
|
-
if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line
|
64
|
-
versions[$1.downcase] = $2.to_i
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
["major", "minor", "micro"].collect {|type| versions[type]}.compact.join(".")
|
69
|
-
end
|
70
|
-
|
71
|
-
private
|
72
|
-
def initialize_variables
|
73
|
-
@name = ""
|
74
|
-
@summary = ""
|
75
|
-
@description = ""
|
76
|
-
@author = "The Ruby-GNOME2 Project Team"
|
77
|
-
@email = "ruby-gnome2-devel-en@lists.sourceforge.net"
|
78
|
-
@homepage = "http://ruby-gnome2.sourceforge.jp/"
|
79
|
-
end
|
80
|
-
|
81
|
-
def initialize_configurations
|
82
|
-
@dependency_configuration = DependencyConfiguration.new(self)
|
83
|
-
@win32_configuration = Win32Configuration.new(self)
|
84
|
-
end
|
85
|
-
|
86
|
-
def define_spec
|
87
|
-
@spec = Gem::Specification.new do |s|
|
88
|
-
s.name = @name
|
89
|
-
s.summary = @summary
|
90
|
-
s.description = @description
|
91
|
-
s.author = @author
|
92
|
-
s.email = @email
|
93
|
-
s.homepage = @homepage
|
94
|
-
s.version = version
|
95
|
-
extensions = FileList["ext/#{@name}/extconf.rb"]
|
96
|
-
extensions.existing!
|
97
|
-
s.extensions = extensions
|
98
|
-
s.require_paths = ["lib"]
|
99
|
-
files = FileList["ChangeLog", "README",
|
100
|
-
"Rakefile", "extconf.rb",
|
101
|
-
"lib/**/*.rb",
|
102
|
-
"{ext,sample,test,test-unit}/**/*"]
|
103
|
-
files.existing!
|
104
|
-
s.files = files
|
105
|
-
s.required_ruby_version = @required_ruby_version || ">= 1.8.5"
|
106
|
-
s.post_install_message = @post_install_message
|
107
|
-
@dependency_configuration.apply(s)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def define_win32_tasks
|
112
|
-
define_win32_extension_task
|
113
|
-
define_win32_download_task
|
114
|
-
define_win32_build_task
|
115
|
-
end
|
116
|
-
|
117
|
-
def so_base_name
|
118
|
-
@name.gsub(/-/, "_")
|
119
|
-
end
|
120
|
-
|
121
|
-
def define_win32_extension_task
|
122
|
-
Rake::ExtensionTask.new(so_base_name, @spec) do |ext|
|
123
|
-
ext.ext_dir = "ext/#{@name}"
|
124
|
-
ext.cross_compile = true
|
125
|
-
ext.cross_compiling do |spec|
|
126
|
-
if /mingw|mswin/ =~ spec.platform.to_s
|
127
|
-
win32_binary_dir = @win32_configuration.relative_binary_dir
|
128
|
-
win32_files = []
|
129
|
-
if File.exist?(win32_binary_dir)
|
130
|
-
Find.find(win32_binary_dir) do |file|
|
131
|
-
next if /\.zip\z/ =~ file
|
132
|
-
win32_files << file
|
133
|
-
end
|
134
|
-
end
|
135
|
-
spec.files += win32_files
|
136
|
-
end
|
137
|
-
@cross_compiling_hooks.each do |hook|
|
138
|
-
hook.call(spec)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def define_win32_download_task
|
144
|
-
GNOME2Win32BinaryDownloadTask.new(@win32_configuration)
|
145
|
-
end
|
146
|
-
|
147
|
-
def define_win32_build_task
|
148
|
-
GNOME2Win32BinaryBuildTask.new(@win32_configuration)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def define_package_tasks
|
153
|
-
Gem::PackageTask.new(@spec) do |pkg|
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
class DependencyConfiguration
|
158
|
-
attr_accessor :platform, :ruby
|
159
|
-
def initialize(package)
|
160
|
-
@package = package
|
161
|
-
@platform = Gem::Platform::RUBY
|
162
|
-
@gem_configuration = GemConfiguration.new(@package)
|
163
|
-
end
|
164
|
-
|
165
|
-
def gem
|
166
|
-
@gem_configuration
|
167
|
-
end
|
168
|
-
|
169
|
-
def apply(spec)
|
170
|
-
spec.platform = @platform
|
171
|
-
@gem_configuration.apply(spec)
|
172
|
-
end
|
173
|
-
|
174
|
-
class GemConfiguration
|
175
|
-
attr_accessor :runtime, :development
|
176
|
-
def initialize(package)
|
177
|
-
@package = package
|
178
|
-
@runtime = []
|
179
|
-
@development = []
|
180
|
-
end
|
181
|
-
|
182
|
-
def apply(spec)
|
183
|
-
@runtime.each do |dependency|
|
184
|
-
spec.add_runtime_dependency(*append_version(dependency))
|
185
|
-
end
|
186
|
-
|
187
|
-
@development.each do |dependency|
|
188
|
-
spec.add_development_dependency(*append_version(dependency))
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
def append_version(dependency)
|
193
|
-
name, *ver = dependency.is_a?(Array) ? dependency : [dependency]
|
194
|
-
ver << ">= #{@package.version}" if @package.ruby_gnome2_package?(name)
|
195
|
-
[name, *ver]
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
class Win32Configuration
|
201
|
-
attr_reader :package
|
202
|
-
attr_accessor :packages, :dependencies, :build_packages, :build_dependencies
|
203
|
-
attr_accessor :build_host
|
204
|
-
attr_accessor :relative_binary_dir, :absolute_binary_dir
|
205
|
-
attr_accessor :support_concurrent_build
|
206
|
-
def initialize(package)
|
207
|
-
@package = package
|
208
|
-
@packages = []
|
209
|
-
@dependencies = []
|
210
|
-
@build_packages = []
|
211
|
-
@build_dependencies = []
|
212
|
-
@build_host = "i686-w64-mingw32"
|
213
|
-
@relative_binary_dir = File.join("vendor", "local")
|
214
|
-
@absolute_binary_dir = File.expand_path(@relative_binary_dir)
|
215
|
-
@support_concurrent_build = true
|
216
|
-
end
|
5
|
+
# Just for backward compatibility.
|
6
|
+
require "gnome2/rake/package-task"
|
217
7
|
|
218
|
-
|
219
|
-
{
|
220
|
-
:packages => @packages,
|
221
|
-
:dependencies => @dependencies,
|
222
|
-
:build_packages => @build_packages,
|
223
|
-
:build_host => @build_host,
|
224
|
-
:relative_binary_dir => @relative_binary_dir,
|
225
|
-
:absolute_binary_dir => @absolute_binary_dir,
|
226
|
-
:support_concurrent_build => @support_concurrent_build,
|
227
|
-
}
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
8
|
+
GNOME2Package = GNOME2::Rake::PackageTask
|