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 89 90 91 92 93 94 95
|
#!/usr/bin/env ruby
# vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 :
require 'pathname'
require 'English'
require 'mkmf'
require 'fileutils'
require "pkg-config"
checking_for(checking_message("GCC")) do
if macro_defined?("__GNUC__", "")
$CFLAGS += ' -Wall'
true
else
false
end
end
package = "cairo"
module_name = "cairo"
major, minor, micro = 1, 2, 0
def required_pkg_config_package(package_info, native_package_info=nil)
if package_info.is_a?(Array)
required_package_info = package_info
else
required_package_info = [package_info]
end
return true if PKGConfig.have_package(*required_package_info)
native_package_info ||= {}
PKGConfig.have_package(*required_package_info)
end
unless required_pkg_config_package([package, major, minor, micro],
:alpine_linux => "cairo-dev",
:alt_linux => [
"bzlib-devel",
"libXdmcp-devel",
"libbrotli-devel",
"libcairo-devel",
"libexpat-devel",
"libpixman-devel",
],
:arch_linux => "cairo",
:conda => [
"cairo",
"xorg-libxau",
"xorg-libxext",
"xorg-libxrender",
"xorg-xproto",
],
:debian => "libcairo2-dev",
:gentoo_linux => "cairo",
:homebrew => "cairo",
:macports => "cairo",
:msys2 => "cairo",
:redhat => "cairo-devel")
exit(false)
end
PKGConfig.have_package("cairo-ft")
checking_for(checking_message("macOS")) do
case RUBY_PLATFORM
when /darwin/
if have_macro("CAIRO_HAS_QUARTZ_SURFACE", ["cairo.h"])
checking_for("RubyCocoa") do
begin
require "osx/cocoa"
$defs << "-DHAVE_RUBY_COCOA"
$DLDFLAGS << " -Wl,-framework,RubyCocoa"
true
rescue LoadError
false
end
end
end
true
else
false
end
end
$defs << "-DRB_CAIRO_COMPILATION"
have_header("ruby/st.h") unless have_macro("HAVE_RUBY_ST_H", "ruby.h")
have_header("ruby/io.h") unless have_macro("HAVE_RUBY_IO_H", "ruby.h")
have_func("rb_errinfo", "ruby.h")
have_func("rb_gc_adjust_memory_usage", "ruby.h")
have_type("enum ruby_value_type", "ruby.h")
create_makefile(module_name)
|