Skip to content

Commit

Permalink
Respect LDSHAREDXX in RbConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
yugui committed Sep 24, 2022
1 parent 0bf3059 commit 8764fa5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ext/jsonnet/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ def using_system_libraries?

dir_config('jsonnet')

RbConfig::MAKEFILE_CONFIG['LDSHARED'] = '$(CXX) -shared'
unless using_system_libraries?
message "Building jsonnet using packaged libraries.\n"
require 'rubygems'
Expand Down Expand Up @@ -77,6 +76,13 @@ def target_object_files
# but the makefile to fail. These commands add the necessary paths to do both
$LIBPATH = ["#{recipe.path}/lib"] | $LIBPATH
$CPPFLAGS << " -I#{recipe.path}/include"

# jsonnet_wrap extension must be linked with c++ stdlib because
# the C++ library Rapid YAML is being statically linked.
rbconfig = RbConfig::MAKEFILE_CONFIG
if rbconfig['LDSHAREDXX']
rbconfig['LDSHARED'] = rbconfig['LDSHAREDXX']
end
end

abort 'libjsonnet.h not found' unless have_header('libjsonnet.h')
Expand Down

0 comments on commit 8764fa5

Please sign in to comment.