2014-10-16 04:56:43 +00:00
|
|
|
require "formula"
|
2009-06-04 18:21:19 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Dmd < Formula
|
2014-10-16 04:56:43 +00:00
|
|
|
homepage "http://dlang.org"
|
|
|
|
url "https://github.com/D-Programming-Language/dmd/archive/v2.066.0.tar.gz"
|
|
|
|
sha1 "4ad09f680b249bb10b014b61ccb791a24f7a84c6"
|
2014-01-03 16:41:47 +00:00
|
|
|
|
2014-02-24 16:27:07 +00:00
|
|
|
bottle do
|
2014-10-16 05:08:19 +00:00
|
|
|
sha1 "1cbca6f4f1b0d2af27ad6571c0b2f4b37b928423" => :mavericks
|
|
|
|
sha1 "a61c224f5d15c7b846b3348e196dde6a86cf6b0a" => :mountain_lion
|
|
|
|
sha1 "051c88ee54bebc15c3908fd2f31ec18b6634b9c1" => :lion
|
2014-02-24 16:27:07 +00:00
|
|
|
end
|
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
resource "druntime" do
|
|
|
|
url "https://github.com/D-Programming-Language/druntime/archive/v2.066.0.tar.gz"
|
|
|
|
sha1 "e1a5a29898127b4775a7b60c2534c3f4fc4387a9"
|
2014-01-03 16:41:47 +00:00
|
|
|
end
|
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
resource "phobos" do
|
|
|
|
url "https://github.com/D-Programming-Language/phobos/archive/v2.066.0.tar.gz"
|
|
|
|
sha1 "92385871df5883034055a20f8e8da5c398d11dd6"
|
2014-01-03 16:41:47 +00:00
|
|
|
end
|
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
resource "tools" do
|
|
|
|
url "https://github.com/D-Programming-Language/tools/archive/v2.066.0.tar.gz"
|
|
|
|
sha1 "03384e9237c778e9afcecd10e756111fd4f323de"
|
2014-01-03 16:41:47 +00:00
|
|
|
end
|
2009-06-26 11:58:32 +00:00
|
|
|
|
2009-06-04 18:21:19 +00:00
|
|
|
def install
|
2014-10-16 04:56:43 +00:00
|
|
|
make_args = ["INSTALL_DIR=#{prefix}", "MODEL=#{Hardware::CPU.bits}", "-f", "posix.mak"]
|
2014-01-03 16:41:47 +00:00
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
system "make", "SYSCONFDIR=#{etc}", "TARGET_CPU=X86", "RELEASE=1", *make_args
|
2013-03-04 02:00:44 +00:00
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
bin.install "src/dmd"
|
|
|
|
prefix.install "samples"
|
|
|
|
man.install Dir["docs/man/*"]
|
2013-03-04 02:00:44 +00:00
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
conf = etc/"dmd.conf"
|
2014-02-24 16:22:32 +00:00
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
if conf.exist?
|
|
|
|
inreplace conf, /^DFLAGS=.+$/, "DFLAGS=-I#{include}/d2 -L-L#{lib}"
|
|
|
|
else
|
|
|
|
conf.write <<-EOS.undent
|
|
|
|
[Environment]
|
|
|
|
DFLAGS=-I#{include}/d2 -L-L#{lib}
|
|
|
|
EOS
|
|
|
|
end
|
2009-07-23 03:12:36 +00:00
|
|
|
|
2014-01-03 16:41:47 +00:00
|
|
|
make_args.unshift "DMD=#{bin}/dmd"
|
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
(buildpath/"druntime").install resource("druntime")
|
|
|
|
(buildpath/"phobos").install resource("phobos")
|
|
|
|
|
|
|
|
system "make", "-C", "druntime", *make_args
|
|
|
|
system "make", "-C", "phobos", "VERSION=#{buildpath}/VERSION", *make_args
|
|
|
|
|
|
|
|
(include/"d2").install Dir["druntime/import/*"]
|
|
|
|
cp_r ["phobos/std", "phobos/etc"], include/"d2"
|
|
|
|
lib.install Dir["druntime/lib/*", "phobos/**/libphobos2.a"]
|
2014-02-24 16:22:32 +00:00
|
|
|
|
2014-01-03 16:41:47 +00:00
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
resource("tools").stage do
|
|
|
|
inreplace "posix.mak", "install: $(TOOLS) $(CURL_TOOLS)", "install: $(TOOLS)"
|
2014-01-03 16:41:47 +00:00
|
|
|
system "make", "install", *make_args
|
2013-06-22 13:31:07 +00:00
|
|
|
end
|
|
|
|
end
|
2014-01-03 16:41:47 +00:00
|
|
|
|
2014-02-23 21:31:41 +00:00
|
|
|
test do
|
2014-05-20 04:22:36 +00:00
|
|
|
system bin/"dmd", prefix/"samples/hello.d"
|
2013-06-22 13:31:07 +00:00
|
|
|
system "./hello"
|
2009-06-04 18:21:19 +00:00
|
|
|
end
|
2011-03-10 05:11:03 +00:00
|
|
|
end
|