# # Copyright (C) 2015-2016 Ruby-GNOME2 Project Team # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

$LOAD_PATH.unshift(“./../glib2/lib”) require “gnome2/rake/package-task”

package_task = GNOME2::Rake::PackageTask.new do |package|

package.summary = "Ruby/WebKit2GTK is a Ruby binding of WebKit2GTK+."
package.description = "Ruby/WebKit2GTK is a Ruby binding of WebKit2GTK+."
package.dependency.gem.runtime = ["gobject-introspection", "gtk3"]
package.windows.packages = []
package.windows.dependencies = []
package.windows.build_dependencies = [
  "glib2",
  "gio2",
  "gobject-introspection",
  "atk",
  "pango",
  "gdk_pixbuf2",
  "gdk3",
  "gstreamer",
]
package.windows.gobject_introspection_dependencies = [
  "gio2",
  "atk",
  "gdk_pixbuf2",
  "pango",
  "gdk3",
  "gstreamer",
]

rcairo_binary_base_dir =
  package.windows_binary_build_task.rcairo_binary_base_dir
glib2_binary_base_dir =
  package.windows_binary_build_task.glib2_binary_base_dir
gstreamer_binary_base_dir =
  package.windows_binary_build_task.binary_base_dir("gstreamer")

package.external_packages = [
  {
    :name => "libwebp",
    :download_base_url => "https://storage.googleapis.com/downloads.webmproject.org/releases/webp",
    :label => "WebP",
    :version => "0.5.1",
    :windows => {
      :built_file => "bin/libwebp-6.dll",
    },
  },
  {
    :name => "libxslt",
    :version => "1.1.28",
    :download_base_url => "ftp://xmlsoft.org/libxslt",
    :compression_method => "gz",
    :windows => {
      :built_file => "bin/libxslt-1.dll",
      :configure_args => [
        "--without-python",
        "--with-libxml-prefix=#{rcairo_binary_base_dir}",
      ],
      :patches => [
        "libxslt-1.1.28-add-mkdir-fallback.diff",
      ],
    },
  },
  {
    :name => "webkitgtk",
    :download_site => :webkitgtk,
    :label => "WebKitGTK+",
    :version => "2.18.0",
    :compression_method => "xz",
    :windows => {
      :build_concurrently => false,
      :cmake_args => [
        "-DPORT=GTK",
        "-DZLIB_INCLUDE_DIR=#{rcairo_binary_base_dir}/include",
        "-DZLIB_LIBRARY=#{rcairo_binary_base_dir}/lib/libzlib.dll.a",
        "-DPNG_PNG_INCLUDE_DIR=#{rcairo_binary_base_dir}/include",
        "-DPNG_LIBRARY=#{rcairo_binary_base_dir}/lib/libpng.dll.a",
        "-DJPEG_INCLUDE_DIR=#{gstreamer_binary_base_dir}/include",
        "-DJPEG_LIBRARY=#{gstreamer_binary_base_dir}/lib/libjpeg.dll.a",
        "-DFONTCONFIG_INCLUDE_DIR=#{rcairo_binary_base_dir}/include",
        "-DFONTCONFIG_LIBRARIES=#{rcairo_binary_base_dir}/lib",
        "-DSQLITE_INCLUDE_DIR=#{gstreamer_binary_base_dir}/include",
        "-DSQLITE_LIBRARIES=#{gstreamer_binary_base_dir}/lib",
        "-DPC_GNUTLS_INCLUDEDIR=#{glib2_binary_base_dir}/include",
        "-DPC_GNUTLS_LIBDIR=#{glib2_binary_base_dir}/lib",
        "-DENABLE_PLUGIN_PROCESS_GTK2=OFF",
        "-DENABLE_X11_TARGET=OFF",
        "-DENABLE_JIT=OFF",
        "-DENABLE_GTKDOC=OFF",
        "-DENABLE_GEOLOCATION=OFF",
        "-DENABLE_OPENGL=OFF",
        "-DENABLE_SPELLCHECK=OFF",
        "-DENABLE_API_TESTS=OFF",
        "-DENABLE_FETCH_API=OFF",
        "-DENABLE_INDEXED_DATABASE=OFF",
        "-DUSE_SYSTEM_MALLOC=ON",
        "-DUSE_LIBNOTIFY=OFF",
        "-DUSE_LIBHYPHEN=OFF",
        "-DUSE_LIBSECRET=OFF",
        "-DADDITIONAL_COMPILER_FLAGS=-D_WIN32_WINNT=0x0601 -DWINVER=0x0601",
      ],
      :patches => [
        "webkitgtk-2.13.4-try-buildable.diff",
      ],
    },
  },
]

end package_task.define