Skip to content

Commit 70379f0

Browse files
committed
Switch platform detection to shell out to uname -p -- Config::Config['target']
lies on Intel with Apple's Universal ruby.
1 parent 790a1fb commit 70379f0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

ext/extconf.rb

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@
22
require 'rbconfig'
33

44
def symlink(old, new)
5-
if File.exists?(new) && File.symlink?(new)
5+
begin
6+
File.symlink(old, new)
7+
rescue Errno::EEXIST
68
File.unlink(new)
9+
retry
710
end
8-
File.symlink(old, new)
911
end
1012

1113
$CFLAGS += " -D_LONGLONG_TYPE -g"
1214
have_library("dtrace", "dtrace_open")
1315

14-
# Update machine-dependent symlinks in the source, based on $Config::CONFIG
15-
16-
cpu = Config::CONFIG['target_cpu']
16+
# Update machine-dependent symlinks in the source, based on $Config::CONFIG and `uname -p`
1717
os = Config::CONFIG['target_os']
18-
19-
cpu.gsub! /^i[4-6]86/, 'i386'
2018
os.gsub! /[0-9.]+$/, ''
2119

20+
# On OSX, this is "powerpc", even on Intel...
21+
#cpu = Config::CONFIG['target_cpu']
22+
cpu = `uname -p`.chomp
23+
2224
dir = "#{cpu}-#{os}"
2325
symlink "#{dir}/dtrace_probe.c", "dtrace_probe.c"
2426

2527
# Create makefile in the usual way
26-
2728
create_makefile("dtrace_api")
2829

0 commit comments

Comments
 (0)