File phantomjs.spec of Package phantomjs
#
# spec file for package mongodb
#
#SuSe specific Part
%if %{?sles_version:1}0
#Requires: syslog-ng coreutils pwdutils
#BuildRequires: gcc-c++ flex bison gperf ruby perl sqlite3-devel fontconfig-devel libicu-devel freetype libopenssl0_9_8 libpng-devel libjpeg-devel python qt3 qt3-devel
%endif
%if 0%{?suse_version} == 1500
BuildRequires: unzip gcc-c++ flex bison gperf ruby perl sqlite3-devel fontconfig-devel libicu-devel freetype2 freetype2-devel libopenssl1_0_0 libpng16-16 libpng16-devel libjpeg62 python libQt53DCore-devel libQt5Core5 libQt5Core-devel
Requires: glibc unzip
%endif
%if 0%{?suse_version} == 1315
BuildRequires: unzip gcc-c++ flex bison gperf ruby perl sqlite3-devel fontconfig-devel libicu-devel freetype libopenssl1_0_0 libpng-devel libjpeg-devel python libqt4 libqt4-devel
Requires: glibc unzip
%endif
%if 0%{?suse_version} == 1110
BuildRequires: gcc-c++ flex bison gperf ruby perl sqlite3-devel fontconfig-devel libicu-devel freetype libopenssl0_9_8 libpng-devel libjpeg-devel python qt3 qt3-devel
Requires: syslog-ng coreutils pwdutils
%endif
%if 0%{?centos_version} == 700
BuildRequires: unzip gcc-c++ flex bison gperf ruby perl sqlite-devel fontconfig-devel libicu-devel freetype openssl openssl-libs openssl-devel libpng-devel libjpeg-devel python libyaml
Requires: glibc unzip libyaml
%endif
%if 0%{?rhel_version} == 8
BuildRequires: qt5-qtbase-devel unzip gcc-c++ flex bison perl sqlite-devel fontconfig-devel libicu-devel freetype openssl openssl-libs openssl-devel libpng-devel libjpeg-devel libyaml
Requires: glibc unzip libyaml
#qt5-qtbase-devel
%endif
%if %{?centos_version:1}0
%define init 1
Requires: chkconfig
BuildRequires: chkconfig
Requires: coreutils passwd
BuildRequires: gcc-c++ flex flex-devel bison bison-devel gperf ruby perl sqlite-devel fontconfig-devel libicu-devel freetype freetype-devel openssl-devel openssl libpng-devel openjpeg openjpeg-devel gd gd-devel python qt3 qt3-devel
%endif
#all Distros
Name: phantomjs
Version: 1.9.8
Release: 2
License: BSD-3-Clause
Summary: Headless WebKit scriptable with JavaScript or CoffeeScript
Url: www.phantomjs.org
Group: System/Monitoring
Source: phantomjs-1.9.zip
Source2: phantomjs-1-9-sles15.tar.gz
Source3: phantomjs-2-1-rhel8.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: -post-build-checks
%description
PhantomJS (www.phantomjs.org) is a headless WebKit scriptable with JavaScript or CoffeeScript. It is used by hundreds of developers and dozens of organizations for web-related development workflow.
%prep
cd %{_builddir}
unzip %{_sourcedir}/phantomjs-1.9.zip
tar xvfz %{_sourcedir}/phantomjs-1-9-sles15.tar.gz
tar xvfz %{_sourcedir}/phantomjs-2-1-rhel8.tar.gz
%build
### Build for Centos7
%if 0%{?centos_version} == 700 || 0%{?suse_version} == 1315
echo "Build for Centos 7 and SLES12"
cd %{_builddir}/phantomjs-1.9
./build.sh --confirm --silent --qt-config "-no-rpath"
echo "End of Build Centos 7 and SLES12"
%endif
#%if 0%{?suse_version} == 1500 || 0%{?rhel_version} == 8
#echo "OK"
#%endif
%install
#### Build for Centos 7
%if 0%{?centos_version} == 700 || 0%{?suse_version} == 1315
echo "Install for Centos 7 and SLES12"
cd %{_builddir}/phantomjs-1.9
pwd
ls -rtlh
install -D bin/phantomjs %{buildroot}/usr/bin/phantomjs
#install -D %{_builddir}/phantomjs-1.9/phantomjs %{buildroot}/usr/bin/phantomjs
%endif
#### Build for SLES 15
%if 0%{?suse_version} == 1500
echo "Install for SLES 15"
mkdir -p %{buildroot}/usr/bin/phantomjs
cp %{_builddir}/phantomjs-1-9-sles15 %{buildroot}/usr/bin/phantomjs
#%else
#install -D %{_builddir}/phantomjs %{buildroot}/usr/bin/phantomjs
%endif
### Build for RHEL8
%if 0%{?rhel_version}
echo "Install for RHEL8"
mkdir -p %{buildroot}/usr/bin
cp %{_builddir}/phantomjs-2-1-rhel8 %{buildroot}/usr/bin/phantomjs
%endif
#%if 0%{?suse_version} == 1315
##echo "Build for SLES 12"
#install -D %{_builddir}/phantomjs %{buildroot}/usr/bin/phantomjs
#%endif
export NO_BRP_CHECK_RPATH=true
%post
#mv /opt/phantomjs /usr/bin/phantomjs
chmod +x /usr/bin/phantomjs
%files
%defattr(755,root,root,-)
/usr/bin/phantomjs
%changelog