Skip to content

Commit

Permalink
Yeet.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Sep 3, 2024
1 parent 386ec2e commit 2f30bd0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,16 @@ jobs:
run: |
mkdir distributable
tar -xvzf ruby-with-python.tgz -C `pwd`/distributable
DARWIN_VERSION=$(sw_vers -productVersion | cut -d '.' -f 1)
if [ "$(uname -m)" = "arm64" ]; then
INSTALL_DIR="`pwd`/distributable/opt/homebrew"
RUBY_PLATFORM_PAIR="arm64-darwin${DARWIN_VERSION}"
else
INSTALL_DIR="`pwd`/distributable/usr/local"
RUBY_PLATFORM_PAIR="x86_64-darwin${DARWIN_VERSION}"
fi
export PATH="${INSTALL_DIR}/bin:$PATH"
export RUBYLIB="${INSTALL_DIR}/lib/ruby/3.3.0"
export RUBYLIB="${INSTALL_DIR}/lib/ruby/3.3.0:${INSTALL_DIR}/lib/ruby/3.3.0/${RUBY_PLATFORM_PAIR}"
otool -L ${INSTALL_DIR}/bin/python3
otool -L ${INSTALL_DIR}/Cellar/[email protected]/3.12.5/Frameworks/Python.framework/Versions/3.12/Python || true
otool -L ${INSTALL_DIR}/bin/ruby
Expand Down
13 changes: 10 additions & 3 deletions brew-pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ def elf_file?(file_path)

stdout, status = Open3.capture2("file -bL --mime-encoding \"#{file_path}\"")

# TODO: Remove this...
ohai "Check if it '#{file_path}' is ELF: #{stdout.strip}"

return stdout.strip == 'binary'
end

Expand All @@ -30,6 +27,9 @@ def patchelf(root_dir, prefix_path, binary)
# Get the list of linked libraries with otool
stdout, status = Open3.capture2("otool -L #{binary_path}")

# TODO: Remove
ohai "#{stdout}"

# Remove the first line which is unnecesary
stdout_lines = stdout.lines[1..-1]

Expand All @@ -50,8 +50,15 @@ def patchelf(root_dir, prefix_path, binary)
# Patch the library path relative to the binary path
system("install_name_tool", "-change", lib, new_lib, binary_path)

# TODO: Remove
stdout, status = Open3.capture2("otool -L #{binary_path}")
ohai "#{stdout}"
ohai "patchelf(#{root_dir}, #{prefix_path}, #{lib.delete_prefix(prefix_path)})"

# Recursively iterate through libraries
patchelf(root_dir, prefix_path, lib.delete_prefix(prefix_path))
else
opoo "File 'File.realpath(File.join(#{root_dir}, #{lib})' not found"
end
end
end
Expand Down

0 comments on commit 2f30bd0

Please sign in to comment.