File chromium.spec of Package chromium-square

# Thanks to malcolmlewis for help with this script
# Thanks to Tom "spot" Callaway for much of the patchwork
# Thanks to jhaygood for most of the icu patch

%define svn_rev 96902
%define v8_ver

Name:           chromium
Version:        15.0.854.0
Release:        4.1
License:        BSD
Summary:        Google's opens source browser project
Group:          Productivity/Networking/Web/Browsers
Source0:        %{name}.%{version}.svn%{svn_rev}.tar.lzma
Source8:        ffmpeg-0.6-headers.tar.bz2
Source30:       master_preferences
Source31:       default_bookmarks.html
Source99:       chrome-wrapper
Source101:      chromium-browser.desktop
Source102:      chromium-browser.xml
Source103:      chromium-browser-rpmlintrc
Source104:      chromium-icons.tar.bz2
Provides:       chromium-browser = %{version}
Provides:       chromium-based-browser = %{version}
Obsoletes:      chromium-browser < %{version}
Obsoletes:      chromium-devel <= %{version}
Obsoletes:      chromium-libs <= %{version}
Provides:       chromium-libs = %{version}
Conflicts:	xine-browser-plugin

## Start Patches
# Many changes to the gyp systems so we can use system libraries
# PATCH-FIX-OPENSUSE Fix build with GCC 4.6
Patch1:         chromium-gcc46.patch
# PATCH-FIX-OPENSUSE disable debug for sqlite
#Patch4:         chromium-no-sqlite-debug.patch
# PATCH-FIX-OPENSUSE patches in system zlib library
Patch8:         chromium-codechanges-zlib.patch
# PATCH-FIX-OPENSUSE disables the build of the test suite
Patch12:        chromium-no-test-sources.patch
# PATCH-FIX-OPENSUSE removes build part for courgette
Patch13:        chromium-no-courgette.patch
# PATCH-FIX-OPENSUSE enables reading of the master preference 
Patch14:        chromium-master-prefs-path.patch
# PATCH-FIX-OPENSUSE patches in system glew library
Patch17:        chromium-system-glew.patch
# PATCH-FIX-OPENSUSE patches in system expat library
Patch18:        chromium-system-expat.patch
# PATCH-FIX-OPENSUSE further changes to work with system zlib library
Patch19:        chromium-system-zlib.patch
# PATCH-FIX-OPENSUSE disables the requirement for ffmpeg
Patch20:        chromium-6.0.425.0-ffmpeg-no-pkgconfig.patch
# PATCH-FIX-OPENSUSE ensure that all media formats are being recognized
Patch21:        chromium-7.0.542.0-media-probe.patch
# PATCH-FIX-OPENSUSE disable the use of tcmallic function
Patch25:        tcmalloc-factory.patch
# PATCH-FIX-OPENSUSE make sure that Chrome remoting is linking against the system libvpx
Patch26:        chromium-remoting-build-fix.diff
# PATCH-FIX-OPENSUSE patches in system speex library
Patch28:        chromium-7.0.500.0-system-speex.patch
# PATCH-FIX-OPENSUSE patches in the system ffmpeg header files
Patch29:        chromium-7.0.510.0-system-ffmpeg.patch
# PATCH-FIX-OPENSUSE patches in the system libvpx library
Patch32:        chromium-7.0.542.0-system-libvpx.patch
# PATCH-FIX-OPENSUSE further changes to ensure working with the system minizip and v8 libraries
Patch34:        chromium-7.0.542.0-codechanges-system-minizip-v8.patch
# PATCH-FIX-OPENSUSE remove the rpath in the libraries
Patch62:        chromium-norpath.patch
# PATCH-FIX-OPENSUSE patches in the system v8 library
Patch63:        chromium-6.0.406.0-system-gyp-v8.patch
%if 0%{?suse_version} > 1130
# PATCH-FIX-OPENSUSE ensure that on newer kernels the right /proc/oom_score_adj file is used
Patch99:        chromium_patch_newer_kernels.patch
Patch999:       buildfix.patch

BuildRequires:  Mesa-devel
BuildRequires:  alsa-devel
BuildRequires:  bison
BuildRequires:  cups-devel
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  freetype2-devel
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  gperf
BuildRequires:  hunspell-devel
BuildRequires:  libbz2-devel
BuildRequires:  libevent
BuildRequires:  libexpat-devel
BuildRequires:  libgnutls-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libstdc++-devel
BuildRequires:  libvpx-devel
BuildRequires:  libxslt-devel
BuildRequires:  libzip-devel
BuildRequires:  lzma
BuildRequires:  mozilla-nspr-devel
BuildRequires:  mozilla-nss-devel
BuildRequires:  openssl-devel
BuildRequires:  pam-devel
BuildRequires:  perl(Switch)
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(cairo) >= 1.6
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(gconf-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  python
BuildRequires:  python-xml
BuildRequires:  sqlite3-devel
BuildRequires:  update-desktop-files
BuildRequires:  v8-devel = %{v8_ver}
BuildRequires:  wdiff
BuildRequires:  zlib-devel
BuildRequires:  libpulse-devel
%if 0%{?suse_version} > 1120
BuildRequires:  libgnome-keyring-devel
BuildRequires:  gnome-keyring-devel
%if 0%{?suse_version} > 1130
BuildRequires:  python-devel

%if 0%{?suse_version} >= 1110
BuildRequires:  libevent-devel
BuildRequires:  libicu-devel >= 4.0
BuildRequires:  speex-devel
BuildRequires:  hicolor-icon-theme

Requires:       alsa
Requires:       xdg-utils
Requires:       libv8-3 = %{v8_ver}
Requires:       hicolor-icon-theme
Requires:       update-alternatives

Recommends:     Chromium-password

# Recommends the chromium-ffmpeg library (available from packman)
Recommends:     chromium-ffmpeg = %{version}

%if 0%{?suse_version} < 1120
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Chromium is the open-source project behind Google Chrome. We invite you to join us in our effort to help build a safer, faster, and more stable way for all Internet users to experience the web, and to create a powerful platform for developing a new generation of web applications.

%package desktop-kde
Summary:        Update to chromium to use KDE's kwallet to store passwords
Group:          Productivity/Networking/Web/Browsers
supplements:    packageand(chromium:kdebase4-session)
conflicts:      chromium-desktop-gnome
Provides:       Chromium-password

%description desktop-kde
By using the openSUSE update-alternatives the password store for Chromium is changed to utilize 
KDE's kwallet. Please be aware that by this change the old password are no longer accessible and 
are also not converted to kwallet.

%package desktop-gnome
Summary:        Update to chromium to use Gnome keyring to store passwords
Group:          Productivity/Networking/Web/Browsers
supplements:    packageand(chromium:gnome-session)
conflicts:      chromium-desktop-kde
Provides:       Chromium-password

%description desktop-gnome
By using the openSUSE update-alternatives the password store for Chromium is changed to utilize 
Gnome's Keyring. Please be aware that by this change the old password are no longer accessible and 
are also not converted to Gnome's Keyring.

lzma -cd %{SOURCE0} | tar xf -
%setup -D -T -n %{name}-suse

%patch1 -p1
%patch62 -p1
%patch63 -p1
%patch8 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch25 -p1
%patch26 -p1
%patch28 -p1
%patch29 -p1
%patch32 -p1
%patch34 -p1
%if 0%{?suse_version} > 1130
%patch99 -p1
%patch999 -p1

pushd src/third_party/ffmpeg/
tar xf %{SOURCE8}

rm -rf src/third_party/speex/

# apply vendor patch after substitution
sed "s:RPM_VERSION:%{version}:" %{SOURCE20} | patch -p0


## create make files

PARSED_OPT_FLAGS=`echo \'%{optflags} -DUSE_SYSTEM_LIBEVENT -fPIC -fno-ipa-cp -fno-strict-aliasing \' | sed "s/ /',/g" | sed "s/',/', '/g"`
for i in src/build/common.gypi; do
        sed -i "s|'-march=pentium4',||g" $i
        sed -i "s|'-mfpmath=sse',||g" $i
        sed -i "s|'-O<(debug_optimize)',||g" $i
        sed -i "s|'-m32',||g" $i
        sed -i "s|'-fno-exceptions',|$PARSED_OPT_FLAGS|g" $i
        sed -i "s|'-Werror'|'-Wno-error'|g" $i
# '

pushd src

./build/gyp_chromium -f make build/all.gyp \
-Dlinux_sandbox_path=%{_libdir}/chromium/chrome_sandbox \
-Dlinux_sandbox_chrome_path=%{_libdir}/chromium/chromium \
-Duse_openssl=0 \
-Duse_system_ffmpeg=1 \
-Duse_system_zlib=1 \
-Duse_system_libpng=1 \
-Duse_system_bzip2=1 \
-Duse_system_libbz2=1 \
-Duse_system_libjpeg=1 \
-Duse_system_libxml=1 \
-Duse_system_libxslt=1 \
-Duse_system_libevent=1 \
-Duse_system_vpx=1 \
-Dremove_webcore_debug_symbols=1 \
-Duse_system_v8=1 \
-Dproprietary_codecs=1 \
-Djavascript_engine=v8 \
-Dlinux_fpic=1 \
-Ddisable_sse2=1 \
%ifarch x86_64
-Dtarget_arch=x64 \
-Dno_strict_aliasing=1 \

make -r %{?_smp_mflags} chrome V=1 BUILDTYPE=Release
make -r %{?_smp_mflags} chrome_sandbox V=1 BUILDTYPE=Release


mkdir -p %{buildroot}%{_libdir}/chromium/
install -m 755 %{SOURCE100} %{buildroot}%{_libdir}/chromium/chromium-generic
# x86_64 capable systems need this
sed -i "s|/usr/lib/chromium|%{_libdir}/chromium|g" %{buildroot}%{_libdir}/chromium/chromium-generic
#update the password-store settings for each alternative
sed "s|password-store=detect|password-store=kwallet|g" %{buildroot}%{_libdir}/chromium/chromium-generic > %{buildroot}%{_libdir}/chromium/chromium-kde
sed "s|password-store=detect|password-store=gnome|g" %{buildroot}%{_libdir}/chromium/chromium-generic > %{buildroot}%{_libdir}/chromium/chromium-gnome
mkdir -p %{buildroot}%{_mandir}/man1/
pushd src/out/Release
ls -lR 
cp -a chrome.pak locales resources xdg-settings chrome_sandbox %{buildroot}%{_libdir}/chromium/
cp -a resources.pak %{buildroot}%{_libdir}/chromium/
cp -a chrome %{buildroot}%{_libdir}/chromium/chromium
cp -a chrome.1 %{buildroot}%{_mandir}/man1/chrome.1
cp -a chrome.1 %{buildroot}%{_mandir}/man1/chromium.1
%fdupes %{buildroot}%{_mandir}/man1/

mkdir -p %{buildroot}%{_datadir}/icons/
pushd %{buildroot}%{_datadir}/icons/
tar -xjf %{SOURCE104}
mv oxygen hicolor

mkdir -p %{buildroot}%{_datadir}/applications/
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE101}

mkdir -p %{buildroot}%{_datadir}/gnome-control-center/default-apps/
cp -a %{SOURCE102} %{buildroot}%{_datadir}/gnome-control-center/default-apps/

# link to browser plugin path.  Plugin patch doesn't work. Why?
mkdir -p %{buildroot}%{_libdir}/browser-plugins
pushd %{buildroot}%{_libdir}/%{name}
ln -s %{_libdir}/browser-plugins plugins

# Install the master_preferences file
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
install -m 0644 %{SOURCE30} %{buildroot}%{_sysconfdir}/%{name}
install -m 0644 %{SOURCE31} %{buildroot}%{_sysconfdir}/%{name}

rm -rf %{buildroot}

if [ -f /usr/bin/chromium ] ; then
 rm -v /usr/bin/chromium ; 

# Add snipplets to update the GTK cache on package install.
%if 0%{?suse_version} >= 1140
update-alternatives --install %{_bindir}/chromium chromium %{_libdir}/chromium/chromium-generic 10

update-alternatives --remove all chromium

%if 0%{?suse_version} < 1140
update-alternatives --install %{_bindir}/chromium chromium %{_libdir}/chromium/chromium-generic 10

update-alternatives --remove all chromium

%post desktop-kde
update-alternatives --install %{_bindir}/chromium chromium %{_libdir}/chromium/chromium-kde 15
update-alternatives --auto chromium

%postun desktop-kde
update-alternatives --remove %{_bindir}/chromium %{_libdir}/chromium/chromium-kde
update-alternatives --auto chromium

%post desktop-gnome
update-alternatives --install %{_bindir}/chromium chromium %{_libdir}/chromium/chromium-gnome 15
update-alternatives --auto chromium

%postun desktop-gnome
update-alternatives --remove %{_bindir}/chromium %{_libdir}/chromium/chromium-gnome
update-alternatives --auto chromium

# Files!

%config %{_sysconfdir}/%{name}
%dir %{_datadir}/gnome-control-center
%dir %{_datadir}/gnome-control-center/default-apps
%dir %{_libdir}/chromium/
%attr(4755,root,root) %{_libdir}/chromium/chrome_sandbox

%files desktop-kde
%attr(755, root, root) %{_libdir}/chromium/chromium-kde

%files desktop-gnome
%attr(755, root, root) %{_libdir}/chromium/chromium-gnome

* Tue Aug 16 2011
- Update to 15.0.854
* Sun Aug  7 2011
- Introduce an option to switch the password store for Chromium in
  a more friendlier way, by using the update-alternatives. The user
  has now the option to install a new package (chromium-desktop-kde
  or chromium-desktop-gnome) and based on this the respective
  password store is selected.
* Sat Aug  6 2011
- Update to 15.0.846
* Sat Jul 30 2011
- Update to 15.0.839
* Thu Jul 21 2011
- Update to 14.0.829
* Sun Jul 17 2011
- Update to 14.0.825
* Tue Jul 12 2011
- Fix for bnc#705223:
  + Icons are installed in hicolor instead of oxygen, this ensures
    compatibility with open Desktop standards.
  + Add GTK icon cache update for >= 1140 on %%post and %%postun.
  + Removed the .png in %%{_datadir}/pixmaps as hicolor is a better
  + Add hicolor-icon-theme to BuildRequires and Requires.
* Mon Jun 13 2011
- Update to 14.0.792
* Mon Jun  6 2011
- Update to 14.0.786
* Sat Jun  4 2011
- Update to 14.0.785
* Sat May 28 2011
- Update to 13.0.780
* Wed May 25 2011
- Update to 13.0.777
  + Builds now based on system library for V8.
  + Removed Shared Library build due to errors. Everything is back
    into one single binary
  + Added patchfile to build with GCC 4.6
* Sun May 15 2011
- Update to 13.0.767
* Thu Apr 28 2011
- Update to 13.0.751
* Fri Apr 22 2011
- Update to 12.0.744
* Mon Apr 18 2011
- Update to 12.0.741
- Include icon-set for Oxygen. (bnc#684728)
* Fri Apr  8 2011
- Update to 12.0.731
* Sun Apr  3 2011
- Update to 12.0.724
* Thu Mar 31 2011
- Update to 12.0.721
* Mon Mar 28 2011
- Update to 12.0.718
- Added conflict for xine-browser-plugin
* Wed Mar 16 2011
- Update to 12.0.705
- Included option to detect the password store in /usr/bin/chromium
  (options there are detect,default,gnome,kwallet)
* Fri Mar 11 2011
- Update to 12.0.700
* Wed Mar  9 2011
- Update to 11.0.698
* Fri Mar  4 2011
- Update to 11.0.691
* Wed Mar  2 2011
- Update to 11.0.688
* Sun Feb 27 2011
- Update to 11.0.685
* Sun Feb 27 2011
- Update to 11.0.683
  * Chromium will now use the internal ICU libraries for all
    openSUSE versions.
* Wed Feb 16 2011
- Update to 11.0.674
* Tue Feb 15 2011
- Update to 11.0.673
  * For Factory the internal ICU libraries are used as that
    Chromium does not build with the ones provided by Factory
* Wed Jan 19 2011
- add more mimetypes to desktop file
* Sat Dec 25 2010
- update to 10.0.622.0
* Mon Oct 25 2010
- Update to 9.0.564 build
  * Added specific patches for MeeGo.
  * We are now using shared libraries for Chromium
  * Spec-file cleanup (Thanks to prusnak)
* Thu Jul  8 2010
- use jobs instead of a fixed numer of jobs, buildsystem may hang
* Wed Jul  7 2010
- workaround gcc bug, that produces extremely annoying
  failure of the search bar.
* Mon May 24 2010
- do not include %%{release} in RPM_VERSION that makes the
  package to republish everytime to users even if there
  are no code changes.
* Wed Mar 10 2010
- Add master_preferences source file and install it to /etc/chromium.
- Create a new patch (chromium-master-prefs-path.patch) which tells
  chromium to look in /etc/chromium for the master_preferences file
  (instead of looking in the default directory, which is the same
  directory as the 'chrome' binary).
* Sun Mar  7 2010  
- Update to 5.0.347
  + moved back to static binary again.
  + No longer depends on system v8
* Sun Feb 21 2010  
- Update to 5.0.341
  + remove courgette build and sources (patent issue)
  + Move to shared libraries build
  + Depends on system v8 again
* Sun Jan 24 2010
- added vendor to user agent (
* Sun Nov 29 2009
- added --enable-sync to wrapper to enable bookmark sync
* Sun Nov 29 2009  
- Update to 4.0.260
* Fri Nov 27 2009  
- Update to 4.0.259
* Thu Nov 26 2009  
- Update to 4.0.258
* Tue Nov 24 2009  
- In order to complete prevent the wrong v8 version to be used,
  the Chromium build has been changed to having an built-in v8
* Tue Nov 24 2009  
- Re-base patches.
- Fixed a few patch errors.
- Rename some patches to better correspond with function.
- Removed some patches.
- Minor SPEC changes.
- I changed the v8 requirement to be exact, instead of greater than a specific version.
* Fri Nov 13 2009
- update to 247.0 svn 31928
* Fri Oct 30 2009
- update to 229.0 svn 30454
  + Fix regression where popups and app frames lost their titlebars.
  + Makes it so that when a folder is open on the bookmark bar
    and the mouse moves over another folder, the menu for that
    folder is shown.
  + Lazily create the find bar.
  + Polish to the gmail checker sample.
  * New, crisper icons that are exactly 19x19
  * Add a loading animation at the beginning before Gmail
  * Fix a bug where we sometimes don't update the UI after a
    logout/login cycle.
  + Refactor widget methods to support desktop notifications,
    including GTK stubs.
  + Find-in-page should not ding while deleting characters.
  + Add SSL wrapper for linux and mac.  This allows notifier to
    use chrome's SSL layer instead of OpenSSL.
  + Add three of the six extensions to PAC that Internet Explorer supports.
  + WebSocket support in chromium. (Run with --enable-web-sockets
    enables WebSocket features.)
  + Do not allow GTK File Chooser dialogs to return directories.
  + Fix the notifier SSL layer to make notifications work for
    Linux Bookmark sync.
  + linux: don't override mouse selection behavior in omnibox
* Sun Oct 25 2009
- Update to 224.4 svn 30027
  + First cut at new page and browser action docs based
    on new API. Deleted old stuff.
  + Add suppression for new memory leak caused by WebKit merge 49830:49844
  + Cleanup: change PIDs to base::ProcessId (or pid_t, as appropriate)
  + Minimize dependency of user scripts
  + Fixup the flip_framer eof-handling semantics now that we have
    the FIN bit in place
  + app depends on x11 because of active_window_watcher_x
  + Adding two images for the new Extension managment UI
  + Removing hard-coded Chrome Frame output path
  + Rearrange clipboard code
  + Fix crash bug when attempting to download a url with unsupported scheme,
    e.g. 'data:', by 'Alt + Click'
  + GTK: Change text for extension download UI
  + Ignore invalid urls on command line
  + Make dropped tabs animate from where they were dropped.
  + Make room for the full width of the tab placeholder.
  + Make tab dragging as smooth as glass.
  + Remove an annoying NOTIMPLEMNETED
  + Extensions: guarantee removal of BROWSER_WINDOW_READY registration
  + If we're in the middle of a drag, don't allow the user to middle
    click to close or right click for the context menu
  + "Fix" a NOTIMPLEMENTED on Linux by using the default password store
  + Remove +x bit from files that shouldn't have it
  + Fold first 3 channels of multichannel instead of 5.  Use fixed point
  + Adding new image needed for the managment UI
  + Fix a race bug where content scripts would not apply to the first page load
  + Make escape remove a bookmark if it's just been added (but not if it already existed)
  + Fix bubbles deactivating the opaque frame
  + Allow ESC to cancel ALT+SHIFT+T in Toolbar
  + ake all pepper plugins default to windowless and transparent
  + Add styles for printing
  + Implement the new extension management UI
  + Add support for to automation interface load install and load extensions
  + GTK: theme the info bar border
  + Update V8 to version
  + Introduce WebSecurityPolicy for security related methods
  + New button scheme...borders are separate from the inner contents so
    that they can be highlighted / depressed independently
  + When opening Chrome maximized with an application window already
    running, the Chrome window was not activated
  + Fix compatibility problems with FileZilla FTP Server
  + Remove the extension shelf on Linux
  + Fix the proxy host and port string to start with http:// if it does not already
  + Enable HTML5 databases for all extension renderer processes
* Sat Oct 24 2009  
- don't create desktop files in wrapper
- fix LD_LIBRARY_PATH (chromium-fix-wrapper.patch)
* Tue Oct 20 2009  
- update to newer svn snapshot
  + Obsoletes fwrite patch (included upstream)
* Fri Oct 16 2009  
- update to newer svn snapshot
  + Requires newer version of v8
* Thu Oct 15 2009  
- do not force SSE on x86 (drop-sse.patch)
* Tue Oct 13 2009  
- Update to newer svn snapshot
- Fixed spec file in order to build
- Included patch to build with system zlib
* Mon Oct 12 2009  
- package renamed to chromium
- cleaned up spec file
* Tue Oct  6 2009  
- v8 is now built as a separate package, and is required
- included many patches to use system libraries:
    v8, icu, libxml2, libxslt, libjpeg, libpng, libevent, bzip2, zlib, nspr, nss
* Thu Oct  1 2009  
- included a newer DEP than is in svn, native_client@823
- things should compile cleanly now
* Mon Aug 31 2009  
- initial build