glib2 0.20.0 → 0.90.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. data/ChangeLog +92 -0
  2. data/README +22 -10
  3. data/Rakefile +54 -72
  4. data/ext/glib2/depend +10 -0
  5. data/ext/glib2/extconf.rb +61 -0
  6. data/ext/glib2/glib2.def +89 -0
  7. data/{src → ext/glib2}/rbgcompat.h +0 -0
  8. data/{src → ext/glib2}/rbglib.c +17 -7
  9. data/{src → ext/glib2}/rbglib.h +2 -2
  10. data/{src → ext/glib2}/rbglib_bookmarkfile.c +0 -0
  11. data/{src → ext/glib2}/rbglib_completion.c +0 -0
  12. data/{src → ext/glib2}/rbglib_convert.c +0 -0
  13. data/{src → ext/glib2}/rbglib_error.c +0 -0
  14. data/{src → ext/glib2}/rbglib_fileutils.c +0 -0
  15. data/{src → ext/glib2}/rbglib_i18n.c +0 -0
  16. data/{src → ext/glib2}/rbglib_int64.c +0 -0
  17. data/{src → ext/glib2}/rbglib_iochannel.c +0 -0
  18. data/{src → ext/glib2}/rbglib_keyfile.c +0 -0
  19. data/{src → ext/glib2}/rbglib_maincontext.c +1 -3
  20. data/{src → ext/glib2}/rbglib_mainloop.c +0 -0
  21. data/{src → ext/glib2}/rbglib_messages.c +0 -0
  22. data/{src → ext/glib2}/rbglib_pollfd.c +0 -0
  23. data/{src → ext/glib2}/rbglib_shell.c +0 -0
  24. data/{src → ext/glib2}/rbglib_source.c +0 -0
  25. data/{src → ext/glib2}/rbglib_spawn.c +0 -0
  26. data/{src → ext/glib2}/rbglib_threads.c +0 -0
  27. data/{src → ext/glib2}/rbglib_timer.c +0 -0
  28. data/{src → ext/glib2}/rbglib_unicode.c +0 -0
  29. data/{src → ext/glib2}/rbglib_utils.c +0 -0
  30. data/{src → ext/glib2}/rbglib_win32.c +0 -0
  31. data/{src → ext/glib2}/rbgobj_boxed.c +0 -0
  32. data/{src → ext/glib2}/rbgobj_closure.c +0 -0
  33. data/{src → ext/glib2}/rbgobj_convert.c +0 -0
  34. data/{src → ext/glib2}/rbgobj_enums.c +0 -0
  35. data/{src → ext/glib2}/rbgobj_fundamental.c +0 -0
  36. data/{src → ext/glib2}/rbgobj_object.c +0 -0
  37. data/{src → ext/glib2}/rbgobj_param.c +0 -0
  38. data/{src → ext/glib2}/rbgobj_paramspecs.c +0 -0
  39. data/{src → ext/glib2}/rbgobj_signal.c +0 -0
  40. data/{src → ext/glib2}/rbgobj_strv.c +0 -0
  41. data/{src → ext/glib2}/rbgobj_type.c +0 -0
  42. data/{src → ext/glib2}/rbgobj_typeinstance.c +0 -0
  43. data/{src → ext/glib2}/rbgobj_typeinterface.c +0 -0
  44. data/{src → ext/glib2}/rbgobj_typemodule.c +0 -0
  45. data/{src → ext/glib2}/rbgobj_typeplugin.c +0 -0
  46. data/{src → ext/glib2}/rbgobj_value.c +0 -0
  47. data/{src → ext/glib2}/rbgobj_valuearray.c +0 -0
  48. data/{src → ext/glib2}/rbgobj_valuetypes.c +0 -0
  49. data/{src → ext/glib2}/rbgobject.c +0 -0
  50. data/{src → ext/glib2}/rbgobject.h +0 -0
  51. data/{src → ext/glib2}/rbgprivate.h +0 -0
  52. data/ext/glib2/rbgutil.c +316 -0
  53. data/{src → ext/glib2}/rbgutil.h +9 -9
  54. data/{src → ext/glib2}/rbgutil_callback.c +0 -0
  55. data/extconf.rb +48 -60
  56. data/{src/lib → lib}/glib-mkenums.rb +2 -2
  57. data/{src/lib → lib}/glib2.rb +28 -9
  58. data/lib/gnome2-win32-binary-downloader.rb +92 -0
  59. data/{src/lib → lib}/mkmf-gnome2.rb +76 -89
  60. data/test-unit/COPYING +56 -0
  61. data/test-unit/GPL +340 -0
  62. data/test-unit/History.txt +232 -0
  63. data/test-unit/Manifest.txt +110 -0
  64. data/test-unit/PSFL +271 -0
  65. data/test-unit/README.txt +75 -0
  66. data/test-unit/Rakefile +53 -0
  67. data/test-unit/TODO +5 -0
  68. data/test-unit/bin/testrb +5 -0
  69. data/test-unit/html/bar.png +0 -0
  70. data/test-unit/html/bar.svg +153 -0
  71. data/test-unit/html/developer.png +0 -0
  72. data/test-unit/html/developer.svg +469 -0
  73. data/test-unit/html/famfamfam-logo.png +0 -0
  74. data/test-unit/html/favicon.ico +0 -0
  75. data/test-unit/html/favicon.png +0 -0
  76. data/test-unit/html/favicon.svg +82 -0
  77. data/test-unit/html/heading-mark.png +0 -0
  78. data/test-unit/html/heading-mark.svg +393 -0
  79. data/test-unit/html/index.html +247 -0
  80. data/test-unit/html/index.html.ja +270 -0
  81. data/test-unit/html/install.png +0 -0
  82. data/test-unit/html/install.svg +636 -0
  83. data/test-unit/html/jp.png +0 -0
  84. data/test-unit/html/kinotan-failure.png +0 -0
  85. data/test-unit/html/kinotan-pass.png +0 -0
  86. data/test-unit/html/logo.png +0 -0
  87. data/test-unit/html/logo.svg +483 -0
  88. data/test-unit/html/reference.png +0 -0
  89. data/test-unit/html/rubyforge.png +0 -0
  90. data/test-unit/html/tango-logo.png +0 -0
  91. data/test-unit/html/test-unit.css +339 -0
  92. data/test-unit/html/tutorial.png +0 -0
  93. data/test-unit/html/tutorial.svg +559 -0
  94. data/test-unit/html/us.png +0 -0
  95. data/test-unit/images/color-diff.png +0 -0
  96. data/test-unit/lib/test/unit.rb +328 -0
  97. data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
  98. data/test-unit/lib/test/unit/assertions.rb +1334 -0
  99. data/test-unit/lib/test/unit/attribute.rb +125 -0
  100. data/test-unit/lib/test/unit/autorunner.rb +363 -0
  101. data/test-unit/lib/test/unit/collector.rb +36 -0
  102. data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
  103. data/test-unit/lib/test/unit/collector/dir.rb +108 -0
  104. data/test-unit/lib/test/unit/collector/load.rb +144 -0
  105. data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
  106. data/test-unit/lib/test/unit/color-scheme.rb +106 -0
  107. data/test-unit/lib/test/unit/color.rb +96 -0
  108. data/test-unit/lib/test/unit/diff.rb +740 -0
  109. data/test-unit/lib/test/unit/error.rb +130 -0
  110. data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
  111. data/test-unit/lib/test/unit/failure.rb +136 -0
  112. data/test-unit/lib/test/unit/fixture.rb +176 -0
  113. data/test-unit/lib/test/unit/notification.rb +129 -0
  114. data/test-unit/lib/test/unit/omission.rb +191 -0
  115. data/test-unit/lib/test/unit/pending.rb +150 -0
  116. data/test-unit/lib/test/unit/priority.rb +180 -0
  117. data/test-unit/lib/test/unit/runner/console.rb +52 -0
  118. data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
  119. data/test-unit/lib/test/unit/runner/tap.rb +8 -0
  120. data/test-unit/lib/test/unit/testcase.rb +483 -0
  121. data/test-unit/lib/test/unit/testresult.rb +121 -0
  122. data/test-unit/lib/test/unit/testsuite.rb +110 -0
  123. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
  124. data/test-unit/lib/test/unit/ui/console/testrunner.rb +430 -0
  125. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
  126. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +82 -0
  127. data/test-unit/lib/test/unit/ui/testrunner.rb +53 -0
  128. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
  129. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
  130. data/test-unit/lib/test/unit/util/backtracefilter.rb +42 -0
  131. data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
  132. data/test-unit/lib/test/unit/util/observable.rb +90 -0
  133. data/test-unit/lib/test/unit/util/output.rb +31 -0
  134. data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
  135. data/test-unit/lib/test/unit/version.rb +7 -0
  136. data/test-unit/sample/adder.rb +13 -0
  137. data/test-unit/sample/subtracter.rb +12 -0
  138. data/test-unit/sample/test_adder.rb +20 -0
  139. data/test-unit/sample/test_subtracter.rb +20 -0
  140. data/test-unit/sample/test_user.rb +23 -0
  141. data/test-unit/test/collector/test-descendant.rb +133 -0
  142. data/test-unit/test/collector/test-load.rb +442 -0
  143. data/test-unit/test/collector/test_dir.rb +406 -0
  144. data/test-unit/test/collector/test_objectspace.rb +100 -0
  145. data/test-unit/test/run-test.rb +15 -0
  146. data/test-unit/test/test-attribute.rb +86 -0
  147. data/test-unit/test/test-color-scheme.rb +69 -0
  148. data/test-unit/test/test-color.rb +47 -0
  149. data/test-unit/test/test-diff.rb +518 -0
  150. data/test-unit/test/test-emacs-runner.rb +60 -0
  151. data/test-unit/test/test-fixture.rb +287 -0
  152. data/test-unit/test/test-notification.rb +33 -0
  153. data/test-unit/test/test-omission.rb +81 -0
  154. data/test-unit/test/test-pending.rb +70 -0
  155. data/test-unit/test/test-priority.rb +119 -0
  156. data/test-unit/test/test-testcase.rb +544 -0
  157. data/test-unit/test/test_assertions.rb +1197 -0
  158. data/test-unit/test/test_error.rb +26 -0
  159. data/test-unit/test/test_failure.rb +33 -0
  160. data/test-unit/test/test_testresult.rb +113 -0
  161. data/test-unit/test/test_testsuite.rb +129 -0
  162. data/test-unit/test/testunit-test-util.rb +14 -0
  163. data/test-unit/test/ui/test_tap.rb +33 -0
  164. data/test-unit/test/ui/test_testrunmediator.rb +20 -0
  165. data/test-unit/test/util/test-method-owner-finder.rb +38 -0
  166. data/test-unit/test/util/test-output.rb +11 -0
  167. data/test-unit/test/util/test_backtracefilter.rb +41 -0
  168. data/test-unit/test/util/test_observable.rb +102 -0
  169. data/test-unit/test/util/test_procwrapper.rb +36 -0
  170. data/test/run-test.rb +2 -6
  171. metadata +197 -100
  172. data/src/glib-enum-types.c +0 -1032
  173. data/src/glib-enum-types.h +0 -140
  174. data/src/lib/pkg-config.rb +0 -137
  175. data/src/rbgutil.c +0 -222
data/ChangeLog CHANGED
@@ -1,3 +1,95 @@
1
+ 2010-09-26 Kouhei Sutou <kou@cozmixng.org>
2
+
3
+ * ext/glib2/rbglib.h: 0.90.2 -> 0.90.3.
4
+
5
+ 2010-09-25 Kouhei Sutou <kou@cozmixng.org>
6
+
7
+ * lib/mkmf-gnome2.rb (ensure_objs): add.
8
+
9
+ * lib/mkmf-gnome2.rb: add generated files in build directory
10
+ to build targets too.
11
+
12
+ 2010-09-23 Kouhei Sutou <kou@cozmixng.org>
13
+
14
+ * ext/glib2/rbglib.h: 0.90.1 -> 0.90.2.
15
+
16
+ * Rakefile: don't add .zip into gem.
17
+
18
+ * lib/mkmf-gnome2.rb (#add_depend_package): improve auto build
19
+ path detection.
20
+
21
+ * ext/glib2/rbglib.h: 0.90.0 -> 0.90.1.
22
+
23
+ * ext/glib2/rbglib.h (RBGLIB_MINOR_VERSION): 20 -> 90. (0.20.0 -> 0.90.0)
24
+
25
+ * lib/glib2.rb (GLib#prepend_environment_path): add for Windows DLL.
26
+
27
+ * ext/glib2/rbgutil.c (rbgutil_gslist2ary_and_free): fix wrong
28
+ address is passed.
29
+
30
+ * test/run-test.rb: fix extension library path.
31
+
32
+ * lib/mkmf-gnome2.rb (#add_depend_package): don't add nonexistent
33
+ path to include paths.
34
+
35
+ * lib/mkmf-gnome2.rb (#ruby_gnome2_version): follow directory
36
+ structure change.
37
+
38
+ * lib/mkmf-gnome2.rb (#add_depend_package): support top build
39
+ directory path.
40
+
41
+ * README: add installation document by RubyGems.
42
+
43
+ * lib/mkmf-gnome2.rb (#add_depend_package): add build directory to
44
+ include path.
45
+
46
+ 2010-09-21 Kouhei Sutou <kou@cozmixng.org>
47
+
48
+ * lib/mkmf-gnome2.rb (#check_cairo): support rcairo path customize
49
+ by arguments.
50
+
51
+ * lib/mkmf-gnome2.rb (#check_cairo): follow rcairo's path change.
52
+
53
+ * ext/glib/extconfr.b, lib/mkmf-gnome2.rb: share Windows setup code.
54
+
55
+ * Rakefile, lib/gnome2-win32-binary-downloader.rb: share
56
+ Windows binary file downloader.
57
+
58
+ 2010-09-11 Kouhei Sutou <kou@cozmixng.org>
59
+
60
+ * ext/glib2/rbglib_maincontext.c (idle_add): fix default priority.
61
+ Reported by ashbb. Thanks!!!
62
+
63
+ 2010-09-07 Kouhei Sutou <kou@cozmixng.org>
64
+
65
+ * lib/mkmf-gnome2.rb: ensure add generated enum file.
66
+
67
+ * ./: support cross-compile for Windows.
68
+
69
+ 2010-09-02 Kouhei Sutou <kou@cozmixng.org>
70
+
71
+ * ./: reconstruct directory structure for rake-compiler.
72
+
73
+ 2010-07-24 Nikolai Weibull
74
+
75
+ src/rbgutil.c: make sure that all strings are fred in
76
+ rbgutil_glist2ary_string_and_free.
77
+
78
+ 2010-07-23 Nikolai Weibull
79
+
80
+ src/rbgutil.c: use rb_ensure around all *_free functions and also fix a
81
+ bug that made sure that no lists were actually freed. That's the price
82
+ of reusing variables.
83
+
84
+ 2010-07-14 Kouhei Sutou <kou@cozmixng.org>
85
+
86
+ * src/rbglib.c: fix coding style.
87
+
88
+ 2010-07-12 Nikolai Weibull
89
+
90
+ * src/rbglib.c: use rb_ensure for rbg_cstr_to_rval to free the memory
91
+ even if an error occurs when creating the Ruby String.
92
+
1
93
  2010-04-17 Kouhei Sutou <kou@cozmixng.org>
2
94
 
3
95
  * src/rbglib.h: 0.19.4 -> 0.20.0.
data/README CHANGED
@@ -4,20 +4,32 @@ Ruby/GLib2 is a Ruby binding of GLib-2.x.
4
4
 
5
5
  Requirements
6
6
  ------------
7
- Ruby: http://www.ruby-lang.org/
8
- GLib: http://www.gtk.org/
9
7
 
10
- Install
11
- -------
12
- 0. install ruby-1.6.x or later, GLib.
13
- 1. ruby extconf.rb
14
- 2. make
15
- 3. su
16
- 4. make install
8
+ Ruby >= 1.8.5: http://www.ruby-lang.org/
9
+ pkg-config.rb: http://github.com/rcairo/pkg-config
10
+ GLib >= 2.x: http://www.gtk.org/
11
+
12
+ Install (RubyGems)
13
+ ------------------
14
+
15
+ % sudo gem install glib2
16
+
17
+ Windows:
18
+
19
+ > gem install glib2 --platform x86-mingw32
20
+
21
+ Install (traditional)
22
+ ---------------------
23
+
24
+ Install ruby-1.8.5 or later, pkg-config.rb and GLib-2.x.
25
+
26
+ % ruby extconf.rb
27
+ % make
28
+ % sudo make install
17
29
 
18
30
  Copying
19
31
  -------
20
- Copyright (c) 2002-2005 Ruby-GNOME2 Project Team
32
+ Copyright (c) 2002-2010 Ruby-GNOME2 Project Team
21
33
 
22
34
  This program is free software.
23
35
  You can distribute/modify this program under the terms of
data/Rakefile CHANGED
@@ -1,87 +1,69 @@
1
- require 'rake/clean'
2
- CLEAN.include '**/*.o'
3
- CLEAN.include "**/*.#{Config::MAKEFILE_CONFIG['DLEXT']}"
4
- CLOBBER.include 'doc'
5
- CLOBBER.include '**/*.log'
6
- CLOBBER.include '**/Makefile'
7
- CLOBBER.include '**/extconf.h'
1
+ # -*- ruby -*-
8
2
 
9
- # Determine the current version of the software
10
- def ruby_glib_version
11
- buf = File.read('src/rbglib.h')
12
- if buf =~ /\s*RBGLIB_MAJOR_VERSION\s*(\d.+)/
13
- major = $1
14
- else
15
- major = 0
16
- end
17
- if buf =~ /\s*RBGLIB_MINOR_VERSION\s*(\d.+)/
18
- minor = $1
19
- else
20
- minor = 0
21
- end
22
- if buf =~ /\s*RBGLIB_MICRO_VERSION\s*(\d.+)/
23
- micro = $1
24
- else
25
- micro = 0
26
- end
27
- "#{major}.#{minor}.#{micro}"
28
- end
29
-
30
- CURRENT_VERSION = ruby_glib_version
31
-
32
- desc "Default Task (Test project)"
33
- task :default => :test
34
-
35
- # Make tasks -----------------------------------------------------
36
- make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
37
- MAKECMD = ENV['MAKE_CMD'] || make_program
38
- MAKEOPTS = ENV['MAKE_OPTS'] || ''
3
+ require 'find'
4
+ require 'rubygems'
5
+ require 'rake/extensiontask'
39
6
 
40
- GLIB_SO = "src/glib2.#{Config::MAKEFILE_CONFIG['DLEXT']}"
7
+ task :default => :build
41
8
 
42
- file 'Makefile' => 'extconf.rb' do
43
- sh "ruby extconf.rb #{ENV['EXTCONF_OPTS']}"
9
+ def version
10
+ @version ||= ENV["VERSION"] || guess_version
44
11
  end
45
12
 
46
- def make(target = '')
47
- pid = system("#{MAKECMD} #{MAKEOPTS} #{target}")
48
- $?.exitstatus
49
- end
50
-
51
- # Let make handle dependencies between c/o/so - we'll just run it.
52
- file GLIB_SO => (['Makefile'] + Dir['src/*.c'] + Dir['src/*.h']) do
53
- m = make
54
- fail "Make failed (status #{m})" unless m == 0
13
+ def guess_version
14
+ versions = {}
15
+ File.open("ext/glib2/rbglib.h") do |rbglib_h|
16
+ rbglib_h.each_line do |line|
17
+ if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line
18
+ versions[$1.downcase] = $2.to_i
19
+ end
20
+ end
21
+ end
22
+ ["major", "minor", "micro"].collect {|type| versions[type]}.compact.join(".")
55
23
  end
56
24
 
57
- desc "Configure Glib2"
58
- task :configure => ['Makefile']
25
+ package_name = "glib2"
59
26
 
60
- desc "Compile the shared object"
61
- task :compile => [GLIB_SO]
27
+ spec = Gem::Specification.new do |s|
28
+ s.name = package_name
29
+ s.summary = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
30
+ s.description = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
31
+ s.author = "The Ruby-GNOME2 Proejct Team"
32
+ s.email = "ruby-gnome2-devel-en@lists.sourceforge.net"
33
+ s.homepage = "http://ruby-gnome2.sourceforge.jp/"
34
+ s.version = version
35
+ s.platform = Gem::Platform::RUBY
36
+ s.extensions = FileList["ext/#{package_name}/extconf.rb"]
37
+ s.require_paths = ["lib"]
38
+ s.files = FileList["ChangeLog", "README", "Rakefile", "extconf.rb",
39
+ "lib/**/*.rb", "{ext,sample,test,test-unit}/**/*"]
40
+ end
62
41
 
63
- desc "Run glib tests"
64
- task :test => :compile do
65
- sh "ruby test/run-test.rb"
42
+ Rake::GemPackageTask.new(spec) do |pkg|
66
43
  end
67
44
 
68
- desc 'Generate gem specification'
69
- task :gemspec do
70
- require 'erb'
71
- tspec = ERB.new(File.read(File.join(File.dirname(__FILE__),'src','glib2.gemspec.erb')))
72
- File.open(File.join(File.dirname(__FILE__),'glib2.gemspec'),'wb') do|f|
73
- f << tspec.result
45
+ Rake::ExtensionTask.new(package_name, spec) do |ext|
46
+ ext.cross_compile = true
47
+ ext.cross_compiling do |spec|
48
+ if /mingw|mswin/ =~ spec.platform.to_s
49
+ win32_dir = File.join("vendor", "local")
50
+ win32_files = []
51
+ Find.find(win32_dir) do |file|
52
+ next if /\.zip\z/ =~ file
53
+ win32_files << file
54
+ end
55
+ spec.files += win32_files
56
+ end
74
57
  end
75
58
  end
76
59
 
77
- desc 'Build gem'
78
- task :package => :gemspec do
79
- require 'rubygems/specification'
80
- spec_source = File.read File.join(File.dirname(__FILE__),'glib2.gemspec')
81
- spec = nil
82
- # see: http://gist.github.com/16215
83
- Thread.new { spec = eval("$SAFE = 3\n#{spec_source}") }.join
84
- spec.validate
85
- Gem::Builder.new(spec).build
60
+ namespace :win32 do
61
+ desc "download Windows binaries"
62
+ task :download do
63
+ base_dir = File.join(File.dirname(__FILE__), "lib")
64
+ $LOAD_PATH.unshift(base_dir)
65
+ require 'gnome2-win32-binary-downloader'
66
+ GNOME2Win32BinaryDownloader.download(:package => "glib",
67
+ :dependencies => ["gettext-runtime"])
68
+ end
86
69
  end
87
-
@@ -0,0 +1,10 @@
1
+ install-so:
2
+ $(INSTALL_DATA) $(srcdir)/rbglib.h $(RUBYARCHDIR)
3
+ $(INSTALL_DATA) $(srcdir)/rbgutil.h $(RUBYARCHDIR)
4
+ $(INSTALL_DATA) $(srcdir)/rbgobject.h $(RUBYARCHDIR)
5
+ $(INSTALL_DATA) $(srcdir)/rbgcompat.h $(RUBYARCHDIR)
6
+ $(INSTALL_DATA) glib-enum-types.h $(RUBYARCHDIR)
7
+
8
+ install:
9
+ $(MAKEDIRS) $(libdir)/pkgconfig
10
+ $(INSTALL_DATA) ruby-glib2.pc $(libdir)/pkgconfig
@@ -0,0 +1,61 @@
1
+ =begin
2
+ extconf.rb for Ruby/GLib extention library
3
+ =end
4
+
5
+ require 'pathname'
6
+
7
+ base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
8
+ mkmf_gnome2_dir = base_dir + 'lib'
9
+
10
+ $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
11
+
12
+ module_name = "glib2"
13
+ package_id = "gobject-2.0"
14
+
15
+ require 'mkmf-gnome2'
16
+
17
+ setup_win32(module_name, base_dir)
18
+
19
+ PKGConfig.have_package(package_id) or exit 1
20
+ PKGConfig.have_package('gthread-2.0')
21
+
22
+ have_header("unistd.h")
23
+ have_header("io.h")
24
+
25
+ glib_header = "glib.h"
26
+ have_func("g_spawn_close_pid", glib_header)
27
+ have_func("g_thread_init", glib_header)
28
+ have_func("g_main_depth", glib_header)
29
+ have_func("g_listenv", glib_header)
30
+
31
+ ruby_header = "ruby.h"
32
+ have_func("rb_check_array_type", ruby_header)
33
+ have_func("rb_exec_recursive", ruby_header)
34
+ have_func("rb_errinfo", ruby_header)
35
+ have_func("rb_sourcefile", ruby_header)
36
+ have_func("rb_sourceline", ruby_header)
37
+ have_func("ruby_set_current_source", ruby_header)
38
+ have_func("rb_thread_blocking_region", ruby_header)
39
+ have_func("ruby_native_thread_p", ruby_header)
40
+ have_func("rb_str_encode", ruby_header)
41
+
42
+ have_var("curr_thread", [ruby_header, "node.h"])
43
+ have_var("rb_curr_thread", [ruby_header, "node.h"])
44
+
45
+ create_pkg_config_file("Ruby/GLib2", package_id)
46
+
47
+ enum_type_prefix = "glib-enum-types"
48
+ include_paths = PKGConfig.cflags_only_I("glib-2.0")
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"])
59
+
60
+ $defs << "-DRUBY_GLIB2_COMPILATION"
61
+ create_makefile(module_name)
@@ -0,0 +1,89 @@
1
+ EXPORTS
2
+ Init_glib2
3
+ mGLib DATA
4
+ rbgobj_cType DATA
5
+ rbgobj_id_children DATA
6
+ rbgobj_add_relative
7
+ rbgobj_invalidate_relatives
8
+ rbgobj_add_relative_removable
9
+ rbgobj_get_relative_removable
10
+ rbgobj_remove_relative
11
+ rbgobj_remove_relative_all
12
+ rbgobj_define_class
13
+ rbgobj_define_class_dynamic
14
+ rbgobj_instance_from_ruby_object
15
+ rbgobj_ruby_object_from_instance
16
+ rbgobj_ruby_object_from_instance2
17
+ rbgobj_ruby_object_from_instance_with_unref
18
+ rbgobj_get_ruby_object_from_gobject
19
+ rbgobj_create_object
20
+ rbgobj_gobject_new
21
+ rbgobj_boxed_create
22
+ rbgobj_boxed_get
23
+ rbgobj_boxed_not_copy_obj
24
+ rbgobj_make_boxed
25
+ rbgobj_add_abstract_but_create_instance_class
26
+ rbgobj_gtype_get
27
+ rbgobj_gtype_new
28
+ rbgobj_gvalue_to_rvalue
29
+ rbgobj_rvalue_to_gvalue
30
+ rbgobj_initialize_gvalue
31
+ rbgobj_initialize_object
32
+ rbgobj_lookup_class
33
+ rbgobj_lookup_class_by_gtype
34
+ rbgobj_gtype_to_ruby_class
35
+ rbgobj_ptr2cptr
36
+ rbgobj_ptr_new
37
+ rbgobj_make_enum
38
+ rbgobj_get_enum
39
+ rbgobj_make_flags
40
+ rbgobj_get_flags
41
+ rbgobj_register_g2r_func
42
+ rbgobj_register_r2g_func
43
+ rbgobj_register_class
44
+ rbgobj_register_property_getter
45
+ rbgobj_register_property_setter
46
+ rbgobj_set_signal_func
47
+ rbgobj_get_signal_func
48
+ rbgobj_add_constants
49
+ rbgobj_constant_remap
50
+ rbgobj_signal_wrap
51
+ g_rclosure_new
52
+ g_rclosure_attach
53
+ g_rclosure_set_tag
54
+ rbgobj_ruby_value_get_type
55
+ g_value_get_ruby_value
56
+ g_value_set_ruby_value
57
+ g_key_file_get_type
58
+ rbg_rval_inspect
59
+ rbg_rval2cstr_accept_nil
60
+ rbg_cstr2rval
61
+ rbg_cstr2rval_with_free
62
+ rbg_string_value_ptr
63
+ rbgutil_id_module_eval DATA
64
+ rbgutil_def_setters
65
+ rbgutil_glist2ary
66
+ rbgutil_glist2ary_boxed
67
+ rbgutil_glist2ary_string
68
+ rbgutil_glist2ary_and_free
69
+ rbgutil_glist2ary_boxed_and_free
70
+ rbgutil_glist2ary_string_and_free
71
+ rbgutil_gslist2ary
72
+ rbgutil_gslist2ary_boxed
73
+ rbgutil_gslist2ary_and_free
74
+ rbgutil_gslist2ary_boxed_and_free
75
+ rbgutil_set_properties
76
+ rbgutil_sym_g2r_func
77
+ rbgutil_protect
78
+ rbgutil_invoke_callback
79
+ rbgutil_start_callback_dispatch_thread
80
+ rbgutil_stop_callback_dispatch_thread
81
+ rbgutil_string_set_utf8_encoding
82
+ rbgerr_define_gerror
83
+ rbgerr_gerror2exception
84
+ rbgobj_convert_define
85
+ rbgobj_fund_define_fundamental
86
+ rbgobj_gc_mark_gvalue
87
+ rbgobj_gc_mark_instance
88
+
89
+ g_connect_flags_get_type
File without changes
@@ -71,15 +71,25 @@ rbg_cstr2rval(const char* str)
71
71
  return str ? rb_str_new2(str) : Qnil;
72
72
  }
73
73
 
74
+ static VALUE
75
+ rbg_cstr2rval_with_free_body(VALUE str)
76
+ {
77
+ return rb_str_new2((gchar *)str);
78
+ }
79
+
80
+ static VALUE
81
+ rbg_cstr2rval_with_free_ensure(VALUE str)
82
+ {
83
+ g_free((gchar *)str);
84
+
85
+ return Qnil;
86
+ }
87
+
74
88
  VALUE
75
- rbg_cstr2rval_with_free(gchar* str)
89
+ rbg_cstr2rval_with_free(gchar *str)
76
90
  {
77
- VALUE ret = Qnil;
78
- if (str) {
79
- ret = rb_str_new2(str);
80
- g_free(str);
81
- }
82
- return ret;
91
+ return str ? rb_ensure(rbg_cstr2rval_with_free_body, (VALUE)str,
92
+ rbg_cstr2rval_with_free_ensure, (VALUE)str) : Qnil;
83
93
  }
84
94
 
85
95
  #if 0