libxml-ruby 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +42 -0
- data/README +123 -117
- data/doc/classes/XML.html +226 -0
- data/doc/classes/XML/Attr.html +969 -0
- data/doc/classes/XML/Attributes.html +487 -0
- data/doc/classes/XML/Document.html +1423 -0
- data/doc/classes/XML/Dtd.html +159 -0
- data/doc/classes/XML/Error.html +111 -0
- data/doc/classes/XML/HTMLParser.html +330 -0
- data/doc/classes/XML/InputCallbacks.html +154 -0
- data/doc/classes/XML/NS.html +366 -0
- data/doc/classes/XML/Node.html +3292 -0
- data/doc/classes/XML/Node/FailedModify.html +111 -0
- data/doc/classes/XML/Node/Set.html +435 -0
- data/doc/classes/XML/Node/SetNamespace.html +111 -0
- data/doc/classes/XML/Node/UnknownType.html +111 -0
- data/doc/classes/XML/Parser.html +2178 -0
- data/doc/classes/XML/Parser/Context.html +1233 -0
- data/doc/classes/XML/Parser/ParseError.html +111 -0
- data/doc/classes/XML/Reader.html +2173 -0
- data/doc/classes/XML/SaxParser.html +396 -0
- data/doc/classes/XML/SiblingEnum.html +142 -0
- data/doc/classes/XML/State.html +118 -0
- data/doc/classes/XML/Tree.html +224 -0
- data/doc/classes/XML/XInclude.html +117 -0
- data/doc/classes/XML/XInclude/Error.html +111 -0
- data/doc/classes/XML/XMLParserOptions.html +198 -0
- data/doc/classes/XML/XPath.html +269 -0
- data/doc/classes/XML/XPath/Context.html +193 -0
- data/doc/classes/XML/XPath/InvalidPath.html +111 -0
- data/doc/classes/XML/XPath/Object.html +439 -0
- data/doc/classes/XML/XPointer.html +164 -0
- data/doc/classes/XML/XPointer/Context.html +117 -0
- data/doc/classes/XML/XPointer/Context/InvalidPath.html +111 -0
- data/doc/classes/XML/XPointer/InvalidExpression.html +111 -0
- data/doc/classes/singleton.html +114 -0
- data/doc/created.rid +1 -0
- data/doc/files/CHANGES.html +375 -0
- data/doc/files/LICENSE.html +133 -0
- data/doc/files/README.html +279 -0
- data/doc/files/VERSION.html +107 -0
- data/doc/files/ext/libxml/cbg_c.html +101 -0
- data/doc/files/ext/libxml/libxml_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_attr_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_attributes_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_document_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_dtd_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_html_parser_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_input_cbg_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_node_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_node_set_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_ns_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_parser_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_parser_context_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_reader_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_sax_parser_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_schema_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_state_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_tree_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xinclude_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpath_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpath_context_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpath_object_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpointer_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpointer_context_c.html +101 -0
- data/doc/files/lib/libxml_rb.html +115 -0
- data/doc/files/lib/xml/libxml_rb.html +114 -0
- data/doc/fr_class_index.html +60 -0
- data/doc/fr_file_index.html +56 -0
- data/doc/fr_method_index.html +373 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/ext/libxml/cbg.c +76 -76
- data/ext/libxml/extconf.rb +308 -308
- data/ext/libxml/libxml.c +58 -62
- data/ext/libxml/ruby_libxml.h +1 -0
- data/ext/libxml/ruby_xml_attr.c +201 -113
- data/ext/libxml/ruby_xml_attr.h +6 -9
- data/ext/libxml/ruby_xml_attributes.c +268 -0
- data/ext/libxml/ruby_xml_attributes.h +17 -0
- data/ext/libxml/ruby_xml_document.c +80 -66
- data/ext/libxml/ruby_xml_dtd.c +2 -2
- data/ext/libxml/ruby_xml_dtd.h +17 -17
- data/ext/libxml/ruby_xml_html_parser.c +18 -19
- data/ext/libxml/ruby_xml_html_parser.h +29 -29
- data/ext/libxml/ruby_xml_input_cbg.c +6 -0
- data/ext/libxml/ruby_xml_input_cbg.h +20 -20
- data/ext/libxml/ruby_xml_node.c +438 -536
- data/ext/libxml/ruby_xml_node.h +17 -27
- data/ext/libxml/ruby_xml_node_set.c +10 -9
- data/ext/libxml/ruby_xml_node_set.h +20 -20
- data/ext/libxml/ruby_xml_ns.c +60 -69
- data/ext/libxml/ruby_xml_ns.h +12 -21
- data/ext/libxml/ruby_xml_parser.c +54 -53
- data/ext/libxml/ruby_xml_parser.h +31 -31
- data/ext/libxml/ruby_xml_parser_context.c +37 -91
- data/ext/libxml/ruby_xml_parser_context.h +20 -22
- data/ext/libxml/ruby_xml_reader.h +14 -14
- data/ext/libxml/ruby_xml_sax_parser.c +55 -55
- data/ext/libxml/ruby_xml_sax_parser.h +56 -56
- data/ext/libxml/ruby_xml_schema.c +44 -51
- data/ext/libxml/ruby_xml_schema.h +16 -16
- data/ext/libxml/ruby_xml_state.c +35 -96
- data/ext/libxml/ruby_xml_state.h +2 -3
- data/ext/libxml/ruby_xml_tree.h +12 -12
- data/ext/libxml/ruby_xml_xinclude.h +13 -13
- data/ext/libxml/ruby_xml_xpath.c +57 -18
- data/ext/libxml/ruby_xml_xpath.h +23 -23
- data/ext/libxml/ruby_xml_xpath_context.c +11 -7
- data/ext/libxml/ruby_xml_xpath_context.h +20 -20
- data/ext/libxml/ruby_xml_xpath_object.c +9 -16
- data/ext/libxml/ruby_xml_xpath_object.h +4 -10
- data/ext/libxml/ruby_xml_xpointer.c +11 -11
- data/ext/libxml/ruby_xml_xpointer.h +27 -27
- data/ext/libxml/ruby_xml_xpointer_context.h +18 -18
- data/ext/libxml/version.h +2 -2
- data/lib/libxml.rb +134 -125
- data/mingw/libiconv-2.dll +0 -0
- data/mingw/libxml2-2.dll +0 -0
- data/mingw/libxml_ruby.so +0 -0
- data/test/ets_copy_bug.rb +1 -1
- data/test/ets_copy_bug2.rb +16 -27
- data/test/ets_doc_to_s.rb +1 -1
- data/test/ets_gpx.rb +1 -1
- data/test/ets_node_gc.rb +1 -1
- data/test/ets_tsr.rb +1 -1
- data/test/tc_well_formed.rb +1 -1
- data/test/tc_xml_attributes.rb +106 -0
- data/test/tc_xml_document.rb +10 -10
- data/test/tc_xml_document_write3.rb +1 -1
- data/test/tc_xml_dtd.rb +49 -0
- data/test/tc_xml_html_parser.rb +3 -3
- data/test/tc_xml_node.rb +69 -33
- data/test/tc_xml_node_attr.rb +170 -0
- data/test/{tc_xml_node8.rb → tc_xml_node_cdata.rb} +2 -2
- data/test/{tc_xml_node9.rb → tc_xml_node_comment.rb} +3 -3
- data/test/tc_xml_node_edit.rb +91 -0
- data/test/tc_xml_parser.rb +97 -50
- data/test/tc_xml_parser_context.rb +61 -23
- data/test/tc_xml_schema.rb +39 -0
- data/test/tc_xml_xinclude.rb +5 -6
- data/test/tc_xml_xpath.rb +51 -27
- data/test/test_suite.rb +27 -0
- data/vc/{libxml.sln → libxml_ruby.sln} +5 -5
- data/vc/{libxml.vcproj → libxml_ruby.vcproj} +9 -1
- metadata +106 -54
- data/mingw/mingw.rake +0 -36
- data/test/dtd-test.rb +0 -24
- data/test/merge_bug.rb +0 -55
- data/test/schema-test.rb +0 -74
- data/test/tc_xml_node2.rb +0 -25
- data/test/tc_xml_node3.rb +0 -27
- data/test/tc_xml_node4.rb +0 -86
- data/test/tc_xml_node5.rb +0 -52
- data/test/tc_xml_node6.rb +0 -27
- data/test/tc_xml_node7.rb +0 -35
- data/test/tc_xml_parser2.rb +0 -16
- data/test/tc_xml_parser3.rb +0 -23
- data/test/tc_xml_parser4.rb +0 -33
- data/test/tc_xml_parser5.rb +0 -27
- data/test/tc_xml_parser6.rb +0 -23
- data/test/tc_xml_parser7.rb +0 -28
- data/test/tc_xml_parser8.rb +0 -32
- data/test/tc_xml_parser9.rb +0 -11
- data/test/tc_xml_xpath2.rb +0 -14
- data/work/vc/debug/libxml.exp +0 -0
- data/work/vc/debug/libxml.ilk +0 -0
- data/work/vc/debug/libxml.lib +0 -0
- data/work/vc/debug/libxml.pdb +0 -0
- data/work/vc/debug/libxml.so +0 -0
data/doc/index.html
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
libxml-ruby
|
9
|
+
|
10
|
+
-->
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
|
+
<head>
|
13
|
+
<title>libxml-ruby</title>
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
|
+
</head>
|
16
|
+
<frameset rows="20%, 80%">
|
17
|
+
<frameset cols="25%,35%,45%">
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
21
|
+
</frameset>
|
22
|
+
<frame src="files/README.html" name="docwin" />
|
23
|
+
</frameset>
|
24
|
+
</html>
|
data/doc/rdoc-style.css
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
|
2
|
+
body {
|
3
|
+
font-family: Verdana,Arial,Helvetica,sans-serif;
|
4
|
+
font-size: 90%;
|
5
|
+
margin: 0;
|
6
|
+
margin-left: 40px;
|
7
|
+
padding: 0;
|
8
|
+
background: white;
|
9
|
+
}
|
10
|
+
|
11
|
+
h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
|
12
|
+
h1 { font-size: 150%; }
|
13
|
+
h2,h3,h4 { margin-top: 1em; }
|
14
|
+
|
15
|
+
a { background: #eef; color: #039; text-decoration: none; }
|
16
|
+
a:hover { background: #039; color: #eef; }
|
17
|
+
|
18
|
+
/* Override the base stylesheet's Anchor inside a table cell */
|
19
|
+
td > a {
|
20
|
+
background: transparent;
|
21
|
+
color: #039;
|
22
|
+
text-decoration: none;
|
23
|
+
}
|
24
|
+
|
25
|
+
/* and inside a section title */
|
26
|
+
.section-title > a {
|
27
|
+
background: transparent;
|
28
|
+
color: #eee;
|
29
|
+
text-decoration: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
/* === Structural elements =================================== */
|
33
|
+
|
34
|
+
div#index {
|
35
|
+
margin: 0;
|
36
|
+
margin-left: -40px;
|
37
|
+
padding: 0;
|
38
|
+
font-size: 90%;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
div#index a {
|
43
|
+
margin-left: 0.7em;
|
44
|
+
}
|
45
|
+
|
46
|
+
div#index .section-bar {
|
47
|
+
margin-left: 0px;
|
48
|
+
padding-left: 0.7em;
|
49
|
+
background: #ccc;
|
50
|
+
font-size: small;
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
div#classHeader, div#fileHeader {
|
55
|
+
width: auto;
|
56
|
+
color: white;
|
57
|
+
padding: 0.5em 1.5em 0.5em 1.5em;
|
58
|
+
margin: 0;
|
59
|
+
margin-left: -40px;
|
60
|
+
border-bottom: 3px solid #006;
|
61
|
+
}
|
62
|
+
|
63
|
+
div#classHeader a, div#fileHeader a {
|
64
|
+
background: inherit;
|
65
|
+
color: white;
|
66
|
+
}
|
67
|
+
|
68
|
+
div#classHeader td, div#fileHeader td {
|
69
|
+
background: inherit;
|
70
|
+
color: white;
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
div#fileHeader {
|
75
|
+
background: #057;
|
76
|
+
}
|
77
|
+
|
78
|
+
div#classHeader {
|
79
|
+
background: #048;
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
.class-name-in-header {
|
84
|
+
font-size: 180%;
|
85
|
+
font-weight: bold;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
div#bodyContent {
|
90
|
+
padding: 0 1.5em 0 1.5em;
|
91
|
+
}
|
92
|
+
|
93
|
+
div#description {
|
94
|
+
padding: 0.5em 1.5em;
|
95
|
+
background: #efefef;
|
96
|
+
border: 1px dotted #999;
|
97
|
+
}
|
98
|
+
|
99
|
+
div#description h1,h2,h3,h4,h5,h6 {
|
100
|
+
color: #125;;
|
101
|
+
background: transparent;
|
102
|
+
}
|
103
|
+
|
104
|
+
div#validator-badges {
|
105
|
+
text-align: center;
|
106
|
+
}
|
107
|
+
div#validator-badges img { border: 0; }
|
108
|
+
|
109
|
+
div#copyright {
|
110
|
+
color: #333;
|
111
|
+
background: #efefef;
|
112
|
+
font: 0.75em sans-serif;
|
113
|
+
margin-top: 5em;
|
114
|
+
margin-bottom: 0;
|
115
|
+
padding: 0.5em 2em;
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
/* === Classes =================================== */
|
120
|
+
|
121
|
+
table.header-table {
|
122
|
+
color: white;
|
123
|
+
font-size: small;
|
124
|
+
}
|
125
|
+
|
126
|
+
.type-note {
|
127
|
+
font-size: small;
|
128
|
+
color: #DEDEDE;
|
129
|
+
}
|
130
|
+
|
131
|
+
.xxsection-bar {
|
132
|
+
background: #eee;
|
133
|
+
color: #333;
|
134
|
+
padding: 3px;
|
135
|
+
}
|
136
|
+
|
137
|
+
.section-bar {
|
138
|
+
color: #333;
|
139
|
+
border-bottom: 1px solid #999;
|
140
|
+
margin-left: -20px;
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
.section-title {
|
145
|
+
background: #79a;
|
146
|
+
color: #eee;
|
147
|
+
padding: 3px;
|
148
|
+
margin-top: 2em;
|
149
|
+
margin-left: -30px;
|
150
|
+
border: 1px solid #999;
|
151
|
+
}
|
152
|
+
|
153
|
+
.top-aligned-row { vertical-align: top }
|
154
|
+
.bottom-aligned-row { vertical-align: bottom }
|
155
|
+
|
156
|
+
/* --- Context section classes ----------------------- */
|
157
|
+
|
158
|
+
.context-row { }
|
159
|
+
.context-item-name { font-family: monospace; font-weight: bold; color: black; }
|
160
|
+
.context-item-value { font-size: small; color: #448; }
|
161
|
+
.context-item-desc { color: #333; padding-left: 2em; }
|
162
|
+
|
163
|
+
/* --- Method classes -------------------------- */
|
164
|
+
.method-detail {
|
165
|
+
background: #efefef;
|
166
|
+
padding: 0;
|
167
|
+
margin-top: 0.5em;
|
168
|
+
margin-bottom: 1em;
|
169
|
+
border: 1px dotted #ccc;
|
170
|
+
}
|
171
|
+
.method-heading {
|
172
|
+
color: black;
|
173
|
+
background: #ccc;
|
174
|
+
border-bottom: 1px solid #666;
|
175
|
+
padding: 0.2em 0.5em 0 0.5em;
|
176
|
+
}
|
177
|
+
.method-signature { color: black; background: inherit; }
|
178
|
+
.method-name { font-weight: bold; }
|
179
|
+
.method-args { font-style: italic; }
|
180
|
+
.method-description { padding: 0 0.5em 0 0.5em; }
|
181
|
+
|
182
|
+
/* --- Source code sections -------------------- */
|
183
|
+
|
184
|
+
a.source-toggle { font-size: 90%; }
|
185
|
+
div.method-source-code {
|
186
|
+
background: #262626;
|
187
|
+
color: #ffdead;
|
188
|
+
margin: 1em;
|
189
|
+
padding: 0.5em;
|
190
|
+
border: 1px dashed #999;
|
191
|
+
overflow: hidden;
|
192
|
+
}
|
193
|
+
|
194
|
+
div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
195
|
+
|
196
|
+
/* --- Ruby keyword styles --------------------- */
|
197
|
+
|
198
|
+
.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
|
199
|
+
|
200
|
+
.ruby-constant { color: #7fffd4; background: transparent; }
|
201
|
+
.ruby-keyword { color: #00ffff; background: transparent; }
|
202
|
+
.ruby-ivar { color: #eedd82; background: transparent; }
|
203
|
+
.ruby-operator { color: #00ffee; background: transparent; }
|
204
|
+
.ruby-identifier { color: #ffdead; background: transparent; }
|
205
|
+
.ruby-node { color: #ffa07a; background: transparent; }
|
206
|
+
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
|
207
|
+
.ruby-regexp { color: #ffa07a; background: transparent; }
|
208
|
+
.ruby-value { color: #7fffd4; background: transparent; }
|
data/ext/libxml/cbg.c
CHANGED
@@ -1,76 +1,76 @@
|
|
1
|
-
#include <string.h>
|
2
|
-
#include <libxml/xmlIO.h>
|
3
|
-
#include "ruby.h"
|
4
|
-
|
5
|
-
/*
|
6
|
-
int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
|
7
|
-
xmlInputOpenCallback openFunc,
|
8
|
-
xmlInputReadCallback readFunc,
|
9
|
-
xmlInputCloseCallback closeFunc);
|
10
|
-
|
11
|
-
|
12
|
-
int (*xmlInputMatchCallback) (char const *filename);
|
13
|
-
void* (*xmlInputOpenCallback) (char const *filename);
|
14
|
-
int (*xmlInputReadCallback) (void *context,
|
15
|
-
char *buffer,
|
16
|
-
int len);
|
17
|
-
int (*xmlInputCloseCallback) (void *context);
|
18
|
-
*/
|
19
|
-
|
20
|
-
typedef struct deb_doc_context {
|
21
|
-
char *buffer;
|
22
|
-
char *bpos;
|
23
|
-
int remaining;
|
24
|
-
} deb_doc_context;
|
25
|
-
|
26
|
-
int deb_Match (char const *filename) {
|
27
|
-
fprintf( stderr, "deb_Match: %s\n", filename );
|
28
|
-
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "deb://", 6)) {
|
29
|
-
return(1);
|
30
|
-
}
|
31
|
-
return(0);
|
32
|
-
}
|
33
|
-
|
34
|
-
void* deb_Open (char const *filename) {
|
35
|
-
deb_doc_context *deb_doc;
|
36
|
-
VALUE res;
|
37
|
-
|
38
|
-
deb_doc = (deb_doc_context*)malloc( sizeof(deb_doc_context) );
|
39
|
-
|
40
|
-
res = rb_funcall( rb_funcall( rb_mKernel, rb_intern("const_get"), 1, rb_str_new2("DEBSystem") ),
|
41
|
-
rb_intern("document_query"), 1, rb_str_new2(filename));
|
42
|
-
deb_doc->buffer = strdup( StringValuePtr(res) );
|
43
|
-
//deb_doc->buffer = strdup("<serepes>serepes</serepes>");
|
44
|
-
|
45
|
-
deb_doc->bpos = deb_doc->buffer;
|
46
|
-
deb_doc->remaining = strlen(deb_doc->buffer);
|
47
|
-
return deb_doc;
|
48
|
-
}
|
49
|
-
|
50
|
-
int deb_Read (void *context, char *buffer, int len) {
|
51
|
-
deb_doc_context *deb_doc;
|
52
|
-
int ret_len;
|
53
|
-
deb_doc = (deb_doc_context*)context;
|
54
|
-
|
55
|
-
if (len >= deb_doc->remaining) {
|
56
|
-
ret_len = deb_doc->remaining;
|
57
|
-
} else {
|
58
|
-
ret_len = len;
|
59
|
-
}
|
60
|
-
deb_doc->remaining -= ret_len;
|
61
|
-
strncpy( buffer, deb_doc->bpos, ret_len );
|
62
|
-
deb_doc->bpos += ret_len;
|
63
|
-
|
64
|
-
return ret_len;
|
65
|
-
}
|
66
|
-
|
67
|
-
int deb_Close (void *context) {
|
68
|
-
free( ((deb_doc_context*)context)->buffer );
|
69
|
-
free( context );
|
70
|
-
return 1;
|
71
|
-
}
|
72
|
-
|
73
|
-
|
74
|
-
void deb_register_cbg() {
|
75
|
-
xmlRegisterInputCallbacks( deb_Match, deb_Open, deb_Read, deb_Close );
|
76
|
-
}
|
1
|
+
#include <string.h>
|
2
|
+
#include <libxml/xmlIO.h>
|
3
|
+
#include "ruby.h"
|
4
|
+
|
5
|
+
/*
|
6
|
+
int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
|
7
|
+
xmlInputOpenCallback openFunc,
|
8
|
+
xmlInputReadCallback readFunc,
|
9
|
+
xmlInputCloseCallback closeFunc);
|
10
|
+
|
11
|
+
|
12
|
+
int (*xmlInputMatchCallback) (char const *filename);
|
13
|
+
void* (*xmlInputOpenCallback) (char const *filename);
|
14
|
+
int (*xmlInputReadCallback) (void *context,
|
15
|
+
char *buffer,
|
16
|
+
int len);
|
17
|
+
int (*xmlInputCloseCallback) (void *context);
|
18
|
+
*/
|
19
|
+
|
20
|
+
typedef struct deb_doc_context {
|
21
|
+
char *buffer;
|
22
|
+
char *bpos;
|
23
|
+
int remaining;
|
24
|
+
} deb_doc_context;
|
25
|
+
|
26
|
+
int deb_Match (char const *filename) {
|
27
|
+
fprintf( stderr, "deb_Match: %s\n", filename );
|
28
|
+
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "deb://", 6)) {
|
29
|
+
return(1);
|
30
|
+
}
|
31
|
+
return(0);
|
32
|
+
}
|
33
|
+
|
34
|
+
void* deb_Open (char const *filename) {
|
35
|
+
deb_doc_context *deb_doc;
|
36
|
+
VALUE res;
|
37
|
+
|
38
|
+
deb_doc = (deb_doc_context*)malloc( sizeof(deb_doc_context) );
|
39
|
+
|
40
|
+
res = rb_funcall( rb_funcall( rb_mKernel, rb_intern("const_get"), 1, rb_str_new2("DEBSystem") ),
|
41
|
+
rb_intern("document_query"), 1, rb_str_new2(filename));
|
42
|
+
deb_doc->buffer = strdup( StringValuePtr(res) );
|
43
|
+
//deb_doc->buffer = strdup("<serepes>serepes</serepes>");
|
44
|
+
|
45
|
+
deb_doc->bpos = deb_doc->buffer;
|
46
|
+
deb_doc->remaining = strlen(deb_doc->buffer);
|
47
|
+
return deb_doc;
|
48
|
+
}
|
49
|
+
|
50
|
+
int deb_Read (void *context, char *buffer, int len) {
|
51
|
+
deb_doc_context *deb_doc;
|
52
|
+
int ret_len;
|
53
|
+
deb_doc = (deb_doc_context*)context;
|
54
|
+
|
55
|
+
if (len >= deb_doc->remaining) {
|
56
|
+
ret_len = deb_doc->remaining;
|
57
|
+
} else {
|
58
|
+
ret_len = len;
|
59
|
+
}
|
60
|
+
deb_doc->remaining -= ret_len;
|
61
|
+
strncpy( buffer, deb_doc->bpos, ret_len );
|
62
|
+
deb_doc->bpos += ret_len;
|
63
|
+
|
64
|
+
return ret_len;
|
65
|
+
}
|
66
|
+
|
67
|
+
int deb_Close (void *context) {
|
68
|
+
free( ((deb_doc_context*)context)->buffer );
|
69
|
+
free( context );
|
70
|
+
return 1;
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
void deb_register_cbg() {
|
75
|
+
xmlRegisterInputCallbacks( deb_Match, deb_Open, deb_Read, deb_Close );
|
76
|
+
}
|
data/ext/libxml/extconf.rb
CHANGED
@@ -1,308 +1,308 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rbconfig'
|
4
|
-
|
5
|
-
def method_missing(s, *args)
|
6
|
-
if v = Config::CONFIG[s] || Config::CONFIG[s.upcase]
|
7
|
-
return v
|
8
|
-
else
|
9
|
-
puts "missing: #{s}"
|
10
|
-
super
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
if RUBY_PLATFORM =~ /win32/ # FIXME: Make more robust
|
16
|
-
|
17
|
-
# We can't use Ruby's standard build procedures
|
18
|
-
# on Windows because the Ruby executable is
|
19
|
-
# built with VC++ while here we want to build
|
20
|
-
# with MingW. So just roll our own...
|
21
|
-
|
22
|
-
target = "libxml"
|
23
|
-
|
24
|
-
#RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
|
25
|
-
#RUBY_BIN_DIR = Config::CONFIG["bindir"]
|
26
|
-
#RUBY_LIB_DIR = Config::CONFIG["libdir"]
|
27
|
-
#RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
|
28
|
-
#RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
|
29
|
-
|
30
|
-
#CLEAN.include('*.o')
|
31
|
-
#CLOBBER.include('ruby_prof.so')
|
32
|
-
|
33
|
-
srcs = Dir['../ext/*.c']
|
34
|
-
|
35
|
-
objs = srcs.collect do |srcfile|
|
36
|
-
srcfile = File.basename(srcfile)
|
37
|
-
srcfile.chomp(File.extname(srcfile) + '.o')
|
38
|
-
end
|
39
|
-
|
40
|
-
#srcs.each do |srcfile|
|
41
|
-
# srcfile = File.basename(srcfile)
|
42
|
-
# objfile = srcfile.chomp(File.extname(srcfile) + '.o')
|
43
|
-
#
|
44
|
-
# if File.mtime(objfile) < File.mtime(srcfile)
|
45
|
-
# system "gcc -c -fPIC -O2 -Wall -o #{objfile} #{srcfile} -I#{RUBY_INCLUDE_DIR}"
|
46
|
-
# end
|
47
|
-
#end
|
48
|
-
|
49
|
-
#system "gcc -shared -o #{LIBNAME} #{obj} #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}"
|
50
|
-
|
51
|
-
makefile_template = DATA.read
|
52
|
-
makefile = eval(makefile_template)
|
53
|
-
|
54
|
-
File.open('Makefile', 'w'){ |f| f << makefile }
|
55
|
-
|
56
|
-
else
|
57
|
-
|
58
|
-
require 'mkmf'
|
59
|
-
|
60
|
-
if defined?(CFLAGS)
|
61
|
-
if CFLAGS.index(CONFIG['CCDLFLAGS'])
|
62
|
-
$CFLAGS = CFLAGS
|
63
|
-
else
|
64
|
-
$CFLAGS = CFLAGS + ' ' + CONFIG['CCDLFLAGS']
|
65
|
-
end
|
66
|
-
else
|
67
|
-
$CFLAGS = CONFIG['CFLAGS']
|
68
|
-
end
|
69
|
-
$LDFLAGS = CONFIG['LDFLAGS']
|
70
|
-
$LIBPATH.push(Config::CONFIG['libdir'])
|
71
|
-
|
72
|
-
def crash(str)
|
73
|
-
printf(" extconf failure: %s\n", str)
|
74
|
-
exit 1
|
75
|
-
end
|
76
|
-
|
77
|
-
dir_config('iconv')
|
78
|
-
dir_config('xml2')
|
79
|
-
dir_config('zlib')
|
80
|
-
|
81
|
-
have_library('socket','socket')
|
82
|
-
have_library('nsl','gethostbyname')
|
83
|
-
|
84
|
-
unless have_library('m', 'atan')
|
85
|
-
# try again for gcc 4.0
|
86
|
-
saveflags = $CFLAGS
|
87
|
-
$CFLAGS += ' -fno-builtin'
|
88
|
-
unless have_library('m', 'atan')
|
89
|
-
crash('need libm')
|
90
|
-
end
|
91
|
-
$CFLAGS = saveflags
|
92
|
-
end
|
93
|
-
|
94
|
-
unless have_library('z', 'inflate') or
|
95
|
-
have_library('zlib', 'inflate') or
|
96
|
-
have_library('zlib1', 'inflate')
|
97
|
-
crash('need zlib')
|
98
|
-
else
|
99
|
-
$defs.push('-DHAVE_ZLIB_H')
|
100
|
-
end
|
101
|
-
|
102
|
-
unless have_library('iconv','iconv_open') or
|
103
|
-
have_library('iconv','libiconv_open') or
|
104
|
-
have_library('libiconv', 'libiconv_open') or
|
105
|
-
have_library('libiconv', 'iconv_open') or
|
106
|
-
have_library('c','iconv_open') or
|
107
|
-
have_library('recode','iconv_open') or
|
108
|
-
have_library('iconv')
|
109
|
-
crash(<<EOL)
|
110
|
-
need libiconv.
|
111
|
-
|
112
|
-
Install the libiconv or try passing one of the following options
|
113
|
-
to extconf.rb:
|
114
|
-
|
115
|
-
--with-iconv-dir=/path/to/iconv
|
116
|
-
--with-iconv-lib=/path/to/iconv/lib
|
117
|
-
--with-iconv-include=/path/to/iconv/include
|
118
|
-
EOL
|
119
|
-
end
|
120
|
-
|
121
|
-
unless (have_library('xml2', 'xmlParseDoc') or
|
122
|
-
have_library('libxml2', 'xmlParseDoc') or
|
123
|
-
find_library('xml2', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
124
|
-
(have_header('libxml/xmlversion.h') or
|
125
|
-
find_header('libxml/xmlversion.h',
|
126
|
-
"#{CONFIG['prefix']}/include",
|
127
|
-
'/opt/include/libxml2',
|
128
|
-
'/usr/local/include/libxml2',
|
129
|
-
'/usr/include/libxml2'))
|
130
|
-
crash(<<EOL)
|
131
|
-
need libxml2.
|
132
|
-
|
133
|
-
Install the library or try one of the following options to extconf.rb:
|
134
|
-
|
135
|
-
--with-xml2-dir=/path/to/libxml2
|
136
|
-
--with-xml2-lib=/path/to/libxml2/lib
|
137
|
-
--with-xml2-include=/path/to/libxml2/include
|
138
|
-
EOL
|
139
|
-
end
|
140
|
-
|
141
|
-
unless have_func('xmlDocFormatDump')
|
142
|
-
crash('Your version of libxml2 is too old. Please upgrade.')
|
143
|
-
end
|
144
|
-
|
145
|
-
unless have_func('docbCreateFileParserCtxt')
|
146
|
-
crash('Need docbCreateFileParserCtxt')
|
147
|
-
end
|
148
|
-
|
149
|
-
$CFLAGS << ' ' << $INCFLAGS
|
150
|
-
#$INSTALLFILES = [["libxml.rb", "$(RUBYLIBDIR)", "../xml"]]
|
151
|
-
|
152
|
-
create_header()
|
153
|
-
create_makefile('libxml_ruby')
|
154
|
-
end
|
155
|
-
|
156
|
-
__END__
|
157
|
-
|
158
|
-
SHELL = /bin/sh
|
159
|
-
|
160
|
-
#### Start of system configuration section. ####
|
161
|
-
|
162
|
-
# I think we can remove all the parts related to the install target
|
163
|
-
# since setup.rb and RubyGems handles that on their own. Correct?
|
164
|
-
|
165
|
-
srcdir = .
|
166
|
-
topdir = #{archdir} #/usr/lib/ruby/1.8/x86_64-linux
|
167
|
-
hdrdir = $(topdir)
|
168
|
-
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
169
|
-
prefix = $(DESTDIR)/usr
|
170
|
-
exec_prefix = $(DESTDIR)/usr
|
171
|
-
sitedir = $(DESTDIR)/usr/local/lib/site_ruby
|
172
|
-
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
173
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
174
|
-
dvidir = $(docdir)
|
175
|
-
datarootdir = $(prefix)/share
|
176
|
-
archdir = $(rubylibdir)/$(arch)
|
177
|
-
sbindir = $(exec_prefix)/sbin
|
178
|
-
psdir = $(docdir)
|
179
|
-
localedir = $(datarootdir)/locale
|
180
|
-
htmldir = $(docdir)
|
181
|
-
datadir = $(datarootdir)
|
182
|
-
includedir = $(prefix)/include
|
183
|
-
infodir = $(prefix)/share/info
|
184
|
-
sysconfdir = $(DESTDIR)/etc
|
185
|
-
mandir = $(prefix)/share/man
|
186
|
-
libdir = $(DESTDIR)/usr/lib
|
187
|
-
sharedstatedir = $(prefix)/com
|
188
|
-
oldincludedir = $(DESTDIR)/usr/include
|
189
|
-
pdfdir = $(docdir)
|
190
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
191
|
-
bindir = $(exec_prefix)/bin
|
192
|
-
localstatedir = $(DESTDIR)/var
|
193
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
194
|
-
libexecdir = $(prefix)/lib/ruby1.8
|
195
|
-
|
196
|
-
CC = cc
|
197
|
-
LIBRUBY = $(LIBRUBY_SO)
|
198
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
199
|
-
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
200
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
201
|
-
|
202
|
-
RUBY_EXTCONF_H = extconf.h
|
203
|
-
CFLAGS = -fPIC -fno-strict-aliasing -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/include/libxml2
|
204
|
-
INCFLAGS = -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/include/libxml2
|
205
|
-
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\"
|
206
|
-
CXXFLAGS = $(CFLAGS)
|
207
|
-
DLDFLAGS = -L. -rdynamic -Wl,-export-dynamic
|
208
|
-
LDSHARED = $(CC) -shared
|
209
|
-
AR = ar
|
210
|
-
EXEEXT =
|
211
|
-
|
212
|
-
RUBY_INSTALL_NAME = ruby1.8
|
213
|
-
RUBY_SO_NAME = ruby1.8
|
214
|
-
arch = x86_64-linux
|
215
|
-
sitearch = x86_64-linux
|
216
|
-
ruby_version = 1.8
|
217
|
-
ruby = /usr/bin/ruby1.8
|
218
|
-
RUBY = $(ruby)
|
219
|
-
RM = rm -f
|
220
|
-
MAKEDIRS = mkdir -p
|
221
|
-
INSTALL = /usr/bin/install -c
|
222
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
223
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
224
|
-
COPY = cp
|
225
|
-
|
226
|
-
preload =
|
227
|
-
|
228
|
-
libpath = . $(libdir) /usr/lib
|
229
|
-
LIBPATH = -L"." -L"$(libdir)" -L"/usr/lib"
|
230
|
-
DEFFILE =
|
231
|
-
|
232
|
-
CLEANFILES =
|
233
|
-
DISTCLEANFILES =
|
234
|
-
|
235
|
-
extout =
|
236
|
-
extout_prefix =
|
237
|
-
target_prefix = /xml
|
238
|
-
LOCAL_LIBS =
|
239
|
-
LIBS = $(LIBRUBYARG_SHARED) -lxml2 -lc -lz -lm -lnsl -lpthread -ldl -lcrypt -lm -lc
|
240
|
-
|
241
|
-
SRCS = #{srcs.join(' ')}
|
242
|
-
OBJS = #{objs.join(' ')}
|
243
|
-
|
244
|
-
TARGET = #{target}
|
245
|
-
DLLIB = $(TARGET).so
|
246
|
-
EXTSTATIC =
|
247
|
-
STATIC_LIB =
|
248
|
-
|
249
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
250
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
251
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
252
|
-
|
253
|
-
TARGET_SO = $(DLLIB)
|
254
|
-
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
255
|
-
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
256
|
-
|
257
|
-
all: $(DLLIB)
|
258
|
-
static: $(STATIC_LIB)
|
259
|
-
|
260
|
-
clean:
|
261
|
-
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
262
|
-
|
263
|
-
distclean: clean
|
264
|
-
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
265
|
-
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
266
|
-
|
267
|
-
realclean: distclean
|
268
|
-
install: install-so install-rb
|
269
|
-
|
270
|
-
install-so: $(RUBYARCHDIR)
|
271
|
-
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
272
|
-
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
273
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
274
|
-
install-rb: pre-install-rb install-rb-default
|
275
|
-
install-rb-default: pre-install-rb-default
|
276
|
-
pre-install-rb: Makefile
|
277
|
-
pre-install-rb-default: Makefile
|
278
|
-
$(RUBYARCHDIR):
|
279
|
-
$(MAKEDIRS) $@
|
280
|
-
|
281
|
-
site-install: site-install-so site-install-rb
|
282
|
-
site-install-so: install-so
|
283
|
-
site-install-rb: install-rb
|
284
|
-
|
285
|
-
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
286
|
-
|
287
|
-
.cc.o:
|
288
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
289
|
-
|
290
|
-
.cxx.o:
|
291
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
292
|
-
|
293
|
-
.cpp.o:
|
294
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
295
|
-
|
296
|
-
.C.o:
|
297
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
298
|
-
|
299
|
-
.c.o:
|
300
|
-
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
301
|
-
|
302
|
-
$(DLLIB): $(OBJS)
|
303
|
-
@-$(RM) $@
|
304
|
-
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
305
|
-
|
306
|
-
|
307
|
-
$(OBJS): ruby.h defines.h $(RUBY_EXTCONF_H)
|
308
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbconfig'
|
4
|
+
|
5
|
+
def method_missing(s, *args)
|
6
|
+
if v = Config::CONFIG[s] || Config::CONFIG[s.upcase]
|
7
|
+
return v
|
8
|
+
else
|
9
|
+
puts "missing: #{s}"
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
if RUBY_PLATFORM =~ /win32/ # FIXME: Make more robust
|
16
|
+
|
17
|
+
# We can't use Ruby's standard build procedures
|
18
|
+
# on Windows because the Ruby executable is
|
19
|
+
# built with VC++ while here we want to build
|
20
|
+
# with MingW. So just roll our own...
|
21
|
+
|
22
|
+
target = "libxml"
|
23
|
+
|
24
|
+
#RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
|
25
|
+
#RUBY_BIN_DIR = Config::CONFIG["bindir"]
|
26
|
+
#RUBY_LIB_DIR = Config::CONFIG["libdir"]
|
27
|
+
#RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
|
28
|
+
#RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
|
29
|
+
|
30
|
+
#CLEAN.include('*.o')
|
31
|
+
#CLOBBER.include('ruby_prof.so')
|
32
|
+
|
33
|
+
srcs = Dir['../ext/*.c']
|
34
|
+
|
35
|
+
objs = srcs.collect do |srcfile|
|
36
|
+
srcfile = File.basename(srcfile)
|
37
|
+
srcfile.chomp(File.extname(srcfile) + '.o')
|
38
|
+
end
|
39
|
+
|
40
|
+
#srcs.each do |srcfile|
|
41
|
+
# srcfile = File.basename(srcfile)
|
42
|
+
# objfile = srcfile.chomp(File.extname(srcfile) + '.o')
|
43
|
+
#
|
44
|
+
# if File.mtime(objfile) < File.mtime(srcfile)
|
45
|
+
# system "gcc -c -fPIC -O2 -Wall -o #{objfile} #{srcfile} -I#{RUBY_INCLUDE_DIR}"
|
46
|
+
# end
|
47
|
+
#end
|
48
|
+
|
49
|
+
#system "gcc -shared -o #{LIBNAME} #{obj} #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}"
|
50
|
+
|
51
|
+
makefile_template = DATA.read
|
52
|
+
makefile = eval(makefile_template)
|
53
|
+
|
54
|
+
File.open('Makefile', 'w'){ |f| f << makefile }
|
55
|
+
|
56
|
+
else
|
57
|
+
|
58
|
+
require 'mkmf'
|
59
|
+
|
60
|
+
if defined?(CFLAGS)
|
61
|
+
if CFLAGS.index(CONFIG['CCDLFLAGS'])
|
62
|
+
$CFLAGS = CFLAGS
|
63
|
+
else
|
64
|
+
$CFLAGS = CFLAGS + ' ' + CONFIG['CCDLFLAGS']
|
65
|
+
end
|
66
|
+
else
|
67
|
+
$CFLAGS = CONFIG['CFLAGS']
|
68
|
+
end
|
69
|
+
$LDFLAGS = CONFIG['LDFLAGS']
|
70
|
+
$LIBPATH.push(Config::CONFIG['libdir'])
|
71
|
+
|
72
|
+
def crash(str)
|
73
|
+
printf(" extconf failure: %s\n", str)
|
74
|
+
exit 1
|
75
|
+
end
|
76
|
+
|
77
|
+
dir_config('iconv')
|
78
|
+
dir_config('xml2')
|
79
|
+
dir_config('zlib')
|
80
|
+
|
81
|
+
have_library('socket','socket')
|
82
|
+
have_library('nsl','gethostbyname')
|
83
|
+
|
84
|
+
unless have_library('m', 'atan')
|
85
|
+
# try again for gcc 4.0
|
86
|
+
saveflags = $CFLAGS
|
87
|
+
$CFLAGS += ' -fno-builtin'
|
88
|
+
unless have_library('m', 'atan')
|
89
|
+
crash('need libm')
|
90
|
+
end
|
91
|
+
$CFLAGS = saveflags
|
92
|
+
end
|
93
|
+
|
94
|
+
unless have_library('z', 'inflate') or
|
95
|
+
have_library('zlib', 'inflate') or
|
96
|
+
have_library('zlib1', 'inflate')
|
97
|
+
crash('need zlib')
|
98
|
+
else
|
99
|
+
$defs.push('-DHAVE_ZLIB_H')
|
100
|
+
end
|
101
|
+
|
102
|
+
unless have_library('iconv','iconv_open') or
|
103
|
+
have_library('iconv','libiconv_open') or
|
104
|
+
have_library('libiconv', 'libiconv_open') or
|
105
|
+
have_library('libiconv', 'iconv_open') or
|
106
|
+
have_library('c','iconv_open') or
|
107
|
+
have_library('recode','iconv_open') or
|
108
|
+
have_library('iconv')
|
109
|
+
crash(<<EOL)
|
110
|
+
need libiconv.
|
111
|
+
|
112
|
+
Install the libiconv or try passing one of the following options
|
113
|
+
to extconf.rb:
|
114
|
+
|
115
|
+
--with-iconv-dir=/path/to/iconv
|
116
|
+
--with-iconv-lib=/path/to/iconv/lib
|
117
|
+
--with-iconv-include=/path/to/iconv/include
|
118
|
+
EOL
|
119
|
+
end
|
120
|
+
|
121
|
+
unless (have_library('xml2', 'xmlParseDoc') or
|
122
|
+
have_library('libxml2', 'xmlParseDoc') or
|
123
|
+
find_library('xml2', 'xmlParseDoc', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
124
|
+
(have_header('libxml/xmlversion.h') or
|
125
|
+
find_header('libxml/xmlversion.h',
|
126
|
+
"#{CONFIG['prefix']}/include",
|
127
|
+
'/opt/include/libxml2',
|
128
|
+
'/usr/local/include/libxml2',
|
129
|
+
'/usr/include/libxml2'))
|
130
|
+
crash(<<EOL)
|
131
|
+
need libxml2.
|
132
|
+
|
133
|
+
Install the library or try one of the following options to extconf.rb:
|
134
|
+
|
135
|
+
--with-xml2-dir=/path/to/libxml2
|
136
|
+
--with-xml2-lib=/path/to/libxml2/lib
|
137
|
+
--with-xml2-include=/path/to/libxml2/include
|
138
|
+
EOL
|
139
|
+
end
|
140
|
+
|
141
|
+
unless have_func('xmlDocFormatDump')
|
142
|
+
crash('Your version of libxml2 is too old. Please upgrade.')
|
143
|
+
end
|
144
|
+
|
145
|
+
unless have_func('docbCreateFileParserCtxt')
|
146
|
+
crash('Need docbCreateFileParserCtxt')
|
147
|
+
end
|
148
|
+
|
149
|
+
$CFLAGS << ' ' << $INCFLAGS
|
150
|
+
#$INSTALLFILES = [["libxml.rb", "$(RUBYLIBDIR)", "../xml"]]
|
151
|
+
|
152
|
+
create_header()
|
153
|
+
create_makefile('libxml_ruby')
|
154
|
+
end
|
155
|
+
|
156
|
+
__END__
|
157
|
+
|
158
|
+
SHELL = /bin/sh
|
159
|
+
|
160
|
+
#### Start of system configuration section. ####
|
161
|
+
|
162
|
+
# I think we can remove all the parts related to the install target
|
163
|
+
# since setup.rb and RubyGems handles that on their own. Correct?
|
164
|
+
|
165
|
+
srcdir = .
|
166
|
+
topdir = #{archdir} #/usr/lib/ruby/1.8/x86_64-linux
|
167
|
+
hdrdir = $(topdir)
|
168
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
169
|
+
prefix = $(DESTDIR)/usr
|
170
|
+
exec_prefix = $(DESTDIR)/usr
|
171
|
+
sitedir = $(DESTDIR)/usr/local/lib/site_ruby
|
172
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
173
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
174
|
+
dvidir = $(docdir)
|
175
|
+
datarootdir = $(prefix)/share
|
176
|
+
archdir = $(rubylibdir)/$(arch)
|
177
|
+
sbindir = $(exec_prefix)/sbin
|
178
|
+
psdir = $(docdir)
|
179
|
+
localedir = $(datarootdir)/locale
|
180
|
+
htmldir = $(docdir)
|
181
|
+
datadir = $(datarootdir)
|
182
|
+
includedir = $(prefix)/include
|
183
|
+
infodir = $(prefix)/share/info
|
184
|
+
sysconfdir = $(DESTDIR)/etc
|
185
|
+
mandir = $(prefix)/share/man
|
186
|
+
libdir = $(DESTDIR)/usr/lib
|
187
|
+
sharedstatedir = $(prefix)/com
|
188
|
+
oldincludedir = $(DESTDIR)/usr/include
|
189
|
+
pdfdir = $(docdir)
|
190
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
191
|
+
bindir = $(exec_prefix)/bin
|
192
|
+
localstatedir = $(DESTDIR)/var
|
193
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
194
|
+
libexecdir = $(prefix)/lib/ruby1.8
|
195
|
+
|
196
|
+
CC = cc
|
197
|
+
LIBRUBY = $(LIBRUBY_SO)
|
198
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
199
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
200
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
201
|
+
|
202
|
+
RUBY_EXTCONF_H = extconf.h
|
203
|
+
CFLAGS = -fPIC -fno-strict-aliasing -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/include/libxml2
|
204
|
+
INCFLAGS = -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/include/libxml2
|
205
|
+
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\"
|
206
|
+
CXXFLAGS = $(CFLAGS)
|
207
|
+
DLDFLAGS = -L. -rdynamic -Wl,-export-dynamic
|
208
|
+
LDSHARED = $(CC) -shared
|
209
|
+
AR = ar
|
210
|
+
EXEEXT =
|
211
|
+
|
212
|
+
RUBY_INSTALL_NAME = ruby1.8
|
213
|
+
RUBY_SO_NAME = ruby1.8
|
214
|
+
arch = x86_64-linux
|
215
|
+
sitearch = x86_64-linux
|
216
|
+
ruby_version = 1.8
|
217
|
+
ruby = /usr/bin/ruby1.8
|
218
|
+
RUBY = $(ruby)
|
219
|
+
RM = rm -f
|
220
|
+
MAKEDIRS = mkdir -p
|
221
|
+
INSTALL = /usr/bin/install -c
|
222
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
223
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
224
|
+
COPY = cp
|
225
|
+
|
226
|
+
preload =
|
227
|
+
|
228
|
+
libpath = . $(libdir) /usr/lib
|
229
|
+
LIBPATH = -L"." -L"$(libdir)" -L"/usr/lib"
|
230
|
+
DEFFILE =
|
231
|
+
|
232
|
+
CLEANFILES =
|
233
|
+
DISTCLEANFILES =
|
234
|
+
|
235
|
+
extout =
|
236
|
+
extout_prefix =
|
237
|
+
target_prefix = /xml
|
238
|
+
LOCAL_LIBS =
|
239
|
+
LIBS = $(LIBRUBYARG_SHARED) -lxml2 -lc -lz -lm -lnsl -lpthread -ldl -lcrypt -lm -lc
|
240
|
+
|
241
|
+
SRCS = #{srcs.join(' ')}
|
242
|
+
OBJS = #{objs.join(' ')}
|
243
|
+
|
244
|
+
TARGET = #{target}
|
245
|
+
DLLIB = $(TARGET).so
|
246
|
+
EXTSTATIC =
|
247
|
+
STATIC_LIB =
|
248
|
+
|
249
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
250
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
251
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
252
|
+
|
253
|
+
TARGET_SO = $(DLLIB)
|
254
|
+
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
255
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
256
|
+
|
257
|
+
all: $(DLLIB)
|
258
|
+
static: $(STATIC_LIB)
|
259
|
+
|
260
|
+
clean:
|
261
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
262
|
+
|
263
|
+
distclean: clean
|
264
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
265
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
266
|
+
|
267
|
+
realclean: distclean
|
268
|
+
install: install-so install-rb
|
269
|
+
|
270
|
+
install-so: $(RUBYARCHDIR)
|
271
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
272
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
273
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
274
|
+
install-rb: pre-install-rb install-rb-default
|
275
|
+
install-rb-default: pre-install-rb-default
|
276
|
+
pre-install-rb: Makefile
|
277
|
+
pre-install-rb-default: Makefile
|
278
|
+
$(RUBYARCHDIR):
|
279
|
+
$(MAKEDIRS) $@
|
280
|
+
|
281
|
+
site-install: site-install-so site-install-rb
|
282
|
+
site-install-so: install-so
|
283
|
+
site-install-rb: install-rb
|
284
|
+
|
285
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
286
|
+
|
287
|
+
.cc.o:
|
288
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
289
|
+
|
290
|
+
.cxx.o:
|
291
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
292
|
+
|
293
|
+
.cpp.o:
|
294
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
295
|
+
|
296
|
+
.C.o:
|
297
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
298
|
+
|
299
|
+
.c.o:
|
300
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
301
|
+
|
302
|
+
$(DLLIB): $(OBJS)
|
303
|
+
@-$(RM) $@
|
304
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
305
|
+
|
306
|
+
|
307
|
+
$(OBJS): ruby.h defines.h $(RUBY_EXTCONF_H)
|
308
|
+
|