Auto-generate helix-runtime.def

This commit is contained in:
Peter Wagenet 2017-03-03 15:09:10 -08:00
parent 6b49fdfe34
commit 2d358a4140
4 changed files with 22 additions and 45 deletions

1
ruby/.gitignore vendored
View File

@ -4,6 +4,7 @@
/_yardoc/
/coverage/
/doc/
/ext/helix_runtime/native/native.def
/pkg/
/spec/reports/
/spec/support/dummy/lib

View File

@ -21,7 +21,7 @@ if RUBY_PLATFORM =~ /mingw/
# Windows looks for a .dll in PATH
cp "#{__dir__}/lib/helix_runtime/native.so", "#{__dir__}/windows_build/helix-runtime.dll"
end
CLOBBER.include("windows_build")
CLOBBER.include("ext/helix_runtime/native/native.def", "windows_build")
end
Rake::ExtensionTask.new do |ext|

View File

@ -1,2 +1,22 @@
require "mkmf"
if RUBY_PLATFORM =~ /mingw/
# Hackish way to pull exported methods out of the header
header_path = File.expand_path("../helix_runtime.h", __FILE__)
exports = []
File.readlines(header_path).each do |line|
if line =~ /^\w.+(HELIX_[\w_]+)[;\(]/
exports << $1
end
end
File.open(File.expand_path("../native.def", __FILE__), 'w') do |f|
f.puts "LIBRARY helix-runtime"
f.puts "EXPORTS"
f.puts exports
f.puts "Init_native"
end
end
create_makefile "helix_runtime/native"

View File

@ -1,44 +0,0 @@
LIBRARY helix-runtime
EXPORTS
HELIX_Data_Get_Struct_Value
HELIX_Data_Set_Struct_Value
HELIX_Data_Wrap_Struct
HELIX_FIX2INT
HELIX_INT2FIX
HELIX_Qfalse
HELIX_Qnil
HELIX_Qtrue
HELIX_RARRAY_LEN
HELIX_RARRAY_PTR
HELIX_RB_TYPE_P
HELIX_RSTRING_LEN
HELIX_RSTRING_PTR
HELIX_TYPE
HELIX_T_ARRAY
HELIX_T_BIGNUM
HELIX_T_CLASS
HELIX_T_COMPLEX
HELIX_T_DATA
HELIX_T_FALSE
HELIX_T_FILE
HELIX_T_FIXNUM
HELIX_T_FLOAT
HELIX_T_HASH
HELIX_T_ICLASS
HELIX_T_MASK
HELIX_T_MATCH
HELIX_T_MODULE
HELIX_T_NIL
HELIX_T_NODE
HELIX_T_NONE
HELIX_T_OBJECT
HELIX_T_RATIONAL
HELIX_T_REGEXP
HELIX_T_STRING
HELIX_T_STRUCT
HELIX_T_SYMBOL
HELIX_T_TRUE
HELIX_T_UNDEF
HELIX_T_ZOMBIE
HELIX_rb_utf8_str_new
Init_native