class Object
Constants
- LIBFOX_SOURCE_URI
- LIBFOX_VERSION
- LIBFXSCINTILLA_SOURCE_URI
- LIBFXSCINTILLA_VERSION
- LIBJPEG_SOURCE_URI
- LIBJPEG_VERSION
LIBJPEG_VERSION = ENV || '9b' LIBJPEG_SOURCE_URI = “www.ijg.org/files/jpegsrc.v#{LIBJPEG_VERSION}.tar.gz”
- LIBPNG_SOURCE_URI
- LIBPNG_VERSION
- LIBTIFF_SOURCE_URI
- LIBTIFF_VERSION
- LIBZ_SOURCE_URI
- LIBZ_VERSION
Stick at zlib-1.2.7 for compatibility to MSYS1 based RubyInstaller.
Public Instance Methods
do_rake_compiler_setup()
click to toggle source
# File ext/fox16_c/extconf.rb, line 99 def do_rake_compiler_setup if enable_config("win32-cross") dir_config("installed") libz_recipe = BuildRecipe.new("libz", LIBZ_VERSION, [LIBZ_SOURCE_URI]).tap do |recipe| class << recipe def configure Dir.chdir work_path do mk = File.read 'win32/Makefile.gcc' File.open 'win32/Makefile.gcc', 'wb' do |f| f.puts "BINARY_PATH = #{path}/bin" f.puts "LIBRARY_PATH = #{path}/lib" f.puts "INCLUDE_PATH = #{path}/include" mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-") f.puts mk end end end def configured? Dir.chdir work_path do !! (File.read('win32/Makefile.gcc') =~ /^BINARY_PATH/) end end def compile execute "compile", "make -f win32/Makefile.gcc SHARED_MODE=1" end def install execute "install", "make -f win32/Makefile.gcc install SHARED_MODE=1" end end recipe.cook_and_activate end libpng_recipe = BuildRecipe.new("libpng", LIBPNG_VERSION, [LIBPNG_SOURCE_URI]).tap do |recipe| recipe.configure_options += [ "CPPFLAGS=-I#{libz_recipe.path}/include", "LDFLAGS=-L#{libz_recipe.path}/lib", ] recipe.cook_and_activate end libjpeg_recipe = BuildRecipe.new("libjpeg", LIBJPEG_VERSION, [LIBJPEG_SOURCE_URI]).tap do |recipe| recipe.cook_and_activate end libtiff_recipe = BuildRecipe.new("libtiff", LIBTIFF_VERSION, [LIBTIFF_SOURCE_URI]).tap do |recipe| recipe.cook_and_activate end libfox_recipe = BuildRecipe.new("libfox", LIBFOX_VERSION, [LIBFOX_SOURCE_URI]).tap do |recipe| debug = enable_config("debug") recipe.configure_options += [ "--without-xft", "--without-x", debug ? "--enable-debug" : "--enable-release", "CPPFLAGS=-I#{libjpeg_recipe.path}/include -I#{libpng_recipe.path}/include -I#{libtiff_recipe.path}/include -I#{libz_recipe.path}/include -DUNICODE=1 #{debug ? "-ggdb" : ""}", "LDFLAGS=-L#{libjpeg_recipe.path}/lib -L#{libpng_recipe.path}/lib -L#{libtiff_recipe.path}/lib -L#{libz_recipe.path}/lib #{debug ? "-ggdb" : ""}", ] recipe.cook_and_activate end libfxscintills_recipe = BuildRecipe.new("libfxscintilla", LIBFXSCINTILLA_VERSION, [LIBFXSCINTILLA_SOURCE_URI]).tap do |recipe| class << recipe attr_accessor :libfox_path def mk "#{ENV['MAKE'] || "make"}" end # # This can be uncommented when fxscintilla is used from the source repository. # def configure # execute "bootstrap", "./bootstrap.sh" # super # end def compile execute "compile_lexers", "cd lexers && #{mk}" execute "compile_lexlib", "cd lexlib && #{mk}" execute "compile_src", "cd src && #{mk}" execute "compile_fox", "cd fox && #{mk} libfxscintilla_la_LDFLAGS='-version-info 23:0:3 -export-dynamic -no-undefined -L#{libfox_path}/lib -lFOX-1.6'" end def install execute "install", "cd fox && #{mk} install && cd ../include && #{mk} install" end end recipe.libfox_path = libfox_recipe.path recipe.configure_options += [ "PKG_CONFIG_PATH=#{libfox_recipe.path}/lib/pkgconfig", ] recipe.cook_and_activate end dir_config('libfox', "#{libfox_recipe.path}/include/fox-1.6", "#{libfox_recipe.path}/lib") dir_config('libfxscintilla', "#{libfxscintills_recipe.path}/include/fxscintilla", "#{libfxscintills_recipe.path}/lib") gcc_shared_dlls = %w[libwinpthread-1.dll libgcc_s_dw2-1.dll libgcc_s_sjlj-1.dll libgcc_s_seh-1.dll libstdc++-6.dll] gcc_shared_dlls.each do |dll| cmd = "#{CONFIG['CC']} -print-file-name=\"#{dll}\"" res = `#{cmd}`.chomp next if dll == res puts "#{cmd} => #{res}" FileUtils.cp `#{cmd}`.chomp, "#{libfox_recipe.path}/bin/", verbose: true end CONFIG['CXX'] = "#{libfox_recipe.host}-g++" # CXX setting must be prefixed for cross build CONFIG['CC'] += "\nCXX=#{CONFIG['CXX']}" # Hack CXX into Makefile for cross compilation CONFIG['LDSHARED'].gsub!('gcc', 'g++') # ensure C++ linker is used, so that libstdc++ is linked static $LDFLAGS += " -s" # remove symbol table informations from shared lib $libs = append_library($libs, "fxscintilla") elsif RUBY_PLATFORM =~ /mingw/ $CFLAGS = $CFLAGS + " -I/usr/local/include" $LDFLAGS = $LDFLAGS + " -I/usr/local/lib" %w{stdc++ glu32 opengl32 wsock32 comctl32 mpr gdi32 winspool}.each {|lib| $libs = append_library($libs, lib) } elsif RUBY_PLATFORM =~ /darwin/ $CFLAGS = $CFLAGS + " -I/usr/X11/include" # for built-in libpng $LDFLAGS = $LDFLAGS + " -L/usr/X11/lib" # for built-in libpng $CFLAGS = $CFLAGS + " -I/usr/local/include" # for libjpeg and libtiff $LDFLAGS = $LDFLAGS + " -L/usr/local/lib" # for libjpeg and libtiff %w{Xft}.each {|lib| $libs = append_library($libs, lib) } end $libs = append_library($libs, "stdc++") unless RUBY_PLATFORM =~ /mingw/ || enable_config("win32-static-build") have_header("sys/time.h") unless RUBY_PLATFORM =~ /mingw/ || enable_config("win32-static-build") have_header("signal.h") have_library("z", "deflate") have_library("png", "png_create_read_struct") have_library("jpeg", "jpeg_mem_init") have_library("tiff", "TIFFSetErrorHandler") have_library("Xft", "XftInit") find_library("Xext", "XShmQueryVersion", "/usr/X11R6/lib") find_library("X11", "XFindContext", "/usr/X11R6/lib") find_library("GL", "glXCreateContext", "/usr/X11R6/lib") find_library("GLU", "gluNewQuadric", "/usr/X11R6/lib") $libs = append_library($libs, "Xrandr") unless RUBY_PLATFORM =~ /mingw/ || enable_config("win32-static-build") $libs = append_library($libs, "Xcursor") unless RUBY_PLATFORM =~ /mingw/ || enable_config("win32-static-build") $libs = append_library($libs, "FOX-1.6") $INCFLAGS << " -I#{File.join(File.dirname(__FILE__), 'include')}" if is_fxscintilla_build? $CPPFLAGS = $CPPFLAGS + " -DWITH_FXSCINTILLA -DHAVE_FOX_1_6" end checking_for("thread local variables") do $defs.push( "-DHAVE___THREAD" ) if try_compile <<-EOT __thread int x=1; #if defined(__MINGW32__) #include <windows.h> #if !defined(__MINGW64_VERSION_MAJOR) #error "Old mingw32 compiler doesn't implement thread local variables properly." #endif #endif EOT end && have_func('rb_thread_call_without_gvl') && have_func('rb_thread_call_with_gvl') have_func('rb_during_gc') end
enum(start, count)
click to toggle source
Enumeration
# File lib/fox16/responder.rb, line 2 def enum(start, count) (start...(start+count)).to_a end
fxscintilla_support_suppressed?()
click to toggle source
# File ext/fox16_c/extconf.rb, line 19 def fxscintilla_support_suppressed? !with_config("fxscintilla", true) end
is_fxscintilla_build?()
click to toggle source
# File ext/fox16_c/extconf.rb, line 11 def is_fxscintilla_build? # No means no return false if fxscintilla_support_suppressed? # Check arguments with_config("fxscintilla", false) || $autodetected_fxscintilla end
missingDependency(msg)
click to toggle source
This is a little helper function used by some of the examples to report missing dependencies information on startup. It's especially useful for the Windows distribution since people will often start the examples by double- clicking on an icon instead of running from the command line.
# File lib/fox16/missingdep.rb, line 6 def missingDependency(msg) app = Fox::FXApp.new("Dummy", "FoxTest") app.init(ARGV) mainWindow = Fox::FXMainWindow.new(app, "") app.create Fox::FXMessageBox.error(mainWindow, Fox::MBOX_OK, "Dependencies Missing", msg) raise SystemExit end