Skip to content

Instantly share code, notes, and snippets.

@chrmoritz
Last active December 28, 2015 00:59
Show Gist options
  • Save chrmoritz/7417440 to your computer and use it in GitHub Desktop.
Save chrmoritz/7417440 to your computer and use it in GitHub Desktop.
require 'formula'
# see: https://developer.mozilla.org/en-US/docs/Developer_Guide/Source_Code/Mercurial/Bundles
class HgBundleDownloadStrategy < CurlDownloadStrategy
def hgpath
# #{HOMEBREW_PREFIX}/share/python/hg is deprecated, but we levae it in for a while
@path ||= %W[
#{which("hg")}
#{HOMEBREW_PREFIX}/bin/hg
#{HOMEBREW_PREFIX}/opt/mercurial/bin/hg
#{HOMEBREW_PREFIX}/share/python/hg
].find { |p| File.executable? p }
end
def fetch
@repo=@url.split('|')[1]
@url=@url.split('|')[0]
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 Xulrunner < Formula
homepage 'https://developer.mozilla.org/en-US/docs/XULRunner'
url 'http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/24.0/source/xulrunner-24.0.source.tar.bz2'
sha1 '28726eb14fbefb124d14e38e9fae8109ac5eac43'
head 'http://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/mozilla-central.hg|https://hg.mozilla.org/mozilla-central/', :using => HgBundleDownloadStrategy
devel do
url 'http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/26.0b8/source/xulrunner-26.0b8.source.tar.bz2'
sha1 '3e8357530e16cb618bbc6fa731d06184fab51e2f'
version '26.0b8'
end
# we get rid of this as soon as these patches are merged down from Mozilla
env :userpaths if MacOS.version >= :mavericks and !build.head?
depends_on :macos => :lion # needs clang++
depends_on :python => ['2.7', :build]
depends_on 'gnu-tar' => :build
depends_on 'pkg-config' => :build
depends_on 'mercurial' => :build if build.head?
depends_on 'gettext' => :build if build.head?
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
def patches
p = {:p1 => [
# ICU patch to fix OSX 10.9 build errors, see: https://bugzilla.mozilla.org/show_bug.cgi?id=901348
'https://hg.mozilla.org/mozilla-central/raw-rev/37e29c27e6e8',
# fixes duplicate symbol errors linking WebRTC when using the 10.9 SDK, see: https://bugzilla.mozilla.org/show_bug.cgi?id=918943
'https://hg.mozilla.org/mozilla-central/raw-rev/beacc621ec68',
# fixes various duplicate symbol errors building tree with the 10.9 SDK, see: https://bugzilla.mozilla.org/show_bug.cgi?id=917526
'https://hg.mozilla.org/mozilla-central/raw-rev/5e4d9cc03f15'
]}
# fixes Quartz support, see: https://bugzilla.mozilla.org/show_bug.cgi?id=884014
if build.devel?
p[:p1] << 'https://hg.mozilla.org/mozilla-central/raw-rev/0accdf78d53c'
else
p[:p1] << DATA
end
p
end if MacOS.version >= :mavericks and !build.head?
resource 'mozconfig' do
url 'https://gist.github.com/chrmoritz/7815762/raw/d1ec6a29fe3ee2e59f39f854371ee9978cdb684a/mozconfig'
sha1 'af105b46d126ee0b25f2f2487eb2b577725aa3c0'
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
# fixed non executable configure scripts
system "chmod -R 755 #{buildpath}" if build.head?
# autoconf213 is needed for head builds and patched configure files on mavericks
if build.head? or MacOS.version >= :mavericks
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', 'gtar -c --owner=0 --group=0 --numeric-owner'
# we get rid of this as soon as these patches are merged down from Mozilla
if MacOS.version >= :mavericks and !build.head?
# we are not building an .app => need to skip this check, fixes:
# Exception: Binary expected at /tmp/xulrunner-KgUS/mozilla-beta/objdir/dist/XULRunner.app/Contents/MacOS/xulrunner does not exist.
inreplace 'python/mozbuild/mozbuild/mach_commands.py', 'if not what:', 'if 0:'
mkdir '.mozbuild'
ENV['MOZBUILD_STATE_PATH'] = "#{buildpath}/.mozbuild"
system './mach build -v'
system './mach package'
else
system 'make -f client.mk build'
system 'make -f client.mk package'
end
frameworks.mkdir
system "tar -xvjf objdir/dist/xulrunner-28.0a1.en-US.mac64.tar.bz2 -C #{frameworks}" if build.head?
system "tar -xvjf objdir/dist/xulrunner-26.0.en-US.mac64.tar.bz2 -C #{frameworks}" if build.devel?
system "tar -xvjf objdir/dist/xulrunner-24.0.en-US.mac64.tar.bz2 -C #{frameworks}" if build.stable?
end
def post_install
# symlink only xulrunner here will fail
bin.write_exec_script frameworks+'XUL.framework/Versions/Current/xulrunner'
end
test do
system bin+'xulrunner', '-v'
system HOMEBREW_PREFIX+'Frameworks/XUL.framework/Versions/Current/xulrunner', '-v'
end
end
__END__
diff --git a/gfx/2d/QuartzSupport.h b/gfx/2d/QuartzSupport.h
--- a/gfx/2d/QuartzSupport.h
+++ b/gfx/2d/QuartzSupport.h
@@ -9,6 +9,7 @@
#ifdef XP_MACOSX
#import <OpenGL/OpenGL.h>
+#import <OpenGL/gl.h>
#import "ApplicationServices/ApplicationServices.h"
#include "gfxTypes.h"
#include "mozilla/RefPtr.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment