File link-with-soname.patch of Package mruby
diff -Nur mruby-3.1.0/build_config/host-shared.rb new/build_config/host-shared.rb
--- mruby-3.1.0/build_config/host-shared.rb 2022-05-12 05:19:10.000000000 +0200
+++ new/build_config/host-shared.rb 2023-02-15 19:40:18.649494310 +0100
@@ -18,12 +18,12 @@
conf.archiver do |archiver|
archiver.command = 'gcc'
- archiver.archive_options = '-shared -o %{outfile} %{objs}'
+ archiver.archive_options = '-shared -Wl,-soname,%{filename} -o %{outfile} %{objs}'
end
# file extensions
conf.exts do |exts|
- exts.library = '.so'
+ exts.library = '.so.%{version}'
end
# file separator
diff -Nur mruby-3.1.0/lib/mruby/build/command.rb new/lib/mruby/build/command.rb
--- mruby-3.1.0/lib/mruby/build/command.rb 2022-05-12 05:19:10.000000000 +0200
+++ new/lib/mruby/build/command.rb 2023-02-15 19:39:00.763898579 +0100
@@ -4,7 +4,7 @@
class Command
include Rake::DSL
extend Forwardable
- def_delegators :@build, :filename, :objfile, :libfile, :exefile
+ def_delegators :@build, :filename, :realname, :objfile, :libfile, :exefile
attr_accessor :build, :command
def initialize(build)
@@ -234,7 +234,7 @@
def run(outfile, objfiles)
mkdir_p File.dirname(outfile)
_pp "AR", outfile.relative_path
- _run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' ') }
+ _run archive_options, { :outfile => filename(outfile), :filename => realname(outfile), :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' ') }
end
end
diff -Nur mruby-3.1.0/lib/mruby/build.rb new/lib/mruby/build.rb
--- mruby-3.1.0/lib/mruby/build.rb 2022-05-12 05:19:10.000000000 +0200
+++ new/lib/mruby/build.rb 2023-02-15 19:39:00.763898579 +0100
@@ -6,6 +6,7 @@
autoload :Gem, "mruby/gem"
autoload :Lockfile, "mruby/lockfile"
autoload :Presym, "mruby/presym"
+ autoload :Source, 'mruby/source'
class << self
def targets
@@ -382,6 +383,10 @@
end
end
+ def realname(name)
+ filename(name).rpartition(file_separator)[-1]
+ end
+
def exefile(name)
if name.is_a?(Array)
name.flatten.map { |n| exefile(n) }
@@ -405,7 +410,7 @@
if name.is_a?(Array)
name.flatten.map { |n| libfile(n) }
else
- "#{name}#{exts.library}"
+ "#{name}#{exts.library}" % {:version => MRuby::Source::MRUBY_VERSION}
end
end