teius 0.1.0 → 0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/extconf.rb +3 -1
- data/ext/teius.c +139 -7
- data/lib/teius.rb +39 -2
- data/test/input.xml +11 -0
- data/test/teius_test.rb +58 -0
- data/test/test.xsl +27 -0
- metadata +8 -9
- data/ext/Makefile +0 -138
- data/ext/teius.o +0 -0
- data/ext/teius.so +0 -0
- data/lib/teius.so +0 -0
data/ext/extconf.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
-
dir_config('libxml', '/usr/include/
|
3
|
+
dir_config('libxml', '/usr/include/libxml', '/usr/lib');
|
4
|
+
dir_config('libxslt', '/usr/include', '/usr/lib');
|
4
5
|
have_library('xml2', 'xmlReadFile')
|
6
|
+
have_library('xslt', 'xsltParseStylesheetFile')
|
5
7
|
create_makefile("teius")
|
data/ext/teius.c
CHANGED
@@ -1,20 +1,31 @@
|
|
1
|
+
/* NOTES: possibly call xsltCleanupGlobals() and xmlCleanupParser() at some point */
|
2
|
+
|
1
3
|
#include <stdio.h>
|
2
4
|
#include "ruby.h"
|
3
5
|
#include <libxml/parser.h>
|
4
6
|
#include <libxml/tree.h>
|
5
7
|
#include <libxml/xpath.h>
|
6
8
|
|
9
|
+
#include <libxslt/xslt.h>
|
10
|
+
#include <libxslt/xsltInternals.h>
|
11
|
+
#include <libxslt/transform.h>
|
12
|
+
#include <libxslt/xsltutils.h>
|
13
|
+
|
7
14
|
static VALUE cParseError;
|
8
15
|
static VALUE cXpathError;
|
9
16
|
static VALUE cNodeNotFound;
|
10
17
|
static VALUE cNodeNotUnique;
|
11
18
|
static VALUE cNode;
|
12
19
|
static VALUE cDocument;
|
20
|
+
static VALUE cStylesheet;
|
13
21
|
static ID sRequired;
|
14
22
|
static ID sFirst;
|
15
23
|
static ID sAll;
|
16
24
|
static ID sUnique;
|
17
25
|
|
26
|
+
/* Suppress error messages to stderr */
|
27
|
+
static void null_handler(void *ctx, const char *msg, ...) {}
|
28
|
+
|
18
29
|
static void doc_free(void *p) {
|
19
30
|
xmlFreeDoc(p);
|
20
31
|
}
|
@@ -151,7 +162,31 @@ static VALUE node_pointer(VALUE self) {
|
|
151
162
|
return INT2NUM((int)node);
|
152
163
|
}
|
153
164
|
|
154
|
-
|
165
|
+
/* Returns the line number the node starts on */
|
166
|
+
static VALUE node_line(VALUE self) {
|
167
|
+
xmlNodePtr node = NULL;
|
168
|
+
Data_Get_Struct(self, xmlNode, node);
|
169
|
+
return INT2NUM(node->line);
|
170
|
+
}
|
171
|
+
|
172
|
+
/* Returns the recursive content of the node in string format */
|
173
|
+
static VALUE node_content(VALUE self) {
|
174
|
+
xmlNodePtr node = NULL;
|
175
|
+
const xmlChar *mem;
|
176
|
+
xmlBufferPtr buf;
|
177
|
+
int size;
|
178
|
+
|
179
|
+
Data_Get_Struct(self, xmlNode, node);
|
180
|
+
buf = xmlBufferCreate();
|
181
|
+
size = xmlNodeDump(buf, node->doc, node, 0, 1);
|
182
|
+
mem = xmlBufferContent(buf);
|
183
|
+
VALUE rStr = rb_str_new2(mem);
|
184
|
+
xmlBufferFree(buf);
|
185
|
+
|
186
|
+
return rStr;
|
187
|
+
}
|
188
|
+
|
189
|
+
static VALUE document_parse_file(VALUE self, VALUE rFilename) {
|
155
190
|
xmlDocPtr doc = xmlReadFile(StringValuePtr(rFilename), NULL, 0);
|
156
191
|
if (doc == NULL) {
|
157
192
|
xmlErrorPtr err = xmlGetLastError();
|
@@ -165,7 +200,7 @@ static VALUE parse_file(VALUE self, VALUE rFilename) {
|
|
165
200
|
return rDoc;
|
166
201
|
}
|
167
202
|
|
168
|
-
static VALUE
|
203
|
+
static VALUE document_parse_string(VALUE self, VALUE rDocString) {
|
169
204
|
xmlDocPtr doc = xmlReadDoc(StringValuePtr(rDocString), NULL, NULL, 0);
|
170
205
|
if (doc == NULL) {
|
171
206
|
xmlErrorPtr err = xmlGetLastError();
|
@@ -178,8 +213,8 @@ static VALUE parse_string(VALUE self, VALUE rDocString) {
|
|
178
213
|
return rDoc;
|
179
214
|
}
|
180
215
|
|
181
|
-
static VALUE document_to_s(VALUE self
|
182
|
-
xmlDocPtr doc
|
216
|
+
static VALUE document_to_s(VALUE self) {
|
217
|
+
xmlDocPtr doc = NULL;
|
183
218
|
xmlChar *mem;
|
184
219
|
int size;
|
185
220
|
|
@@ -191,9 +226,96 @@ static VALUE document_to_s(VALUE self, VALUE rDocString) {
|
|
191
226
|
return rStr;
|
192
227
|
}
|
193
228
|
|
229
|
+
static VALUE document_root(VALUE self) {
|
230
|
+
xmlDocPtr doc = NULL;
|
231
|
+
xmlNodePtr node = NULL;
|
232
|
+
VALUE rResult;
|
233
|
+
|
234
|
+
Data_Get_Struct(self, xmlDoc, doc);
|
235
|
+
node = xmlDocGetRootElement(doc);
|
236
|
+
rResult = Data_Wrap_Struct(cNode, 0, 0, node);
|
237
|
+
|
238
|
+
return rResult;
|
239
|
+
}
|
240
|
+
|
241
|
+
/* LibXslt Stuff */
|
242
|
+
static void stylesheet_free(void *p) {
|
243
|
+
xsltFreeStylesheet(p);
|
244
|
+
}
|
245
|
+
|
246
|
+
static VALUE stylesheet_parse_file(VALUE self, VALUE rFilename) {
|
247
|
+
xsltStylesheetPtr xsl = xsltParseStylesheetFile(StringValuePtr(rFilename));
|
248
|
+
if (xsl == NULL) {
|
249
|
+
xmlErrorPtr err = xmlGetLastError();
|
250
|
+
rb_raise(cParseError, "could not parse file %s: %s",
|
251
|
+
StringValuePtr(rFilename), err->message);
|
252
|
+
}
|
253
|
+
|
254
|
+
/* Load new document */
|
255
|
+
VALUE rStylesheet = Data_Wrap_Struct(cStylesheet, 0, stylesheet_free, xsl);
|
256
|
+
|
257
|
+
return rStylesheet;
|
258
|
+
}
|
259
|
+
|
260
|
+
static VALUE stylesheet_apply(VALUE self, VALUE rDocument) {
|
261
|
+
xsltStylesheetPtr stylesheet = NULL;
|
262
|
+
xmlDocPtr doc = NULL, res = NULL;
|
263
|
+
|
264
|
+
Data_Get_Struct(self, xsltStylesheet, stylesheet);
|
265
|
+
Data_Get_Struct(rDocument, xmlDoc, doc);
|
266
|
+
res = xsltApplyStylesheet(stylesheet, doc, NULL);
|
267
|
+
|
268
|
+
VALUE rDoc = Data_Wrap_Struct(cDocument, 0, doc_free, res);
|
269
|
+
|
270
|
+
return rDoc;
|
271
|
+
}
|
272
|
+
|
273
|
+
static VALUE stylesheet_save_to_file(VALUE self, VALUE rResult, VALUE rFilename) {
|
274
|
+
xsltStylesheetPtr stylesheet = NULL;
|
275
|
+
xmlDocPtr result = NULL;
|
276
|
+
int st;
|
277
|
+
|
278
|
+
Data_Get_Struct(self, xsltStylesheet, stylesheet);
|
279
|
+
Data_Get_Struct(rResult, xmlDoc, result);
|
280
|
+
|
281
|
+
st = xsltSaveResultToFilename(StringValuePtr(rFilename), result, stylesheet, 0);
|
282
|
+
if (st == -1) {
|
283
|
+
xmlErrorPtr err = xmlGetLastError();
|
284
|
+
rb_raise(rb_eIOError, "could not save stylesheet result file %s: %s",
|
285
|
+
StringValuePtr(rFilename), err->message);
|
286
|
+
}
|
287
|
+
|
288
|
+
return Qnil;
|
289
|
+
}
|
290
|
+
|
291
|
+
static VALUE stylesheet_save_to_string(VALUE self, VALUE rResult) {
|
292
|
+
xsltStylesheetPtr stylesheet = NULL;
|
293
|
+
xmlDocPtr result = NULL;
|
294
|
+
int st;
|
295
|
+
xmlChar *mem;
|
296
|
+
int size;
|
297
|
+
|
298
|
+
Data_Get_Struct(self, xsltStylesheet, stylesheet);
|
299
|
+
Data_Get_Struct(rResult, xmlDoc, result);
|
300
|
+
|
301
|
+
st = xsltSaveResultToString(&mem, &size, result, stylesheet);
|
302
|
+
if (st == -1) {
|
303
|
+
xmlErrorPtr err = xmlGetLastError();
|
304
|
+
rb_raise(rb_eStandardError, "could not save stylesheet result to string: %s",
|
305
|
+
err->message);
|
306
|
+
}
|
307
|
+
VALUE rStr = rb_str_new2(mem);
|
308
|
+
xmlFree(mem);
|
309
|
+
|
310
|
+
return rStr;
|
311
|
+
}
|
312
|
+
|
194
313
|
void Init_teius() {
|
195
314
|
/* LIBXML_TEST_VERSION */
|
196
315
|
|
316
|
+
xmlSetGenericErrorFunc(NULL, null_handler);
|
317
|
+
xsltSetGenericErrorFunc(NULL, null_handler);
|
318
|
+
|
197
319
|
/* Symbols */
|
198
320
|
sRequired = rb_intern("required");
|
199
321
|
sFirst = rb_intern("first");
|
@@ -220,10 +342,20 @@ void Init_teius() {
|
|
220
342
|
rb_define_method(cNode, "name", node_name, 0);
|
221
343
|
rb_define_method(cNode, "xpath", node_xpath, 0);
|
222
344
|
rb_define_method(cNode, "pointer", node_pointer, 0);
|
345
|
+
rb_define_method(cNode, "line", node_line, 0);
|
346
|
+
rb_define_method(cNode, "content", node_content, 0);
|
223
347
|
|
224
348
|
/* Document */
|
225
349
|
cDocument = rb_define_class_under(mTeius, "Document", cNode);
|
226
|
-
rb_define_singleton_method(cDocument, "parse_file",
|
227
|
-
rb_define_singleton_method(cDocument, "parse_string",
|
228
|
-
rb_define_method(
|
350
|
+
rb_define_singleton_method(cDocument, "parse_file", document_parse_file, 1);
|
351
|
+
rb_define_singleton_method(cDocument, "parse_string", document_parse_string, 1);
|
352
|
+
rb_define_method(cDocument, "to_s", document_to_s, 0);
|
353
|
+
rb_define_method(cDocument, "root", document_root, 0);
|
354
|
+
|
355
|
+
/* XSL Stylesheet */
|
356
|
+
cStylesheet = rb_define_class_under(mTeius, "Stylesheet", cNode);
|
357
|
+
rb_define_singleton_method(cStylesheet, "parse_file", stylesheet_parse_file, 1);
|
358
|
+
rb_define_method(cStylesheet, "apply", stylesheet_apply, 1);
|
359
|
+
rb_define_method(cStylesheet, "save_to_string", stylesheet_save_to_string, 1);
|
360
|
+
rb_define_method(cStylesheet, "save_to_file", stylesheet_save_to_file, 2);
|
229
361
|
}
|
data/lib/teius.rb
CHANGED
@@ -1,17 +1,34 @@
|
|
1
|
-
require 'teius.so'
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'ext', 'teius.so')
|
2
2
|
|
3
3
|
module Teius
|
4
|
+
class Document
|
5
|
+
|
6
|
+
def self.content(xml)
|
7
|
+
parse_string(xml).content
|
8
|
+
end
|
9
|
+
|
10
|
+
def content
|
11
|
+
root.content
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
4
15
|
class Node
|
5
16
|
def fetch(xpath)
|
6
|
-
node = find(:unique, xpath, :required =>
|
17
|
+
node = find(:unique, xpath, :required => false)
|
7
18
|
return node ? node.value : nil
|
8
19
|
end
|
9
20
|
|
21
|
+
def [](key)
|
22
|
+
attributes[key]
|
23
|
+
end
|
24
|
+
|
10
25
|
def ==(other)
|
26
|
+
return false unless other.kind_of? Node
|
11
27
|
self.pointer == other.pointer
|
12
28
|
end
|
13
29
|
|
14
30
|
def eql?(other)
|
31
|
+
return false unless other.kind_of? Node
|
15
32
|
self.pointer == other.pointer
|
16
33
|
end
|
17
34
|
|
@@ -31,5 +48,25 @@ module Teius
|
|
31
48
|
self.find :all, 'child::*'
|
32
49
|
end
|
33
50
|
|
51
|
+
def to_s
|
52
|
+
"#{name}:#{line}"
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
class Stylesheet
|
58
|
+
|
59
|
+
# If no filename is provided, will return the result as a String
|
60
|
+
def transform(doc, filename = nil)
|
61
|
+
result = apply doc
|
62
|
+
if filename
|
63
|
+
out = save_to_file result, filename # returns nil
|
64
|
+
else
|
65
|
+
out = save_to_string result
|
66
|
+
end
|
67
|
+
out
|
68
|
+
end
|
69
|
+
|
34
70
|
end
|
71
|
+
|
35
72
|
end
|
data/test/input.xml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
4
|
+
<head>
|
5
|
+
<title>Test document</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<h1>Test document</h1>
|
9
|
+
<p>This paragraph indicates the rest of the document.</p>
|
10
|
+
</body>
|
11
|
+
</html>
|
data/test/teius_test.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
2
2
|
require 'test/unit'
|
3
3
|
require 'teius'
|
4
|
+
require 'tempfile'
|
4
5
|
|
5
6
|
class TeiusTest < Test::Unit::TestCase
|
6
7
|
include Teius
|
@@ -135,4 +136,61 @@ class TeiusTest < Test::Unit::TestCase
|
|
135
136
|
assert_equal 9, sibs.size
|
136
137
|
end
|
137
138
|
|
139
|
+
def test_xslt
|
140
|
+
current_dir = File.dirname(__FILE__)
|
141
|
+
test_doc_path = File.join(current_dir, 'input.xml')
|
142
|
+
xsl_path = File.join(current_dir, 'test.xsl')
|
143
|
+
doc = Document.parse_file test_doc_path
|
144
|
+
xsl = Stylesheet.parse_file xsl_path
|
145
|
+
assert_no_match %r{menu}, doc.to_s
|
146
|
+
assert_match %r{menu}, xsl.transform(doc)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_xslt_write_to_file
|
150
|
+
current_dir = File.dirname(__FILE__)
|
151
|
+
test_doc_path = File.join(current_dir, 'input.xml')
|
152
|
+
xsl_path = File.join(current_dir, 'test.xsl')
|
153
|
+
doc = Document.parse_file test_doc_path
|
154
|
+
xsl = Stylesheet.parse_file xsl_path
|
155
|
+
Tempfile.open('xslt_test_file') do |tf|
|
156
|
+
outpath = tf.path
|
157
|
+
xsl.transform doc, outpath
|
158
|
+
str = tf.read
|
159
|
+
assert_match %r{menu}, str
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_xml_bad_file
|
164
|
+
assert_raise(Teius::ParseError) {
|
165
|
+
Document.parse_file File.join(File.dirname(__FILE__), 'bogus.xsl')
|
166
|
+
}
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_xslt_bad_file
|
170
|
+
assert_raise(Teius::ParseError) {
|
171
|
+
Stylesheet.parse_file File.join(File.dirname(__FILE__), 'bogus.xsl')
|
172
|
+
}
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_root
|
176
|
+
root = @doc.root
|
177
|
+
assert_equal 'sports-content:2', root.to_s
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_node_content
|
181
|
+
node = @doc.find :first, '//team-metadata'
|
182
|
+
expected = [ '<team-metadata team-key="l.nfl.com-t.24" alignment="away">',
|
183
|
+
' <name first="Green Bay" last="Packers"/>', '</team-metadata>' ].join "\n"
|
184
|
+
assert_equal expected, node.content
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_doc_content
|
188
|
+
assert_match /^<sports-content/, @doc.content
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_doc_class_content
|
192
|
+
content = Document.content '<library><book/></library>'
|
193
|
+
assert_equal "<library>\n <book/>\n</library>", content
|
194
|
+
end
|
195
|
+
|
138
196
|
end
|
data/test/test.xsl
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes" exclude-result-prefixes="xhtml xsl fn xs xdt">
|
3
|
+
<xsl:output method="xml" version="1.0" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" indent="yes"/>
|
4
|
+
|
5
|
+
<!-- the identity template -->
|
6
|
+
<xsl:template match="@*|node()">
|
7
|
+
<xsl:copy>
|
8
|
+
<xsl:apply-templates select="@*|node()"/>
|
9
|
+
</xsl:copy>
|
10
|
+
</xsl:template>
|
11
|
+
|
12
|
+
<!-- template for the head section. Only needed if we want to change, delete or add nodes. In our case we need it to add a link element pointing to an external CSS stylesheet. -->
|
13
|
+
<xsl:template match="xhtml:head">
|
14
|
+
<xsl:copy>
|
15
|
+
<link rel="StyleSheet" href="xhtml_test.css" type="text/css"/>
|
16
|
+
<xsl:apply-templates select="@*|node()"/>
|
17
|
+
</xsl:copy>
|
18
|
+
</xsl:template>
|
19
|
+
|
20
|
+
<!-- template for the body section. Only needed if we want to change, delete or add nodes. In our case we need it to add a div element containing a menu of navigation. -->
|
21
|
+
<xsl:template match="xhtml:body">
|
22
|
+
<xsl:copy>
|
23
|
+
<div class="menu"><p><a href="home">Homepage</a> > <strong>Test document</strong></p></div>
|
24
|
+
<xsl:apply-templates select="@*|node()"/>
|
25
|
+
</xsl:copy>
|
26
|
+
</xsl:template>
|
27
|
+
</xsl:stylesheet>
|
metadata
CHANGED
@@ -3,11 +3,12 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: teius
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-
|
6
|
+
version: "0.5"
|
7
|
+
date: 2006-06-28 00:00:00 +03:00
|
8
8
|
summary: Light-weight Ruby API to LibXML.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
+
- dll
|
11
12
|
email: joshmh@gmail.com
|
12
13
|
homepage: http://teius.rubyforge.org
|
13
14
|
rubyforge_project: teius
|
@@ -28,17 +29,15 @@ cert_chain:
|
|
28
29
|
authors:
|
29
30
|
- Joshua Harvey
|
30
31
|
files:
|
31
|
-
-
|
32
|
-
- ext/Makefile
|
33
|
-
- ext/teius.c
|
34
|
-
- ext/teius.o
|
35
|
-
- ext/teius.so
|
36
|
-
- lib/teius.rb
|
37
|
-
- lib/teius.so
|
32
|
+
- test/input.xml
|
38
33
|
- test/teius_test.rb
|
34
|
+
- test/test.xsl
|
39
35
|
- xml/xt.3608774-update-mid-event.xml
|
40
36
|
- xml/xt.3608787-update-post-event.xml
|
41
37
|
- doc/LICENCE.txt
|
38
|
+
- ext/extconf.rb
|
39
|
+
- ext/teius.c
|
40
|
+
- lib/teius.rb
|
42
41
|
test_files:
|
43
42
|
- test/teius_test.rb
|
44
43
|
rdoc_options: []
|
data/ext/Makefile
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
#### Start of system configuration section. ####
|
5
|
-
|
6
|
-
srcdir = .
|
7
|
-
topdir = d:/msys/local/lib/ruby/1.8/i386-mingw32
|
8
|
-
hdrdir = $(topdir)
|
9
|
-
VPATH = $(srcdir);$(topdir);$(hdrdir)
|
10
|
-
|
11
|
-
DESTDIR = d:
|
12
|
-
prefix = $(DESTDIR)/msys/local
|
13
|
-
exec_prefix = $(DESTDIR)/msys/local
|
14
|
-
sitedir = $(prefix)/lib/ruby/site_ruby
|
15
|
-
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
16
|
-
archdir = $(rubylibdir)/$(arch)
|
17
|
-
sbindir = $(exec_prefix)/sbin
|
18
|
-
datadir = $(prefix)/share
|
19
|
-
includedir = $(prefix)/include
|
20
|
-
infodir = $(prefix)/info
|
21
|
-
sysconfdir = $(prefix)/etc
|
22
|
-
mandir = $(prefix)/man
|
23
|
-
libdir = $(DESTDIR)/msys/local/lib
|
24
|
-
sharedstatedir = $(prefix)/com
|
25
|
-
oldincludedir = $(DESTDIR)/usr/include
|
26
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
27
|
-
bindir = $(exec_prefix)/bin
|
28
|
-
localstatedir = $(prefix)/var
|
29
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
30
|
-
libexecdir = $(exec_prefix)/libexec
|
31
|
-
|
32
|
-
CC = gcc
|
33
|
-
LIBRUBY = lib$(LIBRUBY_SO).a
|
34
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
35
|
-
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
36
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
37
|
-
|
38
|
-
CFLAGS = -g -O2
|
39
|
-
CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) -Id:/msys/local/include/libxml2
|
40
|
-
CXXFLAGS = $(CFLAGS)
|
41
|
-
DLDFLAGS = -Wl,--enable-auto-import,--export-all
|
42
|
-
LDSHARED = gcc -shared -s
|
43
|
-
AR = ar
|
44
|
-
EXEEXT = .exe
|
45
|
-
|
46
|
-
RUBY_INSTALL_NAME = ruby
|
47
|
-
RUBY_SO_NAME = msvcrt-ruby18
|
48
|
-
arch = i386-mingw32
|
49
|
-
sitearch = i386-msvcrt
|
50
|
-
ruby_version = 1.8
|
51
|
-
ruby = d:/msys/local/bin/ruby
|
52
|
-
RUBY = $(ruby)
|
53
|
-
RM = rm -f
|
54
|
-
MAKEDIRS = mkdir -p
|
55
|
-
INSTALL = /bin/install -c
|
56
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
57
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
58
|
-
COPY = cp
|
59
|
-
|
60
|
-
#### End of system configuration section. ####
|
61
|
-
|
62
|
-
preload =
|
63
|
-
|
64
|
-
libpath = d:/msys/local/lib $(libdir)
|
65
|
-
LIBPATH = -L"d:/msys/local/lib" -L"$(libdir)"
|
66
|
-
DEFFILE =
|
67
|
-
|
68
|
-
CLEANFILES =
|
69
|
-
DISTCLEANFILES =
|
70
|
-
|
71
|
-
extout =
|
72
|
-
extout_prefix =
|
73
|
-
target_prefix =
|
74
|
-
LOCAL_LIBS =
|
75
|
-
LIBS = $(LIBRUBYARG_SHARED) -lxml2 -lwsock32
|
76
|
-
SRCS = teius.c
|
77
|
-
OBJS = teius.o
|
78
|
-
TARGET = teius
|
79
|
-
DLLIB = $(TARGET).so
|
80
|
-
STATIC_LIB =
|
81
|
-
|
82
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
83
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
84
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
85
|
-
|
86
|
-
TARGET_SO = $(DLLIB)
|
87
|
-
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
88
|
-
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
89
|
-
|
90
|
-
all: $(DLLIB)
|
91
|
-
static: $(STATIC_LIB)
|
92
|
-
|
93
|
-
clean:
|
94
|
-
@-$(RM) $(CLEANLIBS:/=\) $(CLEANOBJS:/=\) $(CLEANFILES:/=\)
|
95
|
-
|
96
|
-
distclean: clean
|
97
|
-
@-$(RM) Makefile extconf.h conftest.* mkmf.log
|
98
|
-
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES:/=\)
|
99
|
-
|
100
|
-
realclean: distclean
|
101
|
-
install: install-so install-rb
|
102
|
-
|
103
|
-
install-so: $(RUBYARCHDIR)
|
104
|
-
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
105
|
-
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
106
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
107
|
-
install-rb: pre-install-rb install-rb-default
|
108
|
-
install-rb-default: pre-install-rb-default
|
109
|
-
pre-install-rb: Makefile
|
110
|
-
pre-install-rb-default: Makefile
|
111
|
-
$(RUBYARCHDIR):
|
112
|
-
$(MAKEDIRS) $@
|
113
|
-
|
114
|
-
site-install: site-install-so site-install-rb
|
115
|
-
site-install-so: install-so
|
116
|
-
site-install-rb: install-rb
|
117
|
-
|
118
|
-
.SUFFIXES: .c .m .cc .cxx .cpp .o
|
119
|
-
|
120
|
-
.cc.o:
|
121
|
-
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
122
|
-
|
123
|
-
.cxx.o:
|
124
|
-
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
125
|
-
|
126
|
-
.cpp.o:
|
127
|
-
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
128
|
-
|
129
|
-
.c.o:
|
130
|
-
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
131
|
-
|
132
|
-
$(DLLIB): $(OBJS)
|
133
|
-
@-$(RM) $@
|
134
|
-
$(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
$(OBJS): ruby.h defines.h
|
data/ext/teius.o
DELETED
Binary file
|
data/ext/teius.so
DELETED
Binary file
|
data/lib/teius.so
DELETED
Binary file
|