2011-03-10 05:11:03 +00:00
|
|
|
class Dmd < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "D programming language compiler for OS X"
|
2015-12-18 19:03:47 +00:00
|
|
|
homepage "https://dlang.org/"
|
2015-07-26 21:44:42 +00:00
|
|
|
|
|
|
|
stable do
|
2016-04-06 15:37:27 +00:00
|
|
|
url "https://github.com/D-Programming-Language/dmd/archive/v2.071.0.tar.gz"
|
|
|
|
sha256 "e223bfa0ad6d3cf04afd35ef03f3507e674ceefc19ff0b0109265b86b7857500"
|
2015-07-26 21:44:42 +00:00
|
|
|
|
|
|
|
resource "druntime" do
|
2016-04-06 15:37:27 +00:00
|
|
|
url "https://github.com/D-Programming-Language/druntime/archive/v2.071.0.tar.gz"
|
|
|
|
sha256 "54f9aea60424fe43d950112d6beaa102048e82f78bf1362d20c98525f199f356"
|
2015-07-26 21:44:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "phobos" do
|
2016-04-06 15:37:27 +00:00
|
|
|
url "https://github.com/D-Programming-Language/phobos/archive/v2.071.0.tar.gz"
|
|
|
|
sha256 "3d3f63c2cd303546c1f4ed0169b9dd69173c9d4ded501721cd846c1a05738a69"
|
2015-07-26 21:44:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "tools" do
|
2016-04-06 15:37:27 +00:00
|
|
|
url "https://github.com/D-Programming-Language/tools/archive/v2.071.0.tar.gz"
|
|
|
|
sha256 "e41f444cb85ee2ca723abc950c1f875d9e0004d92208a883454ff2b8efd2c441"
|
2015-10-08 08:39:03 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-11-04 21:52:31 +00:00
|
|
|
bottle do
|
2016-04-13 10:36:49 +00:00
|
|
|
sha256 "3b06c86da15f6cf45fff69b10db6e95a38f7eb8badf65bfce22ea6a73fcaa3f7" => :el_capitan
|
|
|
|
sha256 "31ef9523b4bba0466d1c20bc7b84a9e293be65ceba64195fe76d4dd22b7d9707" => :yosemite
|
|
|
|
sha256 "4fffd14884ab78b936768208d7269bed193ff52cc30de53a55ead0bce0e9c47a" => :mavericks
|
2015-11-04 21:52:31 +00:00
|
|
|
end
|
|
|
|
|
2015-07-26 21:44:42 +00:00
|
|
|
head do
|
|
|
|
url "https://github.com/D-Programming-Language/dmd.git"
|
|
|
|
|
|
|
|
resource "druntime" do
|
|
|
|
url "https://github.com/D-Programming-Language/druntime.git"
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "phobos" do
|
|
|
|
url "https://github.com/D-Programming-Language/phobos.git"
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "tools" do
|
|
|
|
url "https://github.com/D-Programming-Language/tools.git"
|
|
|
|
end
|
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
|
|
|
|
2015-07-26 21:44:42 +00:00
|
|
|
system "make", "SYSCONFDIR=#{etc}", "TARGET_CPU=X86", "AUTO_BOOTSTRAP=1", "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
|
|
|
|
2015-03-13 01:34:12 +00:00
|
|
|
# A proper dmd.conf is required for later build steps:
|
|
|
|
conf = buildpath/"dmd.conf"
|
|
|
|
# Can't use opt_include or opt_lib here because dmd won't have been
|
|
|
|
# linked into opt by the time this build runs:
|
|
|
|
conf.write <<-EOS.undent
|
2014-10-16 04:56:43 +00:00
|
|
|
[Environment]
|
2016-02-05 12:21:01 +00:00
|
|
|
DFLAGS=-I#{include}/dlang/dmd -L-L#{lib}
|
2014-10-16 04:56:43 +00:00
|
|
|
EOS
|
2015-03-13 01:34:12 +00:00
|
|
|
etc.install conf
|
|
|
|
install_new_dmd_conf
|
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
|
|
|
|
|
2016-02-05 12:21:01 +00:00
|
|
|
(include/"dlang/dmd").install Dir["druntime/import/*"]
|
|
|
|
cp_r ["phobos/std", "phobos/etc"], include/"dlang/dmd"
|
2014-10-16 04:56:43 +00:00
|
|
|
lib.install Dir["druntime/lib/*", "phobos/**/libphobos2.a"]
|
2014-02-24 16:22:32 +00:00
|
|
|
|
2014-10-16 04:56:43 +00:00
|
|
|
resource("tools").stage do
|
2015-03-27 09:39:16 +00:00
|
|
|
inreplace "posix.mak", "install: $(TOOLS) $(CURL_TOOLS)", "install: $(TOOLS) $(ROOT)/dustmite"
|
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
|
|
|
|
2015-03-13 01:34:12 +00:00
|
|
|
# Previous versions of this formula may have left in place an incorrect
|
|
|
|
# dmd.conf. If it differs from the newly generated one, move it out of place
|
|
|
|
# and warn the user.
|
|
|
|
# This must be idempotent because it may run from both install() and
|
|
|
|
# post_install() if the user is running `brew install --build-from-source`.
|
|
|
|
def install_new_dmd_conf
|
|
|
|
conf = etc/"dmd.conf"
|
|
|
|
|
|
|
|
# If the new file differs from conf, etc.install drops it here:
|
|
|
|
new_conf = etc/"dmd.conf.default"
|
|
|
|
# Else, we're already using the latest version:
|
|
|
|
return unless new_conf.exist?
|
|
|
|
|
|
|
|
backup = etc/"dmd.conf.old"
|
|
|
|
opoo "An old dmd.conf was found and will be moved to #{backup}."
|
|
|
|
mv conf, backup
|
|
|
|
mv new_conf, conf
|
|
|
|
end
|
|
|
|
|
|
|
|
def post_install
|
|
|
|
install_new_dmd_conf
|
|
|
|
end
|
|
|
|
|
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
|