Skip to content

Commit 4429b75

Browse files
karreiromarcoroth
authored andcommitted
Update project compilation (use DLEXT instead of SOEXT)
1 parent 1728348 commit 4429b75

File tree

5 files changed

+18
-31
lines changed

5 files changed

+18
-31
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
*.so
4242
*.so.*
4343
*.dylib
44+
*.bundle
4445

4546
# Executables
4647
*.exe
@@ -64,3 +65,6 @@ modules.order
6465
Module.symvers
6566
Mkfile.old
6667
dkms.conf
68+
69+
# Temporary files
70+
tmp/*

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test_sources = $(wildcard test/*.c)
88
test_objects = $(test_sources:.c=.o)
99
non_main_objects = $(filter-out src/main.o, $(objects))
1010

11-
soext ?= $(shell ruby -e 'puts RbConfig::CONFIG["SOEXT"]')
11+
soext ?= $(shell ruby -e 'puts RbConfig::CONFIG["DLEXT"]')
1212
lib_name = lib$(exec).$(soext)
1313
ruby_extension = ext/erbx/$(lib_name)
1414

@@ -47,4 +47,4 @@ test: $(test_objects) $(non_main_objects)
4747

4848
clean:
4949
rm -f $(exec) $(test_exec) $(lib_name) $(ruby_extension)
50-
rm -f src/*.o test/*.o
50+
rm -rf src/*.o test/*.o lib/erbx/*.bundle tmp

Rakefile

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,17 @@ Rake::TestTask.new(:test) do |t|
1717
end
1818

1919
Rake::Task[:compile].enhance do
20-
IO.popen("make") do |output|
21-
output.each_line do |line|
22-
puts "#{line}"
23-
end
24-
end
20+
puts "▏compile src/*"
2521

26-
if $?.exitstatus != 0
27-
raise "src/* could not be compiled #{$?.exitstatus}"
28-
end
29-
end
22+
IO.popen("make") do |output|
23+
output.each_line do |line|
24+
puts "▏#{line}"
25+
end
26+
end
3027

31-
Rake::Task[:clean].enhance do
32-
IO.popen("make clean") do |output|
33-
output.each_line do |line|
34-
puts "#{line}"
35-
end
36-
end
37-
end
28+
if $?.exitstatus != 0
29+
raise "src/* could not be compiled #{$?.exitstatus}"
30+
end
31+
end
3832

39-
task default: [:compile, :test]
33+
task default: [:compile, :test]

ext/erbx/extconf.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,5 @@
99
abort "#{extension_name}.h can't be found"
1010
end
1111

12-
# expected_functions = [
13-
# "erbx_lex",
14-
# "erbx_lex_file",
15-
# ]
16-
#
17-
# expected_functions.each do |expected_function|
18-
# unless find_library(extension_name, expected_function)
19-
# abort "lib#{extension_name}.so can't be found or #{expected_function}() not defined in it"
20-
# end
21-
# end
22-
2312
create_header
2413
create_makefile("#{extension_name}/#{extension_name}")

lib/erbx/liberbx.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module LibERBX
88
extend FFI::Library
99

1010
def self.library_extension
11-
RbConfig::CONFIG["SOEXT"]
11+
RbConfig::CONFIG["DLEXT"]
1212
end
1313

1414
def self.library_name

0 commit comments

Comments
 (0)