File mozilla-xulrunner190.spec of Package mozilla-xulrunner190

#
# spec file for package mozilla-xulrunner190 (Version 1.9.0.18)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2006-2010 Wolfgang Rosenauer
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           mozilla-xulrunner190
BuildRequires:  gcc-c++ libgnomeui-devel libidl-devel python-devel startup-notification-devel update-desktop-files zip
# needed for brp-check-bytecode-version (jar, fastjar would do as well)
BuildRequires:  unzip
%if %suse_version > 1020
BuildRequires:  fdupes
%endif
%if %suse_version > 1030
BuildRequires:  hunspell-devel
%endif
%if %suse_version > 1100
BuildRequires:  nss-shared-helper-devel
%endif
License:        GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
Version:        1.9.0.18
Release:        1
Summary:        Mozilla Runtime Environment 1.9
Url:            http://www.mozilla.org
Group:          Productivity/Other
Provides:       gecko19
%ifarch %ix86
Provides:       mozilla-xulrunner190-32bit = %{version}-%{release}
%endif
Source:         xulrunner-source-%{version}.tar.bz2
Source1:        l10n-%{version}.tar.bz2
Source2:        find-external-requires.sh
Source3:        mozilla-xulrunner190-rpmlintrc
Source4:        xulrunner-openSUSE-prefs.js
Source5:        add-plugins.sh.in
Patch1:         mozilla-gcc43.patch
Patch2:         locale.patch
Patch3:         mozilla-pkgconfig.patch
Patch4:         idldir.patch
Patch5:         mozilla-path_len.patch
Patch7:         mozilla-nongnome-proxies.patch
Patch8:         mozilla-helper-app.patch
Patch9:         mozilla-system-hunspell.patch.bz2
Patch10:        mozilla-restart-cmd.patch
Patch11:        mozilla-cairo-no-sse.patch
Patch14:        mozilla-aboutAbout.patch
Patch15:        mozilla-pyxpcom.patch
# PATCH-FEATURE-SLED FATE#302023, FATE#302024 - hfiguiere@novell.com
Patch16:        gconf-backend.patch
Patch17:        gecko-lockdown.patch
Patch18:        toolkit-ui-lockdown.patch
Patch22:        mozilla-shared-nss-db.patch
Patch23:        bmo472464.patch
Patch24:        mozilla-abi.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         libstdc++ expat pango xorg-x11-libs fontconfig freetype2
PreReq:         gtk2 atk glib2 update-alternatives coreutils
### build configuration ###
%define has_system_nspr  0
%define has_system_nss   0
%define has_system_cairo 0
%define localize 1
%if %suse_version > 1030 || 0%{?opensuse_bs}
%define has_system_nspr  1
%define has_system_nss   1
%endif
%if %suse_version > 1100
%define has_system_cairo 1
%endif
%define releasedate 2010020400
%define version_internal %{version}
%define apiversion 1.9
%define uaweight 190918
### configuration end ###
%define _use_internal_dependency_generator 0
%define __find_requires sh %{SOURCE2}
%global provfind sh -c "grep -v 'libsqlite3.so' | %__find_provides"
%global __find_provides %provfind
%if %has_system_nspr
BuildRequires:  mozilla-nspr-devel
PreReq:         mozilla-nspr >= %(rpm -q --queryformat '%{VERSION}' mozilla-nspr)
%endif
%if %has_system_nss
BuildRequires:  mozilla-nss-devel >= 3.12.3
PreReq:         mozilla-nss >= %(rpm -q --queryformat '%{VERSION}' mozilla-nss)
%endif
Recommends:     %{name}-gnomevfs

%description
XULRunner is a single installable package that can be used to bootstrap
multiple XUL+XPCOM applications that are as rich as Firefox and
Thunderbird.


%package devel
License:        GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
Summary:        XULRunner/Gecko SDK 1.9
Group:          Development/Libraries/Other
%if %has_system_nspr
Requires:       mozilla-nspr-devel >= %(rpm -q --queryformat '%{VERSION}' mozilla-nspr-devel) 
%endif
%if %has_system_nss
Requires:       mozilla-nss-devel >= %(rpm -q --queryformat '%{VERSION}' mozilla-nss-devel)
%endif
PreReq:         %{name} = %{version}

%description devel
Software Development Kit to embed XUL or Gecko into other applications.


%package translations
License:        GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
Summary:        Translations for XULRunner 1.9
Group:          System/Localization
PreReq:         %{name} = %{version}
Provides:       locale(%{name}:af;ar;be;bg;bn_IN;ca;cs;cy;da;de;el;en_GB;eo;es_AR;es_ES;et;eu;fi;fr;fy_NL;ga_IE;gl;gu_IN;he;hi_IN;hu;id;is;it;ja;ka;kn;ko;ku;lt;lv;mk;mn;mr;nb_NO;nl;nn_NO;oc;pa_IN;pl;pt_BR;pt_PT;ro;ru;si;sk;sl;sq;sr;sv_SE;te;th;tr;uk;zh_CN;zh_TW)
# from OBS and 11.0beta updates
Provides:       %{name}-lang = %{version}
Obsoletes:      %{name}-lang < %{version}

%description translations
XULRunner is a single installable package that can be used to bootstrap
multiple XUL+XPCOM applications that are as rich as Firefox and
Thunderbird.

This package contains all supported languages but en-US which is
delivered in the main package.


%package gnomevfs
License:        GPLv2# ; LGPLv2.1# ; MPLv1.1#
Summary:        XULRunner components depending on gnome-vfs
Group:          Productivity/Other
PreReq:         %{name} = %{version}-%{release}

%description gnomevfs
This subpackage contains the Necko Gnome-VFS and Gnome components which
rely on the gnome-vfs subsystem to be installed. They are recommended
for full desktop integration but not mandatory for small disk footprint
KDE installations for example.


%package -n python-xpcom190
License:        GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
Summary:        Python XPCOM bindings
Group:          Development/Languages/Python
Provides:       python-xpcom
Conflicts:      python-xpcom191 python-xpcom192
Conflicts:      otherproviders(python-xpcom)
PreReq:         %{name} = %{version}-%{release}
%py_requires

%description -n python-xpcom190
This package contains the libraries and Python modules necessary to use
Mozilla XulRunner's XPCOM.


%prep
%setup -n mozilla -b 1 -q
%patch1
%patch2
%patch3
%patch4
%patch5 -p1
%patch7
%patch8
pushd extensions
%patch9
popd
%patch10
%patch11
%patch14
%patch15
%patch16 -p1
%patch17 -p2
%patch18 -p1
%patch22
%patch23
%patch24

%build
MOZ_APP_DIR=%{_libdir}/xulrunner-%{version_internal}
export MOZ_BUILD_DATE=%{releasedate}
#export LD_LIBRARY_PATH=$RPM_BUILD_DIR/mozilla/dist/bin
export CFLAGS="$RPM_OPT_FLAGS -Os -fno-strict-aliasing"
%ifarch ppc64
export CFLAGS="$CFLAGS -mminimal-toc"
%endif
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-Wl,-rpath -Wl,${MOZ_APP_DIR}"
export MOZCONFIG=$RPM_BUILD_DIR/mozconfig
export MOZILLA_OFFICIAL=1
export BUILD_OFFICIAL=1
export MOZ_MILESTONE_RELEASE=1
#
cat << EOF > $MOZCONFIG
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZ_MILESTONE_RELEASE=1
mk_add_options MOZ_MAKE_FLAGS=%{?jobs:-j%jobs}
. \$topsrcdir/xulrunner/config/mozconfig
ac_add_options --prefix=%{_prefix}
ac_add_options --libdir=%{_libdir}
ac_add_options --sysconfdir=%{_sysconfdir}
ac_add_options --mandir=%{_mandir}
ac_add_options --includedir=%{_includedir}
ac_add_options --enable-optimize
ac_add_options --enable-extensions=python,default
ac_add_options --with-system-jpeg
#ac_add_options --with-system-png # no APNG support
ac_add_options --with-system-zlib
ac_add_options --enable-xft
ac_add_options --disable-freetype2
ac_add_options --enable-svg
ac_add_options --enable-canvas
ac_add_options --disable-tests
ac_add_options --disable-mochitest
ac_add_options --disable-installer
ac_add_options --disable-javaxpcom
ac_add_options --disable-crashreporter
ac_add_options --enable-startup-notification
ac_add_options --enable-url-classifier
#ac_add_options --enable-debug
EOF
%if %has_system_nspr
cat << EOF >> $MOZCONFIG
ac_add_options --with-system-nspr
EOF
%endif
%if %has_system_nss
cat << EOF >> $MOZCONFIG
ac_add_options --with-system-nss
EOF
%endif
%if %has_system_cairo
cat << EOF >> $MOZCONFIG
ac_add_options --enable-system-cairo
EOF
%endif
%if %suse_version > 1030
cat << EOF >> $MOZCONFIG
ac_add_options --enable-system-hunspell
#ac_add_options --enable-system-sqlite
EOF
%endif
make -f client.mk build

%install
%makeinstall STRIP=/bin/true
# remove some executable permissions
find $RPM_BUILD_ROOT%{_includedir}/xulrunner-%{version_internal} \
     -type f -perm -111 -exec chmod a-x {} \;
find $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/ \
     -name "*.js" -o -name "*.xpm" -o -name "*.png" | xargs chmod a-x
mkdir -p $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/extensions
# fixing SDK dynamic libs (symlink instead of copy)
rm $RPM_BUILD_ROOT%{_libdir}/xulrunner-devel-%{version_internal}/sdk/lib/*.so
ln -sf ../../../xulrunner-%{version_internal}/libmozjs.so \
       $RPM_BUILD_ROOT%{_libdir}/xulrunner-devel-%{version_internal}/sdk/lib/
ln -sf ../../../xulrunner-%{version_internal}/libxpcom.so \
       $RPM_BUILD_ROOT%{_libdir}/xulrunner-devel-%{version_internal}/sdk/lib/
ln -sf ../../../xulrunner-%{version_internal}/libxul.so \
       $RPM_BUILD_ROOT%{_libdir}/xulrunner-devel-%{version_internal}/sdk/lib/
# XPI example
#cp -rL dist/xpi-stage/simple $RPM_BUILD_ROOT/%{_libdir}/xulrunner-%{version_internal}/
# preferences
cp %{SOURCE4} $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/greprefs/all-openSUSE.js
# install add-plugins.sh
sed "s:%%PROGDIR:%{_libdir}/xulrunner-%{version_internal}:g" \
  %{SOURCE5} > $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/add-plugins.sh
chmod 755 $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/add-plugins.sh
# 64bit classification for GRE config
%ifarch x86_64 s390x ppc64
mv $RPM_BUILD_ROOT%{_sysconfdir}/gre.d/%{version_internal}.system.conf \
   $RPM_BUILD_ROOT%{_sysconfdir}/gre.d/%{version_internal}-64bit.system.conf
%endif
# ghosts
touch $RPM_BUILD_ROOT/%{_libdir}/xulrunner-%{version_internal}/global.reginfo
# install additional locales
%if %localize
rm -f %{_tmppath}/translations.list
for locale in $(awk '{ print $1; }' browser/locales/shipped-locales); do
  case $locale in
   ja-JP-mac|en-US)
      ;;
   *)
      make -C toolkit/locales libs-$locale
      cp dist/xpi-stage/locale-$locale/chrome/$locale.jar \
         $RPM_BUILD_ROOT/%{_libdir}/xulrunner-%{version_internal}/chrome
      cp dist/xpi-stage/locale-$locale/chrome/$locale.manifest \
         $RPM_BUILD_ROOT/%{_libdir}/xulrunner-%{version_internal}/chrome
      echo %{_libdir}/xulrunner-%{version_internal}/chrome/$locale.jar \
         >> %{_tmppath}/translations.list
      echo %{_libdir}/xulrunner-%{version_internal}/chrome/$locale.manifest \
         >> %{_tmppath}/translations.list
  esac
done
%endif
# API symlink
ln -sf xulrunner-%{version_internal} $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{apiversion}
# compat links
%if 0%{?ga_version:1}
touch $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{ga_version}
%endif
# moving Python stuff
mkdir -p $RPM_BUILD_ROOT%{py_sitedir}/
cp -r $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/python/* \
      $RPM_BUILD_ROOT%{py_sitedir}/ && \
  rm -rf $RPM_BUILD_ROOT/%{_libdir}/xulrunner-%{version_internal}/python
# excludes
rm -f $RPM_BUILD_ROOT%{_bindir}/xulrunner
rm -f $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/updater
rm -f $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/LICENSE
rm -f $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/README.txt
rm -f $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/dictionaries/en-US*
# fdupes
%if %suse_version > 1020
%fdupes $RPM_BUILD_ROOT%{_includedir}/xulrunner-%{version_internal}/
%fdupes $RPM_BUILD_ROOT%{_libdir}/xulrunner-%{version_internal}/
%endif

%clean
rm -rf $RPM_BUILD_ROOT
%if %localize
rm -rf %{_tmppath}/translations.list
%endif

%post
/usr/sbin/update-alternatives --install %{_bindir}/xulrunner \
  xulrunner %{_libdir}/xulrunner-%{version_internal}/xulrunner %{uaweight} || :
%{_libdir}/xulrunner-%{version_internal}/add-plugins.sh > /dev/null 2>&1
exit 0

%posttrans
# needed for updates which transition directory to symlink
%if 0%{?ga_version:1} 
test -d %{_libdir}/xulrunner-%{ga_version} && rm -rf %{_libdir}/xulrunner-%{ga_version}
ln -sf xulrunner-%{version_internal} %{_libdir}/xulrunner-%{ga_version}
%endif
[ -e %{_libdir}/xulrunner-%{version_internal}/add-plugins.sh ] && \
  %{_libdir}/xulrunner-%{version_internal}/add-plugins.sh > /dev/null 2>&1
exit 0

%preun
if [ "$1" = "0" ]; then # deinstallation
  # that's not quite nice since old versions should be removed on update as well
  # but that's problematic for updates w/o raising the version number
  /usr/sbin/update-alternatives --remove xulrunner %{_libdir}/xulrunner-%{version_internal}/xulrunner
fi
rm -f %{_libdir}/xulrunner-%{version_internal}/dictionaries/*
exit 0

%triggerin -- myspell-dictionary
%{_libdir}/xulrunner-%{version_internal}/add-plugins.sh > /dev/null 2>&1
exit 0

%triggerpostun -- myspell-dictionary
%{_libdir}/xulrunner-%{version_internal}/add-plugins.sh > /dev/null 2>&1
exit 0

%files
%defattr(-,root,root)
%dir %{_libdir}/xulrunner-%{version_internal}/
%dir %{_libdir}/xulrunner-%{version_internal}/chrome/
%dir %{_libdir}/xulrunner-%{version_internal}/dictionaries/
%dir %{_libdir}/xulrunner-%{version_internal}/extensions/
%{_libdir}/xulrunner-%{version_internal}/chrome/classic.*
%{_libdir}/xulrunner-%{version_internal}/chrome/comm.*
%{_libdir}/xulrunner-%{version_internal}/chrome/en-US.*
%{_libdir}/xulrunner-%{version_internal}/chrome/pippki.*
%{_libdir}/xulrunner-%{version_internal}/chrome/toolkit.*
%{_libdir}/xulrunner-%{version_internal}/chrome/icons/
%{_libdir}/xulrunner-%{version_internal}/components/
%exclude %{_libdir}/xulrunner-%{version_internal}/components/libmozgnome.so
%exclude %{_libdir}/xulrunner-%{version_internal}/components/libnkgnomevfs.so
%exclude %{_libdir}/xulrunner-%{version_internal}/libpy*.so
%exclude %{_libdir}/xulrunner-%{version_internal}/components/libpy*.so
%exclude %{_libdir}/xulrunner-%{version_internal}/components/pyabout.py
%{_libdir}/xulrunner-%{version_internal}/defaults/
%dir %{_libdir}/xulrunner-%{version_internal}/greprefs/
%{_libdir}/xulrunner-%{version_internal}/greprefs/all.js
%{_libdir}/xulrunner-%{version_internal}/greprefs/security-prefs.js
%{_libdir}/xulrunner-%{version_internal}/greprefs/xpinstall.js
%{_libdir}/xulrunner-%{version_internal}/greprefs/all-openSUSE.js
%{_libdir}/xulrunner-%{version_internal}/icons/
%{_libdir}/xulrunner-%{version_internal}/modules/
%{_libdir}/xulrunner-%{version_internal}/plugins/
%{_libdir}/xulrunner-%{version_internal}/res/
%{_libdir}/xulrunner-%{version_internal}/*.so
%{_libdir}/xulrunner-%{version_internal}/add-plugins.sh
%{_libdir}/xulrunner-%{version_internal}/dependentlibs.list
%{_libdir}/xulrunner-%{version_internal}/mozilla-xremote-client
%if !%has_system_nss
%{_libdir}/xulrunner-%{version_internal}/libsoftokn3.chk
%{_libdir}/xulrunner-%{version_internal}/libfreebl3.chk
%endif
%{_libdir}/xulrunner-%{version_internal}/run-mozilla.sh
%{_libdir}/xulrunner-%{version_internal}/xulrunner
%{_libdir}/xulrunner-%{version_internal}/xulrunner-bin
%{_libdir}/xulrunner-%{version_internal}/xulrunner-stub
%{_libdir}/xulrunner-%{version_internal}/platform.ini
#%{_libdir}/xulrunner-%{version_internal}/javaxpcom.jar
# ghosts
%ghost %{_libdir}/xulrunner-%{version_internal}/global.reginfo
# GRE
%dir %{_sysconfdir}/gre.d/
%attr(644,root,root) %{_sysconfdir}/gre.d/*
# example
#%{_libdir}/xulrunner-%{version_internal}/simple/
# API symlink
%{_libdir}/xulrunner-%{apiversion}
# compat symlinks
%if 0%{?ga_version:1} 
%ghost %{_libdir}/xulrunner-%{ga_version}
%endif

%files devel
%defattr(-,root,root)
#%{_libdir}/xulrunner-%{version_internal}/MozillaInterfaces*
%{_libdir}/xulrunner-%{version_internal}/xpcshell
%{_libdir}/xulrunner-%{version_internal}/xpidl
%{_libdir}/xulrunner-%{version_internal}/xpt_dump
%{_libdir}/xulrunner-%{version_internal}/xpt_link
%{_libdir}/xulrunner-devel-%{version_internal}/
# FIXME symlink dynamic libs below sdk/lib
%attr(644,root,root) %{_libdir}/pkgconfig/*
%{_includedir}/xulrunner-%{version_internal}/

%files gnomevfs
%defattr(-,root,root)
%{_libdir}/xulrunner-%{version_internal}/components/libmozgnome.so
%{_libdir}/xulrunner-%{version_internal}/components/libnkgnomevfs.so

%files -n python-xpcom190
%defattr(-,root,root)
%{_libdir}/xulrunner-%{version_internal}/libpyxpcom.so
%{_libdir}/xulrunner-%{version_internal}/components/libpydom.so
%{_libdir}/xulrunner-%{version_internal}/components/libpyloader.so
%{_libdir}/xulrunner-%{version_internal}/components/pyabout.py
%{py_sitedir}/nsdom/
%{py_sitedir}/xpcom/
%if %localize

%files translations -f %{_tmppath}/translations.list
%defattr(-,root,root)
%endif

%changelog
openSUSE Build Service is sponsored by