diff --git a/.gitignore b/.gitignore index 0124c1492..5864c4dd1 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ *.so *.so.* *.dylib +*.bundle # Executables *.exe @@ -64,3 +65,6 @@ modules.order Module.symvers Mkfile.old dkms.conf + +# Temporary files +tmp/* diff --git a/Makefile b/Makefile index 2dad3d7f0..3ee73c116 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ test_sources = $(wildcard test/*.c) test_objects = $(test_sources:.c=.o) non_main_objects = $(filter-out src/main.o, $(objects)) -soext ?= $(shell ruby -e 'puts RbConfig::CONFIG["SOEXT"]') +soext ?= $(shell ruby -e 'puts RbConfig::CONFIG["DLEXT"]') lib_name = lib$(exec).$(soext) ruby_extension = ext/erbx/$(lib_name) @@ -47,4 +47,4 @@ test: $(test_objects) $(non_main_objects) clean: rm -f $(exec) $(test_exec) $(lib_name) $(ruby_extension) - rm -f src/*.o test/*.o + rm -rf src/*.o test/*.o lib/erbx/*.bundle tmp diff --git a/Rakefile b/Rakefile index b8984c84a..d57104dec 100644 --- a/Rakefile +++ b/Rakefile @@ -17,23 +17,24 @@ Rake::TestTask.new(:test) do |t| end Rake::Task[:compile].enhance do - IO.popen("make") do |output| - output.each_line do |line| - puts "#{line}" - end - end + IO.popen("make") do |output| + output.each_line do |line| + puts "#{line}" + end + end + + if $?.exitstatus != 0 + raise "src/* could not be compiled #{$?.exitstatus}" + end +end - if $?.exitstatus != 0 - raise "src/* could not be compiled #{$?.exitstatus}" - end - end - Rake::Task[:clean].enhance do - IO.popen("make clean") do |output| - output.each_line do |line| - puts "#{line}" - end - end - end +Rake::Task[:clean].enhance do + IO.popen("make clean") do |output| + output.each_line do |line| + puts "#{line}" + end + end +end - task default: [:compile, :test] \ No newline at end of file +task default: [:compile, :test] diff --git a/erbx.gemspec b/erbx.gemspec index 21bdda211..cd77bd2f6 100644 --- a/erbx.gemspec +++ b/erbx.gemspec @@ -13,11 +13,14 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 3.0.0" spec.require_paths = ["lib"] - spec.files = [ - "ext/erbx/extension.c", - "lib/erbx.rb", - # "lib/erbx/version.rb" - ] + + gemspec = File.basename(__FILE__) + spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls| + ls.readlines("\x0", chomp: true).reject do |f| + (f == gemspec) || + f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile]) + end + end spec.extensions = ["ext/erbx/extconf.rb"] spec.metadata["allowed_push_host"] = "https://rubygems.org" diff --git a/ext/erbx/extconf.rb b/ext/erbx/extconf.rb index a7b2ea32a..2d512f9c4 100644 --- a/ext/erbx/extconf.rb +++ b/ext/erbx/extconf.rb @@ -9,16 +9,5 @@ abort "#{extension_name}.h can't be found" end -# expected_functions = [ -# "erbx_lex", -# "erbx_lex_file", -# ] -# -# expected_functions.each do |expected_function| -# unless find_library(extension_name, expected_function) -# abort "lib#{extension_name}.so can't be found or #{expected_function}() not defined in it" -# end -# end - create_header create_makefile("#{extension_name}/#{extension_name}") diff --git a/lib/erbx/liberbx.rb b/lib/erbx/liberbx.rb index 692bf18de..51f330837 100644 --- a/lib/erbx/liberbx.rb +++ b/lib/erbx/liberbx.rb @@ -8,7 +8,7 @@ module LibERBX extend FFI::Library def self.library_extension - RbConfig::CONFIG["SOEXT"] + RbConfig::CONFIG["DLEXT"] end def self.library_name