fxruby 1.6.35 → 1.6.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,95 +6,28 @@ require 'mkmf'
6
6
  gem 'mini_portile2', '~>2.1'
7
7
  require 'mini_portile2'
8
8
 
9
- def find_installed_fox_version
10
- stddirs = ["/usr/include/fox-1.6",
11
- "/usr/local/include/fox-1.6",
12
- "/sw/include/fox-1.6",
13
- "/opt/local/include/fox-1.6"]
14
- usrdirs = []
15
- ARGV.each do |arg|
16
- if arg =~ /--with-fox-include/
17
- option, value = arg.split('=')
18
- usrdirs = [ value ] + usrdirs
19
- end
20
- end
21
- incdirs = usrdirs + stddirs
22
- incdirs.uniq! # remove duplicates
23
-
24
- incdirs.each do |incdir|
25
- filename = File.join(incdir, "fxver.h")
26
- if FileTest.exist?(filename)
27
- idircflag = "-I" + incdir
28
- $CPPFLAGS += " " + idircflag unless $CPPFLAGS.split.include?(idircflag)
29
- return
30
- end
31
- end
32
-
33
- # Couldn't find it; this should have been caught by the pre-config script
34
- raise RuntimeError, "couldn't find FOX header files"
35
- end
36
-
37
9
  $autodetected_fxscintilla = false
38
10
 
39
- def find_installed_fxscintilla_version
40
- stddirs = ["/usr/include/fxscintilla",
41
- "/usr/local/include/fxscintilla",
42
- "/sw/include/fxscintilla",
43
- "/opt/local/include/fxscintilla"]
44
- usrdirs = []
45
- ARGV.each do |arg|
46
- if arg =~ /--with-fxscintilla-include/
47
- option, value = arg.split('=')
48
- usrdirs = [ value ] + usrdirs
49
- end
50
- end
51
- incdirs = usrdirs + stddirs
52
- incdirs.uniq! # remove duplicates
53
-
54
- incdirs.each do |incdir|
55
- filename = File.join(incdir, "FXScintilla.h")
56
- if FileTest.exist?(filename)
57
- $autodetected_fxscintilla = true
58
- idircflag = "-I" + incdir
59
- $CPPFLAGS += " " + idircflag unless $CPPFLAGS.split.include?(idircflag)
60
- return
61
- end
62
- end
63
- end
64
-
65
11
  def is_fxscintilla_build?
66
12
  # No means no
67
13
  return false if fxscintilla_support_suppressed?
68
14
 
69
15
  # Check arguments
70
- args = ARGV.delete_if { |e| !(e =~ /--with-fxscintilla/) }
71
- (args.length > 0) || $autodetected_fxscintilla
16
+ with_config("fxscintilla", false) || $autodetected_fxscintilla
72
17
  end
73
18
 
74
19
  def fxscintilla_support_suppressed?
75
- ARGV.include? "--without-fxscintilla"
76
- end
77
-
78
- def with_env(hash)
79
- hash.each do |k, v|
80
- ENV[k] = v
81
- end
82
- begin
83
- yield
84
- ensure
85
- hash.each do |k, v|
86
- ENV.delete(k)
87
- end
88
- end
20
+ !with_config("fxscintilla", true)
89
21
  end
90
22
 
23
+ # Stick at zlib-1.2.7 for compatibility to MSYS1 based RubyInstaller.
91
24
  LIBZ_VERSION = ENV['LIBZ_VERSION'] || '1.2.7.3'
92
25
  LIBZ_SOURCE_URI = "http://zlib.net/fossils/zlib-#{LIBZ_VERSION}.tar.gz"
93
26
 
94
27
  LIBPNG_VERSION = ENV['LIBPNG_VERSION'] || '1.6.26'
95
28
  LIBPNG_SOURCE_URI = "http://prdownloads.sourceforge.net/libpng/libpng-#{LIBPNG_VERSION}.tar.gz"
96
29
 
97
- LIBJPEG_VERSION = ENV['LIBJPEG_VERSION'] || '8d'
30
+ LIBJPEG_VERSION = ENV['LIBJPEG_VERSION'] || '9b'
98
31
  LIBJPEG_SOURCE_URI = "http://www.ijg.org/files/jpegsrc.v#{LIBJPEG_VERSION}.tar.gz"
99
32
 
100
33
  LIBTIFF_VERSION = ENV['LIBTIFF_VERSION'] || '4.0.7'
@@ -105,17 +38,20 @@ LIBFOX_SOURCE_URI = "http://ftp.fox-toolkit.org/pub/fox-#{LIBFOX_VERSION
105
38
 
106
39
  LIBFXSCINTILLA_VERSION = ENV['LIBFXSCINTILLA_VERSION'] || '2.28.0'
107
40
  LIBFXSCINTILLA_SOURCE_URI = "http://download.savannah.gnu.org/releases/fxscintilla/fxscintilla-#{LIBFXSCINTILLA_VERSION}.tar.gz"
41
+ # LIBFXSCINTILLA_VERSION = ENV['LIBFXSCINTILLA_VERSION'] || '3.5.2'
42
+ # LIBFXSCINTILLA_SOURCE_URI = "https://github.com/yetanothergeek/fxscintilla/archive/FXSCINTILLA-#{LIBFXSCINTILLA_VERSION.gsub(".","_")}.tar.gz"
108
43
 
109
44
 
110
45
  class BuildRecipe < MiniPortile
111
46
  def initialize(name, version, files)
112
47
  super(name, version)
113
48
  self.files = files
114
- self.target = File.expand_path('../../../ports', __FILE__)
49
+ rootdir = File.expand_path('../../..', __FILE__)
50
+ self.target = File.join(rootdir, "ports")
115
51
  # Prefer host_alias over host in order to use i586-mingw32msvc as
116
52
  # correct compiler prefix for cross build, but use host if not set.
117
53
  self.host = consolidated_host(RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"])
118
- self.patch_files = Dir[File.join(self.target, "patches", self.name, self.version, "*.diff")].sort
54
+ self.patch_files = Dir[File.join(rootdir, "patches", self.name, self.version, "*.diff")].sort
119
55
  end
120
56
 
121
57
  def consolidated_host(name)
@@ -195,12 +131,11 @@ def do_rake_compiler_setup
195
131
  end
196
132
 
197
133
  libpng_recipe = BuildRecipe.new("libpng", LIBPNG_VERSION, [LIBPNG_SOURCE_URI]).tap do |recipe|
198
- with_env(
199
- 'CPPFLAGS' => "-I#{libz_recipe.path}/include",
200
- 'LDFLAGS' => "-L#{libz_recipe.path}/lib"
201
- ) do
202
- recipe.cook_and_activate
203
- end
134
+ recipe.configure_options += [
135
+ "CPPFLAGS=-I#{libz_recipe.path}/include",
136
+ "LDFLAGS=-L#{libz_recipe.path}/lib",
137
+ ]
138
+ recipe.cook_and_activate
204
139
  end
205
140
 
206
141
  libjpeg_recipe = BuildRecipe.new("libjpeg", LIBJPEG_VERSION, [LIBJPEG_SOURCE_URI]).tap do |recipe|
@@ -212,11 +147,14 @@ def do_rake_compiler_setup
212
147
  end
213
148
 
214
149
  libfox_recipe = BuildRecipe.new("libfox", LIBFOX_VERSION, [LIBFOX_SOURCE_URI]).tap do |recipe|
150
+ debug = enable_config("debug")
215
151
  recipe.configure_options += [
216
152
  "--without-xft",
217
153
  "--without-x",
218
- enable_config("debug") ? "--enable-debug" : "--enable-release",
219
- ]
154
+ debug ? "--enable-debug" : "--enable-release",
155
+ "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" : ""}",
156
+ "LDFLAGS=-L#{libjpeg_recipe.path}/lib -L#{libpng_recipe.path}/lib -L#{libtiff_recipe.path}/lib -L#{libz_recipe.path}/lib #{debug ? "-ggdb" : ""}",
157
+ ]
220
158
  class << recipe
221
159
  def compile
222
160
  # Add param -no-undefined to libtool to build a win32 shared lib
@@ -224,12 +162,7 @@ def do_rake_compiler_setup
224
162
  end
225
163
  end
226
164
 
227
- with_env(
228
- "CPPFLAGS" => "-I#{libjpeg_recipe.path}/include -I#{libpng_recipe.path}/include -I#{libtiff_recipe.path}/include -I#{libz_recipe.path}/include",
229
- "LDFLAGS" => "-L#{libjpeg_recipe.path}/lib -L#{libpng_recipe.path}/lib -L#{libtiff_recipe.path}/lib -L#{libz_recipe.path}/lib"
230
- ) do
231
- recipe.cook_and_activate
232
- end
165
+ recipe.cook_and_activate
233
166
  end
234
167
 
235
168
  libfxscintills_recipe = BuildRecipe.new("libfxscintilla", LIBFXSCINTILLA_VERSION, [LIBFXSCINTILLA_SOURCE_URI]).tap do |recipe|
@@ -239,6 +172,12 @@ def do_rake_compiler_setup
239
172
  "#{ENV['MAKE'] || "make"}"
240
173
  end
241
174
 
175
+ # # This can be uncommented when fxscintilla is used from the source repository.
176
+ # def configure
177
+ # execute "bootstrap", "./bootstrap.sh"
178
+ # super
179
+ # end
180
+
242
181
  def compile
243
182
  execute "compile_lexers", "cd lexers && #{mk}"
244
183
  execute "compile_lexlib", "cd lexlib && #{mk}"
@@ -252,13 +191,11 @@ def do_rake_compiler_setup
252
191
  end
253
192
  recipe.libfox_path = libfox_recipe.path
254
193
 
255
- with_env(
256
- 'PKG_CONFIG_PATH' => "#{libfox_recipe.path}/lib/pkgconfig"
257
- ) do
258
- recipe.cook_and_activate
259
- end
194
+ recipe.configure_options += [
195
+ "PKG_CONFIG_PATH=#{libfox_recipe.path}/lib/pkgconfig",
196
+ ]
197
+ recipe.cook_and_activate
260
198
  end
261
- $autodetected_fxscintilla = true
262
199
 
263
200
  dir_config('libfox', "#{libfox_recipe.path}/include/fox-1.6", "#{libfox_recipe.path}/lib")
264
201
  dir_config('libfxscintilla', "#{libfxscintills_recipe.path}/include/fxscintilla", "#{libfxscintills_recipe.path}/lib")
@@ -276,6 +213,7 @@ def do_rake_compiler_setup
276
213
  CONFIG['CC'] += "\nCXX=#{CONFIG['CXX']}" # Hack CXX into Makefile for cross compilation
277
214
  CONFIG['LDSHARED'].gsub!('gcc', 'g++') # ensure C++ linker is used, so that libstdc++ is linked static
278
215
  $LDFLAGS += " -s" # remove symbol table informations from shared lib
216
+ $libs = append_library($libs, "fxscintilla")
279
217
 
280
218
  elsif RUBY_PLATFORM =~ /mingw/
281
219
  $CFLAGS = $CFLAGS + " -I/usr/local/include"
@@ -305,15 +243,11 @@ def do_rake_compiler_setup
305
243
  $libs = append_library($libs, "FOX-1.6")
306
244
  $INCFLAGS << " -I#{File.join(File.dirname(__FILE__), 'include')}"
307
245
  if is_fxscintilla_build?
308
- FileUtils.move('scintilla_wrap.cpp.bak', 'scintilla_wrap.cpp') if FileTest.exist?('scintilla_wrap.cpp.bak')
309
246
  $CPPFLAGS = $CPPFLAGS + " -DWITH_FXSCINTILLA -DHAVE_FOX_1_6"
310
- find_library("fxscintilla", nil) || find_library(":libfxscintilla.so.19", nil) || ($libs = append_library($libs, "fxscintilla"))
311
- else
312
- FileUtils.move('scintilla_wrap.cpp', 'scintilla_wrap.cpp.bak') if FileTest.exist?('scintilla_wrap.cpp')
313
247
  end
314
248
 
315
249
  checking_for("thread local variables") do
316
- $defs.push( "-DHAVE___THREAD" ) if try_compile(<<-EOT)
250
+ $defs.push( "-DHAVE___THREAD" ) if try_compile <<-EOT
317
251
  __thread int x=1;
318
252
  #if defined(__MINGW32__)
319
253
  #include <windows.h>
@@ -341,7 +275,9 @@ dir_config('fox', '/usr/local/include/fox-1.6', '/usr/local/lib')
341
275
  dir_config('fxscintilla', '/usr/local/include/fxscintilla', '/usr/local/lib')
342
276
 
343
277
  unless enable_config("win32-cross")
344
- find_installed_fox_version
278
+ checking_for "fox per pkg-config" do
279
+ pkg_config("fox")
280
+ end
345
281
 
346
282
  #
347
283
  # Check for FXScintilla header files, unless FXScintilla support has
@@ -349,13 +285,31 @@ unless enable_config("win32-cross")
349
285
  #
350
286
 
351
287
  unless fxscintilla_support_suppressed?
352
- find_installed_fxscintilla_version
288
+ checking_for "fxscintilla per pkg-config" do
289
+ $autodetected_fxscintilla = pkg_config("fxscintilla")
290
+ end
291
+
292
+ unless $autodetected_fxscintilla
293
+ checking_for "fxscintilla on Ubuntu with missing libfxscintilla.so link" do
294
+ if find_library(":libfxscintilla.so.19", nil) && (cflags = RUBY_VERSION>="2.1" ? pkg_config("fxscintilla", "cflags") : `pkg-config --cflags fxscintilla`)
295
+ $CXXFLAGS += " " + cflags
296
+ $autodetected_fxscintilla = true
297
+ end
298
+ end
299
+ end
300
+ end
301
+ checking_for "fxscintilla build" do
302
+ is_fxscintilla_build?
353
303
  end
354
304
  end
355
305
 
356
- unless enable_config("debug")
306
+ if enable_config("debug")
307
+ $CPPFLAGS += " -ggdb"
308
+ $LDFLAGS += " -ggdb"
309
+ else
357
310
  $CPPFLAGS += " -DNDEBUG"
358
311
  end
312
+ $CPPFLAGS += " -Wno-unused-function"
359
313
 
360
314
  # Platform-specific modifications
361
315
  do_rake_compiler_setup
data/ext/fox16_c/impl.cpp CHANGED
@@ -652,6 +652,8 @@ IMPLEMENT_FXWINDOW_STUBS(FXRbMessageBox)
652
652
  IMPLEMENT_FXTOPWINDOW_STUBS(FXRbMessageBox)
653
653
  IMPLEMENT_FXDIALOGBOX_STUBS(FXRbMessageBox)
654
654
 
655
+ /* Start stub implementations for class FXRbObjRegistry */
656
+
655
657
  /* Start stub implementations for class FXRbObject */
656
658
  IMPLEMENT_FXOBJECT_STUBS(FXRbObject)
657
659
 
@@ -0,0 +1,101 @@
1
+ /***********************************************************************
2
+ * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
3
+ * Copyright (c) 2017-2017 by Lyle Johnson. All Rights Reserved.
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ *
19
+ * For further information please contact the author by e-mail
20
+ * at "lars@greiz-reinsdorf.de".
21
+ ***********************************************************************/
22
+
23
+ #ifndef FXRBOBJREGISTRY_H
24
+ #define FXRBOBJREGISTRY_H
25
+
26
+ #include <ruby.h>
27
+ #include "fx.h"
28
+
29
+ extern "C" {
30
+ // Opaque type declaration for SWIG runtime support
31
+ struct swig_type_info;
32
+ }
33
+
34
+ class FXRbObjRegistry {
35
+
36
+ /**
37
+ * The FXRuby_Objects hash table basically maps C++ objects to Ruby instances.
38
+ * Each key in the table is a pointer to a C++ object we've seen before, and
39
+ * the corresponding value is an FXRubyObjDesc struct (see below) that tells
40
+ * us which Ruby instance corresponds to that C++ object.
41
+ */
42
+
43
+ st_table * FXRuby_Objects;
44
+
45
+ /**
46
+ * Each value in the FXRuby_Objects hash table is an instance of this
47
+ * struct. It identifies the Ruby instance associated with a C++ object.
48
+ * It also indicates whether this is merely a "borrowed" reference to
49
+ * some C++ object (i.e. it's not one we need to destroy later).
50
+ *
51
+ * in_gc is set for FXWindows that are in garbage collection and must
52
+ * not call ruby code anymore.
53
+ */
54
+
55
+ enum ObjType { own, borrowed, callback };
56
+
57
+ struct ObjDesc {
58
+ VALUE obj;
59
+ enum ObjType type;
60
+ bool in_gc;
61
+ };
62
+
63
+ const char * safe_rb_obj_classname(VALUE obj);
64
+
65
+ public:
66
+
67
+ FXRbObjRegistry();
68
+
69
+ /**
70
+ * NewBorrowedObj() is a wrapper around SWIG_Ruby_NewPointerObj() that also
71
+ * registers this C++ object & Ruby instance pair in our FXRuby_Objects
72
+ * hash table. This function should only get called for methods that return
73
+ * a reference to an already-existing C++ object (i.e. one that FOX "owns")
74
+ * and for that reason we mark these objects as "borrowed".
75
+ */
76
+ VALUE NewBorrowedObj(void *ptr,swig_type_info* ty);
77
+
78
+ // Register this Ruby class instance
79
+ void RegisterRubyObj(VALUE rubyObj,const void* foxObj);
80
+
81
+ void UnregisterRubyObj(const void* foxObj, bool alsoOwned);
82
+
83
+ /**
84
+ * Return the registered Ruby class instance associated with this
85
+ * FOX object, or Qnil if not found.
86
+ */
87
+ VALUE GetRubyObj(const void *foxObj,bool alsoBorrowed, bool in_gc_mark=false);
88
+
89
+ /**
90
+ * FXRbIsBorrowed() returns true if the specified C++ object is one that
91
+ * FOX owns (i.e. it's borrowed).
92
+ */
93
+ bool IsBorrowed(void* ptr);
94
+
95
+ bool SetInGC(const void* ptr, bool enabled);
96
+ bool IsInGC(const void* ptr);
97
+
98
+ static FXRbObjRegistry main;
99
+ };
100
+
101
+ #endif
@@ -86,7 +86,6 @@ void FXRbRegisterRubyObj(VALUE rubyObj, const void* foxObj);
86
86
  // Remove mapping for this FOX object and zero out any pointers
87
87
  // to this (now dead) C++ object held by any Ruby object
88
88
  void FXRbUnregisterRubyObj(const void* foxObj);
89
- void FXRbUnregisterRubyObj2(const void* foxObj, bool alsoOwned=true);
90
89
  void FXRbUnregisterBorrowedRubyObj(const void* foxObj);
91
90
  void FXRbUnregisterBorrowedRubyObj(FXlong foxObj);
92
91
  void FXRbUnregisterBorrowedRubyObj(FXString& foxObj);
@@ -110,7 +109,7 @@ void FXRbDestroyAppSensitiveObjects();
110
109
  * FOX object (if any). If searchBoth is false, only considers the
111
110
  * Ruby-owned objects; otherwise considers all outstanding references.
112
111
  */
113
- VALUE FXRbGetRubyObj(const void *foxObj, bool searchBoth, bool in_gc=false);
112
+ VALUE FXRbGetRubyObj(const void *foxObj, bool searchBoth, bool in_gc_mark=false);
114
113
 
115
114
  /**
116
115
  * Return the registered Ruby class instance associated with this
@@ -531,7 +531,6 @@ void FXRbTableItem::freefunc(FXTableItem* self){
531
531
 
532
532
 
533
533
  void FXRbTable::markfunc(FXTable* self){
534
- register FXTableItem* item;
535
534
  FXRbScrollArea::markfunc(self);
536
535
  if(self){
537
536
  FXRbGcMark(self->FXTable::getFont());
@@ -539,7 +538,7 @@ void FXRbTable::markfunc(FXTable* self){
539
538
  FXRbGcMark(self->FXTable::getColumnHeaderFont());
540
539
  for(FXint row=0;row<self->FXTable::getNumRows();row++){
541
540
  for(FXint col=0;col<self->FXTable::getNumColumns();col++){
542
- item=self->FXTable::getItem(row,col);
541
+ FXTableItem* item=self->FXTable::getItem(row,col);
543
542
  FXRbGcMark(item);
544
543
  }
545
544
  }
data/fxruby.gemspec ADDED
@@ -0,0 +1,53 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fox16/version'
5
+
6
+ SWIG_MODULES = {
7
+ "core.i" => "core_wrap.cpp",
8
+ "dcmodule.i" => "dc_wrap.cpp",
9
+ "dialogs.i" => "dialogs_wrap.cpp",
10
+ "framesmodule.i" => "frames_wrap.cpp",
11
+ "iconlistmodule.i" => "iconlist_wrap.cpp",
12
+ "icons.i" => "icons_wrap.cpp",
13
+ "image.i" => "image_wrap.cpp",
14
+ "labelmodule.i" => "label_wrap.cpp",
15
+ "layout.i" => "layout_wrap.cpp",
16
+ "listmodule.i" => "list_wrap.cpp",
17
+ "mdi.i" => "mdi_wrap.cpp",
18
+ "menumodule.i" => "menu_wrap.cpp",
19
+ "fx3d.i" => "fx3d_wrap.cpp",
20
+ "scintilla.i" => "scintilla_wrap.cpp",
21
+ "table-module.i" => "table_wrap.cpp",
22
+ "text-module.i" => "text_wrap.cpp",
23
+ "treelist-module.i" => "treelist_wrap.cpp",
24
+ "ui.i" => "ui_wrap.cpp"
25
+ }
26
+
27
+ Gem::Specification.new do |spec|
28
+ spec.name = "fxruby"
29
+ spec.version = Fox.fxrubyversion
30
+ spec.authors = ["Lyle Johnson", "Lars Kanis"]
31
+ spec.email = ["lyle@lylejohnson.name", "lars@greiz-reinsdorf.de"]
32
+
33
+ spec.summary = %q{FXRuby is the Ruby binding to the FOX GUI toolkit.}
34
+ spec.homepage = "http://fxruby.org/"
35
+ spec.license = 'LGPL-2.1'
36
+
37
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
38
+ f=~/^fox-includes|^web/
39
+ end
40
+ spec.files += SWIG_MODULES.values.map{|f| File.join("ext/fox16_c", f) }
41
+ spec.files << 'ext/fox16_c/include/inlinestubs.h'
42
+ spec.files << 'ext/fox16_c/swigruby.h'
43
+ spec.files << 'doap.rdf'
44
+ spec.files << 'lib/fox16/kwargs.rb'
45
+
46
+ spec.bindir = "exe"
47
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
48
+ spec.require_paths = ["lib"]
49
+ spec.extensions = ["ext/fox16_c/extconf.rb"]
50
+ spec.metadata['msys2_mingw_dependencies'] = 'fox'
51
+
52
+ spec.add_runtime_dependency 'mini_portile2', '~> 2.1'
53
+ end