cairo-gobject 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +32 -0
- data/ext/cairo-gobject/extconf.rb +94 -0
- data/ext/cairo-gobject/rb-cairo-gobject.c +146 -0
- data/ext/cairo-gobject/rb-cairo-gobject.h +42 -0
- data/extconf.rb +71 -0
- data/lib/cairo-gobject.rb +30 -0
- data/test/cairo-gobject-test-utils.rb +21 -0
- data/test/run-test.rb +50 -0
- metadata +117 -0
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
$LOAD_PATH.unshift("./../glib2/lib")
|
20
|
+
require "gnome2-raketask"
|
21
|
+
|
22
|
+
package = GNOME2Package.new do |_package|
|
23
|
+
_package.summary = "Ruby/CairoGObject is a Ruby binding of cairo-gobject."
|
24
|
+
_package.description = "Ruby/CairoGObject is a Ruby binding of cairo-gobject."
|
25
|
+
_package.dependency.gem.runtime = ["cairo", "glib2"]
|
26
|
+
_package.dependency.gem.development = ["test-unit-notify"]
|
27
|
+
_package.win32.packages = []
|
28
|
+
_package.win32.dependencies = []
|
29
|
+
_package.win32.build_dependencies = ["cairo", "glib2"]
|
30
|
+
_package.win32.build_packages = []
|
31
|
+
end
|
32
|
+
package.define_tasks
|
@@ -0,0 +1,94 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
require "pathname"
|
20
|
+
|
21
|
+
source_dir = Pathname(__FILE__).dirname
|
22
|
+
base_dir = source_dir.parent.parent.expand_path
|
23
|
+
top_dir = base_dir.parent.expand_path
|
24
|
+
top_build_dir = Pathname(".").parent.parent.parent.expand_path
|
25
|
+
|
26
|
+
mkmf_gnome2_dir = top_dir + "glib2" + "lib"
|
27
|
+
version_suffix = ""
|
28
|
+
unless mkmf_gnome2_dir.exist?
|
29
|
+
if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
|
30
|
+
version_suffix = $1
|
31
|
+
mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + "lib"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
$LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
|
36
|
+
|
37
|
+
module_name = "cairo_gobject"
|
38
|
+
package_id = "cairo-gobject"
|
39
|
+
|
40
|
+
begin
|
41
|
+
require "mkmf-gnome2"
|
42
|
+
rescue LoadError
|
43
|
+
require "rubygems"
|
44
|
+
gem "glib2"
|
45
|
+
require "mkmf-gnome2"
|
46
|
+
end
|
47
|
+
|
48
|
+
["glib2"].each do |package|
|
49
|
+
directory = "#{package}#{version_suffix}"
|
50
|
+
build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
|
51
|
+
add_depend_package(package, "#{directory}/ext/#{package}",
|
52
|
+
top_dir.to_s,
|
53
|
+
:top_build_dir => top_build_dir.to_s,
|
54
|
+
:target_build_dir => build_dir)
|
55
|
+
end
|
56
|
+
|
57
|
+
rcairo_options = {}
|
58
|
+
rcairo_source_dir_names = ["rcairo"]
|
59
|
+
if /mingw|cygwin|mswin32/ =~ RUBY_PLATFORM
|
60
|
+
rcairo_source_dir_names.unshift("rcairo.win32")
|
61
|
+
end
|
62
|
+
rcairo_source_dir_names.each do |rcairo_source_dir_name|
|
63
|
+
rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
|
64
|
+
if rcairo_source_dir.exist?
|
65
|
+
rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
|
66
|
+
break
|
67
|
+
end
|
68
|
+
end
|
69
|
+
check_cairo(rcairo_options)
|
70
|
+
|
71
|
+
setup_win32(module_name, base_dir)
|
72
|
+
|
73
|
+
unless required_pkg_config_package(package_id,
|
74
|
+
:debian => "libcairo-gobject2",
|
75
|
+
:fedora => "cairo-gobject-devel")
|
76
|
+
exit(false)
|
77
|
+
end
|
78
|
+
|
79
|
+
create_pkg_config_file("Ruby/CairoGObject",
|
80
|
+
package_id, ruby_gnome2_version,
|
81
|
+
"ruby-cairo-gobject.pc")
|
82
|
+
|
83
|
+
ensure_objs
|
84
|
+
|
85
|
+
$defs << "-DRUBY_CAIRO_GOBJECT_COMPILATION"
|
86
|
+
create_makefile(module_name)
|
87
|
+
|
88
|
+
pkg_config_dir = with_config("pkg-config-dir")
|
89
|
+
if pkg_config_dir.is_a?(String)
|
90
|
+
File.open("Makefile", "ab") do |makefile|
|
91
|
+
makefile.puts
|
92
|
+
makefile.puts("pkgconfigdir=#{pkg_config_dir}")
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2013 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rb-cairo-gobject.h"
|
22
|
+
|
23
|
+
#define RG_TARGET_NAMESPACE rb_mCairoGObject
|
24
|
+
|
25
|
+
#define DEFINE_CONVERSION(prefix, gtype, rb_klass, RVAL2CR, CR2RVAL) \
|
26
|
+
static gpointer \
|
27
|
+
prefix ## _robj2instance(VALUE rb_object, \
|
28
|
+
G_GNUC_UNUSED gpointer user_data) \
|
29
|
+
{ \
|
30
|
+
VALUE rb_boxed; \
|
31
|
+
\
|
32
|
+
rb_boxed = rb_iv_get(rb_object, "gboxed"); \
|
33
|
+
if (NIL_P(rb_boxed)) { \
|
34
|
+
gpointer cr_object = RVAL2CR(rb_object); \
|
35
|
+
rb_boxed = rbgobj_make_boxed_default(cr_object, gtype); \
|
36
|
+
rb_iv_set(rb_object, "gboxed", rb_boxed); \
|
37
|
+
} \
|
38
|
+
\
|
39
|
+
return rbgobj_boxed_get_default(rb_boxed, gtype); \
|
40
|
+
} \
|
41
|
+
\
|
42
|
+
static VALUE \
|
43
|
+
prefix ## _instance2robj(gpointer cr_object, \
|
44
|
+
G_GNUC_UNUSED gpointer user_data) \
|
45
|
+
{ \
|
46
|
+
return CR2RVAL(cr_object); \
|
47
|
+
} \
|
48
|
+
\
|
49
|
+
static void \
|
50
|
+
define_ ## prefix ## _conversion(void) \
|
51
|
+
{ \
|
52
|
+
RGConvertTable table; \
|
53
|
+
\
|
54
|
+
memset(&table, 0, sizeof(RGConvertTable)); \
|
55
|
+
table.type = gtype; \
|
56
|
+
table.klass = rb_klass; \
|
57
|
+
table.robj2instance = prefix ## _robj2instance; \
|
58
|
+
table.instance2robj = prefix ## _instance2robj; \
|
59
|
+
\
|
60
|
+
RG_DEF_CONVERSION(&table); \
|
61
|
+
}
|
62
|
+
|
63
|
+
DEFINE_CONVERSION(context, CAIRO_GOBJECT_TYPE_CONTEXT, rb_cCairo_Context,
|
64
|
+
RVAL2CRCONTEXT, CRCONTEXT2RVAL)
|
65
|
+
DEFINE_CONVERSION(device, CAIRO_GOBJECT_TYPE_DEVICE, rb_cCairo_Device,
|
66
|
+
RVAL2CRDEVICE, CRDEVICE2RVAL)
|
67
|
+
DEFINE_CONVERSION(pattern, CAIRO_GOBJECT_TYPE_PATTERN, rb_cCairo_Pattern,
|
68
|
+
RVAL2CRPATTERN, CRPATTERN2RVAL)
|
69
|
+
DEFINE_CONVERSION(surface, CAIRO_GOBJECT_TYPE_SURFACE, rb_cCairo_Surface,
|
70
|
+
RVAL2CRSURFACE, CRSURFACE2RVAL)
|
71
|
+
DEFINE_CONVERSION(scaled_font, CAIRO_GOBJECT_TYPE_SCALED_FONT,
|
72
|
+
rb_cCairo_ScaledFont, RVAL2CRSCALEDFONT, CRSCALEDFONT2RVAL)
|
73
|
+
DEFINE_CONVERSION(font_face, CAIRO_GOBJECT_TYPE_FONT_FACE, rb_cCairo_FontFace,
|
74
|
+
RVAL2CRFONTFACE, CRFONTFACE2RVAL)
|
75
|
+
DEFINE_CONVERSION(font_options, CAIRO_GOBJECT_TYPE_FONT_OPTIONS,
|
76
|
+
rb_cCairo_FontOptions, RVAL2CRFONTOPTIONS, CRFONTOPTIONS2RVAL)
|
77
|
+
DEFINE_CONVERSION(region, CAIRO_GOBJECT_TYPE_REGION, rb_cCairo_Region,
|
78
|
+
RVAL2CRREGION, CRREGION2RVAL)
|
79
|
+
|
80
|
+
void
|
81
|
+
Init_cairo_gobject(void)
|
82
|
+
{
|
83
|
+
VALUE RG_TARGET_NAMESPACE;
|
84
|
+
|
85
|
+
RG_TARGET_NAMESPACE = rb_define_module("CairoGObject");
|
86
|
+
|
87
|
+
rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION",
|
88
|
+
rb_ary_new3(3,
|
89
|
+
INT2FIX(CAIRO_VERSION_MAJOR),
|
90
|
+
INT2FIX(CAIRO_VERSION_MINOR),
|
91
|
+
INT2FIX(CAIRO_VERSION_MICRO)));
|
92
|
+
|
93
|
+
define_context_conversion();
|
94
|
+
define_device_conversion();
|
95
|
+
define_pattern_conversion();
|
96
|
+
define_surface_conversion();
|
97
|
+
define_scaled_font_conversion();
|
98
|
+
define_font_face_conversion();
|
99
|
+
define_font_options_conversion();
|
100
|
+
define_region_conversion();
|
101
|
+
|
102
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_STATUS, "Status",
|
103
|
+
RG_TARGET_NAMESPACE);
|
104
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_CONTENT, "Content",
|
105
|
+
RG_TARGET_NAMESPACE);
|
106
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_OPERATOR, "Operator",
|
107
|
+
RG_TARGET_NAMESPACE);
|
108
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_ANTIALIAS, "Antialias",
|
109
|
+
RG_TARGET_NAMESPACE);
|
110
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FILL_RULE, "FillRule",
|
111
|
+
RG_TARGET_NAMESPACE);
|
112
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_LINE_CAP, "LineCap",
|
113
|
+
RG_TARGET_NAMESPACE);
|
114
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_LINE_JOIN, "LineJoin",
|
115
|
+
RG_TARGET_NAMESPACE);
|
116
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_TEXT_CLUSTER_FLAGS, "TextClusterFlags",
|
117
|
+
RG_TARGET_NAMESPACE);
|
118
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FONT_SLANT, "FontSlant",
|
119
|
+
RG_TARGET_NAMESPACE);
|
120
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FONT_WEIGHT, "FontWeight",
|
121
|
+
RG_TARGET_NAMESPACE);
|
122
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_SUBPIXEL_ORDER, "SubpixelOrder",
|
123
|
+
RG_TARGET_NAMESPACE);
|
124
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_HINT_STYLE, "HintStyle",
|
125
|
+
RG_TARGET_NAMESPACE);
|
126
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_HINT_METRICS, "HintMetrics",
|
127
|
+
RG_TARGET_NAMESPACE);
|
128
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FONT_TYPE, "FontType",
|
129
|
+
RG_TARGET_NAMESPACE);
|
130
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_PATH_DATA_TYPE, "PathDataType",
|
131
|
+
RG_TARGET_NAMESPACE);
|
132
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_DEVICE_TYPE, "DeviceType",
|
133
|
+
RG_TARGET_NAMESPACE);
|
134
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_SURFACE_TYPE, "SurfaceType",
|
135
|
+
RG_TARGET_NAMESPACE);
|
136
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FORMAT, "Format",
|
137
|
+
RG_TARGET_NAMESPACE);
|
138
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_PATTERN_TYPE, "PatternType",
|
139
|
+
RG_TARGET_NAMESPACE);
|
140
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_EXTEND, "Extend",
|
141
|
+
RG_TARGET_NAMESPACE);
|
142
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FILTER, "Filter",
|
143
|
+
RG_TARGET_NAMESPACE);
|
144
|
+
G_DEF_CLASS(CAIRO_GOBJECT_TYPE_REGION_OVERLAP, "RegionOverlap",
|
145
|
+
RG_TARGET_NAMESPACE);
|
146
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2013 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#ifndef RB_CAIRO_GOBJECT_H
|
22
|
+
#define RB_CAIRO_GOBJECT_H
|
23
|
+
|
24
|
+
#include <ruby.h>
|
25
|
+
#include <rbgobject.h>
|
26
|
+
#include <glib-enum-types.h>
|
27
|
+
|
28
|
+
#include <cairo-gobject.h>
|
29
|
+
|
30
|
+
#ifndef CAIRO_GOBJECT_TYPE_HINT_METRICS
|
31
|
+
# define CAIRO_GOBJECT_TYPE_HINT_METRICS CAIRO_GOBJECT_TYPE_HNT_METRICS
|
32
|
+
#endif
|
33
|
+
|
34
|
+
#ifndef CAIRO_GOBJECT_TYPE_TEXT_CLUSTER_FLAGS
|
35
|
+
# define CAIRO_GOBJECT_TYPE_TEXT_CLUSTER_FLAGS cairo_gobject_text_cluster_flags_get_type ()
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#include <rb_cairo.h>
|
39
|
+
|
40
|
+
extern void Init_cairo_gobject(void);
|
41
|
+
|
42
|
+
#endif
|
data/extconf.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
require "pathname"
|
20
|
+
require "mkmf"
|
21
|
+
require "rbconfig"
|
22
|
+
require "fileutils"
|
23
|
+
|
24
|
+
module_name = "cairo_gobject"
|
25
|
+
package = "cairo-gobject"
|
26
|
+
|
27
|
+
base_dir = Pathname(__FILE__).dirname.expand_path
|
28
|
+
ext_dir = base_dir + "ext" + package
|
29
|
+
mkmf_gnome2_dir = base_dir + 'lib'
|
30
|
+
|
31
|
+
if RbConfig.respond_to?(:ruby)
|
32
|
+
ruby = RbConfig.ruby
|
33
|
+
else
|
34
|
+
ruby = File.join(RbConfig::CONFIG['bindir'],
|
35
|
+
RbConfig::CONFIG['ruby_install_name'] +
|
36
|
+
RbConfig::CONFIG["EXEEXT"])
|
37
|
+
end
|
38
|
+
build_dir = Pathname("ext") + package
|
39
|
+
FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
|
40
|
+
extconf_rb_path = ext_dir + "extconf.rb"
|
41
|
+
unless system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV)
|
42
|
+
exit(false)
|
43
|
+
end
|
44
|
+
|
45
|
+
create_makefile(module_name)
|
46
|
+
FileUtils.mv("Makefile", "Makefile.lib")
|
47
|
+
|
48
|
+
File.open("Makefile", "w") do |makefile|
|
49
|
+
makefile.puts(<<-EOM)
|
50
|
+
all:
|
51
|
+
(cd ext/#{package} && $(MAKE))
|
52
|
+
$(MAKE) -f Makefile.lib
|
53
|
+
|
54
|
+
install:
|
55
|
+
(cd ext/#{package} && $(MAKE) install)
|
56
|
+
$(MAKE) -f Makefile.lib install
|
57
|
+
|
58
|
+
site-install:
|
59
|
+
(cd ext/#{package} && $(MAKE) site-install)
|
60
|
+
$(MAKE) -f Makefile.lib site-install
|
61
|
+
|
62
|
+
clean:
|
63
|
+
(cd ext/#{package} && $(MAKE) clean)
|
64
|
+
$(MAKE) -f Makefile.lib clean
|
65
|
+
|
66
|
+
distclean:
|
67
|
+
(cd ext/#{package} && $(MAKE) distclean)
|
68
|
+
$(MAKE) -f Makefile.lib distclean
|
69
|
+
@rm -f Makefile.lib
|
70
|
+
EOM
|
71
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "cairo"
|
18
|
+
require "glib2"
|
19
|
+
|
20
|
+
begin
|
21
|
+
major, minor, _ = RUBY_VERSION.split(/\./)
|
22
|
+
require "#{major}.#{minor}/cairo_gobject.so"
|
23
|
+
rescue LoadError
|
24
|
+
require "cairo_gobject.so"
|
25
|
+
end
|
26
|
+
|
27
|
+
module CairoGObject
|
28
|
+
LOG_DOMAIN = "CairoGObject"
|
29
|
+
GLib::Log.set_log_domain(LOG_DOMAIN)
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "test-unit"
|
18
|
+
require "test/unit/notify"
|
19
|
+
|
20
|
+
module CairoGObjectTestUtils
|
21
|
+
end
|
data/test/run-test.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
|
20
|
+
ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
|
21
|
+
|
22
|
+
glib_base = File.join(ruby_gnome2_base, "glib2")
|
23
|
+
gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
|
24
|
+
cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
|
25
|
+
|
26
|
+
modules = [
|
27
|
+
[glib_base, "glib2"],
|
28
|
+
[gobject_introspection_base, "gobject-introspection"],
|
29
|
+
[cairo_gobject_base, "cairo-gobject"],
|
30
|
+
]
|
31
|
+
modules.each do |target, module_name|
|
32
|
+
if system("which make > /dev/null")
|
33
|
+
`make -C #{target.dump} > /dev/null` or exit(false)
|
34
|
+
end
|
35
|
+
$LOAD_PATH.unshift(File.join(target, "ext", module_name))
|
36
|
+
$LOAD_PATH.unshift(File.join(target, "lib"))
|
37
|
+
end
|
38
|
+
|
39
|
+
$LOAD_PATH.unshift(File.join(glib_base, "test"))
|
40
|
+
require "glib-test-init"
|
41
|
+
|
42
|
+
$LOAD_PATH.unshift(File.join(gobject_introspection_base, "test"))
|
43
|
+
require "gobject-introspection-test-utils"
|
44
|
+
|
45
|
+
$LOAD_PATH.unshift(File.join(cairo_gobject_base, "test"))
|
46
|
+
require "cairo-gobject-test-utils"
|
47
|
+
|
48
|
+
require "cairo-gobject"
|
49
|
+
|
50
|
+
exit Test::Unit::AutoRunner.run(true)
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cairo-gobject
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- The Ruby-GNOME2 Project Team
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2013-01-24 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: cairo
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: glib2
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 31
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 2
|
46
|
+
- 0
|
47
|
+
version: 1.2.0
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: test-unit-notify
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
type: :development
|
63
|
+
version_requirements: *id003
|
64
|
+
description: Ruby/CairoGObject is a Ruby binding of cairo-gobject.
|
65
|
+
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
66
|
+
executables: []
|
67
|
+
|
68
|
+
extensions:
|
69
|
+
- ext/cairo-gobject/extconf.rb
|
70
|
+
extra_rdoc_files: []
|
71
|
+
|
72
|
+
files:
|
73
|
+
- Rakefile
|
74
|
+
- extconf.rb
|
75
|
+
- lib/cairo-gobject.rb
|
76
|
+
- ext/cairo-gobject/rb-cairo-gobject.h
|
77
|
+
- ext/cairo-gobject/rb-cairo-gobject.c
|
78
|
+
- ext/cairo-gobject/extconf.rb
|
79
|
+
- test/cairo-gobject-test-utils.rb
|
80
|
+
- test/run-test.rb
|
81
|
+
homepage: http://ruby-gnome2.sourceforge.jp/
|
82
|
+
licenses: []
|
83
|
+
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
hash: 61
|
95
|
+
segments:
|
96
|
+
- 1
|
97
|
+
- 8
|
98
|
+
- 5
|
99
|
+
version: 1.8.5
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
requirements: []
|
110
|
+
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 1.8.24
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: Ruby/CairoGObject is a Ruby binding of cairo-gobject.
|
116
|
+
test_files: []
|
117
|
+
|