]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.043
- new
[packages/vim.git] / 7.3.043
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.043
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.043
11 Problem:    Can't load Ruby dynamically on Unix.
12 Solution:   Adjust the configure script. (James Vega)
13 Files:      src/Makefile, src/config.h.in, src/configure.in,
14             src/auto/configure, src/if_ruby.c
15
16
17 *** ../vim-7.3.042/src/Makefile 2010-08-16 21:59:00.000000000 +0200
18 --- src/Makefile        2010-10-27 16:46:41.000000000 +0200
19 ***************
20 *** 414,425 ****
21 --- 414,429 ----
22   # However, this may still cause problems, such as "import termios" failing.
23   # Build two separate versions of Vim in that case.
24   #CONF_OPT_PYTHON = --enable-pythoninterp
25 + #CONF_OPT_PYTHON = --enable-pythoninterp=dynamic
26   #CONF_OPT_PYTHON3 = --enable-python3interp
27 + #CONF_OPT_PYTHON3 = --enable-python3interp=dynamic
28   
29   # RUBY
30   # Uncomment this when you want to include the Ruby interface.
31 + # First one for static linking, second one for loading when used.
32   # Note: you need the development package (e.g., ruby1.9.1-dev on Ubuntu).
33   #CONF_OPT_RUBY = --enable-rubyinterp
34 + #CONF_OPT_RUBY = --enable-rubyinterp=dynamic
35   #CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
36   
37   # TCL
38 ***************
39 *** 1047,1054 ****
40   INSTALL_DATA  = cp
41   INSTALL_DATA_R        = cp -r
42   
43 ! ### Program to run on installed binary
44   #STRIP = strip
45   
46   ### Permissions for binaries  {{{1
47   BINMOD = 755
48 --- 1051,1059 ----
49   INSTALL_DATA  = cp
50   INSTALL_DATA_R        = cp -r
51   
52 ! ### Program to run on installed binary.  Use the second one to disable strip.
53   #STRIP = strip
54 + #STRIP = /bin/true
55   
56   ### Permissions for binaries  {{{1
57   BINMOD = 755
58 ***************
59 *** 1321,1327 ****
60   .SUFFIXES: .c .o .pro
61   
62   PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
63 ! POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
64   
65   ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
66   
67 --- 1326,1332 ----
68   .SUFFIXES: .c .o .pro
69   
70   PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
71 ! POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(EXTRA_DEFS)
72   
73   ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
74   
75 ***************
76 *** 1329,1335 ****
77   # with "-E".
78   OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS)
79   
80 ! LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
81   
82   LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
83   
84 --- 1334,1340 ----
85   # with "-E".
86   OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS)
87   
88 ! LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(RUBY_CFLAGS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
89   
90   LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
91   
92 ***************
93 *** 2532,2538 ****
94         $(CCC) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) -o $@ if_python3.c
95   
96   objects/if_ruby.o: if_ruby.c
97 !       $(CCC) -o $@ if_ruby.c
98   
99   objects/if_sniff.o: if_sniff.c
100         $(CCC) -o $@ if_sniff.c
101 --- 2537,2543 ----
102         $(CCC) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) -o $@ if_python3.c
103   
104   objects/if_ruby.o: if_ruby.c
105 !       $(CCC) $(RUBY_CFLAGS) -o $@ if_ruby.c
106   
107   objects/if_sniff.o: if_sniff.c
108         $(CCC) -o $@ if_sniff.c
109 *** ../vim-7.3.042/src/config.h.in      2010-08-15 21:57:32.000000000 +0200
110 --- src/config.h.in     2010-10-27 16:21:24.000000000 +0200
111 ***************
112 *** 349,354 ****
113 --- 349,357 ----
114   /* Define if you want to include the Ruby interpreter. */
115   #undef FEAT_RUBY
116   
117 + /* Define for linking via dlopen() or LoadLibrary() */
118 + #undef DYNAMIC_RUBY
119
120   /* Define if you want to include the Tcl interpreter. */
121   #undef FEAT_TCL
122   
123 *** ../vim-7.3.042/src/configure.in     2010-08-15 21:57:28.000000000 +0200
124 --- src/configure.in    2010-10-27 16:20:53.000000000 +0200
125 ***************
126 *** 1299,1308 ****
127   
128   AC_MSG_CHECKING(--enable-rubyinterp argument)
129   AC_ARG_ENABLE(rubyinterp,
130 !       [  --enable-rubyinterp     Include Ruby interpreter.], ,
131         [enable_rubyinterp="no"])
132   AC_MSG_RESULT($enable_rubyinterp)
133 ! if test "$enable_rubyinterp" = "yes"; then
134     AC_MSG_CHECKING(--with-ruby-command argument)
135     AC_ARG_WITH(ruby-command, [  --with-ruby-command=RUBY  name of the Ruby command (default: ruby)],
136         RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
137 --- 1299,1308 ----
138   
139   AC_MSG_CHECKING(--enable-rubyinterp argument)
140   AC_ARG_ENABLE(rubyinterp,
141 !       [  --enable-rubyinterp[=OPTS]     Include Ruby interpreter.  [default=no] [OPTS=no/yes/dynamic]], ,
142         [enable_rubyinterp="no"])
143   AC_MSG_RESULT($enable_rubyinterp)
144 ! if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
145     AC_MSG_CHECKING(--with-ruby-command argument)
146     AC_ARG_WITH(ruby-command, [  --with-ruby-command=RUBY  name of the Ruby command (default: ruby)],
147         RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
148 ***************
149 *** 1360,1365 ****
150 --- 1360,1371 ----
151         RUBY_OBJ="objects/if_ruby.o"
152         RUBY_PRO="if_ruby.pro"
153         AC_DEFINE(FEAT_RUBY)
154 +       if test "$enable_rubyinterp" = "dynamic"; then
155 +         libruby=`$vi_cv_path_ruby -r rbconfig -e 'printf "lib%s.%s\n", Config::CONFIG[["RUBY_SO_NAME"]], Config::CONFIG[["DLEXT"]]'`
156 +         AC_DEFINE(DYNAMIC_RUBY)
157 +         RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
158 +         RUBY_LIBS=
159 +       fi
160         else
161         AC_MSG_RESULT(not found; disabling Ruby)
162         fi
163 *** ../vim-7.3.042/src/auto/configure   2010-08-15 21:57:27.000000000 +0200
164 --- src/auto/configure  2010-10-27 16:28:10.000000000 +0200
165 ***************
166 *** 1427,1433 ****
167     --enable-pythoninterp=OPTS   Include Python interpreter. default=no OPTS=no/yes/dynamic
168     --enable-python3interp=OPTS   Include Python3 interpreter. default=no OPTS=no/yes/dynamic
169     --enable-tclinterp      Include Tcl interpreter.
170 !   --enable-rubyinterp     Include Ruby interpreter.
171     --enable-cscope         Include cscope interface.
172     --enable-workshop       Include Sun Visual Workshop support.
173     --disable-netbeans      Disable NetBeans integration support.
174 --- 1427,1433 ----
175     --enable-pythoninterp=OPTS   Include Python interpreter. default=no OPTS=no/yes/dynamic
176     --enable-python3interp=OPTS   Include Python3 interpreter. default=no OPTS=no/yes/dynamic
177     --enable-tclinterp      Include Tcl interpreter.
178 !   --enable-rubyinterp=OPTS     Include Ruby interpreter.  default=no OPTS=no/yes/dynamic
179     --enable-cscope         Include cscope interface.
180     --enable-workshop       Include Sun Visual Workshop support.
181     --disable-netbeans      Disable NetBeans integration support.
182 ***************
183 *** 6103,6109 ****
184   
185   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5
186   $as_echo "$enable_rubyinterp" >&6; }
187 ! if test "$enable_rubyinterp" = "yes"; then
188     { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5
189   $as_echo_n "checking --with-ruby-command argument... " >&6; }
190   
191 --- 6103,6109 ----
192   
193   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5
194   $as_echo "$enable_rubyinterp" >&6; }
195 ! if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
196     { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5
197   $as_echo_n "checking --with-ruby-command argument... " >&6; }
198   
199 ***************
200 *** 6209,6214 ****
201 --- 6209,6221 ----
202         RUBY_PRO="if_ruby.pro"
203         $as_echo "#define FEAT_RUBY 1" >>confdefs.h
204   
205 +       if test "$enable_rubyinterp" = "dynamic"; then
206 +         libruby=`$vi_cv_path_ruby -r rbconfig -e 'printf "lib%s.%s\n", Config::CONFIG["RUBY_SO_NAME"], Config::CONFIG["DLEXT"]'`
207 +         $as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h
208
209 +         RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
210 +         RUBY_LIBS=
211 +       fi
212         else
213         { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found; disabling Ruby" >&5
214   $as_echo "not found; disabling Ruby" >&6; }
215 *** ../vim-7.3.042/src/if_ruby.c        2010-10-23 14:02:48.000000000 +0200
216 --- src/if_ruby.c       2010-10-27 16:40:27.000000000 +0200
217 ***************
218 *** 14,19 ****
219 --- 14,21 ----
220   #include <stdio.h>
221   #include <string.h>
222   
223 + #include "auto/config.h"
224
225   #ifdef _WIN32
226   # if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18)
227   #   define NT
228 ***************
229 *** 48,60 ****
230   #  define RUBY_EXPORT
231   # endif
232   
233 ! #if !(defined(WIN32) || defined(_WIN64))
234   # include <dlfcn.h>
235 ! # define HANDLE void*
236   # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
237   # define symbol_from_dll dlsym
238   # define close_dll dlclose
239   #else
240   # define load_dll vimLoadLib
241   # define symbol_from_dll GetProcAddress
242   # define close_dll FreeLibrary
243 --- 50,64 ----
244   #  define RUBY_EXPORT
245   # endif
246   
247 ! #ifndef WIN3264
248   # include <dlfcn.h>
249 ! # define HINSTANCE void*
250 ! # define RUBY_PROC void*
251   # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
252   # define symbol_from_dll dlsym
253   # define close_dll dlclose
254   #else
255 + # define RUBY_PROC FARPROC
256   # define load_dll vimLoadLib
257   # define symbol_from_dll GetProcAddress
258   # define close_dll FreeLibrary
259 ***************
260 *** 174,180 ****
261 --- 178,186 ----
262   #define rb_lastline_get                       dll_rb_lastline_get
263   #define rb_lastline_set                       dll_rb_lastline_set
264   #define rb_load_protect                       dll_rb_load_protect
265 + #ifndef RUBY19_OR_LATER
266   #define rb_num2long                   dll_rb_num2long
267 + #endif
268   #define rb_num2ulong                  dll_rb_num2ulong
269   #define rb_obj_alloc                  dll_rb_obj_alloc
270   #define rb_obj_as_string              dll_rb_obj_as_string
271 ***************
272 *** 186,191 ****
273 --- 192,200 ----
274   #ifdef rb_str_new2
275   /* Ruby may #define rb_str_new2 to use rb_str_new_cstr. */
276   # define need_rb_str_new_cstr 1
277 + /* Ruby's headers #define rb_str_new_cstr to make use of GCC's
278 +  * __builtin_constant_p extension. */
279 + # undef rb_str_new_cstr
280   # define rb_str_new_cstr              dll_rb_str_new_cstr
281   #else
282   # define rb_str_new2                  dll_rb_str_new2
283 ***************
284 *** 206,214 ****
285   #endif
286   #define ruby_init                     dll_ruby_init
287   #define ruby_init_loadpath            dll_ruby_init_loadpath
288 ! #define NtInitialize                  dll_NtInitialize
289 ! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
290 ! # define rb_w32_snprintf              dll_rb_w32_snprintf
291   #endif
292   
293   #ifdef RUBY19_OR_LATER
294 --- 215,225 ----
295   #endif
296   #define ruby_init                     dll_ruby_init
297   #define ruby_init_loadpath            dll_ruby_init_loadpath
298 ! #ifdef WIN3264
299 ! # define NtInitialize                 dll_NtInitialize
300 ! # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
301 ! #  define rb_w32_snprintf             dll_rb_w32_snprintf
302 ! # endif
303   #endif
304   
305   #ifdef RUBY19_OR_LATER
306 ***************
307 *** 283,289 ****
308 --- 294,305 ----
309   #endif
310   static void (*dll_ruby_init) (void);
311   static void (*dll_ruby_init_loadpath) (void);
312 + #ifdef WIN3264
313   static void (*dll_NtInitialize) (int*, char***);
314 + # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
315 + static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
316 + # endif
317 + #endif
318   #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
319   static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
320   static VALUE (*dll_rb_float_new) (double);
321 ***************
322 *** 293,301 ****
323   #ifdef RUBY19_OR_LATER
324   static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
325   #endif
326 - #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
327 - static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
328 - #endif
329   
330   #ifdef RUBY19_OR_LATER
331   static void (*dll_ruby_script) (const char*);
332 --- 309,314 ----
333 ***************
334 *** 317,328 ****
335   }
336   #endif
337   
338 ! static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
339   
340   /*
341    * Table of name to function pointer of ruby.
342    */
343 - #define RUBY_PROC FARPROC
344   static struct
345   {
346       char *name;
347 --- 330,340 ----
348   }
349   #endif
350   
351 ! static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
352   
353   /*
354    * Table of name to function pointer of ruby.
355    */
356   static struct
357   {
358       char *name;
359 ***************
360 *** 387,401 ****
361   #endif
362       {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
363       {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
364       {
365 ! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
366       "NtInitialize",
367 ! #else
368       "ruby_sysinit",
369 ! #endif
370                         (RUBY_PROC*)&dll_NtInitialize},
371 ! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
372       {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
373   #endif
374   #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
375       {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
376 --- 399,415 ----
377   #endif
378       {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
379       {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
380 + #ifdef WIN3264
381       {
382 ! # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
383       "NtInitialize",
384 ! # else
385       "ruby_sysinit",
386 ! # endif
387                         (RUBY_PROC*)&dll_NtInitialize},
388 ! # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
389       {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
390 + # endif
391   #endif
392   #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
393       {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
394 ***************
395 *** 424,430 ****
396       if (hinstRuby)
397       {
398         close_dll(hinstRuby);
399 !       hinstRuby = 0;
400       }
401   }
402   
403 --- 438,444 ----
404       if (hinstRuby)
405       {
406         close_dll(hinstRuby);
407 !       hinstRuby = NULL;
408       }
409   }
410   
411 ***************
412 *** 454,460 ****
413                         ruby_funcname_table[i].name)))
414         {
415             close_dll(hinstRuby);
416 !           hinstRuby = 0;
417             if (verbose)
418                 EMSG2(_(e_loadfunc), ruby_funcname_table[i].name);
419             return FAIL;
420 --- 468,474 ----
421                         ruby_funcname_table[i].name)))
422         {
423             close_dll(hinstRuby);
424 !           hinstRuby = NULL;
425             if (verbose)
426                 EMSG2(_(e_loadfunc), ruby_funcname_table[i].name);
427             return FAIL;
428 ***************
429 *** 936,944 ****
430         return line ? vim_str2rb_enc_str(line) : Qnil;
431       }
432       rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
433 - #ifndef __GNUC__
434       return Qnil; /* For stop warning */
435 - #endif
436   }
437   
438   static VALUE buffer_aref(VALUE self, VALUE num)
439 --- 950,956 ----
440 *** ../vim-7.3.042/src/version.c        2010-10-27 16:17:56.000000000 +0200
441 --- src/version.c       2010-10-27 16:45:28.000000000 +0200
442 ***************
443 *** 716,717 ****
444 --- 716,719 ----
445   {   /* Add new patch number below this line */
446 + /**/
447 +     43,
448   /**/
449
450 -- 
451 ARTHUR:        A scratch?  Your arm's off!
452 BLACK KNIGHT:  No, it isn't.
453 ARTHUR:        Well, what's that then?
454 BLACK KNIGHT:  I've had worse.
455                                   The Quest for the Holy Grail (Monty Python)
456
457  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
458 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
459 \\\        download, build and distribute -- http://www.A-A-P.org        ///
460  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.08336 seconds and 3 git commands to generate.