# # Copyright (C) 2015 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",
]

gstreamer_relative_binary_dir =
  package.package.project_root_dir +
  "gstreamer" +
  package.windows.relative_binary_dir
gstreamer_absolute_binary_dir = gstreamer_relative_binary_dir.expand_path

rcairo_relative_binary_dir =
  package.package.project_root_dir.parent +
  "rcairo.#{package.windows.build_architecture_suffix}" +
  package.windows.relative_binary_dir
rcairo_absolute_binary_dir = rcairo_relative_binary_dir.expand_path

package.external_packages = [
  {
    :name => "libwebp",
    :download_base_url => "http://downloads.webmproject.org/releases/webp",
    :label => "WebP",
    :version => "0.4.3",
    :windows => {
      :built_file => "bin/libwebp-5.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_absolute_binary_dir}",
      ],
      :patches => [
        "libxslt-1.1.28-add-mkdir-fallback.diff",
      ],
    },
  },
  {
    :name => "webkitgtk",
    :download_base_url => "http://webkitgtk.org/releases",
    :label => "WebKitGTK+",
    :version => "2.9.92",
    :compression_method => "xz",
    :windows => {
      :cmake_args => [
        "-DPORT=GTK",
        "-DZLIB_INCLUDE_DIR=#{rcairo_absolute_binary_dir}/include",
        "-DZLIB_LIBRARY=#{rcairo_absolute_binary_dir}/lib",
        "-DPNG_PNG_INCLUDE_DIR=#{rcairo_absolute_binary_dir}/include",
        "-DPNG_LIBRARY=#{rcairo_absolute_binary_dir}/lib",
        "-DJPEG_INCLUDE_DIR=#{gstreamer_absolute_binary_dir}/include",
        "-DJPEG_LIBRARY=#{gstreamer_absolute_binary_dir}/lib",
        "-DFONTCONFIG_INCLUDE_DIR=#{rcairo_absolute_binary_dir}/include",
        "-DFONTCONFIG_LIBRARIES=#{rcairo_absolute_binary_dir}/lib",
        "-DSQLITE_INCLUDE_DIR=#{gstreamer_absolute_binary_dir}/include",
        "-DSQLITE_LIBRARIES=#{gstreamer_absolute_binary_dir}/lib",
        "-DENABLE_PLUGIN_PROCESS_GTK2=OFF",
        "-DENABLE_X11_TARGET=OFF",
        "-DENABLE_GTKDOC=OFF",
        "-DENABLE_CREDENTIAL_STORAGE=OFF",
        "-DENABLE_GEOLOCATION=OFF",
        "-DENABLE_OPENGL=OFF",
        "-DENABLE_SPELLCHECK=OFF",
        "-DUSE_LIBNOTIFY=OFF",
        "-DUSE_LIBHYPHEN=OFF",
        "-DENABLE_API_TESTS=OFF",
      ],
      :patches => [
        "webkitgtk-2.9.92-try-buildable.diff",
      ],
    },
  },
]

end package_task.define

namespace :dependency do

desc "Install depenencies"
task :install do
  # TODO: Install libwebkit2gtk-4.0-37 on Debian.
end

end

task :build => “dependency:install”