File phantomjs.spec of Package phantomjs

#
# spec file for package phantomjs
#
# 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/
#


# Commit versions that git submodules were on before merge of later Qt versions.
%global commit1 b5cc0083a5766e773885e8dd624c51a967c17de0
%global commit2 e09b87bfe2b3ad6004d31894ee58bd611c8e3e39

# FIXME: please remove this on next update.
%global realversion 2.1.1

Name:           phantomjs
# 4th number is a hack used so that downgrade has a higher version number
# than previous version in repos (2.1.1+git20160526.6090f54).
# FIXME: please remove this on next update.
Version:        %{realversion}.0
Release:        0
Summary:        Scriptable Headless WebKit
License:        BSD-3-Clause
Group:          Development/Languages/NodeJS
Url:            http://phantomjs.org
Source:         https://github.com/ariya/phantomjs/archive/%{realversion}.tar.gz
Source1:        https://github.com/Vitallium/qtbase/archive/%{commit1}.tar.gz#/qtbase-%{commit1}.tar.gz
Source2:        https://github.com/Vitallium/qtwebkit/archive/%{commit2}.tar.gz#/qtwebkit-%{commit2}.tar.gz
Patch1:         unset-QT_QPA_PLATFORM.patch
Patch2:         qt5-webkit-icu59.patch

BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  fontconfig-devel
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  gperf
BuildRequires:  libX11-devel
BuildRequires:  libXext-devel
BuildRequires:  libicu-devel
BuildRequires:  libjpeg-devel
%if 0%{?suse_version} >= 1330
BuildRequires:  libopenssl-1_0_0-devel
%else
BuildRequires:  libopenssl-devel
%endif
BuildRequires:  libpng16-devel
BuildRequires:  perl
BuildRequires:  python
BuildRequires:  python-xml
BuildRequires:  ruby
BuildRequires:  sqlite3-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

%prep
%setup -qn %{name}-%{realversion}
tar -zxf %{SOURCE1} -C src/qt/qtbase   --strip-components=1
tar -zxf %{SOURCE2} -C src/qt/qtwebkit --strip-components=1

%patch1 -p1
# https://bugreports.qt.io/browse/QTBUG-60532
%patch2 -p1

%build
# github issue #13930
touch src/qt/qtbase/.git
touch src/qt/qtwebkit/.git

python build.py --confirm --release

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/%{name}/examples
cp bin/%{name} %{buildroot}%{_bindir}/%{name}
cp examples/* %{buildroot}%{_datadir}/%{name}/examples/

%files
%defattr(-,root,root)
%doc ChangeLog CONTRIBUTING.md LICENSE.BSD README.md
%{_bindir}/%{name}
%{_datadir}/%{name}

%changelog
openSUSE Build Service is sponsored by