glib2 0.20.0 → 0.90.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +92 -0
- data/README +22 -10
- data/Rakefile +54 -72
- data/ext/glib2/depend +10 -0
- data/ext/glib2/extconf.rb +61 -0
- data/ext/glib2/glib2.def +89 -0
- data/{src → ext/glib2}/rbgcompat.h +0 -0
- data/{src → ext/glib2}/rbglib.c +17 -7
- data/{src → ext/glib2}/rbglib.h +2 -2
- data/{src → ext/glib2}/rbglib_bookmarkfile.c +0 -0
- data/{src → ext/glib2}/rbglib_completion.c +0 -0
- data/{src → ext/glib2}/rbglib_convert.c +0 -0
- data/{src → ext/glib2}/rbglib_error.c +0 -0
- data/{src → ext/glib2}/rbglib_fileutils.c +0 -0
- data/{src → ext/glib2}/rbglib_i18n.c +0 -0
- data/{src → ext/glib2}/rbglib_int64.c +0 -0
- data/{src → ext/glib2}/rbglib_iochannel.c +0 -0
- data/{src → ext/glib2}/rbglib_keyfile.c +0 -0
- data/{src → ext/glib2}/rbglib_maincontext.c +1 -3
- data/{src → ext/glib2}/rbglib_mainloop.c +0 -0
- data/{src → ext/glib2}/rbglib_messages.c +0 -0
- data/{src → ext/glib2}/rbglib_pollfd.c +0 -0
- data/{src → ext/glib2}/rbglib_shell.c +0 -0
- data/{src → ext/glib2}/rbglib_source.c +0 -0
- data/{src → ext/glib2}/rbglib_spawn.c +0 -0
- data/{src → ext/glib2}/rbglib_threads.c +0 -0
- data/{src → ext/glib2}/rbglib_timer.c +0 -0
- data/{src → ext/glib2}/rbglib_unicode.c +0 -0
- data/{src → ext/glib2}/rbglib_utils.c +0 -0
- data/{src → ext/glib2}/rbglib_win32.c +0 -0
- data/{src → ext/glib2}/rbgobj_boxed.c +0 -0
- data/{src → ext/glib2}/rbgobj_closure.c +0 -0
- data/{src → ext/glib2}/rbgobj_convert.c +0 -0
- data/{src → ext/glib2}/rbgobj_enums.c +0 -0
- data/{src → ext/glib2}/rbgobj_fundamental.c +0 -0
- data/{src → ext/glib2}/rbgobj_object.c +0 -0
- data/{src → ext/glib2}/rbgobj_param.c +0 -0
- data/{src → ext/glib2}/rbgobj_paramspecs.c +0 -0
- data/{src → ext/glib2}/rbgobj_signal.c +0 -0
- data/{src → ext/glib2}/rbgobj_strv.c +0 -0
- data/{src → ext/glib2}/rbgobj_type.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeinstance.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeinterface.c +0 -0
- data/{src → ext/glib2}/rbgobj_typemodule.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeplugin.c +0 -0
- data/{src → ext/glib2}/rbgobj_value.c +0 -0
- data/{src → ext/glib2}/rbgobj_valuearray.c +0 -0
- data/{src → ext/glib2}/rbgobj_valuetypes.c +0 -0
- data/{src → ext/glib2}/rbgobject.c +0 -0
- data/{src → ext/glib2}/rbgobject.h +0 -0
- data/{src → ext/glib2}/rbgprivate.h +0 -0
- data/ext/glib2/rbgutil.c +316 -0
- data/{src → ext/glib2}/rbgutil.h +9 -9
- data/{src → ext/glib2}/rbgutil_callback.c +0 -0
- data/extconf.rb +48 -60
- data/{src/lib → lib}/glib-mkenums.rb +2 -2
- data/{src/lib → lib}/glib2.rb +28 -9
- data/lib/gnome2-win32-binary-downloader.rb +92 -0
- data/{src/lib → lib}/mkmf-gnome2.rb +76 -89
- data/test-unit/COPYING +56 -0
- data/test-unit/GPL +340 -0
- data/test-unit/History.txt +232 -0
- data/test-unit/Manifest.txt +110 -0
- data/test-unit/PSFL +271 -0
- data/test-unit/README.txt +75 -0
- data/test-unit/Rakefile +53 -0
- data/test-unit/TODO +5 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/html/bar.png +0 -0
- data/test-unit/html/bar.svg +153 -0
- data/test-unit/html/developer.png +0 -0
- data/test-unit/html/developer.svg +469 -0
- data/test-unit/html/famfamfam-logo.png +0 -0
- data/test-unit/html/favicon.ico +0 -0
- data/test-unit/html/favicon.png +0 -0
- data/test-unit/html/favicon.svg +82 -0
- data/test-unit/html/heading-mark.png +0 -0
- data/test-unit/html/heading-mark.svg +393 -0
- data/test-unit/html/index.html +247 -0
- data/test-unit/html/index.html.ja +270 -0
- data/test-unit/html/install.png +0 -0
- data/test-unit/html/install.svg +636 -0
- data/test-unit/html/jp.png +0 -0
- data/test-unit/html/kinotan-failure.png +0 -0
- data/test-unit/html/kinotan-pass.png +0 -0
- data/test-unit/html/logo.png +0 -0
- data/test-unit/html/logo.svg +483 -0
- data/test-unit/html/reference.png +0 -0
- data/test-unit/html/rubyforge.png +0 -0
- data/test-unit/html/tango-logo.png +0 -0
- data/test-unit/html/test-unit.css +339 -0
- data/test-unit/html/tutorial.png +0 -0
- data/test-unit/html/tutorial.svg +559 -0
- data/test-unit/html/us.png +0 -0
- data/test-unit/images/color-diff.png +0 -0
- data/test-unit/lib/test/unit.rb +328 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
- data/test-unit/lib/test/unit/assertions.rb +1334 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +363 -0
- data/test-unit/lib/test/unit/collector.rb +36 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +144 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color-scheme.rb +106 -0
- data/test-unit/lib/test/unit/color.rb +96 -0
- data/test-unit/lib/test/unit/diff.rb +740 -0
- data/test-unit/lib/test/unit/error.rb +130 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +136 -0
- data/test-unit/lib/test/unit/fixture.rb +176 -0
- data/test-unit/lib/test/unit/notification.rb +129 -0
- data/test-unit/lib/test/unit/omission.rb +191 -0
- data/test-unit/lib/test/unit/pending.rb +150 -0
- data/test-unit/lib/test/unit/priority.rb +180 -0
- data/test-unit/lib/test/unit/runner/console.rb +52 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/runner/tap.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +483 -0
- data/test-unit/lib/test/unit/testresult.rb +121 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +430 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +82 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +53 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +42 -0
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/output.rb +31 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/test_adder.rb +20 -0
- data/test-unit/sample/test_subtracter.rb +20 -0
- data/test-unit/sample/test_user.rb +23 -0
- data/test-unit/test/collector/test-descendant.rb +133 -0
- data/test-unit/test/collector/test-load.rb +442 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_objectspace.rb +100 -0
- data/test-unit/test/run-test.rb +15 -0
- data/test-unit/test/test-attribute.rb +86 -0
- data/test-unit/test/test-color-scheme.rb +69 -0
- data/test-unit/test/test-color.rb +47 -0
- data/test-unit/test/test-diff.rb +518 -0
- data/test-unit/test/test-emacs-runner.rb +60 -0
- data/test-unit/test/test-fixture.rb +287 -0
- data/test-unit/test/test-notification.rb +33 -0
- data/test-unit/test/test-omission.rb +81 -0
- data/test-unit/test/test-pending.rb +70 -0
- data/test-unit/test/test-priority.rb +119 -0
- data/test-unit/test/test-testcase.rb +544 -0
- data/test-unit/test/test_assertions.rb +1197 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit-test-util.rb +14 -0
- data/test-unit/test/ui/test_tap.rb +33 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test-method-owner-finder.rb +38 -0
- data/test-unit/test/util/test-output.rb +11 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/run-test.rb +2 -6
- metadata +197 -100
- data/src/glib-enum-types.c +0 -1032
- data/src/glib-enum-types.h +0 -140
- data/src/lib/pkg-config.rb +0 -137
- data/src/rbgutil.c +0 -222
File without changes
|
data/extconf.rb
CHANGED
@@ -1,61 +1,49 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
headers = include_paths.split.inject([]) do |result, path|
|
50
|
-
result + Dir.glob(File.join(path.sub(/^-I/, ""), "glib", "*.h"))
|
51
|
-
end.reject do |file|
|
52
|
-
/g(iochannel|scanner)\.h/ =~ file
|
53
|
-
end
|
54
|
-
include_paths = PKGConfig.cflags_only_I("gobject-2.0")
|
55
|
-
headers = include_paths.split.inject(headers) do |result, path|
|
56
|
-
result + Dir.glob(File.join(path.sub(/^-I/, ""), "gobject", "gsignal.h"))
|
57
|
-
end
|
58
|
-
glib_mkenums(enum_type_prefix, headers, "G_TYPE_", ["glib-object.h"])
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
require 'mkmf'
|
5
|
+
require 'rbconfig'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
package = "glib2"
|
9
|
+
|
10
|
+
base_dir = Pathname(__FILE__).dirname.expand_path
|
11
|
+
ext_dir = base_dir + "ext" + package
|
12
|
+
mkmf_gnome2_dir = base_dir + 'lib'
|
13
|
+
|
14
|
+
ruby = File.join(RbConfig::CONFIG['bindir'],
|
15
|
+
RbConfig::CONFIG['ruby_install_name'] +
|
16
|
+
RbConfig::CONFIG["EXEEXT"])
|
17
|
+
|
18
|
+
build_dir = Pathname("ext") + package
|
19
|
+
FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
|
20
|
+
extconf_rb_path = ext_dir + "extconf.rb"
|
21
|
+
system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false)
|
22
|
+
|
23
|
+
create_makefile(package)
|
24
|
+
FileUtils.mv("Makefile", "Makefile.lib")
|
25
|
+
|
26
|
+
File.open("Makefile", "w") do |makefile|
|
27
|
+
makefile.puts(<<-EOM)
|
28
|
+
all:
|
29
|
+
(cd ext/#{package} && $(MAKE))
|
30
|
+
$(MAKE) -f Makefile.lib
|
31
|
+
|
32
|
+
install:
|
33
|
+
(cd ext/#{package} && $(MAKE) install)
|
34
|
+
$(MAKE) -f Makefile.lib install
|
35
|
+
|
36
|
+
site-install:
|
37
|
+
(cd ext/#{package} && $(MAKE) site-install)
|
38
|
+
$(MAKE) -f Makefile.lib site-install
|
39
|
+
|
40
|
+
clean:
|
41
|
+
(cd ext/#{package} && $(MAKE) clean)
|
42
|
+
$(MAKE) -f Makefile.lib clean
|
43
|
+
|
44
|
+
distclean:
|
45
|
+
(cd ext/#{package} && $(MAKE) distclean)
|
46
|
+
$(MAKE) -f Makefile.lib distclean
|
47
|
+
@rm -f Makefile.lib
|
48
|
+
EOM
|
59
49
|
end
|
60
|
-
|
61
|
-
create_top_makefile
|
@@ -167,7 +167,7 @@ GType #{@enum_name}_get_type (void);
|
|
167
167
|
|
168
168
|
# Create a C source as a String.
|
169
169
|
def create_c
|
170
|
-
ret = "\n/* Generated by glib-mkenums.rb ($Id$) */ \n\n"
|
170
|
+
ret = "\n/* Generated by glib-mkenums.rb ($Id: glib-mkenums.rb 3896 2010-09-25 07:49:34Z ktou $) */ \n\n"
|
171
171
|
ret << %Q[#include "#{@target_filename}.h"\n]
|
172
172
|
@include_files.each do |file|
|
173
173
|
ret << "#include <#{file}>\n"
|
@@ -183,7 +183,7 @@ GType #{@enum_name}_get_type (void);
|
|
183
183
|
header = "#{@target_filename}.h"
|
184
184
|
const = "__#{File.basename(header).upcase.gsub(/-|\./, '_')}__"
|
185
185
|
|
186
|
-
ret = "\n/* Generated by glib-mkenums.rb ($Id$) */ \n\n"
|
186
|
+
ret = "\n/* Generated by glib-mkenums.rb ($Id: glib-mkenums.rb 3896 2010-09-25 07:49:34Z ktou $) */ \n\n"
|
187
187
|
ret << "#ifndef #{const}\n"
|
188
188
|
ret << "#define #{const}\n\n"
|
189
189
|
ret << "#include <glib-object.h>\n\n"
|
data/{src/lib → lib}/glib2.rb
RENAMED
@@ -1,18 +1,12 @@
|
|
1
1
|
#
|
2
2
|
# glib2.rb
|
3
|
-
# Copyright(C) 2005 Ruby-GNOME2 Project.
|
3
|
+
# Copyright(C) 2005-2010 Ruby-GNOME2 Project.
|
4
4
|
#
|
5
5
|
# This program is licenced under the same
|
6
6
|
# license of Ruby-GNOME2.
|
7
7
|
#
|
8
8
|
|
9
|
-
require '
|
10
|
-
if /mingw|mswin|mswin32/ =~ RUBY_PLATFORM
|
11
|
-
ENV['PATH'] = %w(bin lib).collect{|dir|
|
12
|
-
"#{Config::CONFIG["prefix"]}\\lib\\GTK\\#{dir};"
|
13
|
-
}.join('') + ENV['PATH']
|
14
|
-
end
|
15
|
-
|
9
|
+
require 'pathname'
|
16
10
|
require 'English'
|
17
11
|
require 'thread'
|
18
12
|
|
@@ -66,9 +60,34 @@ module GLib
|
|
66
60
|
end
|
67
61
|
end
|
68
62
|
end
|
63
|
+
|
64
|
+
def prepend_environment_path(path)
|
65
|
+
path = Pathname(path) unless path.is_a?(Pathname)
|
66
|
+
if path.exist?
|
67
|
+
environment_name = "PATH"
|
68
|
+
separator = File::PATH_SEPARATOR
|
69
|
+
|
70
|
+
paths = (ENV[environment_name] || '').split(/#{separator}/)
|
71
|
+
dir = path.to_s
|
72
|
+
dir = dir.gsub(/\//, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
|
73
|
+
unless paths.include?(dir)
|
74
|
+
paths = [dir] + paths
|
75
|
+
ENV[environment_name] = paths.join(separator)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
69
79
|
end
|
70
80
|
|
71
|
-
|
81
|
+
|
82
|
+
base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
|
83
|
+
vendor_dir = base_dir + "vendor" + "local"
|
84
|
+
GLib.prepend_environment_path(vendor_dir + "bin")
|
85
|
+
begin
|
86
|
+
major, minor, micro, = RUBY_VERSION.split(/\./)
|
87
|
+
require "#{major}.#{minor}/glib2.so"
|
88
|
+
rescue LoadError
|
89
|
+
require 'glib2.so'
|
90
|
+
end
|
72
91
|
|
73
92
|
module GLib
|
74
93
|
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Copyright(C) 2010 Ruby-GNOME2 Project.
|
2
|
+
#
|
3
|
+
# This program is licenced under the same license of Ruby-GNOME2.
|
4
|
+
|
5
|
+
require 'open-uri'
|
6
|
+
require 'rubygems'
|
7
|
+
require 'mechanize'
|
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)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
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
|
+
end
|
28
|
+
|
29
|
+
def download_package(package)
|
30
|
+
version_page = agent.get("#{URL_BASE}/#{package}")
|
31
|
+
latest_version_link = version_page.links.sort_by do |link|
|
32
|
+
if /\A(\d+\.\d+)\/\z/ =~ link.href
|
33
|
+
$1.split(/\./).collect {|component| component.to_i}
|
34
|
+
else
|
35
|
+
[-1]
|
36
|
+
end
|
37
|
+
end.last
|
38
|
+
|
39
|
+
latest_version_page = latest_version_link.click
|
40
|
+
latest_version = latest_version_page.links.collect do |link|
|
41
|
+
if /_([\d\.\-]+)_win32\.zip\z/ =~ link.href
|
42
|
+
version = $1
|
43
|
+
[version.split(/[\.\-]/).collect {|component| component.to_i}, version]
|
44
|
+
else
|
45
|
+
[[-1], nil]
|
46
|
+
end
|
47
|
+
end.sort_by do |normalized_version, version|
|
48
|
+
normalized_version
|
49
|
+
end.last[1]
|
50
|
+
|
51
|
+
latest_version_page.links.each do |link|
|
52
|
+
if /_#{Regexp.escape(latest_version)}_win32\.zip\z/ =~ link.href
|
53
|
+
click_zip_link(link)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def download_dependency(dependency)
|
59
|
+
dependencies_page = agent.get("#{URL_BASE}/dependencies")
|
60
|
+
latest_version = dependencies_page.links.collect do |link|
|
61
|
+
if /\A#{Regexp.escape(dependency)}_([\d\.\-]+)_win32\.zip\z/ =~ link.href
|
62
|
+
version = $1
|
63
|
+
[version.split(/[\.\-]/).collect {|component| component.to_i}, version]
|
64
|
+
else
|
65
|
+
[[-1], nil]
|
66
|
+
end
|
67
|
+
end.sort_by do |normalized_version, version|
|
68
|
+
normalized_version
|
69
|
+
end.last[1]
|
70
|
+
dependencies_page.links.each do |link|
|
71
|
+
if /\A#{Regexp.escape(dependency)}(?:-dev)?_#{Regexp.escape(latest_version)}_win32.zip/ =~ link.href
|
72
|
+
click_zip_link(link)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
def agent
|
79
|
+
@agent ||= Mechanize.new
|
80
|
+
end
|
81
|
+
|
82
|
+
def click_zip_link(link)
|
83
|
+
zip = link.click
|
84
|
+
FileUtils.mkdir_p(@output_dir)
|
85
|
+
Dir.chdir(@output_dir) do
|
86
|
+
open(zip.filename, "wb") do |file|
|
87
|
+
file.print(zip.body)
|
88
|
+
end
|
89
|
+
system("unzip '#{zip.filename}'")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -10,7 +10,13 @@
|
|
10
10
|
#
|
11
11
|
|
12
12
|
require 'mkmf'
|
13
|
-
|
13
|
+
begin
|
14
|
+
require 'pkg-config'
|
15
|
+
rescue LoadError
|
16
|
+
require 'rubygems'
|
17
|
+
gem 'pkg-config'
|
18
|
+
require 'pkg-config'
|
19
|
+
end
|
14
20
|
require 'glib-mkenums'
|
15
21
|
|
16
22
|
unless defined?(macro_defined?)
|
@@ -42,90 +48,55 @@ if ENV['GTK_BASEPATH'] and /cygwin/ !~ RUBY_PLATFORM
|
|
42
48
|
$CFLAGS += " -I#{include_path} "
|
43
49
|
end
|
44
50
|
|
45
|
-
def
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
STDOUT.print("checking for G_OS_WIN32... ")
|
61
|
-
STDOUT.flush
|
62
|
-
if macro_defined?('G_OS_WIN32', "#include <glibconfig.h>\n")
|
63
|
-
STDOUT.print "yes\n"
|
64
|
-
$G_OS_WIN32 = true
|
65
|
-
if $cc_is_gcc
|
66
|
-
if /^2\./ =~ `#{Config::CONFIG['CC']} -dumpversion`.chomp
|
67
|
-
$CFLAGS += ' -fnative-struct'
|
68
|
-
else
|
69
|
-
$CFLAGS += ' -mms-bitfields'
|
70
|
-
end
|
71
|
-
end
|
72
|
-
else
|
73
|
-
STDOUT.print "no\n"
|
74
|
-
end
|
75
|
-
|
76
|
-
# STDOUT.print("checking for G_WITH_CYGWIN... ")
|
77
|
-
# STDOUT.flush
|
78
|
-
# if macro_defined?('G_WITH_CYGWIN', "#include <glibconfig.h>\n")
|
79
|
-
# STDOUT.print "yes\n"
|
80
|
-
# $G_WITH_CYGWIN = true
|
81
|
-
# else
|
82
|
-
# STDOUT.print "no\n"
|
83
|
-
# end
|
84
|
-
end
|
85
|
-
|
86
|
-
nil
|
87
|
-
end
|
88
|
-
|
89
|
-
def set_output_lib(target_name)
|
90
|
-
if /cygwin|mingw/ =~ RUBY_PLATFORM
|
91
|
-
filename = "libruby-#{target_name}.a"
|
92
|
-
if RUBY_VERSION > "1.8.0"
|
93
|
-
$DLDFLAGS << ",--out-implib=#{filename}" if filename
|
94
|
-
elsif RUBY_VERSION > "1.8"
|
95
|
-
$DLDFLAGS.gsub!(/ -Wl,--out-implib=[^ ]+/, '')
|
96
|
-
$DLDFLAGS << " -Wl,--out-implib=#{filename}" if filename
|
51
|
+
def setup_win32(target_name, base_dir=nil)
|
52
|
+
checking_for(checking_message("Win32 OS")) do
|
53
|
+
case RUBY_PLATFORM
|
54
|
+
when /cygwin|mingw|mswin32/
|
55
|
+
import_library_name = "libruby-#{target_name}.a"
|
56
|
+
$DLDFLAGS << " -Wl,--out-implib=#{import_library_name}"
|
57
|
+
$cleanfiles << import_library_name
|
58
|
+
base_dir ||= Pathname($0).dirname.parent.parent.expand_path
|
59
|
+
base_dir = Pathname(base_dir) if base_dir.is_a?(String)
|
60
|
+
binary_base_dir = base_dir + "vendor" + "local"
|
61
|
+
$CFLAGS += " -I#{binary_base_dir}/include"
|
62
|
+
pkg_config_dir = binary_base_dir + "lib" + "pkgconfig"
|
63
|
+
PKGConfig.add_path(pkg_config_dir.to_s)
|
64
|
+
PKGConfig.set_override_variable("prefix", binary_base_dir.to_s)
|
65
|
+
true
|
97
66
|
else
|
98
|
-
|
99
|
-
$DLDFLAGS << " --output-lib #{filename}" if filename
|
67
|
+
false
|
100
68
|
end
|
101
|
-
elsif /mswin32/ =~ RUBY_PLATFORM
|
102
|
-
filename = "libruby-#{target_name}.lib"
|
103
|
-
$DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
|
104
|
-
$DLDFLAGS.gsub!(/ \/IMPLIB:[^ ]+/, '')
|
105
|
-
$DLDFLAGS << " /IMPLIB:#{filename}" if filename
|
106
69
|
end
|
107
70
|
end
|
108
71
|
|
109
|
-
def setup_win32(target_name)
|
110
|
-
check_win32
|
111
|
-
set_output_lib(target_name)
|
112
|
-
end
|
113
|
-
|
114
72
|
#add_depend_package("glib2", "glib/src", "/...../ruby-gnome2")
|
115
|
-
def add_depend_package(target_name, target_srcdir, top_srcdir)
|
73
|
+
def add_depend_package(target_name, target_srcdir, top_srcdir, options={})
|
116
74
|
[top_srcdir, $configure_args['--topdir']].each do |topdir|
|
117
75
|
topdir = File.expand_path(topdir)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
76
|
+
target_source_dir_full_path = File.join(topdir, target_srcdir)
|
77
|
+
if File.exist?(target_source_dir_full_path)
|
78
|
+
$INCFLAGS = "-I#{target_source_dir_full_path} #{$INCFLAGS}"
|
79
|
+
end
|
80
|
+
|
81
|
+
top_build_dir = options[:top_build_dir] || topdir
|
82
|
+
target_build_dir = options[:target_build_dir] || target_srcdir
|
83
|
+
target_build_dir_full_path = File.join(top_build_dir, target_build_dir)
|
84
|
+
unless File.exist?(target_build_dir_full_path)
|
85
|
+
target_build_dir_full_path = File.join(top_build_dir, target_srcdir)
|
86
|
+
end
|
87
|
+
unless File.exist?(target_build_dir_full_path)
|
88
|
+
target_build_dir_full_path = File.join(topdir, target_build_dir)
|
89
|
+
end
|
90
|
+
unless File.exist?(target_build_dir_full_path)
|
91
|
+
target_build_dir_full_path = File.join(topdir, target_srcdir)
|
122
92
|
end
|
93
|
+
$INCFLAGS = "-I#{target_build_dir_full_path} #{$INCFLAGS}"
|
123
94
|
|
124
95
|
if /cygwin|mingw/ =~ RUBY_PLATFORM
|
125
96
|
$libs << " -lruby-#{target_name}"
|
126
|
-
$LDFLAGS << " -L#{
|
97
|
+
$LDFLAGS << " -L#{target_build_dir_full_path}"
|
127
98
|
elsif /mswin32/ =~ RUBY_PLATFORM
|
128
|
-
$DLDFLAGS << " /libpath:#{
|
99
|
+
$DLDFLAGS << " /libpath:#{target_build_dir_full_path}"
|
129
100
|
$libs << " libruby-#{target_name}.lib"
|
130
101
|
end
|
131
102
|
end
|
@@ -157,7 +128,8 @@ def create_pkg_config_file(package_name, c_package,
|
|
157
128
|
end
|
158
129
|
|
159
130
|
def ruby_gnome2_version(glib_source_directory=nil)
|
160
|
-
glib_source_directory ||= File.join(File.dirname(__FILE__), ".."
|
131
|
+
glib_source_directory ||= File.join(File.dirname(__FILE__), "..",
|
132
|
+
"ext", "glib2")
|
161
133
|
rbglib_h = File.join(glib_source_directory, "rbglib.h")
|
162
134
|
return nil unless File.exist?(rbglib_h)
|
163
135
|
|
@@ -179,6 +151,20 @@ def ruby_gnome2_version(glib_source_directory=nil)
|
|
179
151
|
version
|
180
152
|
end
|
181
153
|
|
154
|
+
def ensure_objs
|
155
|
+
return unless $objs.nil?
|
156
|
+
|
157
|
+
source_dir = '$(srcdir)'
|
158
|
+
RbConfig.expand(source_dir)
|
159
|
+
|
160
|
+
pattern = "*.{#{SRC_EXT.join(',')}}"
|
161
|
+
srcs = Dir[File.join(source_dir, pattern)]
|
162
|
+
srcs |= Dir[File.join(".", pattern)]
|
163
|
+
$objs = srcs.collect do |f|
|
164
|
+
File.basename(f, ".*") + ".o"
|
165
|
+
end.uniq
|
166
|
+
end
|
167
|
+
|
182
168
|
def create_makefile_at_srcdir(pkg_name, srcdir, defs = nil)
|
183
169
|
base_dir = File.basename(Dir.pwd)
|
184
170
|
last_common_index = srcdir.rindex(base_dir)
|
@@ -192,14 +178,7 @@ def create_makefile_at_srcdir(pkg_name, srcdir, defs = nil)
|
|
192
178
|
yield if block_given?
|
193
179
|
|
194
180
|
$defs << defs if defs
|
195
|
-
|
196
|
-
pattern = "*.{#{SRC_EXT.join(',')}}"
|
197
|
-
srcs = Dir[File.join(srcdir, pattern)]
|
198
|
-
srcs |= Dir[File.join(".", pattern)]
|
199
|
-
$objs = srcs.collect do |src|
|
200
|
-
File.basename(src, ".*") + ".o"
|
201
|
-
end.flatten.uniq
|
202
|
-
|
181
|
+
ensure_objs
|
203
182
|
create_makefile(pkg_name, srcdir)
|
204
183
|
end
|
205
184
|
end
|
@@ -328,6 +307,7 @@ SRC
|
|
328
307
|
end
|
329
308
|
|
330
309
|
def add_obj(name)
|
310
|
+
ensure_objs
|
331
311
|
$objs << name unless $objs.index(name)
|
332
312
|
end
|
333
313
|
|
@@ -335,11 +315,17 @@ def glib_mkenums(prefix, files, g_type_prefix, include_files, options={})
|
|
335
315
|
add_distcleanfile(prefix + ".h")
|
336
316
|
add_distcleanfile(prefix + ".c")
|
337
317
|
GLib::MkEnums.create(prefix, files, g_type_prefix, include_files, options)
|
318
|
+
add_obj("#{prefix}.o")
|
338
319
|
end
|
339
320
|
|
340
|
-
def check_cairo
|
321
|
+
def check_cairo(options={})
|
341
322
|
return false unless PKGConfig.have_package('cairo')
|
342
323
|
|
324
|
+
rcairo_source_dir = options[:rcairo_source_dir]
|
325
|
+
if rcairo_source_dir and !File.exist?(rcairo_source_dir)
|
326
|
+
rcairo_source_dir = nil
|
327
|
+
end
|
328
|
+
$CFLAGS += " -I#{rcairo_source_dir}/ext/cairo" if rcairo_source_dir
|
343
329
|
have_rb_cairo_h = have_header('rb_cairo.h')
|
344
330
|
unless have_rb_cairo_h
|
345
331
|
begin
|
@@ -347,8 +333,8 @@ def check_cairo
|
|
347
333
|
gem 'cairo'
|
348
334
|
require 'cairo'
|
349
335
|
rcairo_src_gem_path_re =
|
350
|
-
/\A#{Regexp.escape(Gem.dir)}\/gems\/cairo-[\d.]+\/
|
351
|
-
|
336
|
+
/\A#{Regexp.escape(Gem.dir)}\/gems\/cairo-[\d.]+\/ext\/cairo\z/
|
337
|
+
$LOAD_PATH.each do |path|
|
352
338
|
if rcairo_src_gem_path_re =~ path
|
353
339
|
$CFLAGS += " -I#{path} "
|
354
340
|
have_rb_cairo_h = have_header('rb_cairo.h')
|
@@ -361,11 +347,12 @@ def check_cairo
|
|
361
347
|
|
362
348
|
if have_rb_cairo_h
|
363
349
|
if /mingw|cygwin|mswin32/ =~ RUBY_PLATFORM
|
364
|
-
|
365
|
-
|
366
|
-
|
350
|
+
options = {}
|
351
|
+
build_dir = "tmp/#{RUBY_PLATFORM}/cairo/#{RUBY_VERSION}"
|
352
|
+
if File.exist?(File.join(rcairo_source_dir, build_dir))
|
353
|
+
options[:target_build_dir] = build_dir
|
367
354
|
end
|
368
|
-
add_depend_package("cairo", "
|
355
|
+
add_depend_package("cairo", "ext/cairo", rcairo_source_dir, options)
|
369
356
|
$defs << "-DRUBY_CAIRO_PLATFORM_WIN32"
|
370
357
|
end
|
371
358
|
end
|
@@ -373,7 +360,7 @@ def check_cairo
|
|
373
360
|
end
|
374
361
|
|
375
362
|
add_include_path = Proc.new do |dir_variable|
|
376
|
-
value =
|
363
|
+
value = RbConfig::CONFIG[dir_variable]
|
377
364
|
if value and File.exist?(value)
|
378
365
|
$INCFLAGS << " -I$(#{dir_variable}) "
|
379
366
|
end
|