Permalink
Browse files

Merge branch 'embed'

* embed:
  fixing rsync
  make some header file adjustments for ruby compile
  updating the version to 2.0
  add the license for libyaml
  fix c file name
  only do have_header checks if we are embedding libyaml
  mkmf has a global for this test
  fix build on windows
  only embed libyaml if the system does not have it
  for compiling on mswin
  embedding libyaml
  • Loading branch information...
2 parents d5757ea + 978138b commit c2e0c9878416f621b23525870d69d2bc4816fceb @tenderlove tenderlove committed Dec 13, 2012
View
@@ -4,23 +4,36 @@ CHANGELOG.rdoc
Manifest.txt
README.rdoc
Rakefile
-ext/psych/emitter.c
-ext/psych/emitter.h
ext/psych/extconf.rb
-ext/psych/parser.c
-ext/psych/parser.h
ext/psych/psych.c
ext/psych/psych.h
-ext/psych/to_ruby.c
-ext/psych/to_ruby.h
-ext/psych/yaml_tree.c
-ext/psych/yaml_tree.h
+ext/psych/psych_emitter.c
+ext/psych/psych_emitter.h
+ext/psych/psych_parser.c
+ext/psych/psych_parser.h
+ext/psych/psych_to_ruby.c
+ext/psych/psych_to_ruby.h
+ext/psych/psych_yaml_tree.c
+ext/psych/psych_yaml_tree.h
+ext/psych/yaml/LICENSE
+ext/psych/yaml/api.c
+ext/psych/yaml/config.h
+ext/psych/yaml/dumper.c
+ext/psych/yaml/emitter.c
+ext/psych/yaml/loader.c
+ext/psych/yaml/parser.c
+ext/psych/yaml/reader.c
+ext/psych/yaml/scanner.c
+ext/psych/yaml/writer.c
+ext/psych/yaml/yaml.h
+ext/psych/yaml/yaml_private.h
lib/psych.rb
lib/psych/coder.rb
lib/psych/core_ext.rb
lib/psych/deprecated.rb
lib/psych/handler.rb
lib/psych/handlers/document_stream.rb
+lib/psych/handlers/recorder.rb
lib/psych/json/ruby_events.rb
lib/psych/json/stream.rb
lib/psych/json/tree_builder.rb
@@ -48,6 +61,8 @@ lib/psych/visitors/json_tree.rb
lib/psych/visitors/to_ruby.rb
lib/psych/visitors/visitor.rb
lib/psych/visitors/yaml_tree.rb
+lib/psych/y.rb
+test/psych/handlers/test_recorder.rb
test/psych/helper.rb
test/psych/json/test_stream.rb
test/psych/nodes/test_enumerable.rb
View
@@ -53,7 +53,7 @@ namespace :merge do
[basedir, 'test', 'psych/'] => [rubydir, 'test', 'psych/'],
}
- rsync = 'rsync -av --exclude extconf.rb --exclude lib --exclude ".*" --exclude "*.o" --exclude Makefile --exclude mkmf.log --delete'
+ rsync = 'rsync -av --exclude lib --exclude ".*" --exclude "*.o" --exclude Makefile --exclude mkmf.log --delete'
task :to_ruby do
mergedirs.each do |from, to|
View
@@ -0,0 +1,11 @@
+/api.c
+/config.h
+/dumper.c
+/emitter.c
+/loader.c
+/parser.c
+/reader.c
+/scanner.c
+/writer.c
+/yaml.h
+/yaml_private.h
View
@@ -1,21 +1,40 @@
require 'mkmf'
+require 'fileutils'
# :stopdoc:
-RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
+dir_config 'libyaml'
-INCLUDEDIR = RbConfig::CONFIG['includedir']
-LIBDIR = RbConfig::CONFIG['libdir']
-LIB_DIRS = ['/opt/local/lib', '/usr/local/lib', LIBDIR, '/usr/lib']
-libyaml = dir_config 'libyaml', '/opt/local/include', '/opt/local/lib'
+unless find_header('yaml.h') && find_library('yaml', 'yaml_get_version')
+ # Embed libyaml since we could not find it.
-def asplode missing
- abort "#{missing} is missing. Try 'port install libyaml +universal' " +
- "or 'yum install libyaml-devel'"
-end
+ srcdir = File.expand_path File.dirname __FILE__
+ files = Dir.chdir File.join(srcdir, 'yaml') do
+ Dir.entries(Dir.pwd).find_all { |f|
+ File.file?(f) && File.extname(f) =~ /^\.[hc]/
+ }.map { |f| File.expand_path f }
+ end
+
+ FileUtils.cp_r files, srcdir
+
+ if $mswin
+ $CFLAGS += " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
+ end
-asplode('yaml.h') unless find_header 'yaml.h'
-asplode('libyaml') unless find_library 'yaml', 'yaml_get_version'
+ have_header 'dlfcn.h'
+ have_header 'inttypes.h'
+ have_header 'memory.h'
+ have_header 'stdint.h'
+ have_header 'stdlib.h'
+ have_header 'strings.h'
+ have_header 'string.h'
+ have_header 'sys/stat.h'
+ have_header 'sys/types.h'
+ have_header 'unistd.h'
+
+ find_header 'yaml.h'
+ have_header 'config.h'
+end
create_makefile 'psych'
View
@@ -9,10 +9,10 @@
#include <yaml.h>
-#include <parser.h>
-#include <emitter.h>
-#include <to_ruby.h>
-#include <yaml_tree.h>
+#include <psych_parser.h>
+#include <psych_emitter.h>
+#include <psych_to_ruby.h>
+#include <psych_yaml_tree.h>
extern VALUE mPsych;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,19 @@
+Copyright (c) 2006 Kirill Simonov
+
+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.
Oops, something went wrong. Retry.

0 comments on commit c2e0c98

Please sign in to comment.