Skip to content

Commit

Permalink
Fix json
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed May 6, 2024
1 parent b012db5 commit 0f6e2b3
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions lib/rubygems_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def post_install
elsif extname.to_s == "sqlite3"
extname = "sqlite3_native"
extconf_args = ["--enable-system-libraries", "--with-pkg-config=pkgconf"]
elsif ['unfext', 'byebug', 'generator', 'parser'].include?(extname.to_s)
elsif ['unfext', 'byebug', 'msgpack', 'json', 'generator', 'parser'].include?(extname.to_s)
# No-op
else
puts "Warning: rubygems_plugin.post_install: no configuration given for extension_dir=#{extension_dir}"
Expand Down Expand Up @@ -148,24 +148,30 @@ def post_install

StaticExtensionPlugin.make_static extension_dir, results

File.open(@ext_init_file_name, "a") do |f|
f.puts "extern \"C\" {"
f.puts " void Init_#{extname}(void);"
f.puts "}"
f.puts
f.puts "namespace embedded_help {"
f.puts " inline void init_#{extname}() {"
f.puts " Init_#{extname}();"
f.puts " }"
f.puts "}"
f.puts
end
# json has a makefile, but really it's only json/ext/parser and
# json/ext/generator that are compiled
if extname.to_s == 'json'
puts "Not exporting json because it's shallow and doesn't have a static lib (parser and generator do). #{extension_dir.to_s}"
else
File.open(@ext_init_file_name, "a") do |f|
f.puts "extern \"C\" {"
f.puts " void Init_#{extname}(void);"
f.puts "}"
f.puts
f.puts "namespace embedded_help {"
f.puts " inline void init_#{extname}() {"
f.puts " Init_#{extname}();"
f.puts " }"
f.puts "}"
f.puts
end

File.open(@exports_file_name, "a") do |f|
f.puts "add_library(#{target_name} STATIC IMPORTED)"
f.puts "set_target_properties(#{target_name} PROPERTIES IMPORTED_LOCATION \"${OPENSTUDIO_GEMS_DIR}#{lib_path}\")"
f.puts "list(APPEND ruby_extension_libs #{target_name})"
f.puts
File.open(@exports_file_name, "a") do |f|
f.puts "add_library(#{target_name} STATIC IMPORTED)"
f.puts "set_target_properties(#{target_name} PROPERTIES IMPORTED_LOCATION \"${OPENSTUDIO_GEMS_DIR}#{lib_path}\")"
f.puts "list(APPEND ruby_extension_libs #{target_name})"
f.puts
end
end
end
end
Expand Down

0 comments on commit 0f6e2b3

Please sign in to comment.