mirror of
https://github.com/h2o/h2o.git
synced 2025-04-20 13:11:35 +08:00
extract https://github.com/kazuho/mruby-onig-regexp @ 6699ed4 at deps/mruby-onig-regexp
This commit is contained in:
parent
199ef92cab
commit
ca9d6a04ad
6
deps/mruby-onig-regexp/.travis.yml
vendored
6
deps/mruby-onig-regexp/.travis.yml
vendored
@ -1,3 +1,9 @@
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gperf
|
||||
- libonig-dev
|
||||
script:
|
||||
- export MRUBY_CONFIG="$TRAVIS_BUILD_DIR/.travis_config.rb"
|
||||
- git clone --depth 1 "https://github.com/mruby/mruby.git"
|
||||
|
11
deps/mruby-onig-regexp/.travis_config.rb
vendored
11
deps/mruby-onig-regexp/.travis_config.rb
vendored
@ -6,3 +6,14 @@ MRuby::Build.new do |conf|
|
||||
gem :core => 'mruby-sprintf'
|
||||
gem "#{MRUBY_ROOT}/.."
|
||||
end
|
||||
|
||||
MRuby::Build.new("onigmo-bundled") do |conf|
|
||||
toolchain :gcc
|
||||
enable_debug
|
||||
|
||||
gem :core => 'mruby-print'
|
||||
gem :core => 'mruby-sprintf'
|
||||
gem "#{MRUBY_ROOT}/.." do |g|
|
||||
g.bundle_onigmo
|
||||
end
|
||||
end
|
||||
|
BIN
deps/mruby-onig-regexp/Onigmo-5.15.0.tar.gz
vendored
Normal file
BIN
deps/mruby-onig-regexp/Onigmo-5.15.0.tar.gz
vendored
Normal file
Binary file not shown.
26
deps/mruby-onig-regexp/Onigmo-bsd-compat.patch
vendored
Normal file
26
deps/mruby-onig-regexp/Onigmo-bsd-compat.patch
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
diff --git Makefile.am Makefile.am
|
||||
index 07cf35f..1acf663 100644
|
||||
--- Makefile.am
|
||||
+++ Makefile.am
|
||||
@@ -65,7 +65,7 @@ do_subst = sed \
|
||||
-e 's,[@]includedir[@],$(includedir),g'
|
||||
|
||||
oniguruma.pc: $(srcdir)/oniguruma.pc.in Makefile
|
||||
- $(do_subst) < $(<) > $(@)
|
||||
+ $(do_subst) < $(srcdir)/oniguruma.pc.in > $(@)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = oniguruma.pc
|
||||
diff --git Makefile.in Makefile.in
|
||||
index 5849df9..d4e4c0e 100644
|
||||
--- Makefile.in
|
||||
+++ Makefile.in
|
||||
@@ -1428,7 +1428,7 @@ uninstall-am: uninstall-binSCRIPTS uninstall-includeHEADERS \
|
||||
onig-config: onig-config.in
|
||||
|
||||
oniguruma.pc: $(srcdir)/oniguruma.pc.in Makefile
|
||||
- $(do_subst) < $(<) > $(@)
|
||||
+ $(do_subst) < $(srcdir)/oniguruma.pc.in > $(@)
|
||||
|
||||
dll:
|
||||
$(CXX) -shared -Wl,--output-def,libonig.def -o libonig.dll *.o \
|
6
deps/mruby-onig-regexp/README.md
vendored
6
deps/mruby-onig-regexp/README.md
vendored
@ -34,6 +34,12 @@ matchstr("xyzabc") # => match
|
||||
|
||||
MIT
|
||||
|
||||
### License of Onigmo
|
||||
BSD licensed.
|
||||
|
||||
Onigmo (Oniguruma-mod) -- (C) K.Takata <kentkt AT csc DOT jp>
|
||||
Oniguruma ---- (C) K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
|
||||
## Author
|
||||
|
||||
Yasuhiro Matsumoto (a.k.a mattn)
|
||||
|
133
deps/mruby-onig-regexp/mrbgem.rake
vendored
133
deps/mruby-onig-regexp/mrbgem.rake
vendored
@ -2,76 +2,87 @@ MRuby::Gem::Specification.new('mruby-onig-regexp') do |spec|
|
||||
spec.license = 'MIT'
|
||||
spec.authors = 'mattn'
|
||||
|
||||
spec.linker.libraries << 'onig'
|
||||
def spec.bundle_onigmo
|
||||
return if @onigmo_bundled
|
||||
@onigmo_bundled = true
|
||||
|
||||
next if build.kind_of? MRuby::CrossBuild
|
||||
if build.cc.respond_to? :search_header_path
|
||||
next if build.cc.search_header_path 'oniguruma.h'
|
||||
end
|
||||
require 'open3'
|
||||
|
||||
require 'open3'
|
||||
require 'open-uri'
|
||||
# remove libonig
|
||||
linker.libraries = []
|
||||
|
||||
version = '5.15.0'
|
||||
oniguruma_dir = "#{build_dir}/Onigmo-Onigmo-#{version}"
|
||||
oniguruma_lib = libfile "#{oniguruma_dir}/.libs/libonig"
|
||||
header = "#{oniguruma_dir}/oniguruma.h"
|
||||
version = '5.15.0'
|
||||
oniguruma_dir = "#{build_dir}/Onigmo-Onigmo-#{version}"
|
||||
oniguruma_lib = libfile "#{oniguruma_dir}/.libs/libonig"
|
||||
unless ENV['OS'] == 'Windows_NT'
|
||||
oniguruma_lib = libfile "#{oniguruma_dir}/.libs/libonig"
|
||||
else
|
||||
oniguruma_lib = libfile "#{oniguruma_dir}/onig_s"
|
||||
end
|
||||
header = "#{oniguruma_dir}/oniguruma.h"
|
||||
|
||||
task :clean do
|
||||
FileUtils.rm_rf [oniguruma_dir]
|
||||
end
|
||||
task :clean do
|
||||
FileUtils.rm_rf [oniguruma_dir]
|
||||
end
|
||||
|
||||
file header do |t|
|
||||
FileUtils.mkdir_p oniguruma_dir
|
||||
|
||||
_pp 'getting', "onig-#{version}"
|
||||
begin
|
||||
FileUtils.mkdir_p build_dir
|
||||
file header do |t|
|
||||
FileUtils.mkdir_p oniguruma_dir
|
||||
Dir.chdir(build_dir) do
|
||||
File.open("onig-#{version}.tar.gz", 'wb') do |f|
|
||||
open("https://github.com/k-takata/Onigmo/archive/Onigmo-#{version}.tar.gz", "accept-encoding" => "none") do |io|
|
||||
f.write io.read
|
||||
end
|
||||
end
|
||||
|
||||
_pp 'extracting', "onig-#{version}"
|
||||
`gzip -dc onig-#{version}.tar.gz | tar xf -`
|
||||
raise IOError unless $?.exitstatus
|
||||
_pp 'extracting', "Onigmo-#{version}"
|
||||
`gzip -dc "#{dir}/Onigmo-#{version}.tar.gz" | tar xf -`
|
||||
end
|
||||
rescue IOError
|
||||
File.delete "onig-#{version}.tar.gz"
|
||||
exit(-1)
|
||||
end
|
||||
end
|
||||
|
||||
def run_command(env, command)
|
||||
STDOUT.sync = true
|
||||
Open3.popen2e(env, command) do |stdin, stdout, thread|
|
||||
print stdout.read
|
||||
fail "#{command} failed" if thread.value != 0
|
||||
end
|
||||
end
|
||||
|
||||
file oniguruma_lib => header do |t|
|
||||
Dir.chdir(oniguruma_dir) do
|
||||
e = {
|
||||
'CC' => "#{spec.build.cc.command} #{spec.build.cc.flags.join(' ')}",
|
||||
'CXX' => "#{spec.build.cxx.command} #{spec.build.cxx.flags.join(' ')}",
|
||||
'LD' => "#{spec.build.linker.command} #{spec.build.linker.flags.join(' ')}",
|
||||
'AR' => spec.build.archiver.command }
|
||||
unless ENV['OS'] == 'Windows_NT'
|
||||
_pp 'autotools', oniguruma_dir
|
||||
run_command e, './autogen.sh' if File.exists? 'autogen.sh'
|
||||
run_command e, './configure --disable-shared --enable-static'
|
||||
run_command e, 'make'
|
||||
else
|
||||
run_command e, 'cmd /c "copy /Y win32 > NUL"'
|
||||
run_command e, 'make -f Makefile.mingw'
|
||||
end
|
||||
Dir.chdir(oniguruma_dir) do
|
||||
`patch -p0 < #{dir}/Onigmo-bsd-compat.patch`
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def run_command(env, command)
|
||||
STDOUT.sync = true
|
||||
Open3.popen2e(env, command) do |stdin, stdout, thread|
|
||||
print stdout.read
|
||||
fail "#{command} failed" if thread.value != 0
|
||||
end
|
||||
end
|
||||
|
||||
libonig_objs_dir = "#{oniguruma_dir}/libonig_objs"
|
||||
libmruby_a = libfile("#{build.build_dir}/lib/libmruby")
|
||||
|
||||
file oniguruma_lib => header do |t|
|
||||
Dir.chdir(oniguruma_dir) do
|
||||
e = {
|
||||
'CC' => "#{build.cc.command} #{build.cc.flags.join(' ')}",
|
||||
'CXX' => "#{build.cxx.command} #{build.cxx.flags.join(' ')}",
|
||||
'LD' => "#{build.linker.command} #{build.linker.flags.join(' ')}",
|
||||
'AR' => build.archiver.command }
|
||||
unless ENV['OS'] == 'Windows_NT'
|
||||
_pp 'autotools', oniguruma_dir
|
||||
run_command e, './autogen.sh' if File.exists? 'autogen.sh'
|
||||
run_command e, './configure --disable-shared --enable-static'
|
||||
run_command e, 'make'
|
||||
else
|
||||
run_command e, 'cmd /c "copy /Y win32 > NUL"'
|
||||
run_command e, 'make -f Makefile.mingw'
|
||||
end
|
||||
end
|
||||
|
||||
FileUtils.mkdir_p libonig_objs_dir
|
||||
Dir.chdir(libonig_objs_dir) { `ar x #{oniguruma_lib}` }
|
||||
file libmruby_a => Dir.glob("#{libonig_objs_dir}/*.o")
|
||||
end
|
||||
|
||||
file libmruby_a => Dir.glob("#{libonig_objs_dir}/*.o") if File.exists? oniguruma_lib
|
||||
|
||||
file "#{dir}/src/mruby_onig_regexp.c" => oniguruma_lib
|
||||
cc.include_paths << oniguruma_dir
|
||||
end
|
||||
|
||||
file "#{dir}/src/mruby_onig_regexp.c" => oniguruma_lib
|
||||
spec.cc.include_paths << oniguruma_dir
|
||||
spec.linker.library_paths << File.dirname(oniguruma_lib)
|
||||
|
||||
if build.kind_of? MRuby::CrossBuild or
|
||||
(build.cc.respond_to? :search_header_path and build.cc.search_header_path 'oniguruma.h')
|
||||
spec.linker.libraries << 'onig'
|
||||
else
|
||||
spec.bundle_onigmo
|
||||
end
|
||||
end
|
||||
|
12
deps/mruby-onig-regexp/src/mruby_onig_regexp.c
vendored
12
deps/mruby-onig-regexp/src/mruby_onig_regexp.c
vendored
@ -780,12 +780,24 @@ mrb_mruby_onig_regexp_gem_init(mrb_state* mrb) {
|
||||
mrb_define_const(mrb, clazz, "NOTBOL", mrb_fixnum_value(ONIG_OPTION_NOTBOL));
|
||||
mrb_define_const(mrb, clazz, "NOTEOL", mrb_fixnum_value(ONIG_OPTION_NOTEOL));
|
||||
mrb_define_const(mrb, clazz, "POSIX_REGION", mrb_fixnum_value(ONIG_OPTION_POSIX_REGION));
|
||||
#ifdef ONIG_OPTION_ASCII_RANGE
|
||||
mrb_define_const(mrb, clazz, "ASCII_RANGE", mrb_fixnum_value(ONIG_OPTION_ASCII_RANGE));
|
||||
#endif
|
||||
#ifdef ONIG_OPTION_POSIX_BRACKET_ALL_RANGE
|
||||
mrb_define_const(mrb, clazz, "POSIX_BRACKET_ALL_RANGE", mrb_fixnum_value(ONIG_OPTION_POSIX_BRACKET_ALL_RANGE));
|
||||
#endif
|
||||
#ifdef ONIG_OPTION_WORD_BOUND_ALL_RANGE
|
||||
mrb_define_const(mrb, clazz, "WORD_BOUND_ALL_RANGE", mrb_fixnum_value(ONIG_OPTION_WORD_BOUND_ALL_RANGE));
|
||||
#endif
|
||||
#ifdef ONIG_OPTION_NEWLINE_CRLF
|
||||
mrb_define_const(mrb, clazz, "NEWLINE_CRLF", mrb_fixnum_value(ONIG_OPTION_NEWLINE_CRLF));
|
||||
#endif
|
||||
#ifdef ONIG_OPTION_NOTBOS
|
||||
mrb_define_const(mrb, clazz, "NOTBOS", mrb_fixnum_value(ONIG_OPTION_NOTBOS));
|
||||
#endif
|
||||
#ifdef ONIG_OPTION_NOTEOS
|
||||
mrb_define_const(mrb, clazz, "NOTEOS", mrb_fixnum_value(ONIG_OPTION_NOTEOS));
|
||||
#endif
|
||||
|
||||
mrb_define_method(mrb, clazz, "initialize", onig_regexp_initialize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(2));
|
||||
mrb_define_method(mrb, clazz, "==", onig_regexp_equal, MRB_ARGS_REQ(1));
|
||||
|
12
deps/mruby-onig-regexp/test/mruby_onig_regexp.rb
vendored
12
deps/mruby-onig-regexp/test/mruby_onig_regexp.rb
vendored
@ -77,12 +77,14 @@ assert("OnigRegexp#source", '15.2.15.7.8') do
|
||||
reg.source == str
|
||||
end
|
||||
|
||||
assert('OnigRegexp#options (no options)') do
|
||||
assert_equal OnigRegexp::ASCII_RANGE | OnigRegexp::POSIX_BRACKET_ALL_RANGE | OnigRegexp::WORD_BOUND_ALL_RANGE, OnigRegexp.new(".*").options
|
||||
end
|
||||
if OnigRegexp.const_defined? :ASCII_RANGE
|
||||
assert('OnigRegexp#options (no options)') do
|
||||
assert_equal OnigRegexp::ASCII_RANGE | OnigRegexp::POSIX_BRACKET_ALL_RANGE | OnigRegexp::WORD_BOUND_ALL_RANGE, OnigRegexp.new(".*").options
|
||||
end
|
||||
|
||||
assert('OnigRegexp#options (multiline)') do
|
||||
assert_equal OnigRegexp::MULTILINE | OnigRegexp::ASCII_RANGE | OnigRegexp::POSIX_BRACKET_ALL_RANGE | OnigRegexp::WORD_BOUND_ALL_RANGE, OnigRegexp.new(".*", OnigRegexp::MULTILINE).options
|
||||
assert('OnigRegexp#options (multiline)') do
|
||||
assert_equal OnigRegexp::MULTILINE | OnigRegexp::ASCII_RANGE | OnigRegexp::POSIX_BRACKET_ALL_RANGE | OnigRegexp::WORD_BOUND_ALL_RANGE, OnigRegexp.new(".*", OnigRegexp::MULTILINE).options
|
||||
end
|
||||
end
|
||||
|
||||
# Extended patterns.
|
||||
|
Loading…
x
Reference in New Issue
Block a user