Skip to content

Commit 446ad16

Browse files
committed
Fix for TruffleRuby 20.2 or before.
When pltook_*.c is successfully compiled in extconf.rb, plthook_*.$OBJEXT is removed by File.delete. However TruffleRuby 20.2 or before creates conftest.$OBJEXT. If plthook_*.$OBJEXT isn't compiled before, extconf.rb fails. (GH-225)
1 parent 6cc0b64 commit 446ad16

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/oci8/extconf.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ def fmt.%(x)
155155
else
156156
plthook_src = "plthook_elf.c"
157157
end
158-
if xsystem(cc_command("").gsub(CONFTEST_C, File.dirname(__FILE__) + "/" + plthook_src))
159-
File.delete(plthook_src.gsub(/\.c$/, '.' + RbConfig::CONFIG["OBJEXT"]))
158+
FileUtils.copy(File.dirname(__FILE__) + "/" + plthook_src, CONFTEST_C)
159+
if xsystem(cc_command(""))
160+
FileUtils.rm_f("#{CONFTEST}.#{$OBJEXT}")
160161
puts plthook_src
161162
$objs << plthook_src.gsub(/\.c$/, '.o')
162163
$objs << "hook_funcs.o"

0 commit comments

Comments
 (0)