# Copyright (c) 2012 by Tracelytics, Inc. # All rights reserved. require 'mkmf' require "../../lib/oboe-heroku/version" dir_config('oboe', nil, './src/libs') # Symlinks aren't supported in gems (it packages originals) so to keep # the gem size manageable we create the symlinks here on the fly. pwd = Dir.pwd Dir.chdir './src/libs' File.symlink('libboost_date_time.so.1.53.0', 'libboost_date_time.so') unless File.symlink?('libboost_date_time.so') File.symlink('libboost_system.so.1.53.0', 'libboost_system.so') unless File.symlink?('libboost_system.so') File.symlink('libboost_thread.so.1.53.0', 'libboost_thread.so') unless File.symlink?('libboost_thread.so') File.symlink('libevent-2.0.so.5.1.9', 'libevent-2.0.so.5') unless File.symlink?('libevent-2.0.so.5') File.symlink('libevent-2.0.so.5', 'libevent.so') unless File.symlink?('libevent.so') File.symlink('liboboe-1.0.so.1.3.1', 'liboboe-1.0.so.1') unless File.symlink?('liboboe-1.0.so.1') File.symlink('liboboe-1.0.so.1.3.1', 'liboboe.so') unless File.symlink?('liboboe.so') File.symlink('libthrift-0.9.0.so', 'libthrift.so') unless File.symlink?('libthrift.so') File.symlink('libthriftnb-0.9.0.so', 'libthriftnb.so') unless File.symlink?('libthriftnb.so') File.symlink('libthriftz-0.9.0.so', 'libthriftz.so') unless File.symlink?('libthriftz.so') Dir.chdir pwd $libs = append_library($libs, "stdc++") $libs = append_library($libs, "oboe") $libs = append_library($libs, "boost_system") $libs = append_library($libs, "boost_date_time") $libs = append_library($libs, "fb303") $libs = append_library($libs, "thrift") $libs = append_library($libs, "thriftnb") $libs = append_library($libs, "thriftz") $libs = append_library($libs, "event") # FIXME: Static path hack # This is used to get around Heroku's temporary area build pack # compilation process. We use this path to supply to ld rpath # so that bundled libraries can be linked dynamically at runtime. # The alternative to this would be to set LD_LIBRARY_PATH # in the application which can be risky since we bundle # a couple common libraries such as libevent. static_lib_path = "/app/vendor/bundle/ruby/#{Gem::ConfigMap[:ruby_version]}/gems/oboe-heroku-#{OboeHeroku::Version::STRING}/ext/oboe_metal/src/libs" $CFLAGS << " #{ENV["CFLAGS"]}" $CPPFLAGS << " #{ENV["CPPFLAGS"]}" $LIBS << " #{ENV["LIBS"]}" $LDFLAGS << " #{ENV["LDFLAGS"]} -Wl,-rpath,#{static_lib_path}" cpp_command('g++') if RUBY_VERSION < '1.9' create_makefile('oboe_metal', 'src')