glib2 2.2.3 → 2.2.4

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.
@@ -96,6 +96,8 @@ module GNOME2
96
96
  "PKG_CONFIG_PATH=#{pkg_config_path}",
97
97
  "--prefix=#{dist_dir}",
98
98
  *package.native.configure_args) or exit(false)
99
+ env = []
100
+ env << "PKG_CONFIG_PATH=#{pkg_config_path}"
99
101
  common_make_args = []
100
102
  common_make_args << "GLIB_COMPILE_SCHEMAS=glib-compile-schemas"
101
103
  build_make_args = common_make_args.dup
@@ -104,8 +106,8 @@ module GNOME2
104
106
  make_n_jobs = ENV["MAKE_N_JOBS"]
105
107
  build_make_args << "-j#{make_n_jobs}" if make_n_jobs
106
108
  end
107
- sh("nice", "make", *build_make_args) or exit(false)
108
- sh("make", "install", *install_make_args) or exit(false)
109
+ sh("env", *env, "nice", "make", *build_make_args) or exit(false)
110
+ sh("env", *env, "make", "install", *install_make_args) or exit(false)
109
111
  end
110
112
  end
111
113
 
@@ -14,8 +14,8 @@ require "gnome2/rake/package"
14
14
  require "gnome2/rake/external-package"
15
15
  require "gnome2/rake/source-download-task"
16
16
  require "gnome2/rake/native-binary-build-task"
17
- require "gnome2/rake/win32-binary-download-task"
18
- require "gnome2/rake/win32-binary-build-task"
17
+ require "gnome2/rake/windows-binary-download-task"
18
+ require "gnome2/rake/windows-binary-build-task"
19
19
 
20
20
  module GNOME2
21
21
  module Rake
@@ -44,7 +44,7 @@ module GNOME2
44
44
  define_spec
45
45
  define_source_tasks
46
46
  define_native_tasks
47
- define_win32_tasks
47
+ define_windows_tasks
48
48
  define_package_tasks
49
49
  end
50
50
 
@@ -69,11 +69,6 @@ module GNOME2
69
69
  @package.windows
70
70
  end
71
71
 
72
- # For backward compatibility
73
- def win32
74
- windows
75
- end
76
-
77
72
  def native
78
73
  @package.native
79
74
  end
@@ -133,7 +128,9 @@ module GNOME2
133
128
  files = FileList["ChangeLog", "README",
134
129
  "Rakefile", "extconf.rb",
135
130
  "lib/**/*.rb",
136
- "{ext,sample,test,test-unit}/**/*"]
131
+ "ext/**/depend",
132
+ "ext/**/*.{c,h,def,rb}",
133
+ "{sample,test}/**/*"]
137
134
  files.existing!
138
135
  s.files = files
139
136
  s.required_ruby_version = @required_ruby_version || ">= 1.9.3"
@@ -160,40 +157,44 @@ module GNOME2
160
157
  task.define
161
158
  end
162
159
 
163
- def define_win32_tasks
164
- define_win32_extension_task
165
- define_win32_download_task
166
- define_win32_build_task
160
+ def define_windows_tasks
161
+ define_windows_extension_task
162
+ define_windows_download_task
163
+ define_windows_build_task
167
164
  end
168
165
 
169
166
  def so_base_name
170
167
  @name.gsub(/-/, "_")
171
168
  end
172
169
 
173
- def define_win32_extension_task
170
+ def define_windows_extension_task
174
171
  ::Rake::ExtensionTask.new(so_base_name, @spec) do |ext|
175
172
  ext.cross_platform = cross_platform
176
173
  ext.ext_dir = "ext/#{@name}"
177
174
  ext.cross_compile = true
178
175
  ext.cross_compiling do |spec|
179
176
  if /mingw|mswin/ =~ spec.platform.to_s
180
- win32_binary_dir = @package.windows.relative_binary_dir
181
- win32_files = []
182
- if win32_binary_dir.exist?
183
- Find.find(win32_binary_dir.to_s) do |path|
177
+ windows_binary_dir = @package.windows.relative_binary_dir
178
+ windows_files = []
179
+ if windows_binary_dir.exist?
180
+ Find.find(windows_binary_dir.to_s) do |path|
184
181
  next unless File.file?(path)
185
182
  next if /\.zip\z/ =~ path
186
- win32_files << path
183
+ windows_files << path
187
184
  end
188
185
  end
189
- spec.files += win32_files
186
+ spec.files += windows_files
190
187
  stage_path = "#{ext.tmp_dir}/#{ext.cross_platform}/stage"
191
- win32_files.each do |win32_file|
192
- stage_win32_file = "#{stage_path}/#{win32_file}"
193
- stage_win32_binary_dir = File.dirname(stage_win32_file)
194
- directory stage_win32_binary_dir
195
- file stage_win32_file => [stage_win32_binary_dir, win32_file] do
196
- cp win32_file, stage_win32_file
188
+ windows_files.each do |windows_file|
189
+ stage_windows_file = "#{stage_path}/#{windows_file}"
190
+ stage_windows_binary_dir = File.dirname(stage_windows_file)
191
+ directory stage_windows_binary_dir
192
+ stage_windows_file_dependencies = [
193
+ stage_windows_binary_dir,
194
+ windows_file,
195
+ ]
196
+ file stage_windows_file => stage_windows_file_dependencies do
197
+ cp windows_file, stage_windows_file
197
198
  end
198
199
  end
199
200
  end
@@ -212,12 +213,12 @@ module GNOME2
212
213
  end
213
214
  end
214
215
 
215
- def define_win32_download_task
216
- GNOME2Win32BinaryDownloadTask.new(@package)
216
+ def define_windows_download_task
217
+ GNOME2WindowsBinaryDownloadTask.new(@package)
217
218
  end
218
219
 
219
- def define_win32_build_task
220
- GNOME2Win32BinaryBuildTask.new(@package)
220
+ def define_windows_build_task
221
+ GNOME2WindowsBinaryBuildTask.new(@package)
221
222
  end
222
223
 
223
224
  def define_package_tasks
@@ -129,6 +129,15 @@ module GNOME2
129
129
  def build_architecture
130
130
  ENV["RUBY_GNOME2_BUILD_ARCHITECTURE"] || "x86"
131
131
  end
132
+
133
+ def build_architecture_suffix
134
+ case build_architecture
135
+ when "x86"
136
+ "win32"
137
+ when "x64"
138
+ "win64"
139
+ end
140
+ end
132
141
  end
133
142
 
134
143
  class NativeConfiguration
@@ -5,7 +5,7 @@
5
5
  require "open-uri"
6
6
  require "pathname"
7
7
 
8
- class GNOME2Win32BinaryBuildTask
8
+ class GNOME2WindowsBinaryBuildTask
9
9
  include Rake::DSL
10
10
 
11
11
  def initialize(package)
@@ -15,20 +15,20 @@ class GNOME2Win32BinaryBuildTask
15
15
 
16
16
  private
17
17
  def define
18
- namespace :win32 do
18
+ namespace :windows do
19
19
  namespace :builder do
20
20
  task :before
21
21
  define_build_tasks
22
22
  build_tasks = build_packages.collect do |package|
23
- "win32:builder:build:#{package.name}"
23
+ "windows:builder:build:#{package.name}"
24
24
  end
25
25
  task :build => build_tasks
26
26
  task :after
27
27
  end
28
28
  desc "Build Windows binaries"
29
- task :build => ["win32:builder:before",
30
- "win32:builder:build",
31
- "win32:builder:after"]
29
+ task :build => ["windows:builder:before",
30
+ "windows:builder:build",
31
+ "windows:builder:after"]
32
32
  end
33
33
  end
34
34
 
@@ -46,17 +46,18 @@ class GNOME2Win32BinaryBuildTask
46
46
  ENV["PKG_CONFIG_PATH"] = pkg_config_path.collect do |path|
47
47
  File.expand_path(path)
48
48
  end.join(":")
49
- ENV["PKG_CONFIG_LIBDIR"] = rcairo_win32_pkgconfig_path
49
+ ENV["PKG_CONFIG_LIBDIR"] = rcairo_windows_pkgconfig_path
50
50
  end
51
51
 
52
52
  prepare_task_names << "pkg_config_for_build"
53
53
  task :pkg_config_for_build do
54
- ENV["PKG_CONFIG_FOR_BUILD"] = "env - pkg-config"
54
+ # XXX: Is it needless?
55
+ # ENV["PKG_CONFIG_FOR_BUILD"] = "env - pkg-config"
55
56
  end
56
57
  end
57
58
 
58
59
  full_prepare_task_names = prepare_task_names.collect do |name|
59
- "win32:builder:build:prepare:#{name}"
60
+ "windows:builder:build:prepare:#{name}"
60
61
  end
61
62
  task :prepare => full_prepare_task_names
62
63
 
@@ -68,7 +69,7 @@ class GNOME2Win32BinaryBuildTask
68
69
  if built_file
69
70
  built_file = dist_dir + built_file
70
71
  file built_file.to_s do
71
- Rake::Task["win32:builder:build:prepare"].invoke
72
+ Rake::Task["windows:builder:build:prepare"].invoke
72
73
  Rake::Task[download_task].invoke
73
74
  build_package_task_body(package)
74
75
  end
@@ -81,7 +82,7 @@ class GNOME2Win32BinaryBuildTask
81
82
  task :after
82
83
  end
83
84
 
84
- prefix = "win32:builder:build:#{package.name}"
85
+ prefix = "windows:builder:build:#{package.name}"
85
86
  desc "Build #{package.label} and install it into #{dist_dir}."
86
87
  task package.name => [
87
88
  "#{prefix}:before",
@@ -214,24 +215,25 @@ SET(CMAKE_FIND_ROOT_PATH #{cmake_root_paths.join(" ")})
214
215
  "#{glib2_binary_base_dir}/lib"
215
216
  end
216
217
 
217
- def rcairo_win32_dir
218
- @package.project_root_dir.parent + "rcairo.win32"
218
+ def rcairo_windows_dir
219
+ suffix = @package.windows.build_architecture_suffix
220
+ @package.project_root_dir.parent + "rcairo.#{suffix}"
219
221
  end
220
222
 
221
- def rcairo_win32_binary_base_dir
222
- rcairo_win32_dir + "vendor" + "local"
223
+ def rcairo_windows_binary_base_dir
224
+ rcairo_windows_dir + "vendor" + "local"
223
225
  end
224
226
 
225
- def rcairo_win32_pkgconfig_path
226
- "#{rcairo_win32_binary_base_dir}/lib/pkgconfig"
227
+ def rcairo_windows_pkgconfig_path
228
+ "#{rcairo_windows_binary_base_dir}/lib/pkgconfig"
227
229
  end
228
230
 
229
- def rcairo_win32_include_path
230
- "#{rcairo_win32_binary_base_dir}/include"
231
+ def rcairo_windows_include_path
232
+ "#{rcairo_windows_binary_base_dir}/include"
231
233
  end
232
234
 
233
- def rcairo_win32_lib_path
234
- "#{rcairo_win32_binary_base_dir}/lib"
235
+ def rcairo_windows_lib_path
236
+ "#{rcairo_windows_binary_base_dir}/lib"
235
237
  end
236
238
 
237
239
  def cc(package)
@@ -248,7 +250,7 @@ SET(CMAKE_FIND_ROOT_PATH #{cmake_root_paths.join(" ")})
248
250
  include_paths += [glib2_include_path]
249
251
  end
250
252
  include_paths += [
251
- rcairo_win32_include_path,
253
+ rcairo_windows_include_path,
252
254
  dist_dir + 'include',
253
255
  ]
254
256
  cppflags = include_paths.collect do |path|
@@ -263,7 +265,7 @@ SET(CMAKE_FIND_ROOT_PATH #{cmake_root_paths.join(" ")})
263
265
  library_paths += [glib2_lib_path]
264
266
  end
265
267
  library_paths += [
266
- rcairo_win32_lib_path,
268
+ rcairo_windows_lib_path,
267
269
  dist_dir + 'lib',
268
270
  ]
269
271
  ldflags = library_paths.collect do |path|
@@ -275,7 +277,7 @@ SET(CMAKE_FIND_ROOT_PATH #{cmake_root_paths.join(" ")})
275
277
  def cmake_root_paths
276
278
  paths = [
277
279
  "/usr/#{@package.windows.build_host}",
278
- rcairo_win32_binary_base_dir.to_path,
280
+ rcairo_windows_binary_base_dir.to_path,
279
281
  ]
280
282
  @package.windows.build_dependencies.each do |package|
281
283
  paths << "#{@package.project_root_dir}/#{package}/vendor/local"
@@ -6,10 +6,10 @@ require 'open-uri'
6
6
  require 'rubygems'
7
7
  require 'mechanize'
8
8
 
9
- class GNOME2Win32BinaryDownloadTask
9
+ class GNOME2WindowsBinaryDownloadTask
10
10
  include Rake::DSL
11
11
 
12
- URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries/win32"
12
+ URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries"
13
13
  def initialize(package)
14
14
  @package = package
15
15
  define
@@ -17,7 +17,7 @@ class GNOME2Win32BinaryDownloadTask
17
17
 
18
18
  private
19
19
  def define
20
- namespace :win32 do
20
+ namespace :windows do
21
21
  namespace :downloader do
22
22
  task :before
23
23
 
@@ -45,7 +45,7 @@ class GNOME2Win32BinaryDownloadTask
45
45
  end
46
46
 
47
47
  download_tasks = download_tasks.collect do |task|
48
- "win32:downloader:download:#{task}"
48
+ "windows:downloader:download:#{task}"
49
49
  end
50
50
  desc "download Windows binaries into #{dist_dir}"
51
51
  task :download => download_tasks
@@ -53,9 +53,9 @@ class GNOME2Win32BinaryDownloadTask
53
53
  task :after
54
54
  end
55
55
  desc "download Windows binaries"
56
- task :download => ["win32:downloader:before",
57
- "win32:downloader:download",
58
- "win32:downloader:after"]
56
+ task :download => ["windows:downloader:before",
57
+ "windows:downloader:download",
58
+ "windows:downloader:after"]
59
59
  end
60
60
  end
61
61
 
@@ -71,8 +71,13 @@ class GNOME2Win32BinaryDownloadTask
71
71
  @package.windows.dependencies
72
72
  end
73
73
 
74
+ def build_architecture_suffix
75
+ @package.windows.build_architecture_suffix
76
+ end
77
+
74
78
  def download_package(package)
75
- version_page_url = "#{URL_BASE}/#{package}"
79
+ suffix = build_architecture_suffix
80
+ version_page_url = "#{URL_BASE}/#{suffix}/#{package}"
76
81
  version_page = agent.get(version_page_url)
77
82
  latest_version_link = version_page.links.sort_by do |link|
78
83
  if /\A(\d+\.\d+)\/\z/ =~ link.href
@@ -86,8 +91,8 @@ class GNOME2Win32BinaryDownloadTask
86
91
  latest_version_page = latest_version_link.click
87
92
  latest_version = latest_version_page.links.collect do |link|
88
93
  case link.href
89
- when /#{escaped_package}_([\d\.\-]+)_win32\.zip\z/,
90
- /#{escaped_package}-([\d\.\-]+)-win32\.zip\z/, # old
94
+ when /#{escaped_package}_([\d\.\-]+)_#{suffix}\.zip\z/,
95
+ /#{escaped_package}-([\d\.\-]+)-#{suffix}\.zip\z/, # old
91
96
  /#{escaped_package}-([\d\.\-]+)\.zip\z/ # old
92
97
  version = $1
93
98
  normalized_version = version.split(/[\.\-]/).collect do |component|
@@ -107,8 +112,8 @@ class GNOME2Win32BinaryDownloadTask
107
112
  escaped_latest_version = Regexp.escape(latest_version)
108
113
  latest_version_page.links.each do |link|
109
114
  case link.href
110
- when /#{escaped_package}(?:-dev)?_#{escaped_latest_version}_win32\.zip\z/,
111
- /#{escaped_package}(?:-dev)?-#{escaped_latest_version}-win32\.zip\z/, # old
115
+ when /#{escaped_package}(?:-dev)?_#{escaped_latest_version}_#{suffix}\.zip\z/,
116
+ /#{escaped_package}(?:-dev)?-#{escaped_latest_version}-#{suffix}\.zip\z/, # old
112
117
  /#{escaped_package}(?:-dev)?-#{escaped_latest_version}\.zip\z/ # old
113
118
  click_zip_link(link)
114
119
  end
@@ -116,6 +121,7 @@ class GNOME2Win32BinaryDownloadTask
116
121
  end
117
122
 
118
123
  def download_dependency(dependency)
124
+ suffix = build_architecture_suffix
119
125
  dependency_version = "any"
120
126
  dependency_version_re = /[\d\.\-]+/
121
127
  if dependency.is_a?(Array)
@@ -127,7 +133,7 @@ class GNOME2Win32BinaryDownloadTask
127
133
  dependencies_page = agent.get(dependencies_url)
128
134
  latest_version = dependencies_page.links.collect do |link|
129
135
  case link.href
130
- when /\A#{escaped_dependency}_(#{dependency_version_re})_win32\.zip\z/
136
+ when /\A#{escaped_dependency}_(#{dependency_version_re})_#{suffix}\.zip\z/
131
137
  version = $1
132
138
  [version.split(/[\.\-]/).collect {|component| component.to_i}, version]
133
139
  else
@@ -145,7 +151,7 @@ class GNOME2Win32BinaryDownloadTask
145
151
  escaped_latest_version = Regexp.escape(latest_version)
146
152
  dependencies_page.links.each do |link|
147
153
  case link.href
148
- when /\A#{escaped_dependency}(?:-dev)?_#{escaped_latest_version}_win32\.zip\z/
154
+ when /\A#{escaped_dependency}(?:-dev)?_#{escaped_latest_version}_#{suffix}\.zip\z/
149
155
  click_zip_link(link)
150
156
  end
151
157
  end
@@ -109,8 +109,8 @@ if ENV['GTK_BASEPATH'] and /cygwin/ !~ RUBY_PLATFORM
109
109
  $CFLAGS += " -I#{include_path} "
110
110
  end
111
111
 
112
- def setup_win32(target_name, base_dir=nil)
113
- checking_for(checking_message("Win32 OS")) do
112
+ def setup_windows(target_name, base_dir=nil)
113
+ checking_for(checking_message("Windows")) do
114
114
  case RUBY_PLATFORM
115
115
  when /cygwin|mingw|mswin/
116
116
  import_library_name = "libruby-#{target_name}.a"
@@ -130,6 +130,10 @@ def setup_win32(target_name, base_dir=nil)
130
130
  end
131
131
  end
132
132
  end
133
+ # For backward compatibility
134
+ def setup_win32(*args, &block)
135
+ setup_windows(*args, &block)
136
+ end
133
137
 
134
138
  def find_gem_spec(package)
135
139
  begin
@@ -446,7 +450,27 @@ def glib_mkenums(prefix, files, g_type_prefix, include_files, options={})
446
450
  end
447
451
 
448
452
  def check_cairo(options={})
453
+ is_windows = (/mingw|cygwin|mswin/ === RUBY_PLATFORM)
454
+
449
455
  rcairo_source_dir = options[:rcairo_source_dir]
456
+ if rcairo_source_dir.nil?
457
+ suffix = nil
458
+ if is_windows
459
+ case RUBY_PLATFORM
460
+ when /\Ax86-mingw/
461
+ suffix = "win32"
462
+ when /\Ax64-mingw/
463
+ suffix = "win64"
464
+ end
465
+ end
466
+ rcairo_source_base_dir = "rcairo"
467
+ rcairo_source_base_dir << ".#{suffix}" if suffix
468
+ top_dir = options[:top_dir]
469
+ if top_dir
470
+ rcairo_source_dir = File.join(top_dir, "..", rcairo_source_base_dir)
471
+ end
472
+ end
473
+
450
474
  if rcairo_source_dir and !File.exist?(rcairo_source_dir)
451
475
  rcairo_source_dir = nil
452
476
  end
@@ -456,7 +480,7 @@ def check_cairo(options={})
456
480
  end
457
481
 
458
482
  unless rcairo_source_dir.nil?
459
- if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
483
+ if is_windows
460
484
  options = {}
461
485
  build_dir = "tmp/#{RUBY_PLATFORM}/cairo/#{RUBY_VERSION}"
462
486
  if File.exist?(File.join(rcairo_source_dir, build_dir))