From 6beefb5ec67b7f4d0467aabfa46ebf2115a96cbd Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Tue, 7 Dec 2010 01:40:32 +0000
Subject: xulrunner: upgrade

---
 abs/extra/xulrunner/PKGBUILD                       | 86 ++++++++++++++--------
 .../xulrunner/enable-x86_64-tracemonkey.patch      | 25 +++++++
 abs/extra/xulrunner/fix-mozilla-launcher.patch     | 23 ++++++
 abs/extra/xulrunner/mozconfig                      |  9 ++-
 abs/extra/xulrunner/mozilla-pkgconfig.patch        | 70 ++++++++++++++++++
 abs/extra/xulrunner/python2.7.patch                | 11 +++
 abs/extra/xulrunner/xulrunner-png14.patch          | 11 +++
 abs/extra/xulrunner/xulrunner-version.patch        | 13 ++++
 8 files changed, 215 insertions(+), 33 deletions(-)
 create mode 100644 abs/extra/xulrunner/enable-x86_64-tracemonkey.patch
 create mode 100644 abs/extra/xulrunner/fix-mozilla-launcher.patch
 create mode 100644 abs/extra/xulrunner/mozilla-pkgconfig.patch
 create mode 100644 abs/extra/xulrunner/python2.7.patch
 create mode 100644 abs/extra/xulrunner/xulrunner-png14.patch
 create mode 100644 abs/extra/xulrunner/xulrunner-version.patch

diff --git a/abs/extra/xulrunner/PKGBUILD b/abs/extra/xulrunner/PKGBUILD
index da6d8cd..36ed257 100644
--- a/abs/extra/xulrunner/PKGBUILD
+++ b/abs/extra/xulrunner/PKGBUILD
@@ -1,43 +1,69 @@
-# $Id: PKGBUILD 36430 2009-04-22 12:03:12Z pierre $
-# Maintainer: Alexander Baldeck <alexander@archlinux.org>
-# Contributor: Jan de Groot <jgc@archlinux.org>
+# $Id: PKGBUILD 97209 2010-10-27 20:57:31Z ibiru $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Alexander Baldeck <alexander@archlinux.org>
 pkgname=xulrunner
-pkgver=1.9.1.1
-_ffoxver=3.5.1
-pkgrel=5
+pkgver=1.9.2.12
+_ffoxver=3.6.12
+pkgrel=1
 pkgdesc="Mozilla Runtime Environment"
-arch=(i686 x86_64)
+arch=('i686' 'x86_64')
 license=('MPL' 'GPL' 'LGPL')
-depends=('gtk2>=2.16.0' 'gcc-libs>=4.3.3' 'libidl2>=0.8.13' 'mozilla-common' 'nss>=3.12.3' 'libxt' 'lcms' 
-         'hunspell>=1.2.8' 'startup-notification>=0.9')
-makedepends=('zip' 'pkgconfig' 'diffutils' 'libgnomeui>=2.24.1')
-provides=(gecko-sdk)
-replaces=(gecko-sdk)
+depends=('gtk2>=2.22.0' 'gcc-libs' 'libidl2>=0.8.13' 'mozilla-common' 'nss>=3.12.8' 'libxt' 'hunspell>=1.2.8' 'startup-notification>=0.10' 'mime-types' 'dbus-glib>=0.86' 'alsa-lib>=1.0.23' 'libevent')
+makedepends=('zip' 'pkg-config' 'diffutils' 'libgnomeui' 'python2' 'wireless_tools' 'autoconf2.13')
+optdepends=('libgnomeui: GNOME integration and MIME handling'
+            'wireless_tools: Location aware browsing')
 url="http://wiki.mozilla.org/XUL:Xul_Runner"
-source=(http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${_ffoxver}/source/firefox-${_ffoxver}-source.tar.bz2
-        mozconfig)
-md5sums=('18169e189785d680827d4fce94524449'
-         '6509d12e6b17bfc51c09e1dc35259035')
-install=xulrunner.install
+source=(http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${_ffoxver}/source/firefox-${_ffoxver}.source.tar.bz2
+        mozconfig
+        mozilla-pkgconfig.patch
+        fix-mozilla-launcher.patch
+        xulrunner-version.patch
+        xulrunner-png14.patch
+        enable-x86_64-tracemonkey.patch
+        python2.7.patch)
+md5sums=('80f4d83f23a7c45fc3f1904964ea2a5a'
+         'e195cdcd51a8fb6fc77f0f653ff1e582'
+         '2d2d7143a4e0bfe71149a51f8dbbab2f'
+         '63eee2d1da3b43c9d604f2253f242f40'
+         '371303c5bdc4fa0d955d14521b93b69d'
+         '3bd0566180ad2daa32743b3ce58b2095'
+         'cbd938cd1fb8210cd8a2c41833489af9'
+         'ab3dc9aecae7f08b9492fb3c00a5fd28')
 
 build() {
-  cd ${startdir}/src/mozilla-1.9.1
-  cp ${startdir}/src/mozconfig .mozconfig
+  cd "${srcdir}/mozilla-1.9.2"
+  cp "${srcdir}/mozconfig" .mozconfig
+
+  #fix libdir/sdkdir - fedora
+  patch -Np1 -i "${srcdir}/mozilla-pkgconfig.patch"
+
+  #Fix stub launcher - archlinux
+  patch -Np0 -i "${srcdir}/fix-mozilla-launcher.patch"
+
+  #Force installation to the same path for every version
+  patch -Np1 -i "${srcdir}/xulrunner-version.patch"
+
+  #Fix compile with libpng 1.4
+  patch -Np0 -i "${srcdir}/xulrunner-png14.patch"
+
+  #Tracemonkey for x86_64
+  patch -Np0 -i "${srcdir}/enable-x86_64-tracemonkey.patch"
+
+  #python2.7
+  patch -Np0 -i "${srcdir}/python2.7.patch"
 
   unset CFLAGS
   unset CXXFLAGS
-  export LDFLAGS="-Wl,-rpath,/usr/lib/xulrunner-1.9"
-
-  make -j1 -f client.mk build MOZ_MAKE_FLAGS="$MAKEFLAGS" || return 1
-  make -j1 DESTDIR=${startdir}/pkg install || return 1
 
-  ln -sf xulrunner-${pkgver} ${pkgdir}/usr/lib/xulrunner-1.9
-  ln -sf xulrunner-devel-${pkgver} ${pkgdir}/usr/lib/xulrunner-devel-1.9
-  ln -sf xulrunner-${pkgver} ${pkgdir}/usr/include/xulrunner-1.9
-  ln -sf xulrunner-${pkgver} ${pkgdir}/usr/share/idl/xulrunner-1.9
+  make -j1 -f client.mk build MOZ_MAKE_FLAGS="$MAKEFLAGS"
+  make -j1 DESTDIR="${pkgdir}" install
 
-  # The ubuntu patch adds these... get rid of it, NSS/NSPR has it.
-  rm -f ${startdir}/pkg/usr/lib/pkgconfig/mozilla-ns{s,pr}.pc || return 1
+  #Remove included dictionaries, add symlink to system myspell path.
+  #Note: this will cause file conflicts when users have installed dictionaries in the old location
+  rm -rf "${pkgdir}/usr/lib/xulrunner-1.9.2/dictionaries"
+  ln -sf /usr/share/myspell "${pkgdir}/usr/lib/xulrunner-1.9.2/dictionaries"
 
-  sed -i -e "s/xulrunner-${pkgver}/xulrunner-1.9/g" -e "s/xulrunner-devel-${pkgver}/xulrunner-devel-1.9/g" ${pkgdir}/usr/lib/pkgconfig/*.pc || return 1
+  # add xulrunner library path to ld.so.conf
+  install -d ${pkgdir}/etc/ld.so.conf.d
+  echo "/usr/lib/xulrunner-1.9.2" > ${pkgdir}/etc/ld.so.conf.d/xulrunner.conf
 }
diff --git a/abs/extra/xulrunner/enable-x86_64-tracemonkey.patch b/abs/extra/xulrunner/enable-x86_64-tracemonkey.patch
new file mode 100644
index 0000000..b72ad76
--- /dev/null
+++ b/abs/extra/xulrunner/enable-x86_64-tracemonkey.patch
@@ -0,0 +1,25 @@
+--- js/src/configure.in.old	2009-11-08 19:50:54.299642792 -0500
++++ js/src/configure.in	2009-11-08 19:57:49.235621814 -0500
+@@ -2465,6 +2465,10 @@
+     ENABLE_JIT=1
+     NANOJIT_ARCH=i386
+     ;;
++x86_64*-*)
++    ENABLE_JIT=1
++    NANOJIT_ARCH=X64
++    ;;
+ arm*-*)
+     ENABLE_JIT=1
+     NANOJIT_ARCH=ARM
+@@ -2488,7 +2492,10 @@
+ i?86-*)
+     AC_DEFINE(AVMPLUS_IA32)
+     ;;
+-
++x86_64*-*)
++    AC_DEFINE(AVMPLUS_AMD64)
++    AC_DEFINE(AVMPLUS_64BIT)
++    ;;
+ arm*-*)
+     AC_DEFINE(AVMPLUS_ARM)
+     ;;
diff --git a/abs/extra/xulrunner/fix-mozilla-launcher.patch b/abs/extra/xulrunner/fix-mozilla-launcher.patch
new file mode 100644
index 0000000..de64e4c
--- /dev/null
+++ b/abs/extra/xulrunner/fix-mozilla-launcher.patch
@@ -0,0 +1,23 @@
+--- xulrunner/stub/nsXULStub.cpp	2008-07-17 21:43:11.000000000 +0200
++++ xulrunner/stub/nsXULStub.cpp	2008-07-17 21:47:04.000000000 +0200
+@@ -208,8 +208,10 @@
+   // 3) give up
+ 
+   struct stat fileStat;
++  char *testp;
+ 
+-  if (!realpath(argv[0], iniPath) || stat(iniPath, &fileStat)) {
++  testp = realpath(argv[0], iniPath);
++  if (!(testp != NULL && stat(iniPath, &fileStat) == 0 && S_ISREG(fileStat.st_mode) && fileStat.st_mode & S_IXUSR) || (testp != NULL && stat(iniPath, &fileStat))) {
+     const char *path = getenv("PATH");
+     if (!path)
+       return 1;
+@@ -222,7 +224,7 @@
+     char *token = strtok(pathdup, ":");
+     while (token) {
+       sprintf(tmpPath, "%s/%s", token, argv[0]);
+-      if (realpath(tmpPath, iniPath) && stat(iniPath, &fileStat) == 0) {
++      if (realpath(tmpPath, iniPath) && stat(iniPath, &fileStat) == 0 && S_ISREG(fileStat.st_mode) && fileStat.st_mode & S_IXUSR) {
+         found = PR_TRUE;
+         break;
+       }
diff --git a/abs/extra/xulrunner/mozconfig b/abs/extra/xulrunner/mozconfig
index 22212cb..2b23fc7 100644
--- a/abs/extra/xulrunner/mozconfig
+++ b/abs/extra/xulrunner/mozconfig
@@ -7,10 +7,12 @@ ac_add_options --with-system-jpeg
 ac_add_options --with-system-zlib
 ac_add_options --with-system-bz2
 ac_add_options --with-system-png
-ac_add_options --enable-system-lcms
+ac_add_options --with-system-libevent
 ac_add_options --enable-system-hunspell
-ac_add_options --enable-system-sqlite
-ac_add_options --enable-system-cairo
+#disabled: mozilla is broken with recent versions of sqlite
+#ac_add_options --enable-system-sqlite
+#disabled: mozilla is broken with cairo 1.10
+#ac_add_options --enable-system-cairo
 ac_add_options --with-pthreads
 ac_add_options --enable-strip
 ac_add_options --disable-tests
@@ -26,6 +28,7 @@ ac_add_options --disable-javaxpcom
 ac_add_options --disable-crashreporter
 ac_add_options --enable-safe-browsing
 ac_add_options --enable-startup-notification
+ac_add_options --enable-extensions=default
 
 export BUILD_OFFICIAL=1
 export MOZILLA_OFFICIAL=1
diff --git a/abs/extra/xulrunner/mozilla-pkgconfig.patch b/abs/extra/xulrunner/mozilla-pkgconfig.patch
new file mode 100644
index 0000000..a42d2a3
--- /dev/null
+++ b/abs/extra/xulrunner/mozilla-pkgconfig.patch
@@ -0,0 +1,70 @@
+diff -Nur mozilla-1.9.2.orig/xulrunner/installer/libxul-embedding.pc.in mozilla-1.9.2/xulrunner/installer/libxul-embedding.pc.in
+--- mozilla-1.9.2.orig/xulrunner/installer/libxul-embedding.pc.in	2010-01-21 05:31:27.000000000 +0200
++++ mozilla-1.9.2/xulrunner/installer/libxul-embedding.pc.in	2010-01-21 22:27:17.000000000 +0200
+@@ -6,5 +6,6 @@
+ Name: libxul-embedding
+ Description: Static library for version-independent embedding of the Mozilla runtime
+ Version: %MOZILLA_VERSION%
++Requires: %NSPR_NAME% >= %NSPR_VERSION%
+ Libs: -L${sdkdir}/lib -lxpcomglue
+ Cflags: -DXPCOM_GLUE -I${includedir} %WCHAR_CFLAGS%
+diff -Nur mozilla-1.9.2.orig/xulrunner/installer/libxul.pc.in mozilla-1.9.2/xulrunner/installer/libxul.pc.in
+--- mozilla-1.9.2.orig/xulrunner/installer/libxul.pc.in	2010-01-21 05:31:27.000000000 +0200
++++ mozilla-1.9.2/xulrunner/installer/libxul.pc.in	2010-01-21 22:27:56.000000000 +0200
+@@ -1,5 +1,6 @@
+ prefix=%prefix%
+ sdkdir=%sdkdir%
++libdir=%libdir%
+ includedir=%includedir%
+ idldir=%idldir%
+ 
+diff -Nur mozilla-1.9.2.orig/xulrunner/installer/Makefile.in mozilla-1.9.2/xulrunner/installer/Makefile.in
+--- mozilla-1.9.2.orig/xulrunner/installer/Makefile.in	2010-01-21 05:31:27.000000000 +0200
++++ mozilla-1.9.2/xulrunner/installer/Makefile.in	2010-01-21 22:25:04.000000000 +0200
+@@ -121,6 +121,7 @@
+ 	-e "s|%includedir%|$(includedir)|" \
+ 	-e "s|%idldir%|$(idldir)|" \
+ 	-e "s|%sdkdir%|$(sdkdir)|" \
++	-e "s|%libdir%|$(installdir)|" \
+ 	-e "s|%MOZ_APP_NAME%|$(MOZ_APP_NAME)|" \
+ 	-e "s|%MOZILLA_VERSION%|$(MOZ_APP_VERSION)|" \
+ 	-e "s|%WCHAR_CFLAGS%|$(WCHAR_CFLAGS)|" \
+diff -Nur mozilla-1.9.2.orig/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in mozilla-1.9.2/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in
+--- mozilla-1.9.2.orig/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in	2010-01-21 05:31:27.000000000 +0200
++++ mozilla-1.9.2/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in	2010-01-21 22:28:15.000000000 +0200
+@@ -1,5 +1,6 @@
+ prefix=%prefix%
+ sdkdir=%sdkdir%
++libdir=%libdir%
+ includedir=%includedir%
+ 
+ Name: mozilla-gtkembedmoz
+diff -Nur mozilla-1.9.2.orig/xulrunner/installer/mozilla-gtkmozembed.pc.in mozilla-1.9.2/xulrunner/installer/mozilla-gtkmozembed.pc.in
+--- mozilla-1.9.2.orig/xulrunner/installer/mozilla-gtkmozembed.pc.in	2010-01-21 05:31:27.000000000 +0200
++++ mozilla-1.9.2/xulrunner/installer/mozilla-gtkmozembed.pc.in	2010-01-21 22:28:27.000000000 +0200
+@@ -1,5 +1,6 @@
+ prefix=%prefix%
+ sdkdir=%sdkdir%
++libdir=%libdir%
+ includedir=%includedir%
+ 
+ Name: mozilla-gtkembedmoz
+diff -Nur mozilla-1.9.2.orig/xulrunner/installer/mozilla-js.pc.in mozilla-1.9.2/xulrunner/installer/mozilla-js.pc.in
+--- mozilla-1.9.2.orig/xulrunner/installer/mozilla-js.pc.in	2010-01-21 05:31:27.000000000 +0200
++++ mozilla-1.9.2/xulrunner/installer/mozilla-js.pc.in	2010-01-21 22:29:30.000000000 +0200
+@@ -7,4 +7,4 @@
+ Version: %MOZILLA_VERSION%
+ Requires: %NSPR_NAME% >= %NSPR_VERSION%
+ Libs: -L${sdkdir}/lib -lmozjs
+-Cflags: -I${includedir} -DXP_UNIX -DJS_THREADSAFE
++Cflags: -I${includedir} -I${includedir}/js -DXP_UNIX -DJS_THREADSAFE
+diff -Nur mozilla-1.9.2.orig/xulrunner/installer/mozilla-plugin.pc.in mozilla-1.9.2/xulrunner/installer/mozilla-plugin.pc.in
+--- mozilla-1.9.2.orig/xulrunner/installer/mozilla-plugin.pc.in	2010-01-21 05:31:27.000000000 +0200
++++ mozilla-1.9.2/xulrunner/installer/mozilla-plugin.pc.in	2010-01-21 22:29:58.000000000 +0200
+@@ -5,5 +5,5 @@
+ Name: Mozilla Plug-In API
+ Description: Mozilla Plug-In API
+ Version: %MOZILLA_VERSION%
+-Cflags: -I${includedir}/stable -DXP_UNIX %ojidef%
++Cflags: -I${includedir} -DXP_UNIX %ojidef%
+ 
diff --git a/abs/extra/xulrunner/python2.7.patch b/abs/extra/xulrunner/python2.7.patch
new file mode 100644
index 0000000..05a3e91
--- /dev/null
+++ b/abs/extra/xulrunner/python2.7.patch
@@ -0,0 +1,11 @@
+--- configure.in	2010-10-12 10:44:37.000000000 -0700
++++ configure.in~	2010-10-19 09:51:49.660019364 -0700
+@@ -811,7 +811,7 @@
+     AC_MSG_RESULT([yes])    
+ fi
+ 
+-MOZ_PATH_PROGS(PYTHON, $PYTHON python2.5 python2.4 python)
++MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.5 python2.4 python)
+ if test -z "$PYTHON"; then
+     AC_MSG_ERROR([python was not found in \$PATH])
+ fi
diff --git a/abs/extra/xulrunner/xulrunner-png14.patch b/abs/extra/xulrunner/xulrunner-png14.patch
new file mode 100644
index 0000000..f512416
--- /dev/null
+++ b/abs/extra/xulrunner/xulrunner-png14.patch
@@ -0,0 +1,11 @@
+--- modules/libpr0n/encoders/png/nsPNGEncoder.cpp.orig	2010-01-17 00:15:53.979744638 +0100
++++ modules/libpr0n/encoders/png/nsPNGEncoder.cpp	2010-01-17 00:16:07.855993411 +0100
+@@ -135,7 +135,7 @@
+ 
+   // initialize
+   mPNG = png_create_write_struct(PNG_LIBPNG_VER_STRING,
+-                                 png_voidp_NULL,
++                                 NULL,
+                                  ErrorCallback,
+                                  ErrorCallback);
+   if (! mPNG)
diff --git a/abs/extra/xulrunner/xulrunner-version.patch b/abs/extra/xulrunner/xulrunner-version.patch
new file mode 100644
index 0000000..418b7c7
--- /dev/null
+++ b/abs/extra/xulrunner/xulrunner-version.patch
@@ -0,0 +1,13 @@
+diff -up mozilla/toolkit/mozapps/update/src/updater/module.ver mozilla/toolkit/mozapps/update/src/updater/module
+diff -up mozilla/xulrunner/installer/Makefile.in.ver mozilla/xulrunner/installer/Makefile.in
+--- mozilla/xulrunner/installer/Makefile.in.ver	2007-12-14 09:51:34.000000000 +0100
++++ mozilla/xulrunner/installer/Makefile.in	2007-12-14 09:52:03.000000000 +0100
+@@ -44,6 +44,8 @@ VPATH		= @srcdir@
+ 
+ include $(DEPTH)/config/autoconf.mk
+ 
++MOZ_APP_VERSION="1.9.2"
++
+ NO_PKG_FILES = \
+ 	xulrunner-config \
+ 	regchrome* \
-- 
cgit v0.12

