2013-03-11 00:38:36 +00:00
|
|
|
class Ld64 < Formula
|
2015-03-10 21:31:41 +00:00
|
|
|
homepage "https://opensource.apple.com/"
|
2013-03-11 00:38:36 +00:00
|
|
|
# Latest is 134.9, but it no longer supports building for PPC.
|
|
|
|
# 127.2 won't build on Tiger, at least without some patching.
|
|
|
|
# Leopard users: if you like, add a 127.2 option or fix the build
|
|
|
|
# on Tiger.
|
|
|
|
#
|
2015-03-10 21:31:41 +00:00
|
|
|
url "https://opensource.apple.com/tarballs/ld64/ld64-97.17.tar.gz"
|
|
|
|
sha256 "02bd46af0809eaa415d096d7d41c3e8e7d80f7d8d181840866fb87f036b4e089"
|
2013-03-11 00:38:36 +00:00
|
|
|
|
2014-08-09 20:03:54 +00:00
|
|
|
resource "makefile" do
|
|
|
|
url "https://trac.macports.org/export/123511/trunk/dports/devel/ld64/files/Makefile-97", :using => :nounzip
|
2015-03-10 21:31:41 +00:00
|
|
|
sha256 "48e3475bd73f9501d17b7d334d3bf319f5664f2d5ab9d13378e37c2519ae2a3a"
|
2014-08-09 20:03:54 +00:00
|
|
|
end
|
|
|
|
|
2014-11-09 07:25:09 +00:00
|
|
|
depends_on MaximumMacOSRequirement => :snow_leopard
|
2013-10-15 15:56:38 +00:00
|
|
|
|
2013-03-11 00:38:36 +00:00
|
|
|
# Tiger either includes old versions of these headers,
|
|
|
|
# or doesn't ship them at all
|
2014-11-09 07:25:09 +00:00
|
|
|
depends_on "cctools-headers" => :build
|
|
|
|
depends_on "dyld-headers" => :build
|
|
|
|
depends_on "libunwind-headers" => :build
|
2013-03-11 00:38:36 +00:00
|
|
|
|
|
|
|
keg_only :provided_by_osx,
|
|
|
|
"ld64 is an updated version of the ld shipped by Apple."
|
|
|
|
|
2013-04-13 06:09:39 +00:00
|
|
|
fails_with :gcc_4_0 do
|
2013-04-13 06:08:03 +00:00
|
|
|
build 5370
|
|
|
|
end
|
2013-06-09 03:52:41 +00:00
|
|
|
|
2014-03-17 02:35:20 +00:00
|
|
|
# Fixes logic on PPC branch islands
|
|
|
|
patch :p0 do
|
|
|
|
url "https://trac.macports.org/export/103948/trunk/dports/devel/ld64/files/ld64-97-ppc-branch-island.patch"
|
2015-03-10 21:31:41 +00:00
|
|
|
sha256 "a6bbf25c6e4fa348eee3d4756ad65f42ba42b78922dc0f75669023cdf9c25d72"
|
2014-03-17 02:35:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Remove LTO support
|
|
|
|
patch :p0 do
|
|
|
|
url "https://trac.macports.org/export/103949/trunk/dports/devel/ld64/files/ld64-97-no-LTO.patch"
|
2015-03-10 21:31:41 +00:00
|
|
|
sha256 "2596cc25118981cbc31e82ddcb70508057f1946c46c3d6d6845ab7bd01ff1433"
|
2014-03-17 02:35:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Fix version number
|
|
|
|
patch :p0 do
|
|
|
|
url "https://trac.macports.org/export/103951/trunk/dports/devel/ld64/files/ld64-version.patch"
|
2015-03-10 21:31:41 +00:00
|
|
|
sha256 "3753b6877641648017eab2bb391361840fe887a2b3eb2e5ef689272a28c374fc"
|
2013-03-11 00:38:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2014-08-09 20:03:54 +00:00
|
|
|
buildpath.install resource("makefile")
|
|
|
|
mv "Makefile-97", "Makefile"
|
2014-11-09 07:25:09 +00:00
|
|
|
inreplace "src/ld/Options.cpp", "@@VERSION@@", version
|
2013-03-11 00:38:36 +00:00
|
|
|
|
|
|
|
if MacOS.version < :leopard
|
|
|
|
# No CommonCrypto
|
2014-11-09 07:25:09 +00:00
|
|
|
inreplace "src/ld/MachOWriterExecutable.hpp" do |s|
|
|
|
|
s.gsub! "<CommonCrypto/CommonDigest.h>", "<openssl/md5.h>"
|
|
|
|
s.gsub! "CC_MD5", "MD5"
|
2013-03-11 00:38:36 +00:00
|
|
|
end
|
|
|
|
|
2014-11-09 07:25:09 +00:00
|
|
|
inreplace "Makefile", "-Wl,-exported_symbol,__mh_execute_header", ""
|
2013-03-11 00:38:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
args = %W[
|
|
|
|
CC=#{ENV.cc}
|
|
|
|
CXX=#{ENV.cxx}
|
|
|
|
OTHER_CPPFLAGS=#{ENV.cppflags}
|
|
|
|
OTHER_LDFLAGS=#{ENV.ldflags}
|
|
|
|
]
|
|
|
|
|
|
|
|
args << 'RC_SUPPORTED_ARCHS="armv6 armv7 i386 x86_64"' if MacOS.version >= :lion
|
|
|
|
args << "OTHER_LDFLAGS_LD64=-lcrypto" if MacOS.version < :leopard
|
|
|
|
|
|
|
|
# Macports makefile hardcodes optimization
|
2014-11-09 07:25:09 +00:00
|
|
|
inreplace "Makefile" do |s|
|
|
|
|
s.change_make_var! "CFLAGS", ENV.cflags
|
|
|
|
s.change_make_var! "CXXFLAGS", ENV.cxxflags
|
2013-03-11 00:38:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
system "make", *args
|
|
|
|
system "make", "install", "PREFIX=#{prefix}"
|
|
|
|
end
|
|
|
|
end
|