summaryrefslogtreecommitdiff
path: root/ext/fiddle
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-22 03:42:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-22 03:42:13 +0000
commit458cffce1a42a0dda7832f69f386e7abac8b621f (patch)
treeaa9ee60bb5fcd382b86c46e5d9f1540935c675f6 /ext/fiddle
parent4e9f6719dd1b203fc21a34b393ed9df2e63cc35a (diff)
extconf.rb: libffi with libruby
* ext/fiddle/extconf.rb: link libffi with libruby for symbols provided by ruby on some platforms, e.g. alloca. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/fiddle')
-rw-r--r--ext/fiddle/depend3
-rw-r--r--ext/fiddle/extconf.rb5
2 files changed, 6 insertions, 2 deletions
diff --git a/ext/fiddle/depend b/ext/fiddle/depend
index 4459ddd..89623db 100644
--- a/ext/fiddle/depend
+++ b/ext/fiddle/depend
@@ -4,7 +4,8 @@ CONFIGURE_LIBFFI = \
cd $(LIBFFI_DIR) && \
$(LIBFFI_CONFIGURE) --disable-shared \
--host=$(LIBFFI_ARCH) --enable-builddir=$(arch) \
- CC="$(CC)" CFLAGS="$(LIBFFI_CFLAGS)"
+ CC="$(CC)" CFLAGS="$(LIBFFI_CFLAGS)" \
+ LD="$(LD)" LDFLAGS="$(LIBFFI_LDFLAGS)"
$(OBJS): $(HDRS) $(ruby_headers) \
$(hdrdir)/ruby/io.h \
diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb
index 39201c1..04c4bce 100644
--- a/ext/fiddle/extconf.rb
+++ b/ext/fiddle/extconf.rb
@@ -24,7 +24,7 @@ begin
end
ffi_header = 'ffi.h'
- libffi = Struct.new(*%I[dir srcdir builddir include lib a cflags opt arch]).new
+ libffi = Struct.new(*%I[dir srcdir builddir include lib a cflags ldflags opt arch]).new
libffi.dir = ver
if $srcdir == "."
libffi.builddir = "#{ver}/#{RUBY_PLATFORM}"
@@ -41,12 +41,14 @@ begin
FileUtils.mkdir_p(libffi.dir)
libffi.opt = CONFIG['configure_args'][/'(-C)'/, 1]
+ libffi.ldflags = RbConfig.expand("$(LDFLAGS) #{libpathflag([relative_from($topdir, "..")])} #{$LIBRUBYARG}")
libffi.arch = RbConfig::CONFIG['host']
args = %W[
#{libffi.srcdir}/configure #{libffi.opt}
--disable-shared
--host=#{libffi.arch} --enable-builddir=#{RUBY_PLATFORM}
CC=#{RbConfig::CONFIG['CC']} CFLAGS=#{libffi.cflags}
+ LD=#{RbConfig::CONFIG['LD']} LDFLAGS=#{libffi.ldflags}
]
Logging::open do
@@ -116,6 +118,7 @@ create_makefile 'fiddle' do |conf|
LIBFFI_DIR = #{libffi.dir}
LIBFFI_A = #{libffi.a}
LIBFFI_CFLAGS = #{libffi.cflags}
+ LIBFFI_LDFLAGS = #{libffi.ldflags}
FFI_H = $(LIBFFI_DIR)/include/ffi.h
SUBMAKE_LIBFFI = #{submake}
MK