From 23fa9204d880044df5ed2eb6fe1036aff41bdf08 Mon Sep 17 00:00:00 2001
From: William Pitcock <nenolod@dereferenced.org>
Date: Sun, 10 Jul 2011 22:10:08 -0500
Subject: [PATCH] main/xulrunner: upgrade to 5.0.

all patches have been rebased as needed, with the following exceptions:

gecko-c99math.patch: dropped.

xpcom-c99math.patch: new patch, replacing the NS_finite() call which was added to
                     xulrunner, at some point after xulrunner-2.0 was released.
                     in all reality, this replaces the old gecko-c99math patch.

mozilla-bsdiff-libbz2.patch: new patch, fixes build when using system libbz2.  patch care
                             of Mike Hommey <glandium@debian.org>, see mozilla bug number
                             644692.  hopefully, this will make it into xulrunner-6.0.

mozconfig: add --disable-elf-hack because of incompatibility with preload and current alpine
           psABI.
---
 main/xulrunner/APKBUILD                       | 19 ++++++-----
 main/xulrunner/mozconfig                      |  1 +
 main/xulrunner/mozilla-bsdiff-libbz2.patch    | 33 +++++++++++++++++++
 ...ecko-c99math.patch => xpcom-c99math.patch} |  6 ++--
 4 files changed, 48 insertions(+), 11 deletions(-)
 create mode 100644 main/xulrunner/mozilla-bsdiff-libbz2.patch
 rename main/xulrunner/{gecko-c99math.patch => xpcom-c99math.patch} (52%)

diff --git a/main/xulrunner/APKBUILD b/main/xulrunner/APKBUILD
index 7ee944d29416..0399d2ce304f 100644
--- a/main/xulrunner/APKBUILD
+++ b/main/xulrunner/APKBUILD
@@ -1,9 +1,9 @@
 # Contributor: William Pitcock <nenolod@dereferenced.org>
 # Maintainer: William Pitcock <nenolod@dereferenced.org>
 pkgname=xulrunner
-pkgver=2.0.1
-_ffoxver=4.0.1
-pkgrel=5
+pkgver=5.0
+_ffoxver=5.0
+pkgrel=0
 pkgdesc="runtime environment for xul-based applications"
 url="http://developer.mozilla.org/en/XULRunner"
 arch="all"
@@ -54,9 +54,11 @@ source="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${_ffoxver}
 	xulrunner-mozalloc.patch
 
 	mozjs-c99math.patch
-	gecko-c99math.patch"
+	xpcom-c99math.patch
 
-_builddir="${srcdir}/mozilla-2.0"
+	mozilla-bsdiff-libbz2.patch"
+
+_builddir="${srcdir}/mozilla-release"
 prepare() {
 	local i
 
@@ -101,11 +103,12 @@ dev() {
 	mv "${pkgdir}"/usr/include "${subpkgdir}"/usr/include
 }
 
-md5sums="9abda7d23151e97913c8555a64c13f34  firefox-4.0.1.source.tar.bz2
-de64a11f40bb6e8800ba799d1b2b8d85  mozconfig
+md5sums="9f64a01e86a5d424e12a8e3305c5debe  firefox-5.0.source.tar.bz2
+cc43a2bd96bd2395aa72d0bbb88e5594  mozconfig
 86d33a17286131d9ef4cdfb35ee56f1f  fix-xulrunner-launcher.patch
 02c23dc4ebd88e445533314716331818  mozilla-pkgconfig.patch
 30053b8b5811cc0676bfe7d7d7ffaa4a  xulrunner-jemalloc-aslr.patch
 d38ecbb7bb31032d3e1ced8939e26abd  xulrunner-mozalloc.patch
 b187440207e773e9be606594d2c99216  mozjs-c99math.patch
-aacbb29e1448f9af6697e8a885b9bbfa  gecko-c99math.patch"
+128d37fab6fbcb1d0b994e8023e701e0  xpcom-c99math.patch
+88c5b4db4e7910b7b99cdee96847c13d  mozilla-bsdiff-libbz2.patch"
diff --git a/main/xulrunner/mozconfig b/main/xulrunner/mozconfig
index 9bdde73f45a9..d0cf2c104761 100644
--- a/main/xulrunner/mozconfig
+++ b/main/xulrunner/mozconfig
@@ -28,6 +28,7 @@ ac_add_options --enable-safe-browsing
 ac_add_options --enable-startup-notification
 ac_add_options --enable-extensions=default
 ac_add_options --enable-jemalloc
+ac_add_options --disable-elf-hack
 
 export LIBS="-lfts -lubacktrace"
 export BUILD_OFFICIAL=1
diff --git a/main/xulrunner/mozilla-bsdiff-libbz2.patch b/main/xulrunner/mozilla-bsdiff-libbz2.patch
new file mode 100644
index 000000000000..52e4c9299608
--- /dev/null
+++ b/main/xulrunner/mozilla-bsdiff-libbz2.patch
@@ -0,0 +1,33 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1302680663 -7200
+# Node ID 0583d58b20a3a0789c46f19ed505cb6e96602ec9
+# Parent  0138798a072ad15edce15d614923a03256946218
+Bug 644692 - Fix bsdiff build failure with system bzip2. r=ted
+
+diff --git a/other-licenses/bsdiff/Makefile.in b/other-licenses/bsdiff/Makefile.in
+--- a/other-licenses/bsdiff/Makefile.in
++++ b/other-licenses/bsdiff/Makefile.in
+@@ -43,17 +43,21 @@ VPATH     = @srcdir@
+ 
+ include $(DEPTH)/config/autoconf.mk
+ 
+ # This program is output to dist/host/bin because it is only needed by the
+ # build system and is not intended to be included in Mozilla distributions.
+ HOST_PROGRAM = mbsdiff$(BIN_SUFFIX)
+ HOST_CSRCS = bsdiff.c
+ 
++ifdef MOZ_NATIVE_BZ2
++HOST_LIBS += $(BZ2_LIBS)
++else
+ HOST_LIBS += $(DIST)/host/lib/$(LIB_PREFIX)hostbz2.$(LIB_SUFFIX)
++endif
+ 
+ ifneq (,$(filter WINCE WINNT,$(HOST_OS_ARCH)))
+ HOST_EXTRA_LIBS += $(call EXPAND_LIBNAME,Ws2_32)
+ endif
+ 
+ LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/mozapps/update/updater
+ 
+ include $(topsrcdir)/config/rules.mk
+
diff --git a/main/xulrunner/gecko-c99math.patch b/main/xulrunner/xpcom-c99math.patch
similarity index 52%
rename from main/xulrunner/gecko-c99math.patch
rename to main/xulrunner/xpcom-c99math.patch
index cdb846442bad..955f964eb849 100644
--- a/main/xulrunner/gecko-c99math.patch
+++ b/main/xulrunner/xpcom-c99math.patch
@@ -1,6 +1,6 @@
---- mozilla-2.0.orig/content/canvas/src/nsCanvasRenderingContext2D.cpp
-+++ mozilla-2.0/content/canvas/src/nsCanvasRenderingContext2D.cpp
-@@ -159,7 +159,7 @@
+--- mozilla-release.orig/xpcom/ds/nsMathUtils.h
++++ mozilla-release/xpcom/ds/nsMathUtils.h
+@@ -170,7 +170,7 @@
      // NOTE: '!!' casts an int to bool without spamming MSVC warning C4800.
      return !!_finite(d);
  #else
-- 
GitLab