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

# 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
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
BuildRequires:  libopenssl-devel
BuildRequires:  libpng16-devel
BuildRequires:  perl
BuildRequires:  python
BuildRequires:  python-xml
BuildRequires:  ruby2.5
BuildRequires:  sqlite3-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

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.

%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
%patch2 -p1

mkdir bin
ln -s /usr/bin/ruby.ruby2.5 bin/ruby
export PATH=$PWD/bin:$PATH

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

python --confirm --release

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

%doc ChangeLog LICENSE.BSD