1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
=begin
extconf.rb for Ruby/GtkMozEmbed extention library
=end
PACKAGE_NAME = "gtkmozembed"
PACKAGE_IDS = ["libxul-embedding-unstable",
"xulrunner-gtkmozembed",
"firefox-gtkmozembed",
"seamonkey-gtkmozembed",
"mozilla-gtkmozembed"]
TOPDIR = File.expand_path(File.dirname(__FILE__) + '/..')
MKMF_GNOME2_DIR = TOPDIR + '/glib/src/lib'
SRCDIR = TOPDIR + '/gtkmozembed/src'
$LOAD_PATH.unshift MKMF_GNOME2_DIR
require 'mkmf-gnome2'
package_id = nil
PACKAGE_IDS.each do |v|
if PKGConfig.exist?(v)
package_id = v
$stderr.puts "#{v} is found."
break
else
$stderr.puts "#{v} is not found."
end
end
unless package_id
$stderr.puts "No gtkmozembed is found. Abort."
exit 1
end
#
# detect GTK+ configurations
#
PKGConfig.have_package('gtk+-2.0')
PKGConfig.have_package(package_id)
setup_win32(PACKAGE_NAME)
mozilla_library_path = PKGConfig.libs_only_L(package_id)
mozilla_path = mozilla_library_path.strip.sub(/^-L/, "")
if mozilla_path
# please comment the CFLAGS line if you don't want a default comp_path
$CFLAGS << " -DDEFAULT_MOZILLA_FIVE_HOME='\"#{mozilla_path}\"' "
else
$stderr.puts "${package_id}.pc cannot be found."
exit 1
end
add_depend_package("glib2", "glib/src", TOPDIR)
add_depend_package("gtk2", "gtk/src", TOPDIR)
if have_library("xpcomglue")
have_header("gtkmozembed_glue.cpp") or exit 1
CONFIG['LDSHARED'].gsub!(/\$\(CC\)/, "$(CXX)")
elsif have_library("gtkembedmoz")
have_func('gtk_moz_embed_new') or exit 1
have_func('gtk_moz_embed_set_profile_path') or exit 1
else
exit 1
end
make_version_header("GTKMOZEMBED", package_id)
create_pkg_config_file('Ruby/GtkMozEmbed', package_id)
create_makefile_at_srcdir(PACKAGE_NAME, SRCDIR,
"-DRUBY_GTKMOZEMBED_COMPILATION") do
enum_type_prefix = "gtkmozembed-enum-types"
include_paths = PKGConfig.cflags_only_I(package_id)
include_paths = include_paths.split.collect do |path|
path.strip.sub(/^-I/, '')
end
headers = include_paths.inject([]) do |result, path|
gtkmozembed_h = File.join(path, "gtkmozembed.h")
result += [gtkmozembed_h] if File.exist?(gtkmozembed_h)
result
end
glib_mkenums(enum_type_prefix, headers, "GTK_TYPE_", ["gtkmozembed.h"])
end
create_top_makefile
|