Skip to content

Commit 4f5148e

Browse files
committed
[GR-11010] Store paths relative to the home for core C extensions.
PullRequest: truffleruby/755
2 parents b808cfd + a452120 commit 4f5148e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/cext/preprocess.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def self.patch(file, contents, directory)
6161
if __FILE__ == $0
6262
require 'stringio'
6363

64-
file_name = ARGF.filename
64+
file_name = ARGV.first
6565
original_content = File.read(file_name)
6666
output = patch(file_name, original_content, Dir.pwd)
6767

@@ -72,7 +72,8 @@ def self.patch(file, contents, directory)
7272
file_name = patched_file_name
7373
end
7474

75-
$stdout.puts "#line 1 \"#{file_name}\""
75+
expanded_path = File.expand_path(file_name)
76+
$stdout.puts "#line 1 \"#{expanded_path}\""
7677
$stdout.puts output
7778
end
7879
end

lib/truffle/rbconfig-for-mkmf.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,20 @@
8484

8585
cext_dir = "#{RbConfig::CONFIG['libdir']}/cext"
8686

87+
expanded = RbConfig::CONFIG
88+
mkconfig = RbConfig::MAKEFILE_CONFIG
89+
8790
if Truffle::Boot.get_option 'building.core.cexts'
8891
ruby_home = Truffle::Boot.ruby_home
8992
link_o_files = "#{ruby_home}/src/main/c/cext/ruby.o #{ruby_home}/src/main/c/sulongmock/sulongmock.o"
90-
RbConfig::MAKEFILE_CONFIG['CPPFLAGS'] = "-DSULONG_POLYGLOT_H='\"#{ENV.fetch('SULONG_POLYGLOT_H')}\"'"
93+
relative_debug_paths = "-fdebug-prefix-map=#{ruby_home}=."
94+
polyglot_h = "-DSULONG_POLYGLOT_H='\"#{ENV.fetch('SULONG_POLYGLOT_H')}\"'"
95+
mkconfig['CPPFLAGS'] = "#{relative_debug_paths} #{polyglot_h}"
96+
expanded['CPPFLAGS'] = mkconfig['CPPFLAGS']
9197
else
9298
link_o_files = "#{cext_dir}/ruby.o #{cext_dir}/sulongmock.o"
9399
end
94100

95-
expanded = RbConfig::CONFIG
96-
mkconfig = RbConfig::MAKEFILE_CONFIG
97-
98101
common = {
99102
'CC' => cc,
100103
'CPP' => cc,

0 commit comments

Comments
 (0)