libxslt-ruby 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,90 +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
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.rdoc'
78
+ rdoc.rdoc_files.include('doc/*.rdoc',
79
+ 'ext/**/*.c',
80
+ 'lib/**/*.rb',
81
+ 'CHANGES',
82
+ 'README.rdoc',
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,6 @@
1
+ #ifndef EXTCONF_H
2
+ #define EXTCONF_H
3
+ #define HAVE_LIBXML_XMLVERSION_H 1
4
+ #define HAVE_XSLT_H 1
5
+ #define HAVE_EXSLT_H 1
6
+ #endif
@@ -1,157 +1,112 @@
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")
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
+
10
+ def crash(str)
11
+ print(" extconf failure: %s\n", str)
12
+ exit 1
13
+ end
14
+
15
+ # Directories
16
+ dir_config('xml2')
17
+ dir_config('xslt')
18
+ dir_config('exslt')
19
+
20
+ unless (have_library('xml2', 'xmlXPtrNewRange') or
21
+ have_library('libxml2', 'xmlXPtrNewRange') or
22
+ find_library('xml2', 'xmlXPtrNewRange', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
23
+ (have_header('libxml/xmlversion.h') or
24
+ find_header('libxml/xmlversion.h',
25
+ '/opt/include/libxml2',
26
+ '/usr/local/include/libxml2',
27
+ '/usr/include/libxml2'))
28
+ crash(<<-EOL)
29
+ Cannot find libxml2.
30
+
31
+ Install the library or try one of the following options to extconf.rb:
32
+
33
+ --with-xml2-dir=/path/to/libxml2
34
+ --with-xml2-lib=/path/to/libxml2/lib
35
+ --with-xml2-include=/path/to/libxml2/include
36
+ EOL
37
+ end
38
+
39
+ unless (have_library('xslt','xsltApplyStylesheet') or
40
+ have_library('libxslt','xsltApplyStylesheet') or
41
+ find_library('xslt', 'xsltApplyStylesheet', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
42
+ (have_header('xslt.h') or
43
+ find_header('xslt.h',
44
+ '/opt/include/libxslt',
45
+ '/usr/local/include/libxslt',
46
+ '/usr/include/libxslt'))
47
+ crash(<<-EOL)
48
+ need libxslt.
49
+
50
+ Install the library or try one of the following options to extconf.rb:
51
+
52
+ --with-xslt-dir=/path/to/libxslt
53
+ --with-xslt-lib=/path/to/libxslt/lib
54
+ --with-xslt-include=/path/to/libxslt/include
55
+ EOL
56
+ end
57
+
58
+ unless (have_library('exslt','exsltRegisterAll') or
59
+ have_library('libexslt','exsltRegisterAll') or
60
+ find_library('exslt', 'exsltRegisterAll', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
61
+ (have_header('exslt.h') or
62
+ find_header('exslt.h',
63
+ '/opt/include/libexslt',
64
+ '/usr/local/include/libexslt',
65
+ '/usr/include/libexslt'))
66
+ crash(<<-EOL)
67
+ Need libexslt.
68
+ Install the library or try one of the following options to extconf.rb:
69
+ --with-exslt-dir=/path/to/libexslt
70
+ --with-exslt-lib=/path/to/libexslt/lib
71
+ --with-exslt-include=/path/to/libexslt/include
72
+ EOL
73
+ end
74
+
75
+ # Figure out where libxml-ruby is installed
76
+ unless gem_spec = Gem::Specification.find_by_name('libxml-ruby')
77
+ crash(<<-EOL)
78
+ libxml-ruby gem must be installed
79
+ EOL
80
+ end
81
+
82
+ # Tell gcc where to find ruby_libxml.h
83
+ $INCFLAGS << " -I\"#{gem_spec.full_gem_path}/ext/libxml\""
84
+
85
+ RUBY_VERSION =~ /^(\d+.\d+)/
86
+ minor_version = $1
87
+ paths = ["#{gem_spec.full_gem_path}/lib",
88
+ "#{gem_spec.full_gem_path}/lib/#{minor_version}",
89
+ "#{gem_spec.full_gem_path}/ext/libxml"]
90
+
91
+ # No need to link xml_ruby on OS X
92
+ unless RbConfig::CONFIG['host_os'].match(/darwin|linux/)
93
+ libraries = ["xml_ruby", # Linux
94
+ ":libxml_ruby.so", # mingw
95
+ "libxml_ruby-#{RbConfig::CONFIG["arch"]}"] # mswin
96
+
97
+ libxml_library = libraries.detect do |library|
98
+ find_library(library, "Init_libxml_ruby", *paths)
99
+ end
100
+
101
+ unless libxml_library
102
+ crash(<<-EOL)
103
+ Need libxml-ruby
104
+ Please install libxml-ruby or specify the path to the gem via:
105
+ --with-libxml-ruby=/path/to/libxml-ruby gem
106
+ EOL
107
+ end
108
+ $LIBS.gsub!($LIBRUBYARG_STATIC,'')
109
+ end
110
+
111
+ create_header()
112
+ create_makefile("libxslt_ruby")