Sha256: 4ed8185072696795646b008fa2d9f156a54287634d8020d681f86d04f73d1980

Contents?: true

Size: 1.83 KB

Versions: 3

Compression:

Stored size: 1.83 KB

Contents

# Copyright (c) 2013 AppNeta, Inc.
# All rights reserved.

require 'mkmf'
require 'rbconfig'

# Check if we're running in JRuby
if RbConfig::CONFIG.has_key?('arch')
  # nil meaning java string not found
  jruby = (RbConfig::CONFIG['arch'] =~ /java/i) != nil
else
  jruby = false
end

openshift = ENV.has_key?('OPENSHIFT_TRACEVIEW_DIR')

# When on OpenShift, set the mkmf lib paths so we have no issues linking to
# the TraceView libs.
if openshift
  tv_lib64 = "#{ENV['OPENSHIFT_TRACEVIEW_DIR']}usr/lib64"
  tv_tlyzer = "#{ENV['OPENSHIFT_TRACEVIEW_DIR']}usr/lib64/tracelyzer"

  idefault = "#{ENV['OPENSHIFT_TRACEVIEW_DIR']}usr/include"
  ldefault = "#{tv_lib64}:#{tv_tlyzer}"

  dir_config('oboe', idefault, ldefault)
else
  dir_config('oboe')
end

if jruby or ENV.has_key?('TRACEVIEW_URL') 
  # Build the noop extension under JRuby and Heroku.
  # The oboe-heroku gem builds it's own c extension which links to
  # libs specific to a Heroku dyno
  # FIXME: For JRuby we need to remove the c extension entirely
  create_makefile('oboe_noop', 'noop')

elsif have_library('oboe', 'oboe_config_get_revision', 'oboe/oboe.h')

  $libs = append_library($libs, "oboe")
  $libs = append_library($libs, "stdc++")

  $CFLAGS << " #{ENV["CFLAGS"]}"
  $CPPFLAGS << " #{ENV["CPPFLAGS"]}"
  $LIBS << " #{ENV["LIBS"]}"

  # On OpenShift user rpath to point out the TraceView libraries
  if openshift
    $LDFLAGS << " #{ENV["LDFLAGS"]} -Wl,-rpath=#{tv_lib64},--rpath=#{tv_tlyzer}"
  end

  if RUBY_VERSION < '1.9'
    cpp_command('g++') 
    $CPPFLAGS << "-I./src/"
  end
  create_makefile('oboe_metal', 'src')

else
  if have_library('oboe')
    $stderr.puts "Error: The oboe gem requires an updated liboboe.  Please update your liboboe packages."
  end

  $stderr.puts "Error: Could not find the base liboboe libraries.  No tracing will occur."
  create_makefile('oboe_noop', 'noop')
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oboe-2.6.6.1 ext/oboe_metal/extconf.rb
oboe-2.6.5.5 ext/oboe_metal/extconf.rb
oboe-2.6.4.1 ext/oboe_metal/extconf.rb