File midori.spec of Package midori

# spec file for package midori
# Copyright (c) 2015 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

%define major   1
Name:           midori
Version:        0.5.11
Release:        0
Summary:        Lightweight Webkit-based Web Browser
License:        LGPL-2.1+
Group:          Productivity/Networking/Web/Browsers
Source1:        %{name}.1
Source99:       baselibs.conf
Patch0:         midori-fix-plugins.diff
%if 0%{?with_granite}
BuildRequires:  pkgconfig(granite)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(javascriptcoregtk-3.0)
BuildRequires:  pkgconfig(webkitgtk-3.0)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(javascriptcoregtk-1.0)
BuildRequires:  pkgconfig(webkit-1.0)
BuildRequires:  cmake
BuildRequires:  docutils
BuildRequires:  fdupes
BuildRequires:  intltool
# for rsvg-convert utility
BuildRequires:  rsvg-view
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(gcr-3)
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(gmodule-2.0)
BuildRequires:  pkgconfig(gthread-2.0)
BuildRequires:  pkgconfig(gtk-doc)
BuildRequires:  pkgconfig(libnotify)
BuildRequires:  pkgconfig(libsoup-2.4)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(unique-1.0)
# for valac
BuildRequires:  pkgconfig(vapigen)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xscrnsaver)
%if 0%{?with_zeitgeist}
BuildRequires:  pkgconfig(zeitgeist-2.0)
Requires:       %{name}-branding = %{version}
Recommends:     %{name}-lang
Recommends:     ca-certificates
Recommends:     xdg-utils
Provides:       browser(npapi)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Midori is a lightweight web browser based on WebKit and GTK+. Its major
features are:

* Tabs, windows and session management.
* Flexibly configurable Web Search.
* User scripts and user styles support.
* Straightforward bookmark management.
* Customizable and extensible interface.
* Extensions written in C and Vala.

%package -n libmidori-core%{major}
Summary:        Midori Library
Group:          System/Libraries

%description -n libmidori-core%{major}
Midori shared library.

%package devel
Summary:        Development Files for Midori
Group:          Development/Libraries/C and C++
Requires:       libmidori-core%{major} = %{version}
Recommends:     pkgconfig(vapigen)

%description devel
This package contains development files needed to develop extensions for

%package branding-upstream
Summary:        Upstream Branding of Midori
Group:          Productivity/Networking/Web/Browsers
# BRAND: config: Controls default browser settings such as the homepage.
# BRAND: search: Controls the default search engines.
Supplements:    packageand(%{name}:branding-upstream)
Provides:       %{name}-branding = %{version}
BuildArch:      noarch
Conflicts:      otherproviders(%{name}-branding)

%description branding-upstream
This package provides the upstream look and feel for the Midori web browser.


%setup -q

%patch0 -p1
# remove parts that do not conform to the desktop file spec
for desktop in data/ data/; do
    awk '
/^\[Desktop Entry\]/ {
    d = 1
/^\[/ {
    d = 0
(d == 0) || ($1 ~ /^Actions/) { next }
{ print }
' ${desktop} > ${desktop}.tmp && \
        mv ${desktop}.tmp ${desktop}

%cmake \
%if 0%{?with_granite}
%if 0%{?with_zeitgeist}
make %{?_smp_mflags} VERBOSE=1


# Install a manual page.
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_mandir}/man1/%{name}.1

# Install some header files.
install -d -m 0755 %{buildroot}%{_includedir}/%{name}-0.5/extensions/
install -p -m 0644 build/midori/midori-core.h \
install -p -m 0644 build/extensions/*.h \

# documentation files are included below
rm -rf %{buildroot}%{_datadir}/doc/%{name}/

%fdupes -s %{buildroot}%{_datadir}/

# upstream does not provide a default configuration file
cat >%{buildroot}%{_sysconfdir}/xdg/%{name}/config <<EOF

%suse_update_desktop_file %{name}
%suse_update_desktop_file %{name}-private

%find_lang %{name} %{?no_lang_C}

pushd build
#xvfb-run make check



%post -n libmidori-core%{major} -p /sbin/ldconfig

%postun -n libmidori-core%{major} -p /sbin/ldconfig

%if 0%{?suse_version} && 0%{?suse_version} < 1320
%dir %{_datadir}/appdata/
%doc %{_mandir}/man?/*
%dir %{_sysconfdir}/xdg/%{name}/
%dir %{_sysconfdir}/xdg/%{name}/extensions/
%dir %{_sysconfdir}/xdg/%{name}/extensions/adblock/
%config(noreplace) %{_sysconfdir}/xdg/%{name}/extensions/adblock/config

%files -n libmidori-core%{major}

%files devel
%doc %{_datadir}/gtk-doc/html/%{name}-0-5/

%files branding-upstream
%config(noreplace) %{_sysconfdir}/xdg/%{name}/config
%config(noreplace) %{_sysconfdir}/xdg/%{name}/search

%files lang -f %{name}.lang