Skip to content
Merged
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 Formula/amap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def install
end

test do
output = shell_output("otool -L #{bin}/amap")
assert_match Formula["openssl"].opt_lib.to_s, output
openssl_linked = MachO::Tools.dylibs("#{bin}/amap").any? { |d| d.include? Formula["openssl"].opt_lib.to_s }
assert openssl_linked
# We can do more than this, but unsure how polite it is to port-scan
# someone's domain every time this goes through CI.
assert_match version.to_s, shell_output("#{bin}/amap", 255)
Expand Down
2 changes: 1 addition & 1 deletion Formula/espeak.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def install
lib.install "libespeak.a"
system "make", "libespeak.so", "DATADIR=#{share}/espeak-data", "PREFIX=#{prefix}"
lib.install "libespeak.so.1.1.48" => "libespeak.dylib"
system "install_name_tool", "-id", "#{lib}/libespeak.dylib", "#{lib}/libespeak.dylib"
MachO::Tools.change_dylib_id("#{lib}/libespeak.dylib", "#{lib}/libespeak.dylib")
# macOS does not use the convention libraryname.so.X.Y.Z. macOS uses the convention libraryname.X.dylib
# See https://stackoverflow.com/questions/4580789/ld-unknown-option-soname-on-os-x/32280483#32280483
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/g3log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def install
# No install target yet: https://github.com/KjellKod/g3log/issues/49
include.install "src/g3log"
lib.install "libg3logger.a", "libg3logger.dylib"
system "install_name_tool", "-id", "#{lib}/libg3logger.dylib", "#{lib}/libg3logger.dylib"
MachO::Tools.change_dylib_id("#{lib}/libg3logger.dylib", "#{lib}/libg3logger.dylib")
end

test do
Expand Down
20 changes: 6 additions & 14 deletions Formula/haskell-stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ def install
cabal_sandbox do
inreplace "stack.cabal", "directory >=1.2.1.0 && <1.3,",
"directory >=1.2.1.0 && <1.4,"
system "cabal", "get", "Glob", "hpc"
inreplace "Glob-0.7.13/Glob.cabal", ", directory < 1.3",
", directory < 1.4"
system "cabal", "get", "hpc"
inreplace "hpc-0.6.0.3/hpc.cabal", "directory >= 1.1 && < 1.3,",
"directory >= 1.1 && < 1.4,"
cabal_sandbox_add_source "Glob-0.7.13", "hpc-0.6.0.3"
cabal_sandbox_add_source "hpc-0.6.0.3"

if build.with? "bootstrap"
cabal_install
Expand All @@ -60,17 +58,11 @@ def install
end

# Remove the unneeded rpaths so that the binary works on Sierra
rpaths = Utils.popen_read("otool -l #{bin}/stack").split("\n")
rpaths = rpaths.inject([]) do |r, e|
if e =~ /^ +path (.*) \(offset.*/
r << $~[1]
else
r
end
end
rpaths.each do |r|
system "install_name_tool", "-delete_rpath", r, bin/"stack"
macho = MachO.open("#{bin}/stack")
macho.rpaths.each do |rpath|
macho.delete_rpath(rpath)
end
macho.write!
end

test do
Expand Down
2 changes: 1 addition & 1 deletion Formula/leveldb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def install
lib.install "out-shared/libleveldb.dylib.1.19" => "libleveldb.1.19.dylib"
lib.install_symlink lib/"libleveldb.1.19.dylib" => "libleveldb.dylib"
lib.install_symlink lib/"libleveldb.1.19.dylib" => "libleveldb.1.dylib"
system "install_name_tool", "-id", "#{lib}/libleveldb.1.dylib", "#{lib}/libleveldb.1.19.dylib"
MachO::Tools.change_dylib_id("#{lib}/libleveldb.1.dylib", "#{lib}/libleveldb.1.19.dylib")
end

test do
Expand Down
8 changes: 4 additions & 4 deletions Formula/libgcrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def install
# normal place on >10.10 where SIP is enabled.
# https://github.com/Homebrew/homebrew-core/pull/3004
# https://bugs.gnupg.org/gnupg/issue2056
system "install_name_tool", "-change",
lib/"libgcrypt.20.dylib",
buildpath/"src/.libs/libgcrypt.20.dylib",
buildpath/"tests/.libs/random"
MachO::Tools.change_install_name("#{buildpath}/tests/.libs/random",
"#{lib}/libgcrypt.20.dylib",
"#{buildpath}/src/.libs/libgcrypt.20.dylib")

system "make", "check"
system "make", "install"

Expand Down
2 changes: 1 addition & 1 deletion Formula/libsvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def install
bin.install "svm-scale", "svm-train", "svm-predict"
lib.install "libsvm.so.2" => "libsvm.2.dylib"
lib.install_symlink "libsvm.2.dylib" => "libsvm.dylib"
system "install_name_tool", "-id", "#{lib}/libsvm.2.dylib", "#{lib}/libsvm.2.dylib"
MachO::Tools.change_dylib_id("#{lib}/libsvm.2.dylib", "#{lib}/libsvm.2.dylib")
include.install "svm.h"
end

Expand Down
6 changes: 3 additions & 3 deletions Formula/llvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def caveats
"-I#{libclangclt}/include",
"-I/usr/include", # need it because /Library/.../usr/include/c++/v1/iosfwd refers to <wchar.h>, which CLT installs to /usr/include
"test.cpp", "-o", "testCLT++"
assert_match "/usr/lib/libc++.1.dylib", shell_output("otool -L ./testCLT++").chomp
assert_includes MachO::Tools.dylibs("testCLT++"), "/usr/lib/libc++.1.dylib"
assert_equal "Hello World!", shell_output("./testCLT++").chomp

system "#{bin}/clang", "-v", "-nostdinc",
Expand All @@ -368,7 +368,7 @@ def caveats
"-I#{libclangxc}/include",
"-I#{MacOS.sdk_path}/usr/include",
"test.cpp", "-o", "testXC++"
assert_match "/usr/lib/libc++.1.dylib", shell_output("otool -L ./testXC++").chomp
assert_includes MachO::Tools.dylibs("testXC++"), "/usr/lib/libc++.1.dylib"
assert_equal "Hello World!", shell_output("./testXC++").chomp

system "#{bin}/clang", "-v", "-nostdinc",
Expand All @@ -387,7 +387,7 @@ def caveats
"-I#{MacOS.sdk_path}/usr/include",
"-L#{lib}",
"-Wl,-rpath,#{lib}", "test.cpp", "-o", "test"
assert_match "#{opt_lib}/libc++.1.dylib", shell_output("otool -L ./test").chomp
assert_includes MachO::Tools.dylibs("test"), "#{opt_lib}/libc++.1.dylib"
assert_equal "Hello World!", shell_output("./test").chomp
end
end
Expand Down
6 changes: 3 additions & 3 deletions Formula/pypy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def install
end

(libexec/"lib").install libexec/"bin/libpypy-c.dylib"
system "install_name_tool", "-change", "@rpath/libpypy-c.dylib",
"#{libexec}/lib/libpypy-c.dylib",
"#{libexec}/bin/pypy"
MachO::Tools.change_install_name("#{libexec}/bin/pypy",
"@rpath/libpypy-c.dylib",
"#{libexec}/lib/libpypy-c.dylib")

# The PyPy binary install instructions suggest installing somewhere
# (like /opt) and symlinking in binaries as needed. Specifically,
Expand Down
9 changes: 6 additions & 3 deletions Formula/pypy3.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Pypy3 < Formula
desc "Implementation of Python 3 in Python"
homepage "http://pypy.org/"
url "https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v5.5.0-alpha-src.tar.bz2"
url "https://dl.bintray.com/homebrew/mirror/pypy3-5.5.0.tar.bz2"
sha256 "d5591c34d77253e9ed57d182b6f49585b95f7c09c3e121f0e8630e5a7e75ab5f"

bottle do
Expand Down Expand Up @@ -79,8 +79,11 @@ def install

(libexec/"lib").install libexec/"bin/libpypy-c.dylib" => "libpypy3-c.dylib"

system "install_name_tool", "-change", "@rpath/libpypy-c.dylib", libexec/"lib/libpypy3-c.dylib", "#{libexec}/bin/pypy3.3"
system "install_name_tool", "-id", opt_libexec/"lib/libpypy3-c.dylib", libexec/"lib/libpypy3-c.dylib"
MachO::Tools.change_install_name("#{libexec}/bin/pypy3.3",
"@rpath/libpypy-c.dylib",
"#{libexec}/lib/libpypy3-c.dylib")
MachO::Tools.change_dylib_id("#{libexec}/lib/libpypy3-c.dylib",
"#{opt_libexec}/lib/libpypy3-c.dylib")

(libexec/"lib-python").install "lib-python/3"
libexec.install %w[include lib_pypy]
Expand Down
2 changes: 1 addition & 1 deletion Formula/re2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def install
ENV.cxx11

system "make", "install", "prefix=#{prefix}"
system "install_name_tool", "-id", "#{lib}/libre2.0.dylib", "#{lib}/libre2.0.0.0.dylib"
MachO::Tools.change_dylib_id("#{lib}/libre2.0.0.0.dylib", "#{lib}/libre2.0.dylib")
lib.install_symlink "libre2.0.0.0.dylib" => "libre2.0.dylib"
lib.install_symlink "libre2.0.0.0.dylib" => "libre2.dylib"
end
Expand Down