101 lines
3.3 KiB
Ruby
101 lines
3.3 KiB
Ruby
class Swift < Formula
|
|
desc "High-performance system programming language"
|
|
homepage "https://github.com/apple/swift"
|
|
|
|
stable do
|
|
url "https://github.com/apple/swift/archive/swift-2.2-SNAPSHOT-2016-03-01-a.tar.gz"
|
|
version "2.2-SNAPSHOT-2016-03-01-a"
|
|
sha256 "cefd56b08df9ed4867985ce2669b9ca544b8fbda75b0e8932047a2474d7db209"
|
|
|
|
swift_tag = "swift-#{version}"
|
|
resource "cmark" do
|
|
url "https://github.com/apple/swift-cmark/archive/#{swift_tag}.tar.gz"
|
|
sha256 "aa2e91c790cf1826a4ee0a04769f397b1abfaefd92139816a9d56ceec38f715a"
|
|
end
|
|
|
|
resource "clang" do
|
|
url "https://github.com/apple/swift-clang/archive/#{swift_tag}.tar.gz"
|
|
sha256 "662b94727e17339e7aedd01aef02f881e04dee2aff4a696460020d96fe906d93"
|
|
end
|
|
|
|
resource "llvm" do
|
|
url "https://github.com/apple/swift-llvm/archive/#{swift_tag}.tar.gz"
|
|
sha256 "0cc42660906b5d756e7bba30db9ef301cb6765dbed95f32fdd3fd70b52aa0651"
|
|
end
|
|
end
|
|
|
|
bottle do
|
|
sha256 "5a19b20aab7aa96ec964b5f94a387ba565976663a25017bf0af09cfda7cc8fd2" => :el_capitan
|
|
sha256 "c583e577cd1cfe712cd9f0a8ca5add818dae41be7d9f95a408e4e8b7acc39124" => :yosemite
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/apple/swift.git"
|
|
|
|
resource "cmark" do
|
|
url "https://github.com/apple/swift-cmark.git"
|
|
end
|
|
|
|
resource "clang" do
|
|
url "https://github.com/apple/swift-clang.git", :branch => "stable"
|
|
end
|
|
|
|
resource "llvm" do
|
|
url "https://github.com/apple/swift-llvm.git", :branch => "stable"
|
|
end
|
|
end
|
|
|
|
keg_only :provided_by_osx, "Apple's CLT package contains Swift."
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "ninja" => :build
|
|
depends_on :xcode => ["7.0", :build]
|
|
|
|
# According to the official llvm readme, GCC 4.7+ is required
|
|
fails_with :gcc_4_0
|
|
fails_with :gcc
|
|
("4.3".."4.6").each do |n|
|
|
fails_with :gcc => n
|
|
end
|
|
|
|
def install
|
|
workspace = buildpath.parent
|
|
build = workspace/"build"
|
|
|
|
ln_sf buildpath, "#{workspace}/swift"
|
|
resources.each { |r| r.stage("#{workspace}/#{r.name}") }
|
|
|
|
mkdir build do
|
|
system "#{buildpath}/utils/build-script",
|
|
"-R",
|
|
"--build-subdir=",
|
|
"--no-llvm-assertions",
|
|
"--no-swift-assertions",
|
|
"--no-swift-stdlib-assertions",
|
|
"--",
|
|
"--workspace=#{workspace}",
|
|
"--build-args=-j#{ENV.make_jobs}",
|
|
"--lldb-use-system-debugserver",
|
|
"--install-prefix=#{prefix}",
|
|
"--darwin-deployment-version-osx=#{MacOS.version}",
|
|
"--build-jobs=#{ENV.make_jobs}"
|
|
end
|
|
bin.install "#{build}/swift-macosx-x86_64/bin/swift",
|
|
"#{build}/swift-macosx-x86_64/bin/swift-autolink-extract",
|
|
"#{build}/swift-macosx-x86_64/bin/swift-compress",
|
|
"#{build}/swift-macosx-x86_64/bin/swift-demangle",
|
|
"#{build}/swift-macosx-x86_64/bin/swift-ide-test",
|
|
"#{build}/swift-macosx-x86_64/bin/swift-llvm-opt",
|
|
"#{build}/swift-macosx-x86_64/bin/swiftc",
|
|
"#{build}/swift-macosx-x86_64/bin/sil-extract",
|
|
"#{build}/swift-macosx-x86_64/bin/sil-opt"
|
|
(lib/"swift").install "#{build}/swift-macosx-x86_64/lib/swift/macosx/",
|
|
"#{build}/swift-macosx-x86_64/lib/swift/shims/"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.swift").write 'print("test")'
|
|
system "#{bin}/swiftc", "test.swift"
|
|
assert_equal "test\n", shell_output("./test")
|
|
end
|
|
end
|