glib2 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  # -*- ruby -*-
2
2
 
3
- require './lib/gnome2-raketask'
3
+ $LOAD_PATH.unshift("./lib")
4
+ require 'gnome2-raketask'
4
5
 
5
6
  package = GNOME2Package.new do |_package|
6
7
  _package.summary = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
@@ -8,7 +9,20 @@ package = GNOME2Package.new do |_package|
8
9
  _package.dependency.gem.runtime = [["pkg-config", ">= 0"]]
9
10
  _package.dependency.gem.development = [["test-unit", ">= 2"]]
10
11
  _package.win32.packages = ["glib"]
11
- _package.win32.dependencies = ["gettext-runtime"]
12
+ _package.win32.dependencies = ["gettext-runtime", "gnutls"]
13
+ _package.win32.build_packages = [
14
+ {
15
+ :name => "glib-networking",
16
+ :download_site => :gnome,
17
+ :label => "glib-networking",
18
+ :version => "2.28.7",
19
+ :configure_args => ["--without-libproxy",
20
+ "--without-gnome-proxy",
21
+ "--without-ca-certificates"],
22
+ :patches => ["glib-networking-2.28.7-fix-with-gnome-proxy.diff",
23
+ "glib-networking-2.28.7-support-gnutls-2.4.2.diff"],
24
+ :need_autoreconf => true,
25
+ },
26
+ ]
12
27
  end
13
28
  package.define_tasks
14
-
data/ext/glib2/rbglib.h CHANGED
@@ -35,7 +35,7 @@ extern "C" {
35
35
 
36
36
  #define RBGLIB_MAJOR_VERSION 1
37
37
  #define RBGLIB_MINOR_VERSION 1
38
- #define RBGLIB_MICRO_VERSION 4
38
+ #define RBGLIB_MICRO_VERSION 5
39
39
 
40
40
  #ifndef RSTRING_PTR
41
41
  # define RSTRING_PTR(s) (RSTRING(s)->ptr)
@@ -9,19 +9,22 @@ require 'find'
9
9
  require 'rubygems'
10
10
  require 'rubygems/package_task'
11
11
  require 'rake/extensiontask'
12
+ require 'gnome2-win32-binary-download-task'
13
+ require 'gnome2-win32-binary-build-task'
12
14
 
13
15
  class GNOME2Package
14
16
  include Rake::DSL
15
17
 
16
18
  attr_accessor :name, :summary, :description, :author, :email, :homepage, :required_ruby_version, :post_install_message
19
+ attr_reader :root_dir
17
20
  def initialize
18
21
  initialize_variables
19
22
  initialize_configurations
20
23
  file, line, method = caller[1].scan(/^(.*):(\d+)(?::.*`(.*)')?\Z/).first
21
- @package_root = File.dirname(file)
22
- @glib2_root = File.expand_path("#{@package_root}/../glib2")
23
- @packages = FileList["#{File.dirname(@package_root)}/*"].map{|f| File.directory?(f) ? File.basename(f) : nil}.compact
24
- @name = File.basename(@package_root)
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)
25
28
  @cross_compiling_hooks = []
26
29
  yield(self) if block_given?
27
30
  end
@@ -55,7 +58,7 @@ class GNOME2Package
55
58
 
56
59
  def guess_version
57
60
  versions = {}
58
- File.open("#{@glib2_root}/ext/glib2/rbglib.h") do |rbglib_h|
61
+ File.open("#{@glib2_root_dir}/ext/glib2/rbglib.h") do |rbglib_h|
59
62
  rbglib_h.each_line do |line|
60
63
  if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line
61
64
  versions[$1.downcase] = $2.to_i
@@ -104,19 +107,20 @@ class GNOME2Package
104
107
  end
105
108
 
106
109
  def define_win32_tasks
107
- define_win32_build_task
110
+ define_win32_extension_task
108
111
  define_win32_download_task
112
+ define_win32_build_task
109
113
  end
110
114
 
111
- def define_win32_build_task
115
+ def define_win32_extension_task
112
116
  Rake::ExtensionTask.new(@name, @spec) do |ext|
113
117
  ext.cross_compile = true
114
118
  ext.cross_compiling do |spec|
115
119
  if /mingw|mswin/ =~ spec.platform.to_s
116
- win32_dir = File.join("vendor", "local")
120
+ win32_binary_dir = @win32_configuration.relative_binary_dir
117
121
  win32_files = []
118
- if File.exist?(win32_dir)
119
- Find.find(win32_dir) do |file|
122
+ if File.exist?(win32_binary_dir)
123
+ Find.find(win32_binary_dir) do |file|
120
124
  next if /\.zip\z/ =~ file
121
125
  win32_files << file
122
126
  end
@@ -130,22 +134,11 @@ class GNOME2Package
130
134
  end
131
135
 
132
136
  def define_win32_download_task
133
- namespace :win32 do
134
- namespace :downloader do
135
- task :before do
136
- $LOAD_PATH.unshift("#{@glib2_root}/lib")
137
- require 'gnome2-win32-binary-downloader'
138
- end
139
- task :download do
140
- GNOME2Win32BinaryDownloader.download(@win32_configuration.to_hash)
141
- end
142
- task :after
143
- end
144
- desc "download Windows binaries"
145
- task :download => ["win32:downloader:before",
146
- "win32:downloader:download",
147
- "win32:downloader:after"]
148
- end
137
+ GNOME2Win32BinaryDownloadTask.new(@win32_configuration)
138
+ end
139
+
140
+ def define_win32_build_task
141
+ GNOME2Win32BinaryBuildTask.new(@win32_configuration)
149
142
  end
150
143
  end
151
144
 
@@ -198,19 +191,30 @@ class GNOME2Package
198
191
  end
199
192
 
200
193
  class Win32Configuration
201
- attr_accessor :packages, :dependencies
194
+ attr_reader :package
195
+ attr_accessor :packages, :dependencies, :build_packages, :build_dependencies
196
+ attr_accessor :build_host
197
+ attr_accessor :relative_binary_dir, :absolute_binary_dir
202
198
  def initialize(package)
203
199
  @package = package
204
200
  @packages = []
205
201
  @dependencies = []
202
+ @build_packages = []
203
+ @build_dependencies = []
204
+ @build_host = "i686-w64-mingw32"
205
+ @relative_binary_dir = File.join("vendor", "local")
206
+ @absolute_binary_dir = File.expand_path(@relative_binary_dir)
206
207
  end
207
208
 
208
209
  def to_hash
209
210
  {
210
211
  :packages => @packages,
211
212
  :dependencies => @dependencies,
213
+ :build_packages => @build_packages,
214
+ :build_host => @build_host,
215
+ :relative_binary_dir => @relative_binary_dir,
216
+ :absolute_binary_dir => @absolute_binary_dir,
212
217
  }
213
218
  end
214
219
  end
215
220
  end
216
-
@@ -0,0 +1,191 @@
1
+ # Copyright(C) 2012 Ruby-GNOME2 Project.
2
+ #
3
+ # This program is licenced under the same license of Ruby-GNOME2.
4
+
5
+ require "open-uri"
6
+ require "pathname"
7
+
8
+ class GNOME2Win32BinaryBuildTask
9
+ include Rake::DSL
10
+
11
+ def initialize(configuration)
12
+ @configuration = configuration
13
+ define
14
+ end
15
+
16
+ private
17
+ def define
18
+ namespace :win32 do
19
+ namespace :builder do
20
+ task :before
21
+ define_download_tasks
22
+ define_build_tasks
23
+ build_tasks = build_packages.collect do |package|
24
+ "win32:builder:build:#{package[:name]}"
25
+ end
26
+ desc "Build Windows binaries"
27
+ task :build => build_tasks
28
+ task :after
29
+ end
30
+ desc "download source and build Windows binaries"
31
+ task :build => ["win32:builder:before",
32
+ "win32:builder:build",
33
+ "win32:builder:after"]
34
+ end
35
+ end
36
+
37
+ def define_download_tasks
38
+ namespace :download do
39
+ build_packages.each do |package|
40
+ base = "#{package[:name]}-#{package[:version]}"
41
+ tar_gz = "#{base}.tar.gz"
42
+ tar_gz_url = "#{download_base_url(package)}/#{tar_gz}"
43
+ tar_gz_full_path = download_dir + tar_gz
44
+
45
+ desc "Download #{package[:label]} into #{download_dir}."
46
+ task package[:name] => tar_gz_full_path.to_s
47
+
48
+ directory_path = tar_gz_full_path.dirname
49
+ directory directory_path.to_s
50
+ file tar_gz_full_path.to_s => directory_path.to_s do
51
+ rake_output_message "downloading... #{tar_gz_url}"
52
+ open(tar_gz_url) do |downloaded_tar_gz|
53
+ tar_gz_full_path.open("wb") do |tar_gz_file|
54
+ tar_gz_file.print(downloaded_tar_gz.read)
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ def define_build_tasks
63
+ namespace :build do
64
+ task :prepare do
65
+ depended_packages = @configuration.build_dependencies
66
+ use_packages = [@configuration.package.name] + depended_packages
67
+ pkg_config_path = use_packages.collect do |package|
68
+ "../#{package}/#{@configuration.relative_binary_dir}/lib/pkgconfig"
69
+ end
70
+ ENV["PKG_CONFIG_PATH"] = pkg_config_path.collect do |path|
71
+ File.expand_path(path)
72
+ end.join(":")
73
+ ENV["PKG_CONFIG_LIBDIR"] = rcairo_win32_pkgconfig_path
74
+ end
75
+
76
+ build_packages.each do |package|
77
+ download_task = "win32:builder:download:#{package[:name]}"
78
+ desc "Build #{package[:label]} and install it into #{dist_dir}."
79
+ task package[:name] => [:prepare, download_task] do
80
+ package_tmp_dir = tmp_dir + package[:name]
81
+ rm_rf(package_tmp_dir)
82
+ mkdir_p(package_tmp_dir)
83
+
84
+ base = "#{package[:name]}-#{package[:version]}"
85
+ tar_gz = "#{base}.tar.gz"
86
+ tar_gz_full_path = download_dir + tar_gz
87
+ Dir.chdir(package_tmp_dir.to_s) do
88
+ sh("tar", "xzf", tar_gz_full_path.to_s) or exit(false)
89
+ end
90
+
91
+ Dir.chdir((package_tmp_dir + base).to_s) do
92
+ (package[:patches] || []).each do |patch|
93
+ sh("patch -p1 < #{patches_dir}/#{patch}")
94
+ end
95
+ sh("./autogen.sh") if package[:need_autogen]
96
+ sh("autoreconf -i") if package[:need_autoreconf]
97
+ sh("./configure",
98
+ "CPPFLAGS=-I#{rcairo_win32_include_path} -I#{dist_dir + 'include'}",
99
+ "LDFLAGS=-L#{rcairo_win32_lib_path} -L#{dist_dir + 'lib'}",
100
+ "--prefix=#{dist_dir}",
101
+ "--host=#{@configuration.build_host}",
102
+ *package[:configure_args]) or exit(false)
103
+ common_make_args = []
104
+ common_make_args << "GLIB_COMPILE_SCHEMAS=glib-compile-schemas"
105
+ build_make_args = common_make_args.dup
106
+ install_make_args = common_make_args.dup
107
+ make_n_jobs = ENV["MAKE_N_JOBS"]
108
+ build_make_args << "-j#{make_n_jobs}" if make_n_jobs
109
+ ENV["GREP_OPTIONS"] = "--text"
110
+ sh("nice", "make", *build_make_args) or exit(false)
111
+ sh("make", "install", *install_make_args) or exit(false)
112
+
113
+ package_license_dir = license_dir + package[:name]
114
+ mkdir_p(package_license_dir)
115
+ package_license_files = ["AUTHORS", "COPYING", "COPYING.LIB"]
116
+ package_license_files = package_license_files.reject do |file|
117
+ not File.exist?(file)
118
+ end
119
+ cp(package_license_files, package_license_dir)
120
+ bundled_packages = package[:bundled_packages] || []
121
+ bundled_packages.each do |bundled_package|
122
+ bundled_package_license_dir = license_dir + bundled_package[:name]
123
+ mkdir_p(bundled_package_license_dir)
124
+ license_files = bundled_package[:license_files].collect do |file|
125
+ File.join(bundled_package[:path], file)
126
+ end
127
+ cp(license_files, bundled_package_license_dir)
128
+ end
129
+ end
130
+ end
131
+ end
132
+ end
133
+ end
134
+
135
+ def build_packages
136
+ @configuration.build_packages
137
+ end
138
+
139
+ def dist_dir
140
+ Pathname.new(@configuration.absolute_binary_dir)
141
+ end
142
+
143
+ def license_dir
144
+ dist_dir + "share" + "license"
145
+ end
146
+
147
+ def package_root_dir
148
+ Pathname.new(@configuration.package.root_dir)
149
+ end
150
+
151
+ def tmp_dir
152
+ package_root_dir + "tmp"
153
+ end
154
+
155
+ def download_dir
156
+ tmp_dir + "download"
157
+ end
158
+
159
+ def patches_dir
160
+ package_root_dir + "patches"
161
+ end
162
+
163
+ def rcairo_win32_dir
164
+ package_root_dir.parent.parent + "rcairo.win32"
165
+ end
166
+
167
+ def rcairo_win32_pkgconfig_path
168
+ "#{rcairo_win32_dir}/vendor/local/lib/pkgconfig"
169
+ end
170
+
171
+ def rcairo_win32_include_path
172
+ "#{rcairo_win32_dir}/vendor/local/include"
173
+ end
174
+
175
+ def rcairo_win32_lib_path
176
+ "#{rcairo_win32_dir}/vendor/local/lib"
177
+ end
178
+
179
+ def download_base_url(package)
180
+ download_base_url = package[:download_base_url]
181
+ return download_base_url if download_base_url
182
+
183
+ case package[:download_site]
184
+ when :gnome
185
+ download_base_url = "http://ftp.gnome.org/pub/gnome/sources"
186
+ release_series = package[:version].gsub(/\A(\d+\.\d+).+\z/, '\1')
187
+ download_base_url << "/#{package[:name]}/#{release_series}"
188
+ end
189
+ download_base_url
190
+ end
191
+ end
@@ -1,4 +1,4 @@
1
- # Copyright(C) 2010 Ruby-GNOME2 Project.
1
+ # Copyright(C) 2010-2012 Ruby-GNOME2 Project.
2
2
  #
3
3
  # This program is licenced under the same license of Ruby-GNOME2.
4
4
 
@@ -6,25 +6,69 @@ require 'open-uri'
6
6
  require 'rubygems'
7
7
  require 'mechanize'
8
8
 
9
- class GNOME2Win32BinaryDownloader
10
- class << self
11
- def download(options)
12
- downloader = new(options)
13
- packages = options[:packages] || [options[:package]]
14
- packages.compact.each do |package|
15
- downloader.download_package(package)
16
- end
17
- dependencies = options[:dependencies] || [options[:dependency]]
18
- dependencies.compact.each do |dependency|
19
- downloader.download_dependency(dependency)
9
+ class GNOME2Win32BinaryDownloadTask
10
+ include Rake::DSL
11
+
12
+ URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries/win32"
13
+ def initialize(configuration)
14
+ @configuration = configuration
15
+ define
16
+ end
17
+
18
+ private
19
+ def define
20
+ namespace :win32 do
21
+ namespace :downloader do
22
+ task :before
23
+
24
+ download_tasks = []
25
+ namespace :download do
26
+ directory dist_dir
27
+ task :prepare => [dist_dir]
28
+
29
+ packages.each do |package|
30
+ desc "download #{package}"
31
+ task package => [:prepare] do
32
+ download_package(package)
33
+ end
34
+ download_tasks << package
35
+ end
36
+
37
+ dependencies.each do |dependency|
38
+ name, version = dependency
39
+ desc "download #{name}"
40
+ task name => [:prepare] do
41
+ download_dependency(dependency)
42
+ end
43
+ download_tasks << name
44
+ end
45
+ end
46
+
47
+ download_tasks = download_tasks.collect do |task|
48
+ "win32:downloader:download:#{task}"
49
+ end
50
+ desc "download Windows binaries into #{dist_dir}"
51
+ task :download => download_tasks
52
+
53
+ task :after
20
54
  end
55
+ desc "download Windows binaries"
56
+ task :download => ["win32:downloader:before",
57
+ "win32:downloader:download",
58
+ "win32:downloader:after"]
21
59
  end
22
60
  end
23
61
 
24
- URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries/win32"
25
- def initialize(options={})
26
- output_dir = options[:output_dir] || File.join("vendor", "local")
27
- @output_dir = File.expand_path(output_dir)
62
+ def dist_dir
63
+ @configuration.absolute_binary_dir
64
+ end
65
+
66
+ def packages
67
+ @configuration.packages
68
+ end
69
+
70
+ def dependencies
71
+ @configuration.dependencies
28
72
  end
29
73
 
30
74
  def download_package(package)
@@ -114,15 +158,14 @@ class GNOME2Win32BinaryDownloader
114
158
 
115
159
  def click_zip_link(link)
116
160
  zip = link.click
117
- FileUtils.mkdir_p(@output_dir)
118
- Dir.chdir(@output_dir) do
161
+ Dir.chdir(dist_dir) do
119
162
  open(zip.filename, "wb") do |file|
120
163
  file.print(zip.body)
121
164
  end
122
165
  system("unzip", "-o", zip.filename)
123
166
  Dir.glob("lib/pkgconfig/*.pc") do |pc_path|
124
167
  pc = File.read(pc_path)
125
- pc = pc.gsub(/\Aprefix=.+$/) {"prefix=#{@output_dir}"}
168
+ pc = pc.gsub(/\Aprefix=.+$/) {"prefix=#{dist_dir}"}
126
169
  File.open(pc_path, "w") do |pc_file|
127
170
  pc_file.print(pc)
128
171
  end
metadata CHANGED
@@ -1,67 +1,64 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
- version: !ruby/object:Gem::Version
4
- hash: 27
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.5
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 1
9
- - 4
10
- version: 1.1.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - The Ruby-GNOME2 Project Team
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-07-21 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-08-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: pkg-config
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: test-unit
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: test-unit
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 7
43
- segments:
44
- - 2
45
- version: "2"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '2'
46
38
  type: :development
47
- version_requirements: *id002
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '2'
48
46
  description: Ruby/GLib2 is a Ruby binding of GLib-2.x.
49
47
  email: ruby-gnome2-devel-en@lists.sourceforge.net
50
48
  executables: []
51
-
52
- extensions:
49
+ extensions:
53
50
  - ext/glib2/extconf.rb
54
51
  extra_rdoc_files: []
55
-
56
- files:
52
+ files:
57
53
  - README
58
54
  - Rakefile
59
55
  - extconf.rb
60
56
  - lib/glib2/deprecatable.rb
57
+ - lib/gnome2-win32-binary-build-task.rb
61
58
  - lib/gnome2-raketask.rb
62
- - lib/gnome2-win32-binary-downloader.rb
63
59
  - lib/glib2.rb
64
60
  - lib/mkmf-gnome2.rb
61
+ - lib/gnome2-win32-binary-download-task.rb
65
62
  - lib/glib-mkenums.rb
66
63
  - ext/glib2/rbglib_timer.c
67
64
  - ext/glib2/rbglib_completion.c
@@ -163,38 +160,26 @@ files:
163
160
  - test/glib-test-init.rb
164
161
  homepage: http://ruby-gnome2.sourceforge.jp/
165
162
  licenses: []
166
-
167
163
  post_install_message:
168
164
  rdoc_options: []
169
-
170
- require_paths:
165
+ require_paths:
171
166
  - lib
172
- required_ruby_version: !ruby/object:Gem::Requirement
167
+ required_ruby_version: !ruby/object:Gem::Requirement
173
168
  none: false
174
- requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- hash: 61
178
- segments:
179
- - 1
180
- - 8
181
- - 5
169
+ requirements:
170
+ - - ! '>='
171
+ - !ruby/object:Gem::Version
182
172
  version: 1.8.5
183
- required_rubygems_version: !ruby/object:Gem::Requirement
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
174
  none: false
185
- requirements:
186
- - - ">="
187
- - !ruby/object:Gem::Version
188
- hash: 3
189
- segments:
190
- - 0
191
- version: "0"
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
192
179
  requirements: []
193
-
194
180
  rubyforge_project:
195
- rubygems_version: 1.8.24
181
+ rubygems_version: 1.8.23
196
182
  signing_key:
197
183
  specification_version: 3
198
184
  summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
199
185
  test_files: []
200
-