%define 	add_to_doc_files()	\
	mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}; \
	cp -p %1  %{buildroot}%{_docdir}/%{name}-%{version}/$(echo '%1' | sed -e 's!/!.!g') \
	echo %%{_docdir}/%{name}-%{version}/$(echo '%1' | sed -e 's!/!.!g') >> docfiles.list

#define		svn_revision	43436

# --with coverage: Enables compile-time checking of code coverage. (default: no)
%bcond_with	coverage
# --with jit: Enable JIT ("just-in-time") JavaScript compiling support.
#%bcond_with	jit
# --with pango : use pango for font rendering instead of freetype2 (default: use freetype2)
%bcond_with	pango
# --with wml: Build support for WML
%bcond_with	wml

Name:		WebKit
Version:	2.4.11
Release:	1%{?_dist_release}
Summary:	Web content engine library
Summary(ja):	ウェブコンテンツエンジンライブラリ

Group:		Development/Libraries
License:	LGPLv2+ and BSD
URL:		http://webkitgtk.org/

Vendor: Project Vine
Distribution: Vine Linux
Packager: yasumichi, Takemikaduchi

Source0:	http://www.webkitgtk.org/webkitgtk-%{version}.tar.xz

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires:	bison
BuildRequires:	flex
BuildRequires:	gperf
BuildRequires:	ruby
BuildRequires:	gtk2-devel
BuildRequires:	harfbuzz-icu-devel
BuildRequires:	libjpeg-turbo-devel
BuildRequires:	libtool
BuildRequires:	libxslt-devel
BuildRequires:	libXt-devel
BuildRequires:	pcre-devel
BuildRequires:	sqlite3-devel
BuildRequires:  geoclue-devel
BuildRequires:  gcr-devel
BuildRequires:  gstreamer1-devel
BuildRequires:  gstreamer1-plugins-base-devel
BuildRequires:  enchant-devel
BuildRequires:  libwebp-devel
BuildRequires:  libsecret-devel
BuildRequires:  gobject-introspection-devel
BuildRequires:  gsettings-desktop-schemas
BuildRequires:  gtk-doc
%if %{with pango}
BuildRequires:  pango-devel
%else
BuildRequires:  cairo-devel
BuildRequires:  fontconfig-devel
BuildRequires:  freetype2-devel
%endif
BuildRequires:  libsoup-devel >= 2.28.2


%description
WebKit is an open source web browser engine.

%package	gtk
Summary:	GTK+ port of WebKit
Summary(ja):	WebKit の GTK+ ポート
Group:		Development/Libraries
Provides:		webkitgtk = %{version}-%{release}

%description	gtk
%{name} is an open-source Web content engine library. This package contains
the shared libraries for the WebKit GTK+ port as well as the sample
GtkLauncher tool.


%package	gtk-devel
Summary:	Development package for %{name}
Summary(ja):	%{name} の開発パッケージ
Group:		Development/Libraries
Provides:	webkitgtk-devel = %{version}-%{release}

Requires:	%{name}-gtk = %{version}-%{release}
Requires:	pkgconfig
Requires:	gtk2-devel
Requires:	libsoup-devel >= 2.28.2

%description	gtk-devel
The %{name}-gtk-devel package contains libraries, build data, and header
files for developing applications that use %{name}-gtk.
Please note that the WebKit/GTK+ API is not yet stable. This should
only be used as a "preview" rather than a stable platform library.


%package	docs
Summary:	Documentation for %{name}
Summary(ja):	%{name} のドキュメント
Group:		Documentation
Provides:	webkitgtk-docs = %{version}-%{release}
Provides:	%{name}-doc = %{version}-%{release}

%description	docs
%{name} is an open-source Web content engine library. This package contains
the documentation for %{name}, including various LICENSE, README, and
AUTHORS files.


%prep
%setup -q -n webkitgtk-%{version}

%build
%configure \
--with-gtk=2.0 \
--disable-webkit2 \
--enable-icon-database \
--enable-jit \
--enable-geolocation \
--enable-introspection=yes \
--enable-webgl \
--enable-dependency-tracking \
%{?with_coverage:       --enable-coverage               }       \
%{?with_pango:          --with-font-backend=pango       }       \
%{?with_wml:            --enable-wml                    }

make %{?_smp_mflags}

# workaround for bug 488112
# Compile libJavaScriptCore.a with -fno-strict-aliasing
##touch JavaScriptCore/AllInOneFile.cpp
##make %{?_smp_mflags} CXXFLAGS="%{optflags} -fno-strict-aliasing"


%install
rm -rf %{buildroot}

make install DESTDIR=%{buildroot}
install -d -m 755 %{buildroot}%{_libexecdir}/%{name}
install -m 755 Programs/GtkLauncher %{buildroot}%{_libexecdir}/%{name}

# Finally, copy over and rename the various files for %%doc inclusion.
%add_to_doc_files Source/WebKit/LICENSE
%add_to_doc_files Source/WebKit/gtk/NEWS
%add_to_doc_files Source/WebCore/icu/LICENSE
%add_to_doc_files Source/WebCore/LICENSE-APPLE
%add_to_doc_files Source/WebCore/LICENSE-LGPL-2
%add_to_doc_files Source/WebCore/LICENSE-LGPL-2.1
%add_to_doc_files Source/JavaScriptCore/COPYING.LIB
%add_to_doc_files Source/JavaScriptCore/THANKS
%add_to_doc_files Source/JavaScriptCore/AUTHORS
%add_to_doc_files Source/JavaScriptCore/icu/README

%find_lang WebKitGTK-2.0

%clean
rm -rf %{buildroot}


%post	gtk -p /sbin/ldconfig

%posttrans gtk
glib-compile-schemas %{_datadir}/glib-2.0/schemas ||:

%postun	gtk 
/sbin/ldconfig
if [ $1 -eq 0 ] ; then
    glib-compile-schemas %{_datadir}/glib-2.0/schemas ||:
fi


# %files -f webkit.lang gtk
%files gtk -f WebKitGTK-2.0.lang
%defattr(-,root,root,-)
%doc
%{_libdir}/*.so.*
%{_libexecdir}/WebKit/
%{_bindir}/jsc-1
%{_libdir}/girepository-1.0/*.typelib
#%{_datadir}/glib-2.0/schemas/org.webkitgtk-1.0.gschema.xml
%{_datadir}/webkitgtk-1.0/*

%files	gtk-devel
%defattr(-,root,root,-)
%exclude %{_libdir}/*.la
%{_includedir}/webkitgtk-1.0
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_datadir}/gir-1.0/*.gir

%files	docs -f docfiles.list
%defattr(-,root,root,-)
%{_datadir}/gtk-doc/html/webkitgtk
%{_datadir}/gtk-doc/html/webkitdomgtk


%changelog
* Sun Apr 24 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.11-1
- new usptream release

* Sat Oct 31 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.9-2
- rebuild with icu-56.1

* Fri May 22 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.9-1
- new usptream release

* Sun Jan 11 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.8-1
- new usptream release

* Sun Oct 26 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.7-1
- new usptream release

* Sun Aug 31 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.5-1
- new upstream release

* Wed Jul 09 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.4-1
- new upstream release

* Wed Jun 11 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.3-1
- new upstream release

* Wed May 14 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.2-1
- new upstream release

* Sat Apr 19 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.1-1
- new upstream release

* Sat Mar 29 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4.0-1
- new upstream release

* Sat Jan 25 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.2.4-1
- new upstream release

* Mon Dec 30 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.2.3-2
- rebuild with icu-52.1

* Sun Dec 08 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.2.3-1
- new upstream release

* Sun Nov 24 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.2.2-1
- new upstream release

* Sat Oct 26 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.2.1-1
- new upstream release
- add BuildRequires:  libwebp-devel, libsecret-devel
- change BuildRequires: harfbuzz-icu-devel instead of libicu-devel
- change BuildRequires: gstreamer1-devel instead of gstreamer-devel
- change BuildRequires: gstreamer1-plugins-base-devel instead of gstreamer-plugins-base-devel

* Wed Jan 02 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.10.2-1
- new upstream release

* Wed Oct 17 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.10.1-1
- new upstream release

* Sat Sep 29 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.10.0-1
- new upstream release
- add BuildRequires: ruby

* Tue Aug 28 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.8.3-1
- new upstream release

* Thu Aug 16 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.8.2-1
- new upstream release

* Sun Apr 29 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.8.1-1
- new upstream release
- change BuildRequires: gcr-devel instead of gnome-keyring-devel
- add BuildRequires:  gsettings-desktop-schemas, gtk-doc

* Wed Sep 28 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.6.1-1
- new upstream release

* Fri Sep 23 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.5.90-1
- new upstream release

* Sat Aug 27 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.5.2-1
- new upstream release

* Sun Aug 14 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.5.1-1
- new upstream release

* Sun Jul 03 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.4.2-1
- new upstream release
- delete Patch0
- add BuildRequires: gtk-doc

* Fri Apr 08 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.2.7-1
- new upstream release

* Sat Jan 29 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.2.6-1
- new upstream release

* Sat Oct 09 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.2.5-1
- new upstream release
- add BuildRequires: gobject-introspection-devel
- add configure option (--enable-introspection=yes)
- add Patch0 (WebKit-1.2.5-gir.patch)

* Thu Sep 23 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.2.4-1
- new upstream release (built with rpm-4.8.1-1 for pkg-config file)
- changed BuildRequires: libjpeg-devel to libjpeg-turbo-devel

* Sun Aug 01 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.2.3-1
- new upstream release
- add Requires: libsoup-devel (devel package)
- fix configure (remove unrecognized option)
- drop Patch100

* Wed Apr 14 2010 MATSUBAYASHI Kohji <shaoliN@vinelinux.org> - 1.2.0-2
- rebuilt again on ppc

* Sun Apr 11 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.2.0-1
- new upstream release
- rebuilt with libicu-4.4
- added Patch100 for compiling with libicu-4.4
- s/sqlite-devel/sqlite3-devel/
- s/freetype-devel/freetype2-devel/

* Mon Jan 25 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.1.18-1
- updated to 1.1.18

* Fri Nov 06 2009 Yasumichi Akahoshi <yasumichi@vinelinux.org> 1.1.15.3-2
- change BR from libsoup to libsoup-devel

* Tue Nov 03 2009 Yasumichi Akahoshi <yasumichi@vinelinux.org> 1.1.15.3-1
- new upstream release.
- add Vendor, Distribution and Packager.

* Mon Jul 27 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.1.10-1
- update to webkit-1.1.10 release version
- added BuildRequires:  enchant-devel

* Sun May 10 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.1.6-1
- update to webkit-1.1.6 release version

* Thu Mar 26 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.0-8.svn41944
- update to new upstream snapshot (svn r41944)

* Mon Feb 02 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.0-7.svn40471
- update to new upstream snapshot (svn r40471)

* Tue Sep 30 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.0-6.svn37056
- update to new upstream snapshot (svn r37056)
- disable html5video by default

* Sat Sep 27 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.0-5.svn36882
- update to new upstream snapshot (svn r36882)
- build with gnome-2.24

* Thu Sep 04 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.0-4.svn36053
- build without pango by default.

* Wed Sep 03 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.0-3.svn36053
- update to new upstream snapshot (svn r36053)

* Sun Aug 24 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.0-2.svn34655
- update to new upstream snapshot (svn r34655)

* Mon Jun 16 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 	1.0.0-1.svn34279
- initial build for Vine Linux

* Tue Jun  3 2008 Caol叩n McNamara <caolanm@redhat.com> - 1.0.0-0.12.svn34279
- rebuild for new icu

* Tue Jun  3 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.0.0-0.11.svn34279
- Update to new upstream snapshot (SVN 34279) anyway
- Add BR: libXt-devel

* Tue Apr 29 2008 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.10.svn32531
- Remove the -Qt subpackage stuff. QtWebKit is now included in Qt proper, as
  of qt-4.4.0-0.6.rc1. (We no longer need separate build-qt and build-gtk
  subdirectories either.)
- Reference: bug 442200 (RFE: WebKit Migration)
- Add libjpeg dependency (was previously pulled in by the qt4-devel dependency
  tree).

* Mon Apr 28 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.0.0-0.9.svn32531
- Update to new upstream snapshot (SVN 32531).
- Fix bug 443048 and hopefully fix bug 444445
- Modify the process of building GTK+ port a bit
- on qt port WebKit/qt/Plugins is not built for qt >= 4.4.0

* Sat Apr 12 2008 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.8.svn31787
- Update to new upstream snapshot (SVN 31787).
- Resolves: CVE-2008-1010 (bug 438532: Arbitrary code execution) and
  CVE-2008-1011 (bug 438531: Cross-Site Scripting).
- Switch to using autotools for building the GTK+ port.

* Wed Mar 05 2008 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.7.svn30667
- Fix the WebKitGtk pkgconfig data (should depend on gtk+-2.0). Resolves
  bug 436073 (Requires: gtk+-2.0 missing from WebKitGtk.pc).
- Thanks to Mamoru Tasaka for helping find and squash these many bugs. 
  
* Sat Mar 01 2008 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.6.svn30667
- Fix include directory naming. Resolves: bug 435561 (Header file <> header
  file location mismatch)
- Remove qt4-devel runtime dependency and .prl file from WebKit-gtk-devel.
  Resolves: bug 433138 (WebKit-gtk-devel has a requirement on qt4-devel) 

* Fri Feb 29 2008 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.5.svn30667
- Update to new upstream snapshot (SVN 30667)
- Add some build fixes for GCC 4.3:
  + gcc43.patch

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.0.0-0.5.svn29336
- Autorebuild for GCC 4.3

* Wed Jan 09 2008 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.4.svn29336
- Update to new upstream snapshot (SVN 29336).
- Drop TCSpinLock pthread workaround (fixed upstream):
  - TCSpinLock-use-pthread-stubs.patch

* Thu Dec 06 2007 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.3.svn28482
- Add proper %%defattr line to qt, qt-devel, and doc subpackages.
- Add patch to forcibly build the TCSpinLock code using the pthread
  implementation:
  + TCSpinLock-use-pthread-stubs.patch

* Thu Dec 06 2007 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.2.svn28482
- Package renamed from WebKitGtk.
- Update to SVN 28482.
- Build both the GTK and Qt ports, putting each into their own respective
  subpackages.
- Invoke qmake-qt4 and make directly (with SMP build flags) instead of using
  the build-webkit script from upstream.
- Add various AUTHORS, README, and LICENSE files (via the doc subpackage). 

* Tue Dec 04 2007 Peter Gordon <peter@thecodergeek.com> 1.0.0-0.1.svn28383
- Initial packaging for Fedora.
