libxslt-ruby 1.1.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +154 -0
- data/LICENSE +21 -0
- data/README.rdoc +160 -0
- data/Rakefile +90 -0
- data/ext/libxslt/extconf.rb +157 -0
- data/ext/libxslt/libxslt.c +69 -0
- data/ext/libxslt/libxslt.h +37 -0
- data/ext/libxslt/ruby_exslt.c +149 -0
- data/ext/libxslt/ruby_exslt.h +8 -0
- data/ext/libxslt/ruby_xslt_stylesheet.c +302 -0
- data/ext/libxslt/ruby_xslt_stylesheet.h +10 -0
- data/ext/libxslt/version.h +5 -0
- data/ext/vc/libxslt_ruby.sln +26 -0
- data/ext/vc/libxslt_ruby.vcxproj +110 -0
- data/lib/2.1/libxslt_ruby.so +0 -0
- data/lib/libs/libexslt-0.dll +0 -0
- data/lib/libs/libxslt-1.dll +0 -0
- data/lib/libxslt.rb +16 -0
- data/lib/libxslt/deprecated.rb +68 -0
- data/lib/libxslt/stylesheet.rb +30 -0
- data/lib/xslt.rb +15 -0
- data/libxslt-ruby.gemspec +43 -0
- data/setup.rb +1585 -0
- data/test/files/commentary.dtd +34 -0
- data/test/files/fuzface.xml +154 -0
- data/test/files/fuzface.xsl +4 -0
- data/test/files/params.xml +2 -0
- data/test/files/params.xsl +11 -0
- data/test/files/ramblings.xsl +46 -0
- data/test/test_deprecated.rb +100 -0
- data/test/test_exslt.rb +70 -0
- data/test/test_helper.rb +15 -0
- data/test/test_libxslt.rb +22 -0
- data/test/test_stylesheet.rb +214 -0
- data/test/test_suite.rb +11 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 38eea00ca41403ae3c84fe62ba183dad11240eb3
|
4
|
+
data.tar.gz: 71d2eee3dcd87e8b3a093d90d03e8785409e13ee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2fa021df12e9d4f85f9e9395956b63a617964b6dd459fa41da3c7046d73f93c6de3d010f3cec3270f65ed6332d360f7c128fea3f22cae3f3c764c92d1df87f99
|
7
|
+
data.tar.gz: ee4e4f74209584780b7268c2256398b9244aa0630fe12d626c87204828bb60be599e048ed1100d55a14290f6f82653fbc5b36d4c27d0f38aca671137893b29c3
|
data/CHANGES
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
== 1.1.1 / 2014-03-16 Charlie Savage
|
2
|
+
|
3
|
+
* Adds output and transform methods that respect the <xsl:output> options in stylesheets (Rick Frankel)
|
4
|
+
* Update included binaries
|
5
|
+
* Update extconf.rb to remove warnings
|
6
|
+
|
7
|
+
== 1.1.0 / 2013-01-06 Charlie Savage
|
8
|
+
|
9
|
+
* Update dependency to latest libxml-ruby version (Charlie Savage)
|
10
|
+
* Remove dependency on dl which causes warning in Ruby 2.0.0 (Charlie Savage)
|
11
|
+
|
12
|
+
== 1.0.9 / 2012-03-17 Charlie Savage
|
13
|
+
|
14
|
+
* Build fix for library inclusion order (Andrew Watts)
|
15
|
+
* Add pkg directory to gitignore (Travis Warlick)
|
16
|
+
|
17
|
+
== 1.0.8 / 2011-09-03 Charlie Savage
|
18
|
+
|
19
|
+
* Don't depend on exported data from libxml-ruby, doesn't work with VC++.
|
20
|
+
|
21
|
+
== 1.0.7 / 2011-08-29 Charlie Savage
|
22
|
+
|
23
|
+
* Don't require 'rake' in the gemspec to avoid annoying Bundler bugs
|
24
|
+
|
25
|
+
== 1.0.6 / 2011-08-14
|
26
|
+
|
27
|
+
* Fix compilation with Microsoft Visual Studio 2010 (Charlie Savage)
|
28
|
+
|
29
|
+
|
30
|
+
== 1.0.5 / 2011-08-09
|
31
|
+
|
32
|
+
* Fix Ruby 1.9.3-preview1 libxml 2.7.3 (OS X Lion) conflicting OnigUChar redefinition (Travis Warlick).
|
33
|
+
|
34
|
+
|
35
|
+
== 1.0.4 / 2011-08-03
|
36
|
+
|
37
|
+
* Don't link against libxml-ruby on OS X, as it is unnecessary and doesn't work
|
38
|
+
- dylib vs bundle (Travis Warlick).
|
39
|
+
|
40
|
+
* Add 'rake' to gemspec to enable use of :path option with Bundler (Travis Warlick).
|
41
|
+
|
42
|
+
* Update test requires to work on Ruby 1.8.* and 1.9.* (Charlie Savage)
|
43
|
+
|
44
|
+
|
45
|
+
== 1.0.3 / 2011-07-31
|
46
|
+
|
47
|
+
* Added support for extension function registration. This was adapted from
|
48
|
+
Gregoire Lejeune's ruby-xslt library at https://github.com/glejeune/ruby-xslt (Jens Willie).
|
49
|
+
|
50
|
+
* Update to work with libxml-ruby 2.1.0 and higher (Jens Willie).
|
51
|
+
|
52
|
+
* Use ENV for rake compiler task configuration (Jens Willie)
|
53
|
+
|
54
|
+
* Build fixes (Charlie Savage).
|
55
|
+
|
56
|
+
* Switch to using def files to control library exports (Charlie Savage).
|
57
|
+
|
58
|
+
|
59
|
+
== 1.0.1 / 2011-04-18 Charlie Savage
|
60
|
+
|
61
|
+
* Modernize gem - add gemspec file, use rake-compiler
|
62
|
+
|
63
|
+
* Fix Ruby 1.9.2 compile errors
|
64
|
+
|
65
|
+
* Build fixes
|
66
|
+
|
67
|
+
* Update tests scripts to make testing during development easier
|
68
|
+
|
69
|
+
|
70
|
+
== 0.9.8 / 2011-01-18 Charlie Savage
|
71
|
+
|
72
|
+
* Update build environment
|
73
|
+
|
74
|
+
|
75
|
+
== 0.9.1 / 2008-11-24 Charlie Savage
|
76
|
+
|
77
|
+
* Support libxml-ruby bindings 0.9.3 and above which has a changed
|
78
|
+
external api.
|
79
|
+
|
80
|
+
* Remove unused xslt transform wrapper class.
|
81
|
+
|
82
|
+
== 0.9.0 / 2008-11-18 Charlie Savage
|
83
|
+
|
84
|
+
* Add back in support for exslt.
|
85
|
+
|
86
|
+
* Support libxml-ruby bindings 0.9.0.
|
87
|
+
|
88
|
+
== 0.8.2 / 2008-07-21 Charlie Savage
|
89
|
+
|
90
|
+
* To use LibXSLT you can either require 'xslt' or require 'libxslt'.
|
91
|
+
The differences is that require 'xslt' mixes the LibXML and
|
92
|
+
LIBXSLT modules into the global namespace, thereby allowing
|
93
|
+
you to write code such as:
|
94
|
+
stylesheet = XSLT::Stylesheet.new(XML::Document.new). Note that
|
95
|
+
this is different from 0.8.0 release and may require updating your code.
|
96
|
+
|
97
|
+
* Support for libxml-ruby 0.8.2
|
98
|
+
|
99
|
+
* Improved Windows support - libxslt-ruby should now work out of the box.
|
100
|
+
|
101
|
+
== 0.8.0 / 2008-07-10 Charlie Savage
|
102
|
+
|
103
|
+
* Fix memory errors when reusing a stylehseet
|
104
|
+
|
105
|
+
* Added support for setting xsl::param values
|
106
|
+
|
107
|
+
* Updated RDocs.
|
108
|
+
|
109
|
+
* Moved to LibXSLT namespace
|
110
|
+
|
111
|
+
|
112
|
+
== 0.7.0 / 2008-07-10 Charlie Savage
|
113
|
+
|
114
|
+
* Ability to reuse the same stylesheet multiple times
|
115
|
+
|
116
|
+
* Simpler api
|
117
|
+
|
118
|
+
* Compatibility layer for pre-0.7.0 versions
|
119
|
+
|
120
|
+
* Major rewrite, resulting in significantly less code
|
121
|
+
|
122
|
+
* Updated RDocs.
|
123
|
+
|
124
|
+
|
125
|
+
== 0.6.0 / 2008-07-01 Charlie Savage
|
126
|
+
|
127
|
+
* Now packaged as a separate gem
|
128
|
+
|
129
|
+
* Windows support (both lots of memory fixes and binaries)
|
130
|
+
|
131
|
+
* New libxslt.rb ruby wrapper, so programs can simply say require 'xslt'
|
132
|
+
|
133
|
+
|
134
|
+
== 0.5.0 / 2006-02-27 Ross Bamford <rosco at roscopeco.co.uk>
|
135
|
+
|
136
|
+
* Source layout for Rubygem release
|
137
|
+
|
138
|
+
* Fixed unit tests (set_up to setup, directory handling)
|
139
|
+
|
140
|
+
* Updated extconf to remove shell-script dependency
|
141
|
+
|
142
|
+
* Fixed multiple symbol declarations for -fno-common
|
143
|
+
|
144
|
+
== 0.4.0 / 2003-12-15 Martin Povolny <martin@solnet.cz>
|
145
|
+
|
146
|
+
* libxslt.c: added call to exsltRegisterAll to enable exslt extensions
|
147
|
+
|
148
|
+
* extconf.rb: added -lexslt
|
149
|
+
|
150
|
+
== 0.3.0 / 2004-02-01 Martin Povolny <martin@solnet.cz>
|
151
|
+
|
152
|
+
* libxslt.c: added call to ruby_init_xslt_transform_context() to make it
|
153
|
+
work on ruby1.8
|
154
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
Copyright (c) 2002-2006 Sean Chittenden <sean@chittenden.org> and contributors
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
= libxslt-ruby
|
2
|
+
|
3
|
+
== Overview
|
4
|
+
|
5
|
+
The libxslt gem provides Ruby language bindings for GNOME's Libxslt
|
6
|
+
toolkit. It is free software, released under the MIT License.
|
7
|
+
|
8
|
+
|
9
|
+
== Requirements
|
10
|
+
|
11
|
+
libxslt-ruby requires Ruby 1.8.4 or higher. It is dependent on
|
12
|
+
the following libraries to function properly:
|
13
|
+
|
14
|
+
* libm (math routines: very standard)
|
15
|
+
* libz (zlib)
|
16
|
+
* libiconv
|
17
|
+
* libxml2
|
18
|
+
* libxslt
|
19
|
+
* libxml-ruby bindings
|
20
|
+
|
21
|
+
If you are running Linux or Unix you'll need a C compiler so the extension
|
22
|
+
can be compiled when it is installed. If you are running Windows, then install the Windows specific RubyGem which
|
23
|
+
includes an already built extension.
|
24
|
+
|
25
|
+
!!!NOTE!!! The libxml-ruby and libxslt-ruby bindings must absolutely, positively,
|
26
|
+
without a doubt share the same libxml2 library. This is because libxslt modifies
|
27
|
+
XML documents created by libxml2. If there are two copies of libxml2 on your
|
28
|
+
system, then when XML documents allocated in copy #1 are manipulated by copy #2,
|
29
|
+
a segmentation fault will occur. So make sure that your system has only one copy of libxml2
|
30
|
+
installed.
|
31
|
+
|
32
|
+
|
33
|
+
== INSTALLATION
|
34
|
+
|
35
|
+
The easiest way to install libxslt-ruby is via Ruby Gems. To install:
|
36
|
+
|
37
|
+
<tt>gem install libxslt-ruby</tt>
|
38
|
+
|
39
|
+
If you are running Windows, make sure to install the Mingw64 RubyGem which
|
40
|
+
includes an already built binary file. The binary is built against
|
41
|
+
libxml2 version 2.9.1, iconv version 1.14 and libxslt version 1.1.28.
|
42
|
+
Binaries for libxml2 and iconv are provided in the libxml-ruby bindings,
|
43
|
+
while binaries for libxslt and libexslt areprovided in the
|
44
|
+
libxslt-ruby bindings.
|
45
|
+
|
46
|
+
|
47
|
+
== USAGE
|
48
|
+
|
49
|
+
For in-depth information about using libxslt-ruby please refer
|
50
|
+
to its online Rdoc documentation.
|
51
|
+
|
52
|
+
All libxslt classes are in the LibXSLT::XSLT module. The simplest
|
53
|
+
way to use libxslt is to require 'xslt'. This will mixin the
|
54
|
+
LibXML and LibXSLT modules into the global namespace, allowing you to
|
55
|
+
write code like this:
|
56
|
+
|
57
|
+
require 'xslt'
|
58
|
+
document = XML::Document.new
|
59
|
+
stylesheett = XSLT::Stylesheet.new(document)
|
60
|
+
|
61
|
+
If you prefer not to add the LibXSLT module to the global namepace, then
|
62
|
+
write your code like this:
|
63
|
+
|
64
|
+
require 'libxslt'
|
65
|
+
|
66
|
+
class MyClass
|
67
|
+
def some_method
|
68
|
+
document = LibXML::XML::Document.new
|
69
|
+
stylesheett = LibXSLT::XSLT::Stylesheet.new(document)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
Given an XML file like:
|
74
|
+
|
75
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
76
|
+
<?xml-stylesheet href="fuzface.xsl" type="text/xsl"?>
|
77
|
+
|
78
|
+
<commentary>
|
79
|
+
<meta>
|
80
|
+
<author>
|
81
|
+
<first_name>Sean</first_name>
|
82
|
+
<last_name>Chittenden</last_name>
|
83
|
+
<email>sean@chittenden.org</email>
|
84
|
+
</author>
|
85
|
+
<version>$Version$</version>
|
86
|
+
<date>$Date$</date>
|
87
|
+
<id>$Id$</id> <title>Fuzface...</title>
|
88
|
+
<subtitle>The Internet's a big place and here's some proof...</subtitle>
|
89
|
+
</meta>
|
90
|
+
|
91
|
+
<body>
|
92
|
+
<para>
|
93
|
+
I think it's a tragedy that I'm going to start off my new
|
94
|
+
commentary by talking about facial hair and the Internet.
|
95
|
+
Something about that just screams pathetic, but whatever: it's
|
96
|
+
humor and that's life.
|
97
|
+
</para>
|
98
|
+
</body>
|
99
|
+
</commentary>
|
100
|
+
|
101
|
+
And an XSLT file like this:
|
102
|
+
|
103
|
+
<?xml version="1.0" ?>
|
104
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
105
|
+
<xsl:template match="/">
|
106
|
+
<xsl:element name="html">
|
107
|
+
<xsl:element name="head">
|
108
|
+
<xsl:element name="title">Ramblings - <xsl:value-of select="commentary/meta/title" /> - <xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
|
109
|
+
</xsl:element>
|
110
|
+
|
111
|
+
<xsl:element name="body">
|
112
|
+
<xsl:element name="h1"><xsl:value-of select="commentary/meta/title" /></xsl:element>
|
113
|
+
<xsl:element name="h3"><xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
|
114
|
+
By: <xsl:value-of select="commentary/meta/author/first_name" /> <xsl:value-of select="commentary/meta/author/last_name" /><xsl:element name="br" />
|
115
|
+
Date: <xsl:value-of select="commentary/meta/date" /><xsl:element name="br" />
|
116
|
+
|
117
|
+
<xsl:for-each select="./commentary/body">
|
118
|
+
<xsl:apply-templates />
|
119
|
+
</xsl:for-each>
|
120
|
+
|
121
|
+
</xsl:element>
|
122
|
+
</xsl:element>
|
123
|
+
</xsl:template>
|
124
|
+
|
125
|
+
<xsl:template match="para">
|
126
|
+
<xsl:element name="p">
|
127
|
+
<xsl:value-of select="." />
|
128
|
+
</xsl:element>
|
129
|
+
</xsl:template>
|
130
|
+
</xsl:stylesheet>
|
131
|
+
|
132
|
+
We can easily transform the XML with the following ruby code:
|
133
|
+
|
134
|
+
require 'xslt'
|
135
|
+
|
136
|
+
# Create a new XSL Transform
|
137
|
+
stylesheet_doc = XML::Document.file('files/fuzface.xsl')
|
138
|
+
stylesheet = LibXSLT::Stylesheet.new(stylesheet_doc)
|
139
|
+
|
140
|
+
# Transform a xml document
|
141
|
+
xml_doc = XML::Document.file('files/fuzface.xml')
|
142
|
+
result = stylesheet.apply(xml_doc)
|
143
|
+
|
144
|
+
You can then print, save or manipulate the returned document.
|
145
|
+
|
146
|
+
== License
|
147
|
+
|
148
|
+
See LICENSE for license information.
|
149
|
+
|
150
|
+
== DOCUMENTATION
|
151
|
+
|
152
|
+
RDoc comments are included - run 'rake doc' to generate documentation.
|
153
|
+
You can find the latest documentation at:
|
154
|
+
|
155
|
+
* http://libxsl.rubyforge.org/
|
156
|
+
|
157
|
+
== MORE INFORMATION
|
158
|
+
|
159
|
+
For more information please refer to the documentation. If you have any
|
160
|
+
questions, please send email to libxml-devel@rubyforge.org.
|
data/Rakefile
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake/extensiontask'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'rdoc/task'
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
GEM_NAME = 'libxslt-ruby'
|
10
|
+
SO_NAME = 'libxslt_ruby'
|
11
|
+
|
12
|
+
# Read the spec file
|
13
|
+
spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
|
14
|
+
|
15
|
+
# Setup compile tasks. Configuration can be passed via EVN.
|
16
|
+
# Example:
|
17
|
+
# rake compile with_xml2_include=C:/MinGW/local/include/libxml2
|
18
|
+
# with_xslt_include=C:/MinGW/local/include/libxslt
|
19
|
+
# with_exslt_include=C:/MinGW/local/include/libexslt
|
20
|
+
Rake::ExtensionTask.new do |ext|
|
21
|
+
ext.gem_spec = spec
|
22
|
+
ext.name = SO_NAME
|
23
|
+
ext.ext_dir = "ext/libxslt"
|
24
|
+
ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
|
25
|
+
|
26
|
+
ext.config_options << "--with-zlib-dir=C:/MinGW64/local"
|
27
|
+
ext.config_options << "--with-xml2-include=C:/MinGW64/local/include/libxml2"
|
28
|
+
ext.config_options << "--with-xslt-include=C:/MinGW64/local/include/libxslt"
|
29
|
+
ext.config_options << "--with-exslt-include=C:/MinGW64/local/include/libexslt"
|
30
|
+
|
31
|
+
ENV.each do |key, val|
|
32
|
+
next unless key =~ /\Awith_(\w+)\z/i
|
33
|
+
opt = $1.downcase.tr('_', '-')
|
34
|
+
if File.directory?(path = File.expand_path(val))
|
35
|
+
ext.config_options << "--with-#{opt}=#{path}"
|
36
|
+
else
|
37
|
+
warn "No such directory: #{opt}: #{path}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Setup generic gem
|
43
|
+
Gem::PackageTask.new(spec) do |pkg|
|
44
|
+
pkg.package_dir = 'pkg'
|
45
|
+
pkg.need_tar = false
|
46
|
+
end
|
47
|
+
|
48
|
+
# Setup Windows Gem
|
49
|
+
if RUBY_PLATFORM.match(/win32|mingw32/)
|
50
|
+
binaries = (FileList['lib/**/*.so',
|
51
|
+
'lib/**/*dll'])
|
52
|
+
|
53
|
+
# Windows specification
|
54
|
+
win_spec = spec.clone
|
55
|
+
win_spec.platform = Gem::Platform::CURRENT
|
56
|
+
win_spec.files += binaries.to_a
|
57
|
+
win_spec.instance_variable_set(:@cache_file, nil)
|
58
|
+
|
59
|
+
# Unset extensions
|
60
|
+
win_spec.extensions = nil
|
61
|
+
|
62
|
+
# Rake task to build the windows package
|
63
|
+
Gem::PackageTask.new(win_spec) do |pkg|
|
64
|
+
pkg.package_dir = 'pkg'
|
65
|
+
pkg.need_tar = false
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# RDoc Task
|
70
|
+
desc "Generate rdoc documentation"
|
71
|
+
RDoc::Task.new("rdoc") do |rdoc|
|
72
|
+
rdoc.rdoc_dir = 'doc'
|
73
|
+
rdoc.title = "libxml-xslt"
|
74
|
+
# Show source inline with line numbers
|
75
|
+
rdoc.options << "--line-numbers"
|
76
|
+
# Make the readme file the start page for the generated html
|
77
|
+
rdoc.options << '--main' << 'README'
|
78
|
+
rdoc.rdoc_files.include('doc/*.rdoc',
|
79
|
+
'ext/**/*.c',
|
80
|
+
'lib/**/*.rb',
|
81
|
+
'CHANGES',
|
82
|
+
'README',
|
83
|
+
'LICENSE')
|
84
|
+
end
|
85
|
+
|
86
|
+
# Test Task
|
87
|
+
Rake::TestTask.new do |t|
|
88
|
+
t.libs << "test"
|
89
|
+
t.verbose = true
|
90
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
#!/usr/local/bin/ruby -w
|
2
|
+
|
3
|
+
# See the LICENSE file for copyright and distribution information
|
4
|
+
|
5
|
+
require 'mkmf'
|
6
|
+
require 'rbconfig'
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
$preload = nil
|
10
|
+
$INCFLAGS << " -I/usr/local/include"
|
11
|
+
$LIBPATH.push(RbConfig::CONFIG['libdir'])
|
12
|
+
|
13
|
+
def crash(str)
|
14
|
+
print(" extconf failure: %s\n", str)
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
# Directories
|
19
|
+
dir_config('iconv')
|
20
|
+
dir_config('zlib')
|
21
|
+
dir_config('xml2')
|
22
|
+
dir_config('xslt')
|
23
|
+
dir_config('exslt')
|
24
|
+
|
25
|
+
# Ruby 1.9 has ruby/io.h instead of rubyio.h
|
26
|
+
have_header('ruby/io.h')
|
27
|
+
|
28
|
+
# First get zlib
|
29
|
+
unless have_library('z', 'inflate') or
|
30
|
+
have_library('zlib', 'inflate') or
|
31
|
+
have_library('zlib1', 'inflate') or
|
32
|
+
have_library('libz', 'inflate')
|
33
|
+
crash('need zlib')
|
34
|
+
else
|
35
|
+
$defs.push('-DHAVE_ZLIB_H')
|
36
|
+
end
|
37
|
+
|
38
|
+
unless have_library('iconv','iconv_open') or
|
39
|
+
have_library('iconv','libiconv_open') or
|
40
|
+
have_library('libiconv', 'libiconv_open') or
|
41
|
+
have_library('libiconv', 'iconv_open') or
|
42
|
+
have_library('c','iconv_open') or
|
43
|
+
have_library('recode','iconv_open') or
|
44
|
+
have_library('iconv')
|
45
|
+
crash(<<-EOL)
|
46
|
+
need libiconv.
|
47
|
+
|
48
|
+
Install the libiconv or try passing one of the following options
|
49
|
+
to extconf.rb:
|
50
|
+
|
51
|
+
--with-iconv-dir=/path/to/iconv
|
52
|
+
--with-iconv-lib=/path/to/iconv/lib
|
53
|
+
--with-iconv-include=/path/to/iconv/include
|
54
|
+
EOL
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
unless (have_library('xml2', 'xmlXPtrNewRange') or
|
59
|
+
have_library('libxml2', 'xmlXPtrNewRange') or
|
60
|
+
find_library('xml2', 'xmlXPtrNewRange', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
61
|
+
(have_header('libxml/xmlversion.h') or
|
62
|
+
find_header('libxml/xmlversion.h',
|
63
|
+
'/opt/include/libxml2',
|
64
|
+
'/usr/local/include/libxml2',
|
65
|
+
'/usr/include/libxml2'))
|
66
|
+
crash(<<-EOL)
|
67
|
+
need libxml2.
|
68
|
+
|
69
|
+
Install the library or try one of the following options to extconf.rb:
|
70
|
+
|
71
|
+
--with-xml2-dir=/path/to/libxml2
|
72
|
+
--with-xml2-lib=/path/to/libxml2/lib
|
73
|
+
--with-xml2-include=/path/to/libxml2/include
|
74
|
+
EOL
|
75
|
+
end
|
76
|
+
|
77
|
+
unless (have_library('xslt','xsltApplyStylesheet') or
|
78
|
+
have_library('libxslt','xsltApplyStylesheet') or
|
79
|
+
find_library('xslt', 'xsltApplyStylesheet', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
80
|
+
(have_header('xslt.h') or
|
81
|
+
find_header('xslt.h',
|
82
|
+
'/opt/include/libxslt',
|
83
|
+
'/usr/local/include/libxslt',
|
84
|
+
'/usr/include/libxslt'))
|
85
|
+
crash(<<-EOL)
|
86
|
+
need libxslt.
|
87
|
+
|
88
|
+
Install the library or try one of the following options to extconf.rb:
|
89
|
+
|
90
|
+
--with-xslt-dir=/path/to/libxslt
|
91
|
+
--with-xslt-lib=/path/to/libxslt/lib
|
92
|
+
--with-xslt-include=/path/to/libxslt/include
|
93
|
+
EOL
|
94
|
+
end
|
95
|
+
|
96
|
+
unless (have_library('exslt','exsltRegisterAll') or
|
97
|
+
have_library('libexslt','exsltRegisterAll') or
|
98
|
+
find_library('exslt', 'exsltRegisterAll', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
99
|
+
(have_header('exslt.h') or
|
100
|
+
find_header('exslt.h',
|
101
|
+
'/opt/include/libexslt',
|
102
|
+
'/usr/local/include/libexslt',
|
103
|
+
'/usr/include/libexslt'))
|
104
|
+
crash(<<-EOL)
|
105
|
+
Need libexslt.
|
106
|
+
Install the library or try one of the following options to extconf.rb:
|
107
|
+
--with-exslt-dir=/path/to/libexslt
|
108
|
+
--with-exslt-lib=/path/to/libexslt/lib
|
109
|
+
--with-exslt-include=/path/to/libexslt/include
|
110
|
+
EOL
|
111
|
+
end
|
112
|
+
|
113
|
+
# Figure out where libxml-ruby is installed
|
114
|
+
unless gem_spec = Gem::Specification.find_by_name('libxml-ruby')
|
115
|
+
crash(<<-EOL)
|
116
|
+
libxml-ruby bindings must be installed
|
117
|
+
EOL
|
118
|
+
end
|
119
|
+
|
120
|
+
unless find_header("ruby_libxml.h", "#{gem_spec.full_gem_path}/ext/libxml")
|
121
|
+
crash(<<-EOL)
|
122
|
+
Need headers for libxml-ruby.
|
123
|
+
EOL
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
RUBY_VERSION =~ /(\d+.\d+)/
|
128
|
+
minor_version = $1
|
129
|
+
paths = ["#{gem_spec.full_gem_path}/lib",
|
130
|
+
"#{gem_spec.full_gem_path}/lib/#{minor_version}",
|
131
|
+
"#{gem_spec.full_gem_path}/ext/libxml"]
|
132
|
+
|
133
|
+
# No need to link xml_ruby on OS X
|
134
|
+
unless RbConfig::CONFIG['host_os'].match(/darwin/)
|
135
|
+
# Hack to make sure ruby library is *after* xml_ruby library
|
136
|
+
$LIBS = "#{$LIBRUBYARG_STATIC} #{$LIBS}"
|
137
|
+
|
138
|
+
libraries = ["xml_ruby", # Linux
|
139
|
+
":libxml_ruby.so", # mingw
|
140
|
+
"libxml_ruby-#{RbConfig::CONFIG["arch"]}"] # mswin
|
141
|
+
|
142
|
+
libxml_library = libraries.detect do |library|
|
143
|
+
find_library(library, "Init_libxml_ruby", *paths)
|
144
|
+
end
|
145
|
+
|
146
|
+
unless libxml_library
|
147
|
+
crash(<<-EOL)
|
148
|
+
Need libxml-ruby
|
149
|
+
Please install libxml-ruby or specify the path to the gem via:
|
150
|
+
--with-libxml-ruby=/path/to/libxml-ruby gem
|
151
|
+
EOL
|
152
|
+
end
|
153
|
+
$LIBS.gsub!($LIBRUBYARG_STATIC,'')
|
154
|
+
end
|
155
|
+
|
156
|
+
create_header()
|
157
|
+
create_makefile("libxslt_ruby")
|