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
# Disable debug packages generation.
%global debug_package %{nil}
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}/phantomjs-%{realversion}.tar.gz
Source1: https://github.com/Vitallium/qtbase/archive/%{commit1}/qtbase-%{commit1}.tar.gz#/qtbase-%{commit1}.tar.gz
Source2: https://github.com/Vitallium/qtwebkit/archive/%{commit2}/qtwebkit-%{commit2}.tar.gz#/qtwebkit-%{commit2}.tar.gz
# https://github.com/ariya/phantomjs/issues/12506
Patch0: phantomjs-2.0.0-fileupload.patch
Patch1: phantomjs-2.1.1-unset-QT_QPA_PLATFORM.patch
Patch2: phantomjs-2.1.1-qt5-webkit-icu59.patch
Patch3: phantomjs-2.1.1-qt5-webkit-python3.patch
Patch4: phantomjs-2.1.1-qt5-webkit-icu65.patch
BuildRequires: gcc-c++
BuildRequires: pkgconfig(openssl) >= 1.0
BuildRequires: pkgconfig(openssl) <= 1.1
BuildRequires: pkgconfig(libpng16)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xext)
BuildRequires: libicu-devel
BuildRequires: pkgconfig(libpng16)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: libjpeg-devel
BuildRequires: flex
BuildRequires: bison
BuildRequires: gperf
BuildRequires: ruby
BuildRequires: rubygems
BuildRequires: python3
BuildRequires: python3-rpm-macros
BuildRequires: perl(version)
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 -q -n %{name}-%{realversion}
tar -zxf %{SOURCE1} -C src/qt/qtbase --strip-components=1
tar -zxf %{SOURCE2} -C src/qt/qtwebkit --strip-components=1
# https://github.com/ariya/phantomjs/issues/12506
%patch0 -p1
%patch1 -p1
# https://bugreports.qt.io/browse/QTBUG-60532
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
mkdir bin
# github issue #13930
touch src/qt/qtbase/.git
touch src/qt/qtwebkit/.git
%{__python3} build.py \
%{_smp_mflags} \
--confirm \
--release \
--qmake-args QMAKE_CFLAGS_RELEASE="$RPM_OPT_FLAGS" \
--qmake-args QMAKE_CXXFLAGS_RELEASE="$RPM_OPT_FLAGS" \
--qmake-args QMAKE_LFLAGS_RELEASE="$RPM_LD_FLAGS"
%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