Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions configs/components/runtime-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"#{settings[:bindir]}/libwinpthread-1.dll"

# Used by the zlib default gem.
pkg.install_file "#{settings[:gcc_bindir]}/zlib1.dll",
"#{settings[:bindir]}/zlib1.dll"
pkg.install_file "#{settings[:gcc_bindir]}/libz-1.dll",
"#{settings[:bindir]}/libz-1.dll"
end
end
end
2 changes: 1 addition & 1 deletion configs/components/runtime-openbolt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Matches what the ruby-lang.org builds copy into ruby_builtin_dlls
pkg.install_file "#{settings[:gcc_bindir]}/libgmp-10.dll", "#{settings[:bindir]}/libgmp-10.dll"
pkg.install_file "#{settings[:gcc_bindir]}/libwinpthread-1.dll", "#{settings[:bindir]}/libwinpthread-1.dll"
pkg.install_file "#{settings[:gcc_bindir]}/zlib1.dll", "#{settings[:bindir]}/zlib1.dll"
pkg.install_file "#{settings[:gcc_bindir]}/libz-1.dll", "#{settings[:bindir]}/libz-1.dll"
end
end
end
1 change: 0 additions & 1 deletion configs/platforms/windows-all-x64.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'mingw64-x86_64-gcc-g++',
'mingw64-x86_64-gdbm',
'mingw64-x86_64-libffi',
'mingw64-x86_64-readline',
'mingw64-x86_64-zlib',
'ruby',
'ruby-devel',
Expand Down
26 changes: 26 additions & 0 deletions tasks/build.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
require 'fileutils'

# Returns the imports of toolchain DLLs that the package doesn't contain. They
# load during the build, where the toolchain is on PATH, and nowhere else.
def unshipped_toolchain_dlls(package_dir, toolchain_bindir)
binaries = Dir.glob("#{package_dir}/**/*.{dll,so,exe}")
abort "Found no binaries to check under #{package_dir}" if binaries.empty?

shipped = binaries.map { |binary| File.basename(binary).downcase }
puts "Checking the DLL imports of #{binaries.size} binaries against #{toolchain_bindir}"
binaries.flat_map do |binary|
output, status = Open3.capture2('objdump', '-p', binary)
abort "Could not read the imports of #{binary} with objdump" unless status.success?

output.scan(/DLL Name: (\S+)/).flatten.filter_map do |dll|
next if shipped.include?(dll.downcase) || !File.exist?(File.join(toolchain_bindir, dll))

"#{binary} imports #{dll}"
end
end
end

namespace :vox do
desc 'Build vanagon project with Docker'
task :build, [:project, :platform] do |_, args|
Expand All @@ -24,5 +44,11 @@ namespace :vox do
FileUtils.rm_rf('C:/ProgramFiles64Folder/') if platform =~ /^windows-/

run_command(cmd, silent: false, print_command: true, report_status: true)

next unless platform =~ /^windows-/

toolchain_bindir = platform =~ /^windows-msys2-/ ? '/ucrt64/bin' : '/usr/x86_64-w64-mingw32/sys-root/mingw/bin'
unshipped = unshipped_toolchain_dlls('C:/ProgramFiles64Folder', toolchain_bindir)
abort "These binaries import DLLs that are not in the package:\n#{unshipped.join("\n")}" unless unshipped.empty?
end
end
Loading