File chromium.spec of Package chromium.openSUSE_Leap_42.3_Update

#
# spec file for package chromium
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#


%define rname chromium
%if %{?suse_version} >= 1320 || (%{?suse_version} == 1315 && 0%{?leap_version} >= 420200)
%bcond_without system_minizip
%bcond_without system_harfbuzz
%else
%bcond_with system_minizip
%bcond_with system_harfbuzz
%endif
# This is just overall condition to contain everything we can't provide on SLE12
%if 0%{?suse_version} >= 1320 || 0%{?is_opensuse}
%bcond_with sle_bundles
%else
%bcond_without sle_bundles
%endif
%if 0%{?suse_version} >= 1330
%bcond_without system_libxml
%else
%bcond_with system_libxml
%endif
%bcond_with system_icu
%bcond_with system_vpx
%bcond_with clang
Name:           chromium
Version:        62.0.3202.89
Release:        0
Summary:        Google's open source browser project
License:        BSD-3-Clause AND LGPL-2.1+
Group:          Productivity/Networking/Web/Browsers
Url:            http://code.google.com/p/chromium/
Source0:        http://commondatastorage.googleapis.com/chromium-browser-official/%{rname}-%{version}.tar.xz
# Toolchain definitions
Source1:        BUILD.gn
Source30:       master_preferences
Source100:      chromium-browser.sh
Source101:      chromium-browser.desktop
Source102:      chromium-browser.xml
Source103:      chromium.default
Source104:      chromium-icons.tar.bz2
# PATCH-FEATURE-UPSTREAM https://bugs.chromium.org/p/chromium/issues/detail?id=654190
Source105:      chromium-browser.appdata.xml
# PATCH-FIX-OPENSUSE Make the 1-click-install ymp file always download [bnc#836059]
Patch1:         exclude_ymp.diff
# PATCH-FIX-OPENSUSE enables reading of the master preference
Patch2:         chromium-master-prefs-path.patch
# PATCH-FIX-OPENSUSE Compile the sandbox with -fPIE settings
Patch4:         chromium-sandbox-pie.patch
# PATCH-FIX-OPENSUSE fix_building_widevinecdm_with_chromium.patch - Enable WideVine plugin
Patch6:         fix_building_widevinecdm_with_chromium.patch
# PATCH-FIX-OPENSUSE fix_network_api_crash.patch - Fix crash in network API, e.g. when using chromecast extension
Patch7:         fix_network_api_crash.patch
Patch12:        chromium-dma-buf.patch
Patch14:        chromium-buildname.patch
Patch15:        chromium-gcc5.patch
Patch16:        chromium-60.0.3112.113-breakpad-ucontext.patch
Patch17:        chromium-62.0.3202.62-correct-cplusplus-check.patch
# GN buildsystem related patches
Patch200:       chromium-last-commit-position-r0.patch
Patch201:       fix-gn-bootstrap.diff
# PATCH-FIX-SUSE: allow proprietary codecs to be set with chromium branding
Patch202:       chromium-prop-codecs.patch
BuildRequires:  SDL-devel
BuildRequires:  binutils-gold
BuildRequires:  bison
BuildRequires:  cups-devel
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  gperf
BuildRequires:  hicolor-icon-theme
BuildRequires:  libcap-devel
BuildRequires:  libdc1394
BuildRequires:  libelf-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libgsm
BuildRequires:  libgsm-devel
BuildRequires:  libjpeg-devel >= 8.1
BuildRequires:  libpng-devel
BuildRequires:  libva-devel
BuildRequires:  ncurses-devel
BuildRequires:  ninja >= 1.7.2
BuildRequires:  nodejs6
BuildRequires:  pam-devel
BuildRequires:  pkgconfig
BuildRequires:  procps
BuildRequires:  python
BuildRequires:  re2-devel
BuildRequires:  snappy-devel
BuildRequires:  update-desktop-files
BuildRequires:  util-linux
BuildRequires:  wdiff
BuildRequires:  yasm
BuildRequires:  perl(Switch)
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(cairo) >= 1.6
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(dirac) >= 1.0.0
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(flac++)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gconf-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gnome-keyring-1)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(hunspell)
BuildRequires:  pkgconfig(imlib2)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(kadm-client)
BuildRequires:  pkgconfig(kdb)
BuildRequires:  pkgconfig(krb5)
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavfilter)
BuildRequires:  pkgconfig(libavformat) >= 57.41.100
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libcrypto)
BuildRequires:  pkgconfig(libdc1394-2)
BuildRequires:  pkgconfig(libdrm)
BuildRequires:  pkgconfig(libevent)
BuildRequires:  pkgconfig(libexif)
BuildRequires:  pkgconfig(libffi)
BuildRequires:  pkgconfig(liboil-0.3) >= 0.3.15
BuildRequires:  pkgconfig(libpci)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libssl)
BuildRequires:  pkgconfig(libtcmalloc)
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(libwebp)
BuildRequires:  pkgconfig(libxslt)
BuildRequires:  pkgconfig(nspr) >= 4.9.5
BuildRequires:  pkgconfig(nss) >= 3.26
BuildRequires:  pkgconfig(ogg)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(opus)
BuildRequires:  pkgconfig(python)
BuildRequires:  pkgconfig(schroedinger-1.0)
BuildRequires:  pkgconfig(slang)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(theora) >= 1.1
BuildRequires:  pkgconfig(valgrind)
BuildRequires:  pkgconfig(vdpau)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcomposite)
BuildRequires:  pkgconfig(xcursor)
BuildRequires:  pkgconfig(xdamage)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xfixes)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xrandr)
BuildRequires:  pkgconfig(xrender)
BuildRequires:  pkgconfig(xscrnsaver)
BuildRequires:  pkgconfig(xt)
BuildRequires:  pkgconfig(xtst)
BuildRequires:  pkgconfig(zlib)
Requires:       hicolor-icon-theme
Requires:       xdg-utils
Requires(pre):  permissions
Recommends:     noto-coloremoji-fonts
Recommends:     noto-emoji-fonts
Conflicts:      otherproviders(chromium-browser)
Provides:       chromium-based-browser = %{version}
Provides:       chromium-browser = %{version}
Obsoletes:      %{name}-suid-helper < %{version}
Obsoletes:      chromium-browser < %{version}
Provides:       %{name}-suid-helper = %{version}
Obsoletes:      chromium-beta-desktop-gnome
Obsoletes:      chromium-beta-desktop-kde
Obsoletes:      chromium-desktop-gnome
Obsoletes:      chromium-desktop-kde
Obsoletes:      chromium-dev-desktop-gnome
Obsoletes:      chromium-dev-desktop-kde
Obsoletes:      chromium-ffmpeg
Obsoletes:      chromium-ffmpegsumo
# There is no v8 for ppc and thus chromium won't run on ppc. For aarch64
# certain buildrequires are missing (e.g. valgrind)
# while it would build for %arm, we exclude it as it takes forever to build
ExcludeArch:    %{arm} aarch64 i586 ppc ppc64 ppc64le
%if %{with system_libxml}
BuildRequires:  pkgconfig(libxml-2.0) >= 2.9.5
%endif
%if !%{with sle_bundles}
BuildRequires:  python-beautifulsoup4
BuildRequires:  python-html5lib
BuildRequires:  python-simplejson
BuildRequires:  python-xml
BuildRequires:  yasm-devel
%endif
%if %{with system_minizip}
BuildRequires:  pkgconfig(minizip)
%endif
%if %{with system_harfbuzz}
BuildRequires:  pkgconfig(harfbuzz) >= 1.4.0
%endif
%if %{with system_icu}
BuildRequires:  pkgconfig(icu-i18n) >= 58.0
%endif
%if %{with system_vpx}
BuildRequires:  pkgconfig(vpx) >= 1.6.1
%endif
%if %{with clang}
BuildRequires:  clang >= 3.9.0
%else
%if %{?suse_version} >= 1330
BuildRequires:  gcc >= 6.0
BuildRequires:  gcc-c++ >= 6.0
%else
BuildRequires:  gcc6
BuildRequires:  gcc6-c++
%endif
%endif

%description
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 -n chromedriver
Summary:        WebDriver for Google Chrome/Chromium
License:        BSD-3-Clause
Group:          Development/Tools/Other
Requires:       %{name} = %{version}

%description -n chromedriver
WebDriver is an open source tool for automated testing of webapps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver is a standalone server which implements WebDriver's wire protocol for Chromium. It is being developed by members of the Chromium and WebDriver teams.

%prep
%setup -q -n %{rname}-%{version}

#GN Buildsystem fixes
%patch200 -p1
%patch201 -p1
%patch202 -p1

#Standard patches
%patch1
%patch2
%patch4
%patch6 -p1
%patch7
%patch12 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1

# Copy the toolchain settings
mkdir toolchain
cp %{SOURCE1} toolchain/BUILD.gn

# Fix the path to nodejs binary
mkdir -p third_party/node/linux/node-linux-x64/bin
ln -s %{_bindir}/node third_party/node/linux/node-linux-x64/bin/node

# Remove bundled libs
keeplibs=(
    base/third_party/dmg_fp
    base/third_party/dynamic_annotations
    base/third_party/nspr
    base/third_party/icu
    base/third_party/superfasthash
    base/third_party/symbolize
    base/third_party/valgrind
    base/third_party/xdg_mime
    base/third_party/xdg_user_dirs
    breakpad/src/third_party/curl
    chrome/third_party/mozilla_security_manager
    courgette/third_party
    net/third_party/mozilla_security_manager
    net/third_party/nss
    third_party/WebKit
    third_party/analytics
    third_party/angle
    third_party/angle/src/common/third_party/base
    third_party/angle/src/common/third_party/murmurhash
    third_party/angle/src/third_party/compiler
    third_party/angle/src/third_party/libXNVCtrl
    third_party/angle/src/third_party/trace_event
    third_party/boringssl
    third_party/brotli
    third_party/cacheinvalidation
    third_party/catapult
    third_party/catapult/third_party/polymer
    third_party/catapult/third_party/py_vulcanize
    third_party/catapult/third_party/py_vulcanize/third_party/rcssmin
    third_party/catapult/third_party/py_vulcanize/third_party/rjsmin
    third_party/catapult/tracing/third_party/d3
    third_party/catapult/tracing/third_party/gl-matrix
    third_party/catapult/tracing/third_party/jszip
    third_party/catapult/tracing/third_party/mannwhitneyu
    third_party/catapult/tracing/third_party/oboe
    third_party/ced
    third_party/cld_2
    third_party/cld_3
    third_party/crc32c
    third_party/cros_system_api
    third_party/devscripts
    third_party/dom_distiller_js
    third_party/fips181
    third_party/flatbuffers
    third_party/flot
    third_party/freetype
    third_party/glslang-angle
    third_party/google_input_tools
    third_party/google_input_tools/third_party/closure_library
    third_party/google_input_tools/third_party/closure_library/third_party/closure
    third_party/googletest
    third_party/hunspell
    third_party/iccjpeg
    third_party/inspector_protocol
    third_party/jinja2
    third_party/jstemplate
    third_party/khronos
    third_party/leveldatabase
    third_party/libXNVCtrl
    third_party/libaddressinput
    third_party/libdrm
    third_party/libjingle
    third_party/libphonenumber
    third_party/libsecret
    third_party/libsrtp
    third_party/libudev
    third_party/libusb
    third_party/libwebm
    third_party/libxml/chromium
    third_party/libyuv
    third_party/lss
    third_party/lzma_sdk
    third_party/markupsafe
    third_party/mesa
    third_party/modp_b64
    third_party/mt19937ar
    third_party/node
    third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2
    third_party/openh264
    third_party/openmax_dl
    third_party/ots
    third_party/pdfium
    third_party/pdfium/third_party/agg23
    third_party/pdfium/third_party/base
    third_party/pdfium/third_party/build
    third_party/pdfium/third_party/bigint
    third_party/pdfium/third_party/freetype
    third_party/pdfium/third_party/lcms
    third_party/pdfium/third_party/libopenjpeg20
    third_party/pdfium/third_party/libpng16
    third_party/pdfium/third_party/libtiff
    third_party/ply
    third_party/polymer
    third_party/protobuf
    third_party/protobuf/third_party/six
    third_party/qcms
    third_party/sfntly
    third_party/skia
    third_party/skia/third_party/gif
    third_party/skia/third_party/vulkan
    third_party/smhasher
    third_party/spirv-headers
    third_party/spirv-tools-angle
    third_party/sqlite
    third_party/swiftshader
    third_party/swiftshader/third_party/llvm-subzero
    third_party/swiftshader/third_party/subzero
    third_party/tcmalloc
    third_party/usrsctp
    third_party/vulkan
    third_party/vulkan-validation-layers
    third_party/web-animations-js
    third_party/webdriver
    third_party/webrtc
    third_party/widevine
    third_party/woff2
    third_party/zlib/google
    url/third_party/mozilla
    v8/src/third_party/valgrind
    v8/third_party/inspector_protocol
)
%if %{with sle_bundles}
keeplibs+=(
    third_party/yasm
    third_party/simplejson
    third_party/catapult/third_party/beautifulsoup4
    third_party/catapult/third_party/html5lib-python
    third_party/catapult/third_party/six
)
%endif
%if !%{with system_minizip}
keeplibs+=( third_party/zlib )
%endif
%if !%{with system_icu}
keeplibs+=( third_party/icu )
%endif
%if !%{with system_libxml}
keeplibs+=( third_party/libxml )
%endif
%if !%{with system_vpx}
keeplibs+=(
    third_party/libvpx
    third_party/libvpx/source/libvpx/third_party/x86inc
)
%endif
%if !%{with system_harfbuzz}
keeplibs+=( third_party/harfbuzz-ng )
%endif
# needed due to bugs in GN
keeplibs+=(
    base/third_party/libevent
    third_party/adobe
    third_party/speech-dispatcher
    third_party/usb_ids
    third_party/xdg-utils
    third_party/yasm/run_yasm.py
)
build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove

%build
%if %{with clang}
export CC=clang
export CXX=clang++
%else
# REDUCE DEBUG as it gets TOO large
ARCH_FLAGS="`echo %{optflags} | sed -e 's/^-g / /g' -e 's/ -g / /g' -e 's/ -g$//g'`"
export CFLAGS="${ARCH_FLAGS} -std=gnu11 -fpermissive"
export CXXFLAGS="${ARCH_FLAGS} -fpermissive"
export CC=gcc
export CXX=g++
%if 0%{?suse_version} < 1330
export CC=gcc-6
export CXX=g++-6
# some still call gcc/g++
mkdir "$HOME/bin/"
ln -s /usr/bin/$CC $HOME/bin/gcc
ln -s /usr/bin/$CXX $HOME/bin/g++
export PATH="$HOME/bin/:$PATH"
%endif
%endif
# do not eat all memory
ninjaproc="%{?jobs:%{jobs}}"
echo "Available memory:"
free
echo "System limits:"
ulimit -a
if test -n "$ninjaproc" -a "$ninjaproc" -gt 1 ; then
    mem_per_process=1300
    max_mem=`LANG=C free -t -m | sed -n "s|^Mem: *\([0-9]*\).*$|\1|p"`
    max_jobs="$(($max_mem / $mem_per_process))"
    test "$ninjaproc" -gt "$max_jobs" && ninjaproc="$max_jobs" && echo "Warning: Reducing number of jobs to $max_jobs because of memory limits"
    test "$ninjaproc" -le 0 && ninjaproc=1 && echo "Warning: Do not use the parallel build at all becuse of memory limits"
fi

# Set system libraries to be used
gn_system_libraries=(
    ffmpeg
    flac
    libdrm
    libjpeg
    libpng
    libwebp
    libxslt
    opus
    re2
    snappy
    yasm
)
%if !%{with sle_bundles}
gn_system_libraries+=( yasm )
%endif
%if %{with system_minizip}
gn_system_libraries+=( zlib )
%endif
%if %{with system_harfbuzz}
gn_system_libraries+=( harfbuzz-ng )
%endif
%if %{with system_icu}
gn_system_libraries+=( icu )
%endif
%if %{with system_vpx}
gn_system_libraries+=( libvpx )
%endif
%if %{with system_libxml}
gn_system_libraries+=( libxml )
%endif
build/linux/unbundle/replace_gn_files.py --system-libraries ${gn_system_libraries[@]}

# Create the configuration for GN
# Available options: out/Release/gn args --list out/Release/
myconf_gn=""
myconf_gn+=" custom_toolchain=\"./toolchain:default\""
myconf_gn+=" linux_use_bundled_binutils=false"
myconf_gn+=" use_custom_libcxx=false"
myconf_gn+=" is_debug=false"
myconf_gn+=" enable_nacl=false"
myconf_gn+=" is_component_ffmpeg=true"
myconf_gn+=" use_cups=true"
myconf_gn+=" use_gconf=true"
myconf_gn+=" use_aura=true"
myconf_gn+=" symbol_level=1"
myconf_gn+=" remove_webcore_debug_symbols=true"
myconf_gn+=" use_kerberos=true"
myconf_gn+=" use_pulseaudio=true link_pulseaudio=true"
myconf_gn+=" is_component_build=false"
myconf_gn+=" use_sysroot=false"
myconf_gn+=" fatal_linker_warnings=false"
myconf_gn+=" use_allocator=\"tcmalloc\""
myconf_gn+=" fieldtrial_testing_like_official_build=true"
myconf_gn+=" use_gold=true"
myconf_gn+=" use_sysroot=false"
myconf_gn+=" treat_warnings_as_errors=false"
myconf_gn+=" enable_widevine=true"
myconf_gn+=" enable_hangout_services_extension=true"
%if %{with clang}
myconf_gn+=" is_clang=true clang_base_path=\"/usr\" clang_use_chrome_plugins=false"
%else
myconf_gn+=" is_clang=false"
%endif

# The proprietary codecs just force the chromium to say they can use it and
# offload the actual computation to the ffmpeg, otherwise the chromium
# won't be able to load the codec even if the library can handle it
myconf_gn+=" proprietary_codecs=true"
myconf_gn+=" ffmpeg_branding=\"Chrome\""

%ifarch %{arm}
myconf_gn+=" target_cpu=\"arm\""
myconf_gn+=" target_sysroot_dir=\"\""
myconf_gn+=" arm_use_neon=false"
myconf_gn+=" arm_optionally_use_neon=false"
myconf_gn+=" arm_use_thumb=true"
%endif

# Set up Google API keys, see http://www.chromium.org/developers/how-tos/api-keys
# Note: these are for the openSUSE Chromium builds ONLY. For your own distribution,
# please get your own set of keys.
google_api_key="AIzaSyD1hTe85_a14kr1Ks8T3Ce75rvbR1_Dx7Q"
google_default_client_id="4139804441.apps.googleusercontent.com"
google_default_client_secret="KDTRKEZk2jwT_7CDpcmMA--P"

myconf_gn+=" google_api_key=\"${google_api_key}\""
myconf_gn+=" google_default_client_id=\"${google_default_client_id}\""
myconf_gn+=" google_default_client_secret=\"${google_default_client_secret}\""

tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "${myconf_gn}"
# GN does not support passing cflags:
#  https://bugs.chromium.org/p/chromium/issues/detail?id=642016
out/Release/gn gen --args="${myconf_gn}" out/Release

ninja -v -j $ninjaproc -C out/Release chrome chrome_sandbox chromedriver

%install
mkdir -p %{buildroot}%{_libdir}/chromium
%ifarch x86_64
mkdir -p %{buildroot}%{_libexecdir}/
%endif
mkdir -p %{buildroot}%{_bindir}
install -m 755 %{SOURCE100} %{buildroot}%{_bindir}/chromium

# x86_64 capable systems need this
sed -i "s|%{_libexecdir}/chromium|%{_libdir}/chromium|g" %{buildroot}%{_bindir}/chromium

mkdir -p %{buildroot}%{_mandir}/man1/
pushd out/Release

# Install the file %{_sysconfdir}/default/chromium which defines the chromium flags
mkdir -p %{buildroot}%{_sysconfdir}/default
install -m 644 %{SOURCE103} %{buildroot}%{_sysconfdir}/default/chromium

# Recent Chromium builds now wants to have the sandbox in the same directory. So let's create a symlink to the one in %{_prefix}/lib
cp -a chrome_sandbox %{buildroot}%{_libexecdir}/
ln -s -f %{_libexecdir}/chrome_sandbox %{buildroot}/%{_libdir}/chromium/chrome-sandbox

cp -a *.bin *.pak locales xdg-mime %{buildroot}%{_libdir}/chromium/
%if !%{with system_icu}
cp -a icudtl.dat %{buildroot}%{_libdir}/chromium/
%endif

# chromedriver
cp -a chromedriver %{buildroot}%{_libdir}/chromium/

# Patch xdg-settings to use the chromium version of xdg-mime as that the system one is not KDE4 compatible
sed "s|xdg-mime|%{_libdir}/chromium/xdg-mime|g" xdg-settings > %{buildroot}%{_libdir}/chromium/xdg-settings

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/

popd

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

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

mkdir -p %{buildroot}%{_datadir}/appdata/
cp -a %{SOURCE105} %{buildroot}%{_datadir}/appdata/

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}/chromium
ln -s ../browser-plugins plugins

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

# Set the right attributes
chmod 755 %{buildroot}%{_libdir}/chromium/xdg-settings
chmod 755 %{buildroot}%{_libdir}/chromium/xdg-mime

%verifyscript
%verify_permissions -e %{_libexecdir}/chrome_sandbox

%post
%icon_theme_cache_post
%desktop_database_post
%set_permissions %{_libexecdir}/chrome_sandbox
/sbin/ldconfig %{_libdir}/chromium

%postun
%icon_theme_cache_postun
%desktop_database_postun
/sbin/ldconfig %{_libdir}/chromium

%files
%verify(not mode) %{_libexecdir}/chrome_sandbox
%doc AUTHORS LICENSE
%config %{_sysconfdir}/chromium
%config(noreplace) %{_sysconfdir}/default/chromium
%dir %{_datadir}/gnome-control-center
%dir %{_datadir}/gnome-control-center/default-apps
%{_libdir}/chromium/
%{_mandir}/man1/chrom*
%{_datadir}/applications/*.desktop
%dir %{_datadir}/appdata/
%{_datadir}/appdata/chromium-browser.appdata.xml
%{_datadir}/gnome-control-center/default-apps/chromium-browser.xml
%{_datadir}/icons/hicolor/
%{_libexecdir}/chrome_sandbox
%exclude %{_libdir}/chromium/chromedriver
%{_bindir}/chromium

%files -n chromedriver
%{_libdir}/chromium/chromedriver

%changelog
openSUSE Build Service is sponsored by