cairo 1.8.1 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of cairo might be problematic. Click here for more details.

Files changed (258) hide show
  1. data/NEWS +16 -0
  2. data/Rakefile +14 -15
  3. data/{src → ext/cairo}/cairo.def +0 -0
  4. data/ext/cairo/extconf.rb +80 -0
  5. data/{src → ext/cairo}/rb_cairo.c +1 -1
  6. data/{src → ext/cairo}/rb_cairo.h +0 -0
  7. data/{src → ext/cairo}/rb_cairo_constants.c +0 -0
  8. data/{src → ext/cairo}/rb_cairo_context.c +0 -0
  9. data/{src → ext/cairo}/rb_cairo_exception.c +0 -0
  10. data/{src → ext/cairo}/rb_cairo_font_extents.c +0 -0
  11. data/{src → ext/cairo}/rb_cairo_font_face.c +0 -0
  12. data/{src → ext/cairo}/rb_cairo_font_options.c +0 -0
  13. data/{src → ext/cairo}/rb_cairo_glyph.c +0 -0
  14. data/{src → ext/cairo}/rb_cairo_matrix.c +0 -0
  15. data/{src → ext/cairo}/rb_cairo_path.c +0 -0
  16. data/{src → ext/cairo}/rb_cairo_pattern.c +0 -0
  17. data/{src → ext/cairo}/rb_cairo_private.c +1 -1
  18. data/{src → ext/cairo}/rb_cairo_private.h +0 -0
  19. data/{src → ext/cairo}/rb_cairo_scaled_font.c +0 -0
  20. data/{src → ext/cairo}/rb_cairo_surface.c +0 -0
  21. data/{src → ext/cairo}/rb_cairo_text_cluster.c +0 -0
  22. data/{src → ext/cairo}/rb_cairo_text_extents.c +0 -0
  23. data/extconf.rb +30 -141
  24. data/{src/lib → lib}/cairo.rb +7 -2
  25. data/{src/lib → lib}/cairo/color.rb +14 -2
  26. data/{src/lib → lib}/cairo/colors.rb +0 -0
  27. data/{src/lib → lib}/cairo/constants.rb +0 -0
  28. data/{src/lib → lib}/cairo/context.rb +0 -0
  29. data/{src/lib → lib}/cairo/context/blur.rb +0 -0
  30. data/{src/lib → lib}/cairo/context/circle.rb +0 -0
  31. data/{src/lib → lib}/cairo/context/color.rb +0 -0
  32. data/{src/lib → lib}/cairo/context/path.rb +0 -0
  33. data/{src/lib → lib}/cairo/context/rectangle.rb +0 -0
  34. data/{src/lib → lib}/cairo/context/triangle.rb +0 -0
  35. data/{src/lib → lib}/cairo/paper.rb +0 -0
  36. data/{src/lib → lib}/cairo/papers.rb +0 -0
  37. data/{src/lib → lib}/cairo/path.rb +0 -0
  38. data/{src/lib → lib}/cairo/point.rb +0 -0
  39. data/pkg-config.rb +6 -1
  40. data/test/run-test.rb +3 -3
  41. data/test/test_color.rb +17 -0
  42. metadata +72 -260
  43. data/ChangeLog +0 -1662
  44. data/README +0 -82
  45. data/doc/doc.css +0 -91
  46. data/doc/en/cairo-antialias.html +0 -38
  47. data/doc/en/cairo-clip-not-representable-error.html +0 -47
  48. data/doc/en/cairo-color-base.html +0 -69
  49. data/doc/en/cairo-color-cmyk.html +0 -157
  50. data/doc/en/cairo-color-hsv.html +0 -137
  51. data/doc/en/cairo-color-rgb.html +0 -142
  52. data/doc/en/cairo-color-x11.html +0 -173
  53. data/doc/en/cairo-color.html +0 -238
  54. data/doc/en/cairo-content.html +0 -37
  55. data/doc/en/cairo-context-blur.html +0 -39
  56. data/doc/en/cairo-context-circle.html +0 -39
  57. data/doc/en/cairo-context-color.html +0 -39
  58. data/doc/en/cairo-context-path.html +0 -44
  59. data/doc/en/cairo-context-rectangle.html +0 -39
  60. data/doc/en/cairo-context-triangle.html +0 -39
  61. data/doc/en/cairo-context.html +0 -643
  62. data/doc/en/cairo-error.html +0 -44
  63. data/doc/en/cairo-extend.html +0 -38
  64. data/doc/en/cairo-file-not-found.html +0 -47
  65. data/doc/en/cairo-fill-rule.html +0 -36
  66. data/doc/en/cairo-filter.html +0 -40
  67. data/doc/en/cairo-font-extents.html +0 -129
  68. data/doc/en/cairo-font-face.html +0 -38
  69. data/doc/en/cairo-font-options.html +0 -139
  70. data/doc/en/cairo-font-slant.html +0 -37
  71. data/doc/en/cairo-font-type-mismatch.html +0 -47
  72. data/doc/en/cairo-font-weight.html +0 -36
  73. data/doc/en/cairo-format.html +0 -46
  74. data/doc/en/cairo-glyph.html +0 -99
  75. data/doc/en/cairo-gradient-pattern.html +0 -74
  76. data/doc/en/cairo-hint-metrics.html +0 -37
  77. data/doc/en/cairo-hint-style.html +0 -39
  78. data/doc/en/cairo-image-surface.html +0 -82
  79. data/doc/en/cairo-invalid-clusters.html +0 -47
  80. data/doc/en/cairo-invalid-content-error.html +0 -47
  81. data/doc/en/cairo-invalid-dash-error.html +0 -47
  82. data/doc/en/cairo-invalid-dsc-comment-error.html +0 -47
  83. data/doc/en/cairo-invalid-format-error.html +0 -47
  84. data/doc/en/cairo-invalid-index-error.html +0 -47
  85. data/doc/en/cairo-invalid-matrix-error.html +0 -47
  86. data/doc/en/cairo-invalid-path-data-error.html +0 -47
  87. data/doc/en/cairo-invalid-pop-group-error.html +0 -47
  88. data/doc/en/cairo-invalid-restore-error.html +0 -47
  89. data/doc/en/cairo-invalid-slant.html +0 -47
  90. data/doc/en/cairo-invalid-status-error.html +0 -47
  91. data/doc/en/cairo-invalid-stride-error.html +0 -47
  92. data/doc/en/cairo-invalid-string-error.html +0 -47
  93. data/doc/en/cairo-invalid-visual-error.html +0 -47
  94. data/doc/en/cairo-invalid-weight.html +0 -47
  95. data/doc/en/cairo-line-cap.html +0 -37
  96. data/doc/en/cairo-line-join.html +0 -37
  97. data/doc/en/cairo-linear-pattern.html +0 -60
  98. data/doc/en/cairo-matrix.html +0 -259
  99. data/doc/en/cairo-negative-count.html +0 -47
  100. data/doc/en/cairo-no-current-point-error.html +0 -47
  101. data/doc/en/cairo-null-pointer-error.html +0 -47
  102. data/doc/en/cairo-operator.html +0 -48
  103. data/doc/en/cairo-paper-parse-error.html +0 -47
  104. data/doc/en/cairo-paper-unknown-paper-name.html +0 -66
  105. data/doc/en/cairo-paper-unknown-unit.html +0 -66
  106. data/doc/en/cairo-paper-unrecognized-paper-description.html +0 -66
  107. data/doc/en/cairo-paper.html +0 -184
  108. data/doc/en/cairo-path-close-path.html +0 -49
  109. data/doc/en/cairo-path-curve-to.html +0 -49
  110. data/doc/en/cairo-path-data-type.html +0 -38
  111. data/doc/en/cairo-path-data.html +0 -98
  112. data/doc/en/cairo-path-line-to.html +0 -49
  113. data/doc/en/cairo-path-move-to.html +0 -49
  114. data/doc/en/cairo-path.html +0 -155
  115. data/doc/en/cairo-pattern-type-mismatch-error.html +0 -47
  116. data/doc/en/cairo-pattern.html +0 -99
  117. data/doc/en/cairo-pdf-surface.html +0 -57
  118. data/doc/en/cairo-point.html +0 -74
  119. data/doc/en/cairo-ps-level.html +0 -49
  120. data/doc/en/cairo-ps-surface.html +0 -92
  121. data/doc/en/cairo-quartz-image-surface.html +0 -57
  122. data/doc/en/cairo-quartz-surface.html +0 -57
  123. data/doc/en/cairo-radial-pattern.html +0 -60
  124. data/doc/en/cairo-read-error.html +0 -47
  125. data/doc/en/cairo-rectangle.html +0 -89
  126. data/doc/en/cairo-scaled-font.html +0 -94
  127. data/doc/en/cairo-solid-pattern.html +0 -62
  128. data/doc/en/cairo-subpixel-order.html +0 -39
  129. data/doc/en/cairo-surface-finished-error.html +0 -47
  130. data/doc/en/cairo-surface-pattern.html +0 -57
  131. data/doc/en/cairo-surface-type-mismatch-error.html +0 -47
  132. data/doc/en/cairo-surface.html +0 -121
  133. data/doc/en/cairo-svg-surface.html +0 -77
  134. data/doc/en/cairo-svg-version.html +0 -49
  135. data/doc/en/cairo-temp-file-error.html +0 -47
  136. data/doc/en/cairo-text-cluster-flag.html +0 -35
  137. data/doc/en/cairo-text-cluster.html +0 -84
  138. data/doc/en/cairo-text-extents.html +0 -144
  139. data/doc/en/cairo-toy-font-face.html +0 -67
  140. data/doc/en/cairo-user-font-error.html +0 -47
  141. data/doc/en/cairo-user-font-face-text-to-glyphs-data.html +0 -94
  142. data/doc/en/cairo-user-font-face.html +0 -72
  143. data/doc/en/cairo-user-font-immutable.html +0 -47
  144. data/doc/en/cairo-win32-printing-surface.html +0 -57
  145. data/doc/en/cairo-win32-surface.html +0 -62
  146. data/doc/en/cairo-write-error.html +0 -47
  147. data/doc/en/cairo.html +0 -131
  148. data/doc/en/index.html +0 -1154
  149. data/doc/index.html +0 -18
  150. data/doc/ja/cairo-antialias.html +0 -57
  151. data/doc/ja/cairo-clip-not-representable-error.html +0 -56
  152. data/doc/ja/cairo-color-base.html +0 -75
  153. data/doc/ja/cairo-color-cmyk.html +0 -152
  154. data/doc/ja/cairo-color-hsv.html +0 -135
  155. data/doc/ja/cairo-color-rgb.html +0 -145
  156. data/doc/ja/cairo-color-x11.html +0 -183
  157. data/doc/ja/cairo-color.html +0 -317
  158. data/doc/ja/cairo-content.html +0 -51
  159. data/doc/ja/cairo-context-blur.html +0 -53
  160. data/doc/ja/cairo-context-circle.html +0 -54
  161. data/doc/ja/cairo-context-color.html +0 -52
  162. data/doc/ja/cairo-context-path.html +0 -77
  163. data/doc/ja/cairo-context-rectangle.html +0 -60
  164. data/doc/ja/cairo-context-triangle.html +0 -47
  165. data/doc/ja/cairo-context.html +0 -1542
  166. data/doc/ja/cairo-error.html +0 -56
  167. data/doc/ja/cairo-extend.html +0 -56
  168. data/doc/ja/cairo-file-not-found.html +0 -51
  169. data/doc/ja/cairo-fill-rule.html +0 -58
  170. data/doc/ja/cairo-filter.html +0 -43
  171. data/doc/ja/cairo-font-extents.html +0 -164
  172. data/doc/ja/cairo-font-face.html +0 -55
  173. data/doc/ja/cairo-font-options.html +0 -189
  174. data/doc/ja/cairo-font-slant.html +0 -50
  175. data/doc/ja/cairo-font-type-mismatch.html +0 -52
  176. data/doc/ja/cairo-font-weight.html +0 -47
  177. data/doc/ja/cairo-format.html +0 -81
  178. data/doc/ja/cairo-glyph.html +0 -115
  179. data/doc/ja/cairo-gradient-pattern.html +0 -119
  180. data/doc/ja/cairo-hint-metrics.html +0 -57
  181. data/doc/ja/cairo-hint-style.html +0 -64
  182. data/doc/ja/cairo-image-surface.html +0 -131
  183. data/doc/ja/cairo-invalid-clusters.html +0 -55
  184. data/doc/ja/cairo-invalid-content-error.html +0 -54
  185. data/doc/ja/cairo-invalid-dash-error.html +0 -54
  186. data/doc/ja/cairo-invalid-dsc-comment-error.html +0 -54
  187. data/doc/ja/cairo-invalid-format-error.html +0 -54
  188. data/doc/ja/cairo-invalid-index-error.html +0 -54
  189. data/doc/ja/cairo-invalid-matrix-error.html +0 -54
  190. data/doc/ja/cairo-invalid-path-data-error.html +0 -54
  191. data/doc/ja/cairo-invalid-pop-group-error.html +0 -54
  192. data/doc/ja/cairo-invalid-restore-error.html +0 -55
  193. data/doc/ja/cairo-invalid-slant.html +0 -57
  194. data/doc/ja/cairo-invalid-status-error.html +0 -55
  195. data/doc/ja/cairo-invalid-stride-error.html +0 -55
  196. data/doc/ja/cairo-invalid-string-error.html +0 -54
  197. data/doc/ja/cairo-invalid-visual-error.html +0 -57
  198. data/doc/ja/cairo-invalid-weight.html +0 -57
  199. data/doc/ja/cairo-line-cap.html +0 -50
  200. data/doc/ja/cairo-line-join.html +0 -53
  201. data/doc/ja/cairo-linear-pattern.html +0 -87
  202. data/doc/ja/cairo-matrix.html +0 -354
  203. data/doc/ja/cairo-negative-count.html +0 -52
  204. data/doc/ja/cairo-no-current-point-error.html +0 -54
  205. data/doc/ja/cairo-null-pointer-error.html +0 -54
  206. data/doc/ja/cairo-operator.html +0 -51
  207. data/doc/ja/cairo-paper-parse-error.html +0 -55
  208. data/doc/ja/cairo-paper-unknown-paper-name.html +0 -76
  209. data/doc/ja/cairo-paper-unknown-unit.html +0 -75
  210. data/doc/ja/cairo-paper-unrecognized-paper-description.html +0 -76
  211. data/doc/ja/cairo-paper.html +0 -357
  212. data/doc/ja/cairo-path-close-path.html +0 -57
  213. data/doc/ja/cairo-path-curve-to.html +0 -70
  214. data/doc/ja/cairo-path-data-type.html +0 -53
  215. data/doc/ja/cairo-path-data.html +0 -127
  216. data/doc/ja/cairo-path-line-to.html +0 -62
  217. data/doc/ja/cairo-path-move-to.html +0 -62
  218. data/doc/ja/cairo-path.html +0 -144
  219. data/doc/ja/cairo-pattern-type-mismatch-error.html +0 -56
  220. data/doc/ja/cairo-pattern.html +0 -128
  221. data/doc/ja/cairo-pdf-surface.html +0 -86
  222. data/doc/ja/cairo-point.html +0 -90
  223. data/doc/ja/cairo-ps-level.html +0 -62
  224. data/doc/ja/cairo-ps-surface.html +0 -214
  225. data/doc/ja/cairo-quartz-image-surface.html +0 -75
  226. data/doc/ja/cairo-quartz-surface.html +0 -93
  227. data/doc/ja/cairo-radial-pattern.html +0 -93
  228. data/doc/ja/cairo-read-error.html +0 -55
  229. data/doc/ja/cairo-rectangle.html +0 -109
  230. data/doc/ja/cairo-scaled-font.html +0 -180
  231. data/doc/ja/cairo-solid-pattern.html +0 -87
  232. data/doc/ja/cairo-subpixel-order.html +0 -57
  233. data/doc/ja/cairo-surface-finished-error.html +0 -54
  234. data/doc/ja/cairo-surface-pattern.html +0 -68
  235. data/doc/ja/cairo-surface-type-mismatch-error.html +0 -56
  236. data/doc/ja/cairo-surface.html +0 -213
  237. data/doc/ja/cairo-svg-surface.html +0 -114
  238. data/doc/ja/cairo-svg-version.html +0 -66
  239. data/doc/ja/cairo-temp-file-error.html +0 -50
  240. data/doc/ja/cairo-text-cluster-flag.html +0 -46
  241. data/doc/ja/cairo-text-cluster.html +0 -102
  242. data/doc/ja/cairo-text-extents.html +0 -163
  243. data/doc/ja/cairo-toy-font-face.html +0 -107
  244. data/doc/ja/cairo-user-font-error.html +0 -55
  245. data/doc/ja/cairo-user-font-face-text-to-glyphs-data.html +0 -156
  246. data/doc/ja/cairo-user-font-face.html +0 -268
  247. data/doc/ja/cairo-user-font-immutable.html +0 -54
  248. data/doc/ja/cairo-win32-printing-surface.html +0 -80
  249. data/doc/ja/cairo-win32-surface.html +0 -100
  250. data/doc/ja/cairo-write-error.html +0 -55
  251. data/doc/ja/cairo.html +0 -177
  252. data/doc/ja/index.html +0 -1156
  253. data/src/tml/make/libpng_1.2.32-1_win32.log +0 -269
  254. data/src/tml/make/libpng_1.2.32-1_win32.sh +0 -63
  255. data/test/example_d.exe +0 -0
  256. data/test/minigzip_d.exe +0 -0
  257. data/test/testzlib_d.exe +0 -0
  258. data/test/untgz_d.exe +0 -0
data/NEWS CHANGED
@@ -1,3 +1,19 @@
1
+ Release 1.8.3 (2010-08-26) Kouhei Sutou <kou@cozmixng.org>)
2
+ ===========================================================
3
+
4
+ Features
5
+ --------
6
+ * Support cairo 1.8.10.
7
+ * Support Ruby 1.9.2. (reported by Tasuku SUENAGA and kimura wataru)
8
+ * Fix RGV -> HSV conversion. (patch by Yuta Taniguchi)
9
+ * Support Cairo::Color as Hash key.
10
+
11
+ Thanks
12
+ ------
13
+ * Yuta Taniguchi
14
+ * Tasuku SUENAGA
15
+ * kimura wataru
16
+
1
17
  Release 1.8.1 (2009-12-13) Kouhei Sutou <kou@cozmixng.org>)
2
18
  ===========================================================
3
19
 
data/Rakefile CHANGED
@@ -6,14 +6,15 @@ require 'find'
6
6
  require 'fileutils'
7
7
  require 'rubygems'
8
8
  require 'hoe'
9
+ require 'rake/extensiontask'
9
10
 
10
11
  base_dir = File.join(File.dirname(__FILE__))
11
12
  truncate_base_dir = Proc.new do |x|
12
13
  x.gsub(/^#{Regexp.escape(base_dir + File::SEPARATOR)}/, '')
13
14
  end
14
15
 
15
- cairo_ext_dir = File.join(base_dir, 'src')
16
- cairo_lib_dir = File.join(cairo_ext_dir, 'lib')
16
+ cairo_ext_dir = File.join(base_dir, 'ext', 'cairo')
17
+ cairo_lib_dir = File.join(base_dir, 'lib')
17
18
  $LOAD_PATH.unshift(cairo_ext_dir)
18
19
  $LOAD_PATH.unshift(cairo_lib_dir)
19
20
  ENV["RUBYLIB"] = "#{cairo_lib_dir}:#{cairo_ext_dir}:#{ENV['RUBYLIB']}"
@@ -23,17 +24,14 @@ def guess_rcairo_version
23
24
  Cairo.bindings_version
24
25
  end
25
26
 
26
- cairo_win32_dir = "cairo"
27
- FileUtils.rm_rf(cairo_win32_dir)
28
-
29
27
  manifest = File.join(base_dir, "Manifest.txt")
30
28
  manifest_contents = []
31
29
  base_dir_included_components = %w(AUTHORS COPYING ChangeLog GPL
32
- NEWS README Rakefile
30
+ NEWS README.doc Rakefile
33
31
  extconf.rb pkg-config.rb)
34
32
  excluded_components = %w(.cvsignore .gdb_history CVS depend Makefile pkg
35
- .test-result)
36
- excluded_suffixes = %w(.png .ps .pdf .o .so .a .txt .~)
33
+ .test-result .gitignore .git vendor)
34
+ excluded_suffixes = %w(.png .ps .pdf .o .so .a .txt .~ .log)
37
35
  Find.find(base_dir) do |target|
38
36
  target = truncate_base_dir[target]
39
37
  components = target.split(File::SEPARATOR)
@@ -76,8 +74,8 @@ project = Hoe.spec('cairo') do |project|
76
74
  project.url = 'http://cairographics.org/rcairo'
77
75
  project.test_globs = []
78
76
  project.spec_extras = {
79
- :extensions => ['extconf.rb'],
80
- :require_paths => ['src/lib', 'src'],
77
+ :extensions => ['ext/cairo/extconf.rb'],
78
+ :require_paths => ['lib'],
81
79
  :has_rdoc => false,
82
80
  }
83
81
  platform = ENV["FORCE_PLATFORM"]
@@ -91,12 +89,13 @@ end
91
89
 
92
90
  project.spec.dependencies.delete_if {|dependency| dependency.name == "hoe"}
93
91
 
94
- if /mswin32/ =~ project.spec.platform.to_s
95
- project.spec.extensions = []
96
- project.spec.files += ["src/cairo.so", "src/libruby-cairo.a"]
92
+ Rake::ExtensionTask.new("cairo", project.spec) do |ext|
93
+ ext.cross_compile = true
94
+ ext.cross_platform = 'x86-mingw32'
95
+ end
97
96
 
98
- FileUtils.cp_r(File.expand_path("~/.wine/drive_c/cairo-dev"),
99
- cairo_win32_dir)
97
+ if /mswin32/ =~ project.spec.platform.to_s
98
+ cairo_win32_dir = File.join(base_dir, "vendor", "local")
100
99
  cairo_files = []
101
100
  Find.find(cairo_win32_dir) do |f|
102
101
  cairo_files << f
File without changes
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+ # vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 :
3
+
4
+ require 'pathname'
5
+ require 'English'
6
+ require 'mkmf'
7
+ require 'fileutils'
8
+
9
+ base_dir = (Pathname(__FILE__).dirname + ".." + "..").expand_path
10
+ $LOAD_PATH.unshift(base_dir.to_s)
11
+
12
+ require 'pkg-config'
13
+
14
+ checking_for(checking_message("GCC")) do
15
+ if macro_defined?("__GNUC__", "")
16
+ $CFLAGS += ' -Wall'
17
+ true
18
+ else
19
+ false
20
+ end
21
+ end
22
+
23
+ package = "cairo"
24
+ module_name = "cairo"
25
+ major, minor, micro = 1, 2, 0
26
+
27
+ PKGConfig.have_package(package, major, minor, micro) or exit 1
28
+
29
+ checking_for(checking_message("Win32 OS")) do
30
+ case RUBY_PLATFORM
31
+ when /cygwin|mingw|mswin32/
32
+ $defs << "-DRUBY_CAIRO_PLATFORM_WIN32"
33
+ import_library_name = "libruby-#{module_name}.a"
34
+ $DLDFLAGS << " -Wl,--out-implib=#{import_library_name}"
35
+ $cleanfiles << import_library_name
36
+ local_cairo_install_dir = base_dir + "vendor" + "local"
37
+ $CFLAGS += " -I#{local_cairo_install_dir}/include"
38
+ local_cairo_lib_dir = local_cairo_install_dir + "lib"
39
+ ["cairo.lib", "libcairo.dll.a"].each do |libcairo_base|
40
+ libcairo = local_cairo_lib_dir + libcairo_base
41
+ if libcairo.exist?
42
+ $LDFLAGS += " -L#{local_cairo_lib_dir}"
43
+ break
44
+ end
45
+ end
46
+ true
47
+ else
48
+ false
49
+ end
50
+ end
51
+
52
+ checking_for(checking_message("Mac OS X")) do
53
+ case RUBY_PLATFORM
54
+ when /darwin/
55
+ if have_macro("CAIRO_HAS_QUARTZ_SURFACE", ["cairo.h"])
56
+ checking_for("RubyCocoa") do
57
+ begin
58
+ require 'osx/cocoa'
59
+ $defs << "-DHAVE_RUBY_COCOA"
60
+ $DLDFLAGS << " -Wl,-framework,RubyCocoa"
61
+ true
62
+ rescue LoadError
63
+ false
64
+ end
65
+ end
66
+ end
67
+ true
68
+ else
69
+ false
70
+ end
71
+ end
72
+
73
+ $defs << "-DRB_CAIRO_COMPILATION"
74
+
75
+ have_header("ruby/st.h") unless have_macro("HAVE_RUBY_ST_H", "ruby.h")
76
+ have_header("ruby/io.h") unless have_macro("HAVE_RUBY_IO_H", "ruby.h")
77
+ have_func("rb_errinfo", "ruby.h")
78
+ have_type("enum ruby_value_type", "ruby.h")
79
+
80
+ create_makefile(module_name)
@@ -76,7 +76,7 @@ Init_cairo ()
76
76
 
77
77
  rb_define_const (rb_mCairo, "BINDINGS_VERSION",
78
78
  rb_ary_new3 (4,
79
- INT2FIX (1), INT2FIX (8), INT2FIX (1), Qnil));
79
+ INT2FIX (1), INT2FIX (8), INT2FIX (3), Qnil));
80
80
 
81
81
  rb_define_module_function (rb_mCairo, "satisfied_version?",
82
82
  rb_cairo_satisfied_version, -1);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -24,7 +24,7 @@ VALUE
24
24
  rb_cairo__float_array (double *values, unsigned count)
25
25
  {
26
26
  VALUE result;
27
- int i;
27
+ unsigned i;
28
28
 
29
29
  result = rb_ary_new2 (count);
30
30
  for (i = 0; i < count; i++)
File without changes
File without changes
data/extconf.rb CHANGED
@@ -1,156 +1,45 @@
1
1
  #!/usr/bin/env ruby
2
- # vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 :
3
2
 
4
- $LOAD_PATH.unshift(File.dirname(__FILE__))
5
-
6
- require 'English'
3
+ require 'pathname'
7
4
  require 'mkmf'
8
- require 'pkg-config'
5
+ require 'rbconfig'
9
6
  require 'fileutils'
10
7
 
11
- # from mkmf-gnome2.rb
12
- STDOUT.print("checking for GCC... ")
13
- STDOUT.flush
14
- if macro_defined?("__GNUC__", "")
15
- STDOUT.print "yes\n"
16
- $CFLAGS += ' -Wall'
17
- $cc_is_gcc = true
18
- else
19
- STDOUT.print "no\n"
20
- $cc_is_gcc = false
21
- end
8
+ base_dir = Pathname(__FILE__).dirname.expand_path
9
+ ext_dir = base_dir + "ext" + "cairo"
22
10
 
23
- def check_win32
24
- checking_for("Win32 OS") do
25
- win32_os = /cygwin|mingw|mswin32/ =~ RUBY_PLATFORM
26
- if win32_os
27
- $defs << "-DRUBY_CAIRO_PLATFORM_WIN32"
28
- if $cc_is_gcc
29
- if /^2\./ =~ `#{Config::CONFIG['CC']} -dumpversion`.chomp
30
- $CFLAGS += ' -fnative-struct'
31
- else
32
- $CFLAGS += ' -mms-bitfields'
33
- end
34
- end
35
- end
36
- win32_os
37
- end
38
- end
11
+ ruby = File.join(RbConfig::CONFIG['bindir'],
12
+ RbConfig::CONFIG['ruby_install_name'] +
13
+ RbConfig::CONFIG["EXEEXT"])
39
14
 
40
- def set_output_lib(target_name, directory=nil)
41
- case RUBY_PLATFORM
42
- when /cygwin|mingw/
43
- filename = File.join(*([directory, "libruby-#{target_name}.a"].compact))
44
- if RUBY_VERSION > "1.8.0"
45
- $DLDFLAGS << ",--out-implib=#{filename}"
46
- elsif RUBY_VERSION > "1.8"
47
- $DLDFLAGS.gsub!(/ -Wl,--out-implib=[^ ]+/, '')
48
- $DLDFLAGS << " -Wl,--out-implib=#{filename}"
49
- else
50
- $DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
51
- $DLDFLAGS << " --output-lib #{filename}"
52
- end
53
- $cleanfiles << filename
54
- when /mswin32/
55
- $DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
56
- $DLDFLAGS.gsub!(/ \/IMPLIB:[^ ]+/, '')
57
- $DLDFLAGS << " /IMPLIB:$(IMPLIB)"
58
- when /darwin/
59
- if have_macro("CAIRO_HAS_QUARTZ_SURFACE", ["cairo.h"])
60
- checking_for("RubyCocoa") do
61
- begin
62
- require 'osx/cocoa'
63
- $defs << "-DHAVE_RUBY_COCOA"
64
- $DLDFLAGS << " -Wl,-framework,RubyCocoa"
65
- true
66
- rescue LoadError
67
- false
68
- end
69
- end
70
- end
71
- end
15
+ Dir.chdir(ext_dir.to_s) do
16
+ system(ruby, "extconf.rb")
72
17
  end
73
18
 
19
+ create_makefile("cairo")
20
+ FileUtils.mv("Makefile", "Makefile.lib")
74
21
 
75
- pkg = "cairo"
76
- modname = "cairo"
77
- ext_dir_name = "src"
78
- srcdir = File.join(File.expand_path(File.dirname(__FILE__)), ext_dir_name)
79
- major, minor, micro = 1, 2, 0
80
-
81
- PKGConfig.have_package(pkg, major, minor, micro) or exit 1
22
+ File.open("Makefile", "w") do |makefile|
23
+ makefile.puts(<<-EOM)
24
+ all:
25
+ $(MAKE) $(MAKEFLAGS) -C ext/cairo
26
+ $(MAKE) $(MAKEFLAGS) -f Makefile.lib
82
27
 
83
- have_header("ruby/st.h") unless have_macro("HAVE_RUBY_ST_H", "ruby.h")
84
- have_header("ruby/io.h") unless have_macro("HAVE_RUBY_IO_H", "ruby.h")
85
- have_func("rb_errinfo", "ruby.h")
86
- have_type("enum ruby_value_type", "ruby.h")
28
+ install:
29
+ $(MAKE) $(MAKEFLAGS) -C ext/cairo install
30
+ $(MAKE) $(MAKEFLAGS) -f Makefile.lib install
87
31
 
88
- check_win32
89
- target_name = File.basename(modname)
90
- set_output_lib(target_name, ext_dir_name)
91
- $defs << "-DRB_CAIRO_COMPILATION"
92
- create_makefile(modname, srcdir)
32
+ site-install:
33
+ $(MAKE) $(MAKEFLAGS) -C ext/cairo site-install
34
+ $(MAKE) $(MAKEFLAGS) -f Makefile.lib site-install
93
35
 
94
- wine = with_config("wine", false)
36
+ clean:
37
+ $(MAKE) $(MAKEFLAGS) -C ext/cairo clean
38
+ $(MAKE) $(MAKEFLAGS) -f Makefile.lib clean
95
39
 
96
- makefile = File.read("Makefile")
97
- File.open("Makefile", "w") do |f|
98
- objs = []
99
- co = nil
100
- makefile.each_line do |line|
101
- if wine
102
- line.gsub!(/\s+gcc\b/, " i586-mingw32msvc-gcc")
103
- line.gsub!(/C:/, "$(HOME)/.wine/drive_c")
104
- line.gsub!(/Z:/, "")
105
- end
106
-
107
- case line
108
- when /^DLLIB\s*=\s*/
109
- dllib = $POSTMATCH
110
- f.puts("DLLIB = #{ext_dir_name}/#{dllib}")
111
- f.puts("IMPLIB = #{ext_dir_name}/libruby-#{dllib.gsub(/\..+?$/, '.lib')}")
112
- when /^(SRCS)\s*=\s*/
113
- name = $1
114
- vars = $POSTMATCH.split.collect {|var| "$(srcdir)/#{var}"}.join(" ")
115
- f.puts("#{name} = #{vars}")
116
- when /^(OBJS|CLEANLIBS|CLEANOBJS)\s*=\s*/
117
- name = $1
118
- vars = $POSTMATCH.split.collect {|var| "#{ext_dir_name}/#{var}"}
119
- objs = vars if name == "OBJS"
120
- vars = vars.join(" ")
121
- f.puts("#{name} = #{vars}")
122
- when /^LDSHARED\s*=/
123
- def_file = "#{ext_dir_name}/#{target_name}.def"
124
- line.gsub!(/\b-shared\b/, "-shared #{def_file}") if wine
125
- f.puts(line)
126
- when /^\t\$\(CC\)/
127
- if PKGConfig.msvc?
128
- output_option = "-Fo"
129
- else
130
- output_option = "-o"
131
- end
132
- unless /#{Regexp.escape(output_option)}/ =~ line
133
- line = "#{line.chomp} #{output_option}$@"
134
- end
135
- co = line
136
- f.puts(line)
137
- else
138
- f.puts(line)
139
- end
140
- end
141
-
142
- if co and !objs.empty?
143
- f.puts
144
- if PKGConfig.msvc?
145
- f.puts "{$(srcdir)}.c{#{ext_dir_name}}.obj:"
146
- f.puts co
147
- else
148
- objs.each do |obj|
149
- f.puts "#{obj}: $(srcdir)/#{File.basename(obj).sub(/\..+?$/, '.c')}"
150
- f.puts co
151
- end
152
- end
153
- end
40
+ distclean:
41
+ $(MAKE) $(MAKEFLAGS) -C ext/cairo distclean
42
+ $(MAKE) $(MAKEFLAGS) -f Makefile.lib distclean
43
+ @rm -f Makefile.lib
44
+ EOM
154
45
  end
155
-
156
- FileUtils.mkdir_p(ext_dir_name)
@@ -3,7 +3,7 @@
3
3
  if /mingw|mswin|mswin32/ =~ RUBY_PLATFORM
4
4
  require 'pathname'
5
5
  base_dir = Pathname(File.dirname(__FILE__))
6
- base_dir = base_dir.parent.parent + "cairo"
6
+ base_dir = base_dir.parent + "vendor" + "local"
7
7
  if base_dir.exist?
8
8
  base_dir = base_dir.to_s.gsub(/\//, "\\")
9
9
  ENV['PATH'] = %w(bin lib).collect do |dir|
@@ -39,7 +39,12 @@ end
39
39
  require 'cairo/color'
40
40
  require 'cairo/paper'
41
41
 
42
- require 'cairo.so'
42
+ begin
43
+ major, minor, micro, = RUBY_VERSION.split(/\./)
44
+ require "#{major}.#{minor}/cairo.so"
45
+ rescue LoadError
46
+ require 'cairo.so'
47
+ end
43
48
  require 'cairo/constants'
44
49
 
45
50
  module Cairo
@@ -88,6 +88,18 @@ module Cairo
88
88
  @blue = b
89
89
  end
90
90
 
91
+ def hash
92
+ to_s.hash
93
+ end
94
+
95
+ def eql?(other)
96
+ self == other
97
+ end
98
+
99
+ def ==(other)
100
+ other.is_a?(self.class) and other.to_s == to_s
101
+ end
102
+
91
103
  def to_a
92
104
  [@red, @green, @blue, @alpha]
93
105
  end
@@ -123,10 +135,10 @@ module Cairo
123
135
  when @red
124
136
  numerator = @green - @blue
125
137
  angle = 0
126
- when @blue
138
+ when @green
127
139
  numerator = @blue - @red
128
140
  angle = 120
129
- when @green
141
+ when @blue
130
142
  numerator = @red - @green
131
143
  angle = 240
132
144
  end