Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*.so
*.so.*
*.dylib
*.bundle

# Executables
*.exe
Expand All @@ -64,3 +65,6 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf

# Temporary files
tmp/*
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
35 changes: 18 additions & 17 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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]
task default: [:compile, :test]
13 changes: 8 additions & 5 deletions erbx.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 0 additions & 11 deletions ext/erbx/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
2 changes: 1 addition & 1 deletion lib/erbx/liberbx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module LibERBX
extend FFI::Library

def self.library_extension
RbConfig::CONFIG["SOEXT"]
RbConfig::CONFIG["DLEXT"]
end

def self.library_name
Expand Down