File webkitgtk.spec of Package webkitgtk

#
# spec file for package webkitgtk
#
# Copyright (c) 2018 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 _pkgname_no_slpp libwebkitgtk2
%define _sover -1_0-0
%define _sonamever 1.0
%define _sonameverpkg 1_0
%define _withwk2 0
# empty:
#%%define _develnamever
%define _gtkver 2.0
%define _jscver 1
%define _pkgconfig_suffix -1.0
%define _name webkitgtk
Name:           webkitgtk
Version:        2.4.11
Release:        0
Summary:        Library for rendering web content, GTK+ Port
License:        LGPL-2.0-or-later AND BSD-3-Clause
Group:          Development/Libraries/C and C++
URL:            http://webkitgtk.org/
Source:         http://webkitgtk.org/releases/%{_name}-%{version}.tar.xz
Source1:        baselibs.conf
# PATCH-FIX-OPENSUSE webkitgtk-typelib-sharelib-link.patch dimstar@opensuse.org -- Fixup the .gir file to contain the full library name for libjavascriptcore.
Patch0:         webkitgtk-typelib-sharelib-link.patch
# PATCH-FIX-OPENSUSE webkit-ld-optimization.patch vuntz@opensuse.org -- Add ld options to use less memory when linking, should help building on OBS, but this will be slower
Patch2:         webkit-ld-optimization.patch
# PATCH-FIX-UPSTREAM aarch64-support.patch webkit#116030 schwab@suse.de -- Support for aarch64
Patch3:         webkitgtk-aarch64.patch
# PATCH-FIX-UPSTREAM webkitgtk-x86-assembler-fix.patch webkit#126985 dimstar@opensuse.org -- Fix build creating invalid assembler code on x86.
Patch6:         webkitgtk-x86-assembler-fix.patch
# PATCH-FIX-UPSTREAM webkitgtk-commit-size.patch bnc#866728 mgorse@suse.com -- call mprotect with valid size on s390/ppc64.
Patch8:         webkitgtk-commit-size.patch
# PATCH-FIX-UPSTREAM webkitgtk-ppc32.patch webkit#130837 dvaleev@suse.com --  Webkit2 doesnt build on powerpc 32 bits
Patch10:        webkitgtk-ppc32.patch
# PATCH-FIX-UPSTREAM webkitgtk-abs_to_fabs.patch dimstar@opensuse.org -- Use fabs() instead of abs() on floating point values
Patch11:        webkitgtk-abs_to_fabs.patch
# PATCH-FIX-UPSTREAM webkitgtk-icu59.patch dimstar@opensuse.org -- Fix build against icu 5.9
Patch12:        webkitgtk-icu59.patch
# PATCH-FEATURE-UPSTREAM webkitgtk-python3.patch dimstar@opensuse.org -- Allow to use python 3 to build
Patch13:        webkitgtk-python3.patch
# PATCH-FIX-UPSTREAM webkitgtk-reproducible.patch bmwiedemann@opensuse.org -- Sort resource list
Patch14:        webkitgtk-reproducible.patch
BuildRequires:  Mesa-devel
BuildRequires:  bison
BuildRequires:  chrpath
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  gobject-introspection-devel >= 1.32.0
BuildRequires:  gperf
BuildRequires:  gtk-doc
BuildRequires:  libicu-devel
BuildRequires:  libjpeg-devel
# Needed for patch2
BuildRequires:  libtool
BuildRequires:  perl
BuildRequires:  pkgconfig
BuildRequires:  python3-base
BuildRequires:  ruby
# Needed by make-hash-tools.pl, after move to perl 5.14
BuildRequires:  perl(Switch)
BuildRequires:  pkgconfig(atspi-2) >= 2.2.1
BuildRequires:  pkgconfig(cairo) >= 1.10
BuildRequires:  pkgconfig(cairo-ft)
BuildRequires:  pkgconfig(enchant) >= 0.22
BuildRequires:  pkgconfig(fontconfig) >= 2.5
BuildRequires:  pkgconfig(freetype2) >= 9.0
BuildRequires:  pkgconfig(gail) >= 1.8
BuildRequires:  pkgconfig(geoclue-2.0)
BuildRequires:  pkgconfig(glib-2.0) >= 2.36.0
BuildRequires:  pkgconfig(gstreamer-1.0) >= 1.0.3
BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0) >= 1.0.3
BuildRequires:  pkgconfig(gtk+-2.0) >= 2.24.10
BuildRequires:  pkgconfig(gudev-1.0)
BuildRequires:  pkgconfig(harfbuzz)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libsecret-1)
BuildRequires:  pkgconfig(libsoup-2.4) >= 2.42.0
BuildRequires:  pkgconfig(libwebp)
BuildRequires:  pkgconfig(libxml-2.0) >= 2.6
BuildRequires:  pkgconfig(libxslt) >= 1.1.7
BuildRequires:  pkgconfig(pango) >= 1.30.0
BuildRequires:  pkgconfig(pangoft2)
BuildRequires:  pkgconfig(sqlite3) >= 3.0
BuildRequires:  pkgconfig(xcomposite)
BuildRequires:  pkgconfig(xdamage)
BuildRequires:  pkgconfig(xrender)
BuildRequires:  pkgconfig(xt)
BuildRequires:  pkgconfig(zlib)

%description
WebKit is a web content engine, derived from KHTML and KJS from KDE,
and used primarily in Apple's Safari browser.  It is made to be
embedded in other applications, such as mail readers, or web browsers.

It is able to display content such as HTML, SVG, XML, and others. It
also supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and
more.

%package -n libwebkitgtk%{_sover}
Summary:        Library for rendering web content, GTK+ Port
Group:          System/Libraries
Recommends:     %{_pkgname_no_slpp}-lang = %{version}
# We provide %{_pkgname_no_slpp}: that's the GTK+ version being used.
Provides:       %{_pkgname_no_slpp} = %{version}
Provides:       libWebKitGtk0 = %{version}
Obsoletes:      libWebKitGtk0 < %{version}

%description -n libwebkitgtk%{_sover}
WebKit is a web content engine, derived from KHTML and KJS from KDE,
and used primarily in Apple's Safari browser.  It is made to be
embedded in other applications, such as mail readers, or web browsers.

It is able to display content such as HTML, SVG, XML, and others. It
also supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and
more.

%package -n libjavascriptcoregtk%{_sover}
Summary:        JavaScript Core Engine, GTK+ Port
Group:          System/Libraries

%description -n libjavascriptcoregtk%{_sover}
WebKit is a web content engine, derived from KHTML and KJS from KDE,
and used primarily in Apple's Safari browser.  It is made to be
embedded in other applications, such as mail readers, or web browsers.

It is able to display content such as HTML, SVG, XML, and others. It
also supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and
more.

%package -n typelib-1_0-WebKit-%{_sonameverpkg}
Summary:        Library for rendering web content, GTK+ Port -- Introspection bindings
Group:          System/Libraries

%description -n typelib-1_0-WebKit-%{_sonameverpkg}
WebKit is a web content engine, derived from KHTML and KJS from KDE,
and used primarily in Apple's Safari browser.  It is made to be
embedded in other applications, such as mail readers, or web browsers.

It is able to display content such as HTML, SVG, XML, and others. It
also supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and
more.

This package provides the GObject Introspection bindings for the GTK+
port of WebKit.

%package -n typelib-1_0-JavaScriptCore-%{_sonameverpkg}
Summary:        JavaScript Core Engine, GTK+ Port -- Introspection bindings
Group:          System/Libraries

%description -n typelib-1_0-JavaScriptCore-%{_sonameverpkg}
WebKit is a web content engine, derived from KHTML and KJS from KDE,
and used primarily in Apple's Safari browser.  It is made to be
embedded in other applications, such as mail readers, or web browsers.

It is able to display content such as HTML, SVG, XML, and others. It
also supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and
more.

This package provides the GObject Introspection bindings for the GTK+
port of the JavaScript Core engine.

%package -n libwebkitgtk%{?_develnamever}-devel
Summary:        Library for rendering web content, GTK+ Port
Group:          Development/Libraries/C and C++
Requires:       libjavascriptcoregtk%{_sover} = %{version}
Requires:       libwebkitgtk%{_sover} = %{version}
Requires:       typelib-1_0-JavaScriptCore-%{_sonameverpkg}
Requires:       typelib-1_0-WebKit-%{_sonameverpkg}
Provides:       WebKitGtk-devel = %{version}
Obsoletes:      WebKitGtk-devel < %{version}
Provides:       libwebkit-devel = %{version}
Obsoletes:      libwebkit-devel < %{version}

%description -n libwebkitgtk%{?_develnamever}-devel
WebKit is a web content engine, derived from KHTML and KJS from KDE,
and used primarily in Apple's Safari browser.  It is made to be
embedded in other applications, such as mail readers, or web browsers.

It is able to display content such as HTML, SVG, XML, and others. It
also supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and
more.

%package -n webkit-jsc-%{_jscver}
Summary:        Library for rendering web content, GTK+ Port
Group:          Development/Libraries/C and C++
Requires:       libwebkitgtk%{_sover} = %{version}
Provides:       webkit-jsc = %{version}
Obsoletes:      webkit-jsc < %{version}

%description -n webkit-jsc-%{_jscver}
WebKit is a web content engine, derived from KHTML and KJS from KDE,
and used primarily in Apple's Safari browser.  It is made to be
embedded in other applications, such as mail readers, or web browsers.

It is able to display content such as HTML, SVG, XML, and others. It
also supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and
more.

%lang_package -n %{_pkgname_no_slpp}

%prep
%setup -q -n webkitgtk-%{version}
%patch0 -p1
%patch3 -p1
%patch6 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1

%build
# FIXME: workaround needed in > 1.7.90 to fix build
mkdir -p DerivedSources/webkit
mkdir -p DerivedSources/WebCore
mkdir -p DerivedSources/ANGLE
mkdir -p DerivedSources/WebKit2/webkit2gtk/webkit2
mkdir -p DerivedSources/WebKit2
mkdir -p DerivedSources/webkitdom/
mkdir -p DerivedSources/InjectedBundle
mkdir -p DerivedSources/Platform

LOCAL_OPT_FLAGS="%{optflags}"
if [ $(gcc -dumpversion | awk -F. '{print $1}') -ge 6 ]; then
  # Remove this GCC6 optimization to fix several runtime issues (e.g. boo#987596)
  LOCAL_OPT_FLAGS+=" -fno-delete-null-pointer-checks "
fi
%ifarch ppc64 ppc64le
LOCAL_OPT_FLAGS+=" -mminimal-toc "
%endif
%ifarch %{arm} ppc ppc64 ppc64le s390 s390x
LOCAL_OPT_FLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads "
%endif

#Needed for patch2
#autoreconf --verbose --install -I Source/autotools

#Needed for patch11
autoreconf --verbose --install

# No debug builds.... We run out of about everything with -O2 -g (the .ar becomes > 4.3GB)
# Do not use %%optflags here - as RPM_OPT_FLAGS has been adjusted already higher up
export CFLAGS="$LOCAL_OPT_FLAGS"
export CXXFLAGS="$LOCAL_OPT_FLAGS"

# Use CPPFLAGS to disable jit, webkit#113638
%ifarch %{arm} ppc ppc64 ppc64le s390 s390x
export CPPFLAGS="-DENABLE_JIT=0 -DENABLE_YARR_JIT=0 -DENABLE_ASSEMBLER=0"
%endif

export PYTHON=%{_bindir}/python3
%configure \
        --with-gtk=%{_gtkver} \
        --enable-geolocation \
        --enable-introspection \
        --enable-javascript-debugger \
        --disable-static \
        --enable-shared \
        --with-gstreamer=1.0 \
        --disable-webkit2
make -j1 DerivedSources/WebCore/JSInternalSettingsGenerated.h
make %{?_smp_mflags}

%install
%make_install
%find_lang WebKitGTK-%{_gtkver} %{no_lang_C}
find %{buildroot} -type f -name "*.la" -delete -print

%post -n libwebkitgtk%{_sover} -p /sbin/ldconfig
%postun -n libwebkitgtk%{_sover} -p /sbin/ldconfig
%post -n libjavascriptcoregtk%{_sover} -p /sbin/ldconfig
%postun -n libjavascriptcoregtk%{_sover} -p /sbin/ldconfig

%files -n libwebkitgtk%{_sover}
%license Source/WebCore/LICENSE-APPLE Source/WebCore/LICENSE-LGPL-2 Source/WebCore/LICENSE-LGPL-2.1 Source/WebKit/LICENSE
%doc Source/WebKit/gtk/NEWS
%{_libdir}/libwebkitgtk-%{_sonamever}.so.*
%{_datadir}/webkitgtk-%{_sonamever}/

%files -n libjavascriptcoregtk%{_sover}
%license Source/JavaScriptCore/COPYING.LIB
%doc Source/WebKit/gtk/NEWS
%{_libdir}/libjavascriptcoregtk-%{_sonamever}.so.*

%files -n typelib-1_0-WebKit-%{_sonameverpkg}
%{_libdir}/girepository-1.0/WebKit-%{_sonamever}.typelib

%files -n typelib-1_0-JavaScriptCore-%{_sonameverpkg}
%{_libdir}/girepository-1.0/JavaScriptCore-%{_sonamever}.typelib

%files -n libwebkitgtk%{?_develnamever}-devel
%doc %{_datadir}/gtk-doc/html/%{name}/
%doc %{_datadir}/gtk-doc/html/webkitdomgtk%{?_develnamever}
%{_libdir}/libjavascriptcoregtk-%{_sonamever}.so
%{_libdir}/libwebkitgtk-%{_sonamever}.so
%{_libdir}/pkgconfig/javascriptcoregtk-%{_sonamever}.pc
%{_libdir}/pkgconfig/webkit%{_pkgconfig_suffix}.pc
%{_includedir}/webkitgtk-%{_sonamever}/
%{_datadir}/gir-1.0/*.gir
%if %{_withwk2}
%doc %{_datadir}/gtk-doc/html/webkit2gtk/
%{_libdir}/libwebkit2gtk-%{_sonamever}.so
%{_libdir}/pkgconfig/webkit2%{_pkgconfig_suffix}.pc
%{_libdir}/pkgconfig/webkit2gtk-web-extension*.pc
%endif

%files -n webkit-jsc-%{_jscver}
%{_bindir}/jsc-%{_jscver}

%files -n %{_pkgname_no_slpp}-lang -f WebKitGTK-%{_gtkver}.lang

%changelog
openSUSE Build Service is sponsored by