Permalink
Browse files

Extensions using mkrf now work with rubygems

git-svn-id: http://mkrf.rubyforge.org/svn/trunk@47 6e48df83-f314-0410-b1e7-e69642b30866
  • Loading branch information...
1 parent ff555c6 commit 16a8637026f3f34246863797de63eacbfdd41c1b kevinclark committed Oct 19, 2006
Showing with 9,576 additions and 1 deletion.
  1. +4 −0 CHANGELOG
  2. 0 examples/trivial/README
  3. +35 −0 examples/trivial/Rakefile
  4. +4 −0 examples/trivial/ext/trivial/mkrf_conf.rb
  5. BIN examples/trivial/ext/trivial/trivial.bundle
  6. +5 −0 examples/trivial/ext/trivial/trivial.c
  7. +74 −0 examples/xml/CHANGELOG
  8. +22 −0 examples/xml/LICENSE
  9. +144 −0 examples/xml/README
  10. +35 −0 examples/xml/Rakefile
  11. +76 −0 examples/xml/ext/xml/cbg.c
  12. +86 −0 examples/xml/ext/xml/libxml.c
  13. +82 −0 examples/xml/ext/xml/libxml.h
  14. +107 −0 examples/xml/ext/xml/libxml.rb
  15. +50 −0 examples/xml/ext/xml/mkrf_conf.rb
  16. +95 −0 examples/xml/ext/xml/old_extconf.rb
  17. +372 −0 examples/xml/ext/xml/ruby_xml_attr.c
  18. +21 −0 examples/xml/ext/xml/ruby_xml_attr.h
  19. +224 −0 examples/xml/ext/xml/ruby_xml_attribute.c
  20. +21 −0 examples/xml/ext/xml/ruby_xml_attribute.h
  21. +1,159 −0 examples/xml/ext/xml/ruby_xml_document.c
  22. +27 −0 examples/xml/ext/xml/ruby_xml_document.h
  23. +168 −0 examples/xml/ext/xml/ruby_xml_dtd.c
  24. +17 −0 examples/xml/ext/xml/ruby_xml_dtd.h
  25. +167 −0 examples/xml/ext/xml/ruby_xml_input_cbg.c
  26. +21 −0 examples/xml/ext/xml/ruby_xml_input_cbg.h
  27. +2,139 −0 examples/xml/ext/xml/ruby_xml_node.c
  28. +28 −0 examples/xml/ext/xml/ruby_xml_node.h
  29. +248 −0 examples/xml/ext/xml/ruby_xml_node_set.c
  30. +26 −0 examples/xml/ext/xml/ruby_xml_node_set.h
  31. +153 −0 examples/xml/ext/xml/ruby_xml_ns.c
  32. +21 −0 examples/xml/ext/xml/ruby_xml_ns.h
  33. +1,417 −0 examples/xml/ext/xml/ruby_xml_parser.c
  34. +31 −0 examples/xml/ext/xml/ruby_xml_parser.h
  35. +715 −0 examples/xml/ext/xml/ruby_xml_parser_context.c
  36. +22 −0 examples/xml/ext/xml/ruby_xml_parser_context.h
  37. +426 −0 examples/xml/ext/xml/ruby_xml_sax_parser.c
  38. +52 −0 examples/xml/ext/xml/ruby_xml_sax_parser.h
  39. +142 −0 examples/xml/ext/xml/ruby_xml_schema.c
  40. +16 −0 examples/xml/ext/xml/ruby_xml_schema.h
  41. +43 −0 examples/xml/ext/xml/ruby_xml_tree.c
  42. +12 −0 examples/xml/ext/xml/ruby_xml_tree.h
  43. +20 −0 examples/xml/ext/xml/ruby_xml_xinclude.c
  44. +13 −0 examples/xml/ext/xml/ruby_xml_xinclude.h
  45. +363 −0 examples/xml/ext/xml/ruby_xml_xpath.c
  46. +24 −0 examples/xml/ext/xml/ruby_xml_xpath.h
  47. +125 −0 examples/xml/ext/xml/ruby_xml_xpath_context.c
  48. +24 −0 examples/xml/ext/xml/ruby_xml_xpath_context.h
  49. +100 −0 examples/xml/ext/xml/ruby_xml_xpointer.c
  50. +27 −0 examples/xml/ext/xml/ruby_xml_xpointer.h
  51. +21 −0 examples/xml/ext/xml/ruby_xml_xpointer_context.c
  52. +18 −0 examples/xml/ext/xml/ruby_xml_xpointer_context.h
  53. +202 −0 examples/xml/ext/xml/sax_parser_callbacks.inc
  54. +1 −1 lib/mkrf.rb
  55. +8 −0 lib/mkrf/generator.rb
  56. +123 −0 lib/mkrf/rakehelper.rb
View
@@ -1,4 +1,8 @@
= svn
+* [NEW] Extensions using mkrf can now build properly in RubyGems!
+* [NEW] Extension configurations should now be named mkrf_conf.rb to not conflict with the mkmf settings in RubyGems.
+* [NEW] Added example extensions.
+* [NEW] Add install task to generated Rakefile.
* [CLEAN-UP] Preprocessor define handling moved to Availability from Generator.
* [NEW] find_executable method added to Availability.
* [FIXED] include_header and has_header? now properly set preprocessor defines.
View
No changes.
View
@@ -0,0 +1,35 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/clean'
+require 'rake/gempackagetask'
+require 'rake/rdoctask'
+require 'mkrf/rakehelper'
+require 'fileutils'
+include FileUtils
+
+setup_clean ["pkg", "lib/*.bundle", "*.gem", ".config", "ext/**/Rakefile"]
+
+setup_extension('trivial', 'trivial')
+
+desc "Does a full compile"
+task :default => [:trivial]
+
+version="0.1"
+name="trivial"
+
+setup_gem(name, version) do |spec|
+ spec.summary = "trivial lib"
+ spec.description = spec.summary
+ spec.author="Kevin Clark"
+ spec.add_dependency("mkrf",">=0.1.3")
+ spec.extensions = ["ext/trivial/Rakefile"]
+end
+
+task :install => [:package] do
+ sh %{sudo gem install pkg/#{name}-#{version}.gem}
+end
+
+task :uninstall => [:clean] do
+ sh %{sudo gem uninstall #{name}}
+end
+
@@ -0,0 +1,4 @@
+require 'rubygems'
+require 'mkrf'
+
+Mkrf::Generator.new('trivial')
Binary file not shown.
@@ -0,0 +1,5 @@
+#include "ruby.h"
+
+void Init_trivial() {
+ rb_define_class("MyClass", rb_cObject);
+}
View
@@ -0,0 +1,74 @@
+===== 15.4.2006 Ross Bamford <rosco at roscopeco.co.uk>
+* Implemented SAX parser callback handling
+
+===== 12.4.2006 Ross Bamford <rosco at roscopeco.co.uk>
+* Integrated / tested community patches
+* Defined XML::Node (hash) equality in terms of XML representation
+
+===== 12.4.2006 Tim Yamin <plasmaroo at gentoo.org> (patches)
+* Fixed XML::Node#content inoperable bug
+* Fixed memory leak in same
+
+===== 12.4.2006 Mark Van Holstyn <mvette13 at gmail.com> (patches)
+* Added XML::Node::Set#first
+* Added XML::Node::Set#empty?
+* Fixes to XML::Node::Set#to_a
+* Added XML::Node#find_first
+* Added XML::Node#remove!
+
+===== 27.3.2006 Ross Bamford <rosco at roscopeco.co.uk>
+* Integrated contributed XML::Parser.register_error_handler patch
+
+===== 27.2.2006 Ross Bamford <rosco at roscopeco.co.uk>
+* Fixed all multiple symbol definitions for -fno-common.
+* Removed OSX -fno-common workaround.
+
+===== 21.2.2006 Ross Bamford <rosco at roscopeco.co.uk>
+* Patched extconf.rb with OSX -fno-common workaround
+* Added gem and packaging support to Rakefile
+* Moved version update to Rakefile
+* Removed legacy project utility scripts
+
+===== 19.2.2006 Ross Bamford <rosco at roscopeco.co.uk>
+* Fixed doublefree bug in ruby_xml_attr.
+* Fixed small leak in parser
+
+===== 18.12.2005 Ross Bamford <rosco at roscopeco.co.uk>
+* Updated for GCC 4.0 (community patches)
+* Fixed default validation bug
+* Refactored project, removed outdated files, cleaned up tests.
+* Added RDoc documentation across .c files.
+* Fixed up a few strings.
+
+===== 14.4.2004 Mangler Jurgen <et@wkv.at>
+* ruby_xml_node.cz: fixed ruby_xml_node_property_set. The ill-behaviour
+ was, that there was added a second attribute of the same
+ name, when you were setting the value of an already existing
+ attribute.
+
+===== 17.3.2004 Lukas Svoboda <luks@fi.muni.cz>
+* ruby_xml_node.c: ruby_xml_node_to_s now returns XML subtree dump.
+
+===== 27.2.2004 Martin Povolny <martin@solnet.cz>
+* ruby_xml_node.c: added XML::Node.copy, this makes possible building
+ of xml documents from nodes taken from other xml documents
+ without making ruby SIGSEGV (see tests/copy_bug.rb).
+
+===== 26.2.2004 Martin Povolny <martin@solnet.cz>
+* ruby_xml_dtd.c, ruby_xml_dtd.h, ruby_xml_schema.c, ruby_xml_schema.h:
+ more work on validation, now you can actually validate
+ document using dtd or xml schema, also solved warning and
+ error propagation (see tests/{dtd|schema}-test.rb).
+
+===== 30.12.2003 Martin Povolny <martin@solnet.cz>
+* ruby_xml_dtd.c, ruby_xml_dtd.h, ruby_xml_schema.c, ruby_xml_schema.h:
+ prelimitary support for dtd and schema validation
+
+===== 15.9.2003 Martin Povolny <martin@solnet.cz>
+* ruby_xml_input_cbg.c, libxml.c: added class InputCallbacks to make
+ possible registering custom input callbacks
+ handlers (xmlRegisterInputCallbacks) written in ruby
+
+===== 1.8.2003 Martin Povolny <martin@solnet.cz>
+* ruby_xml_document.c: corrected argument handling in ruby_xml_document_find
+* ruby_xml_node.c: corrected argument handling in ruby_xml_node_find
View
@@ -0,0 +1,22 @@
+# $Id: LICENSE,v 1.3 2006/02/28 09:57:52 roscopeco Exp $
+
+ Copyright (c) 2002-2006 Sean Chittenden <sean@chittenden.org> and contributors
+ Copyright (c) 2001 Wai-Sun "Squidster" Chia <waisun.chia@compaq.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
View
@@ -0,0 +1,144 @@
+== INSTALLATION
+
+Installation is simple. Follow the following steps:
+
+=== Rubygems
+
+ gem install libxml-ruby
+
+=== Tarball/zip
+
+ $ rake test
+ $ rake install
+
+If extconf yacks up an error, follow the instructions it provides.
+You will need to chdir to ext/xml and run 'ruby extconf.rb' to provide
+options, after which you can either use Rake for everything or
+do with make (make && make install).
+
+Once installed, look at the test scripts (tests/*.rb), and run
+'rake doc' to generate API documentation.
+You can find the latest documentation at:
+
+* http://libxml.rubyforge.org/doc
+
+== DEPENDENCIES
+
+libxml requires a few other libraries to be installed inorder to
+function properly.
+
+* libm (math routines: very standard)
+* libz (zlib)
+* libiconv
+* libxml2
+
+== USAGE
+
+Basic usage for reading and writing documents.
+
+=== WRITING
+
+Writing a simple document:
+
+ # require 'rubygems' # if installed via Gems
+ require 'xml/libxml'
+
+ doc = XML::Document.new()
+ doc.root = XML::Node.new('root_node')
+ root = doc.root
+
+ root << elem1 = XML::Node.new('elem1')
+ elem1['attr1'] = 'val1'
+ elem1['attr2'] = 'val2'
+
+ root << elem2 = XML::Node.new('elem2')
+ elem2['attr1'] = 'val1'
+ elem2['attr2'] = 'val2'
+
+ root << elem3 = XML::Node.new('elem3')
+ elem3 << elem4 = XML::Node.new('elem4')
+ elem3 << elem5 = XML::Node.new('elem5')
+
+ elem5 << elem6 = XML::Node.new('elem6')
+ elem6 << 'Content for element 6'
+
+ elem3['attr'] = 'baz'
+
+ # Namespace hack to reduce the numer of times XML:: is typed
+ include XML
+ root << elem7 = Node.new('foo')
+ 1.upto(10) do |i|
+ elem7 << n = Node.new('bar')
+ n << i
+ end
+
+ format = true
+ doc.save('output.xml', format)
+
+The file output.xml contains:
+
+ <?xml version="1.0"?>
+ <root_node>
+ <elem1 attr1="val1" attr2="val2"/>
+ <elem2 attr1="val1" attr2="val2"/>
+ <elem3 attr="baz">
+ <elem4/>
+ <elem5>
+ <elem6>Content for element 6</elem6>
+ </elem5>
+ </elem3>
+ <foo>
+ <bar>1</bar>
+ <bar>2</bar>
+ <bar>3</bar>
+ <bar>4</bar>
+ <bar>5</bar>
+ <bar>6</bar>
+ <bar>7</bar>
+ <bar>8</bar>
+ <bar>9</bar>
+ <bar>10</bar>
+ </foo>
+ </root_node>
+
+=== READING
+
+Reading XML is slightly more complex and there are many more ways to
+perform this operation. This reads in and processes the above
+generated XML document, output.xml. This script assumes that the
+structure of the document is already known.
+
+ # require 'rubygems' # if installed via Gems
+ require 'xml/libxml'
+ doc = XML::Document.file('output.xml')
+ root = doc.root
+
+ puts "Root element name: #{root.name}"
+
+ elem3 = root.find('elem3').to_a.first
+ puts "Elem3: #{elem3['attr']}"
+
+ doc.find('//root_node/foo/bar').each do |node|
+ puts "Node path: #{node.path} \t Contents: #{node}"
+ end
+
+And your terminal should look like:
+
+ Root element name: root_node
+ Elem3: baz
+ Node path: /root_node/foo/bar[1] Contents: 1
+ Node path: /root_node/foo/bar[2] Contents: 2
+ Node path: /root_node/foo/bar[3] Contents: 3
+ Node path: /root_node/foo/bar[4] Contents: 4
+ Node path: /root_node/foo/bar[5] Contents: 5
+ Node path: /root_node/foo/bar[6] Contents: 6
+ Node path: /root_node/foo/bar[7] Contents: 7
+ Node path: /root_node/foo/bar[8] Contents: 8
+ Node path: /root_node/foo/bar[9] Contents: 9
+ Node path: /root_node/foo/bar[10] Contents: 10
+
+== MORE INFORMATION
+
+If you have any questions, please send email to libxml-devel@rubyforge.org.
+
+# $Id: README,v 1.5 2006/04/24 19:29:49 roscopeco Exp $
View
@@ -0,0 +1,35 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/clean'
+require 'rake/gempackagetask'
+require 'rake/rdoctask'
+require 'mkrf/rakehelper'
+require 'fileutils'
+include FileUtils
+
+setup_clean ["pkg", "lib/*.bundle", "*.gem", ".config", "ext/**/Rakefile"]
+
+setup_extension('xml', 'libxml_so')
+
+desc "Does a full compile"
+task :default => [:libxml_so]
+
+version="0.1"
+name="libxml"
+
+setup_gem(name, version) do |spec|
+ spec.summary = "xml lib"
+ spec.description = spec.summary
+ spec.author="Kevin Clark"
+ spec.add_dependency("mkrf",">=0.1.3")
+ spec.extensions = ["ext/xml/Rakefile"]
+end
+
+task :install => [:package] do
+ sh %{sudo gem install pkg/#{name}-#{version}.gem}
+end
+
+task :uninstall => [:clean] do
+ sh %{sudo gem uninstall #{name}}
+end
+
Oops, something went wrong.

0 comments on commit 16a8637

Please sign in to comment.