From 6bdfdf540b8f52d0d33aac596ecde9455199c7b6 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Jul 13 2017 14:12:54 +0000 Subject: bundle webkitgtk (#1375812) --- diff --git a/.gitignore b/.gitignore index 1d9bf78..bf1ab45 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /gnucash-2.6.17.tar.bz2 +/webkitgtk-2.4.11.tar.xz diff --git a/gnucash-webkit.patch b/gnucash-webkit.patch new file mode 100644 index 0000000..572e071 --- /dev/null +++ b/gnucash-webkit.patch @@ -0,0 +1,134 @@ +diff -up gnucash-2.6.17/configure.foo gnucash-2.6.17/configure +--- gnucash-2.6.17/configure.foo 2017-07-10 22:16:35.894106443 -0400 ++++ gnucash-2.6.17/configure 2017-07-10 22:19:39.317530206 -0400 +@@ -23454,105 +23454,6 @@ $as_echo "$with_html_engine" >&6; } + ;; + + webkit) +- +- succeeded=no +- +- if test -z "$PKG_CONFIG"; then +- # Extract the first word of "pkg-config", so it can be a program name with args. +-set dummy pkg-config; ac_word=$2 +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +-$as_echo_n "checking for $ac_word... " >&6; } +-if ${ac_cv_path_PKG_CONFIG+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- case $PKG_CONFIG in +- [\\/]* | ?:[\\/]*) +- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. +- ;; +- *) +- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +-for as_dir in $PATH +-do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +- fi +-done +- done +-IFS=$as_save_IFS +- +- test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" +- ;; +-esac +-fi +-PKG_CONFIG=$ac_cv_path_PKG_CONFIG +-if test -n "$PKG_CONFIG"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +-$as_echo "$PKG_CONFIG" >&6; } +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +- +- +- fi +- +- if test "$PKG_CONFIG" = "no" ; then +- echo "*** The pkg-config script could not be found. Make sure it is" +- echo "*** in your path, or set the PKG_CONFIG environment variable" +- echo "*** to the full path to pkg-config." +- echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." +- else +- pkg_config_min_version=0.9.0 +- if $PKG_CONFIG --atleast-pkgconfig-version $pkg_config_min_version; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for webkit-1.0 >= \"1.2\"" >&5 +-$as_echo_n "checking for webkit-1.0 >= \"1.2\"... " >&6; } +- +- if $PKG_CONFIG --silence-errors --exists "webkit-1.0 >= "1.2"" ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-$as_echo "yes" >&6; } +- succeeded=yes +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking WEBKIT_CFLAGS" >&5 +-$as_echo_n "checking WEBKIT_CFLAGS... " >&6; } +- WEBKIT_CFLAGS=`$PKG_CONFIG --cflags "webkit-1.0 >= "1.2""` +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WEBKIT_CFLAGS" >&5 +-$as_echo "$WEBKIT_CFLAGS" >&6; } +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking WEBKIT_LIBS" >&5 +-$as_echo_n "checking WEBKIT_LIBS... " >&6; } +- WEBKIT_LIBS=`$PKG_CONFIG --libs "webkit-1.0 >= "1.2""` +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WEBKIT_LIBS" >&5 +-$as_echo "$WEBKIT_LIBS" >&6; } +- else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +- WEBKIT_CFLAGS="" +- WEBKIT_LIBS="" +- ## If we have a custom action on failure, don't print errors, but +- ## do set a variable so people can do so. +- WEBKIT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "webkit-1.0 >= "1.2"" 2>&1` +- echo $WEBKIT_PKG_ERRORS +- fi +- +- +- +- else +- echo "*** Your version of pkg-config is too old. You need version $pkg_config_min_version or newer." +- echo "*** See http://www.freedesktop.org/software/pkgconfig" +- fi +- fi +- +- if test $succeeded = yes; then +- : +- else +- as_fn_error $? "Library requirements (webkit-1.0 >= \"1.2\") not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." "$LINENO" 5 +- fi +- + ;; + + *) as_fn_error $? "Invalid HTML engine: must be webkit" "$LINENO" 5 ;; +diff -up gnucash-2.6.17/src/html/Makefile.in.foo gnucash-2.6.17/src/html/Makefile.in +--- gnucash-2.6.17/src/html/Makefile.in.foo 2017-07-02 14:50:42.000000000 -0400 ++++ gnucash-2.6.17/src/html/Makefile.in 2017-07-10 22:16:35.890106412 -0400 +@@ -552,7 +552,8 @@ libgncmod_html_la_LIBADD = \ + ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \ + ${top_builddir}/src/app-utils/libgncmod-app-utils.la \ + $(top_builddir)/lib/libc/libc-missing.la \ +- ${WEBKIT_LIBS} \ ++ ${top_builddir}/webkitgtk-2.4.11/libjavascriptcoregtk-1.0.la \ ++ ${top_builddir}/webkitgtk-2.4.11/libwebkitgtk-1.0.la \ + ${GTK_LIBS} \ + ${GLIB_LIBS} \ + ${DB_LIBS} \ +diff -up gnucash-2.6.17/src/html/gnc-html-webkit.c.cow gnucash-2.6.17/src/html/gnc-html-webkit.c +--- gnucash-2.6.17/src/html/gnc-html-webkit.c.cow 2017-07-11 23:47:07.175542657 -0400 ++++ gnucash-2.6.17/src/html/gnc-html-webkit.c 2017-07-11 23:47:16.821580424 -0400 +@@ -39,7 +39,7 @@ + #include + #include + +-#include ++#include "webkit/webkit.h" + + #include "Account.h" + #include "gnc-prefs.h" diff --git a/gnucash.spec b/gnucash.spec index bf11146..e297fde 100644 --- a/gnucash.spec +++ b/gnucash.spec @@ -2,13 +2,13 @@ Name: gnucash Summary: Finance management application Version: 2.6.17 URL: http://gnucash.org/ -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: Applications/Productivity Source: http://downloads.sourceforge.net/sourceforge/gnucash/gnucash-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: perl-generators -BuildRequires: webkitgtk-devel, libxml2 >= 2.5.10, libxslt-devel, zlib-devel +BuildRequires: libxml2 >= 2.5.10, libxslt-devel, zlib-devel BuildRequires: libgsf-devel >= 1.12.2, goffice-devel < 0.9, swig BuildRequires: libglade2-devel >= 2.4, libgnomecanvas-devel BuildRequires: libofx-devel, aqbanking-devel, guile-devel >= 5:2.0 @@ -28,6 +28,53 @@ Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig Obsoletes: gnucash-backend-postgres +%global build_bundled_webkitgtk 1 +%if %{build_bundled_webkitgtk} +# Bundled webkitgtk fun +## NOTE: Lots of files in various subdirectories have the same name (such as +## "LICENSE") so this short macro allows us to distinguish them by using their +## directory names (from the source tree) as prefixes for the files. +%global add_to_doc_files() \ + mkdir -p %{buildroot}%{_pkgdocdir}-%{version}/webkitgtk ||: ; \ + cp -p %1 %{buildroot}%{_pkgdocdir}-%{version}/webkitgtk/$(echo '%1' | sed -e 's!/!.!g') + +Source100: webkitgtk-2.4.11.tar.xz +Patch101: webkitgtk-2.4.9-abs.patch +Patch102: gnucash-webkit.patch + +BuildRequires: bison +BuildRequires: chrpath +BuildRequires: enchant-devel +BuildRequires: flex +BuildRequires: geoclue2-devel +BuildRequires: gettext +BuildRequires: gperf +BuildRequires: gstreamer1-devel +BuildRequires: gstreamer1-plugins-base-devel +BuildRequires: gtk2-devel >= 2.24.10 +BuildRequires: glib2-devel >= 2.36.0 +BuildRequires: harfbuzz-devel +BuildRequires: libsoup-devel >= 2.42.0 +BuildRequires: libicu-devel +BuildRequires: libjpeg-devel +BuildRequires: libsecret-devel +BuildRequires: libwebp-devel +BuildRequires: libxslt-devel +BuildRequires: libXt-devel +BuildRequires: pcre-devel +BuildRequires: sqlite-devel +BuildRequires: mesa-libGL-devel +BuildRequires: gtk-doc +BuildRequires: ruby rubypick rubygems +BuildRequires: cairo-devel +BuildRequires: cairo-gobject-devel +BuildRequires: fontconfig-devel >= 2.5 +BuildRequires: freetype-devel +Requires: geoclue2 +%else +BuildRequires: webkitgtk-devel +%endif + %description GnuCash is a personal finance manager. A check-book like register GUI allows you to enter and track bank accounts, stocks, income and even @@ -38,9 +85,78 @@ balanced books. %prep %setup -q find src/quotes -name "*.in" -exec sed -i "s|use lib '@-PERLINCL-@';||g" {} \; +%if %{build_bundled_webkitgtk} +%patch102 -p1 + +tar -xf %{SOURCE100} +cd webkitgtk-2.4.11 +patch -p1 < %{PATCH101} +cd .. +%endif %build -autoconf +%if %{build_bundled_webkitgtk} + +cd webkitgtk-2.4.11 +flags="%{optflags}" + +# Use linker flags to reduce memory consumption +flags="$flags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads" + +# Decrease debuginfo verbosity to reduce memory consumption even more +flags="$(echo $flags | sed 's/-g //')" + +%ifarch ppc +# Use linker flag -relax to get WebKit build under ppc(32) with JIT disabled +flags="$flags -Wl,-relax" +%endif + +%ifarch s390 s390x ppc %{power64} aarch64 %{mips} +flags="$flags -DENABLE_YARR_JIT=0" +%endif + +# Workaround crashes with gcc 6.1 +flags="$flags -fno-delete-null-pointer-checks" + +unset CFLAGS; export CFLAGS="$flags" +unset CXXFLAGS; export CXXFLAGS="$flags" + +%configure \ + --libdir=%{_libdir}/gnucash \ + --with-gtk=2.0 \ + --disable-webkit2 \ +%ifarch s390 s390x ppc %{power64} aarch64 %{mips} + --disable-jit \ +%else + --enable-jit \ +%endif + --disable-introspection + +mkdir -p DerivedSources/webkit +mkdir -p DerivedSources/WebCore +mkdir -p DerivedSources/ANGLE +mkdir -p DerivedSources/WebKit2/webkit2gtk/webkit2 +mkdir -p DerivedSources/WebKit2 +mkdir -p DerivedSources/webkitdom/ +mkdir -p DerivedSources/InjectedBundle +mkdir -p DerivedSources/Platform + +make %{_smp_mflags} V=1 + + +unset CFLAGS +unset CXXFLAGS + +# Install here for includedir for gnucash build +make install DESTDIR=$(pwd)/webkitinstall +cd .. +for item in webkitgtk-2.4.11/webkitinstall/usr/include/webkitgtk-1.0/* ; do + mv $item . +done + + +%endif + sed -i 's|get_python_lib(0|get_python_lib(1|g' configure %configure --enable-error-on-warning=no \ --enable-ofx \ @@ -52,16 +168,52 @@ sed -i 's|get_python_lib(0|get_python_lib(1|g' configure --docdir=%{_datadir}/doc/gnucash-%{version} \ --enable-python -#sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool -#sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -#sed -i 's|^link_all_deplibs=no|link_all_deplibs=unknown|g' libtool - -make +%if %{build_bundled_webkitgtk} +make WEBKIT_CFLAGS="-pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include" %{_smp_mflags} +%else +make %{_smp_mflags} +%endif %install -rm -rf $RPM_BUILD_ROOT +%if %{build_bundled_webkitgtk} +cd webkitgtk-2.4.11 make install DESTDIR=$RPM_BUILD_ROOT +install -d -m 755 %{buildroot}%{_libexecdir}/%{name} +install -m 755 Programs/GtkLauncher %{buildroot}%{_libexecdir}/%{name} + +# Remove lib64 rpaths +chrpath --delete %{buildroot}%{_bindir}/jsc-1 +chrpath --delete %{buildroot}%{_libdir}/gnucash/libwebkitgtk-1.0.so +chrpath --delete %{buildroot}%{_libexecdir}/%{name}/GtkLauncher + +# Remove .la files +find $RPM_BUILD_ROOT%{_libdir} -name "*.la" -delete + +%find_lang WebKitGTK-2.0 + +## 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 +%add_to_doc_files Source/JavaScriptCore/icu/LICENSE +rm -rf $RPM_BUILD_ROOT/%{_libdir}/gnucash/pkgconfig +rm -rf $RPM_BUILD_ROOT/%{_datadir}/gtk-doc +rm -rf $RPM_BUILD_ROOT/%{_bindir}/jsc-1 + +cd .. +%endif + + +make install DESTDIR=$RPM_BUILD_ROOT + # Update the screenshot shown in the software center # @@ -73,7 +225,11 @@ if appstream-util --help | grep -q replace-screenshots ; then appstream-util replace-screenshots $RPM_BUILD_ROOT%{_datadir}/appdata/gnucash.appdata.xml \ https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/gnucash/a.png fi + %find_lang %{name} +%if %{build_bundled_webkitgtk} +cat webkitgtk-2.4.11/WebKitGTK-2.0.lang >> %{name}.lang +%endif # vfolder desktop file install stuff mkdir -p $RPM_BUILD_ROOT/%{_datadir}/applications/ @@ -132,8 +288,14 @@ fi %{_mandir}/man*/* %{python_sitearch}/gnucash %config(noreplace) %{_sysconfdir}/gnucash/* +%if %{build_bundled_webkitgtk} +%{_datadir}/webkitgtk-1.0 +%endif %changelog +* Mon Jul 10 2017 Bill Nottingham - 2.6.17-2 +- bundle webkitgtk (#1375812) + * Mon Jul 3 2017 Bill Nottingham - 2.6.17-1 - update to 2.6.17 diff --git a/sources b/sources index 98a78be..4e67b00 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (gnucash-2.6.17.tar.bz2) = 086f31644e29eaf4360db48124e3760d28ea186ef638bcdb6091db1acecb9641932777ac2969331c93d9aec0cd428a04f555e96b1b4e643e07905b86cb6209ca +SHA512 (webkitgtk-2.4.11.tar.xz) = 2e2cf01a52b8593765a0a3c2d7f0ad306121660019eb402226bd2826c7d4666dab4e91ca6ccbd29abe0ad3993549f256ed1ab88de22e9c8516d5f40a4edd6bfb diff --git a/webkitgtk-2.4.9-abs.patch b/webkitgtk-2.4.9-abs.patch new file mode 100644 index 0000000..9a1c5f9 --- /dev/null +++ b/webkitgtk-2.4.9-abs.patch @@ -0,0 +1,26 @@ +diff -Nur webkitgtk-2.4.9.orig/Source/WebCore/platform/gtk/GtkClickCounter.cpp webkitgtk-2.4.9/Source/WebCore/platform/gtk/GtkClickCounter.cpp +--- webkitgtk-2.4.9.orig/Source/WebCore/platform/gtk/GtkClickCounter.cpp 2015-05-20 03:03:24.000000000 -0600 ++++ webkitgtk-2.4.9/Source/WebCore/platform/gtk/GtkClickCounter.cpp 2016-02-07 11:30:42.392686308 -0700 +@@ -85,8 +85,8 @@ + guint32 eventTime = getEventTime(event); + + if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) +- || ((abs(buttonEvent->x - m_previousClickPoint.x()) < doubleClickDistance) +- && (abs(buttonEvent->y - m_previousClickPoint.y()) < doubleClickDistance) ++ || ((fabs(buttonEvent->x - m_previousClickPoint.x()) < doubleClickDistance) ++ && (fabs(buttonEvent->y - m_previousClickPoint.y()) < doubleClickDistance) + && (eventTime - m_previousClickTime < static_cast(doubleClickTime)) + && (buttonEvent->button == m_previousClickButton))) + m_currentClickCount++; +diff -Nur webkitgtk-2.4.9.orig/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp webkitgtk-2.4.9/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp +--- webkitgtk-2.4.9.orig/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2015-05-20 03:03:24.000000000 -0600 ++++ webkitgtk-2.4.9/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2016-02-07 11:49:36.384691005 -0700 +@@ -659,7 +659,7 @@ + if (!std::isfinite(time)) + return String::fromUTF8(_("indefinite time")); + +- int seconds = static_cast(abs(time)); ++ int seconds = static_cast(fabs(time)); + int days = seconds / (60 * 60 * 24); + int hours = seconds / (60 * 60); + int minutes = (seconds / 60) % 60;