Created
October 24, 2013 20:44
-
-
Save chrmoritz/7144640 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Slimerjs < Formula | |
homepage 'http://www.slimerjs.org' | |
url 'http://download.slimerjs.org/v0.8/slimerjs-0.8.3.zip' | |
sha1 '8d2a6dc3b8200fa15cd9d65c84bc9358c11f03f8' | |
head 'https://github.com/laurentj/slimerjs.git' | |
option 'without-xulrunner', 'Do not add xulrunner (requires a local Firefox installation, default on OS X 10.6 and below)' | |
if build.with? 'xulrunner' and MacOS.version > :snow_leopard | |
resource 'xulrunner' do | |
# keep this in sync with the slimerjs standalone version, because it defines a maxgecko version | |
# update version number in tar command (in resource('xulrunner').stage) too | |
url 'http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/24.0/source/xulrunner-24.0.source.tar.bz2' | |
sha1 '28726eb14fbefb124d14e38e9fae8109ac5eac43' | |
end | |
depends_on :python2 => '2.7' | |
depends_on 'yasm' => :recommended # WebM support | |
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 | |
fails_with :clang do | |
build 77 | |
cause 'clang on OS X 10.6 / XCode 3 is to old (requires clang++)' | |
end | |
end | |
def install | |
if build.head? | |
cd 'src/' | |
system 'zip -r omni.ja chrome/ components/ modules/ defaults/ chrome.manifest -x@package_exclude.lst' | |
end | |
libexec.install %w[application.ini omni.ja slimerjs] | |
bin.install_symlink libexec/'slimerjs' | |
resource('xulrunner').stage do | |
# build xulrunner to objdir and disable tests, updater.app and crashreporter.app | |
curl '-O', 'https://gist.github.com/chrmoritz/6952361/raw/d1ec6a29fe3ee2e59f39f854371ee9978cdb684a/.mozconfig' | |
system 'make -f client.mk build' | |
system 'make -f client.mk package' | |
mkdir 'untar' | |
# change the version with every resource update | |
system 'tar -xvjf objdir/dist/xulrunner-24.0.en-US.mac64.tar.bz2 -C untar/' | |
mv 'untar/XUL.framework/Versions/Current', libexec/'xulrunner' | |
end if build.with? 'xulrunner' and MacOS.version > :snow_leopard | |
end | |
def caveats; <<-EOS.undent | |
You should set the environment variable SLIMERJSLAUNCHER to a installation of Mozilla Firefox (or XULRunner). | |
For a standard Mozilla Firefox installation this would be: | |
export SLIMERJSLAUNCHER=/Applications/Firefox.app/Contents/MacOS/firefox | |
EOS | |
end if build.without? 'xulrunner' or MacOS.version <= :snow_leopard | |
test do | |
system 'slimerjs', '-v' | |
curl '-O', 'https://raw.github.com/laurentj/slimerjs/ec1e53a/examples/phantomjs/loadspeed.js' | |
system 'slimerjs loadspeed.js www.google.com' | |
end if MacOS.version > :snow_leopard # test fails on OS X 10.6 (or with --without-xulrunner option) if SLIMERJSLAUNCHER is not set | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment