diff options
| author | Christian Moritz | 2014-01-07 01:57:18 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2014-01-07 08:49:16 +0000 |
| commit | 2c291fe3d65a9d55e653ae25685443147b231a39 (patch) | |
| tree | 985df17793dd1a2b0a9000f9bc366cf3e071cc1c /Library/Formula | |
| parent | 25b5e38158e51df105ebd2ad3bca8ddb612aa8dd (diff) | |
| download | homebrew-2c291fe3d65a9d55e653ae25685443147b231a39.tar.bz2 | |
xulrunner 26.0
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/xulrunner.rb | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/Library/Formula/xulrunner.rb b/Library/Formula/xulrunner.rb new file mode 100644 index 000000000..0257879b5 --- /dev/null +++ b/Library/Formula/xulrunner.rb @@ -0,0 +1,123 @@ +require "formula" + +# speed up head clone, see: https://developer.mozilla.org/en-US/docs/Developer_Guide/Source_Code/Mercurial/Bundles +class HgBundleDownloadStrategy < CurlDownloadStrategy + def hgpath + MercurialDownloadStrategy.new(@name, @resource).hgpath + end + + def fetch + @repo = @url.split("|").last + @url = @url.split("|").first + super() + end + + def stage + safe_system "mkdir mozilla-central" + safe_system hgpath, "init", "mozilla-central" + chdir + safe_system hgpath, "unbundle", @tarball_path + safe_system hgpath, "pull", @repo + safe_system hgpath, "update" + end +end + +class Python273Requirement < Requirement + fatal true + default_formula "python" + + satisfy do + `python -V 2>&1` =~ /^Python 2.7.(\d+)/ + $1.to_i >= 3 + end +end + +class Xulrunner < Formula + homepage "https://developer.mozilla.org/docs/XULRunner" + url "http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/27.0b4/source/xulrunner-27.0b4.source.tar.bz2" + sha1 "8dda88378454d9996cd908eeee48fcdfe47bc3ba" + version "27.0b4" + + head do + url "http://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/mozilla-central.hg|https://hg.mozilla.org/mozilla-central/", :using => HgBundleDownloadStrategy + depends_on "mercurial" => :build + depends_on "gettext" => :build + end + + depends_on :macos => :lion # needs clang++ + depends_on Python273Requirement + depends_on :python + depends_on "gnu-tar" => :build + depends_on "pkg-config" => :build + depends_on "yasm" + + fails_with :gcc do + cause "Mozilla XULRunner only supports Clang on OS X" + end + + fails_with :llvm do + cause "Mozilla XULRunner only supports Clang on OS X" + end + + resource "mozconfig" do + url "https://gist.github.com/chrmoritz/7815762/raw/d1ec6a29fe3ee2e59f39f854371ee9978cdb684a/mozconfig" + sha1 "af105b46d126ee0b25f2f2487eb2b577725aa3c0" + version "1.0" + end + + resource "autoconf213" do + url "http://ftpmirror.gnu.org/autoconf/autoconf-2.13.tar.gz" + mirror "http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz" + sha1 "e4826c8bd85325067818f19b2b2ad2b625da66fc" + end + + def install + if build.head? + resource("autoconf213").stage do + system "./configure", "--disable-debug", "--program-suffix=213", "--prefix=#{buildpath}/ac213" + system "make", "install" + end + ENV["AUTOCONF"] = buildpath/"ac213/bin/autoconf213" + end + + # build xulrunner to objdir and disable tests, updater.app and crashreporter.app + buildpath.install resource("mozconfig") + # fixed usage of bsdtar with unsupported parameters (replaced with gnu-tar) + inreplace "toolkit/mozapps/installer/packager.mk", "$(TAR) -c --owner=0 --group=0 --numeric-owner", + "#{Formula.factory("gnu-tar").bin}/gtar -c --owner=0 --group=0 --numeric-owner" + + system "make", "-f", "client.mk", "build" + system "make", "-f", "client.mk", "package" + + frameworks.mkpath + if build.head? + # update HEAD version here with every version bump + system "tar", "-xvj", "-C", frameworks, "-f", + "objdir/dist/xulrunner-29.0a1.en-US.mac64.tar.bz2" + else + system "tar", "-xvj", "-C", frameworks, "-f", + "objdir/dist/xulrunner-#{version.to_s[/\d+.\d/]}.en-US.mac64.tar.bz2" + end + + # symlink only xulrunner here will fail (assumes dylibs in same directory) + bin.write_exec_script frameworks/"XUL.framework/Versions/Current/xulrunner" + + # fix Trace/BPT trap: 5 error on OS X 10.9, see laurentj/slimerjs#135 + # and https://bugzilla.mozilla.org/show_bug.cgi?id=922590#c4 + if MacOS.version >= :mavericks + (frameworks/"XUL.framework/Versions/Current/Info.plist").write <<-EOS.undent + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <dict> + <key>CFBundleIdentifier</key> + <string>org.mozilla.xulrunner</string> + </dict> + </plist> + EOS + end + end + + test do + system "#{bin}/xulrunner", "-v" + end +end |
