Hi,

2013/12/2 Mon 6:46:09 UTC+9 Cesar wrote:

> Actually you don't need to modify any file, except Make_cyg.mak.
> I managed to build vim under cygwin with strawberry perl 5.18.1.1, using
> only the makefile patch:
> 
> --- C:\vim\Make_cyg.mak
> +++ C:\vim\Make_cyg.mak
> @@ -155,6 +155,7 @@
> ifeq (yes, $(DYNAMIC_PERL))
> DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
> +EXTRA_LIBS += $(PERL)/lib/CORE/libperl$(PERL_VER).a
> else
> -EXTRA_LIBS += $(PERL)/lib/CORE/perl$(PERL_VER).lib
> +EXTRA_LIBS += $(PERL)/lib/CORE/libperl$(PERL_VER).a
> endif
> endif

It's only true if you use MinGW-w64 compiler (i686-w64-mingw32-gcc) and
Perl 5.18.1.  Your patch cause a link error when using ActivePerl 5.16.
Maybe it's better to use the options -L and -l instead of specifying the
actual library file like perlXXX.lib or libperlXXX.a.
Gauchyler's if_perl.xs is needed when using MSVC, and also my patch for
C:\Perl\lib\CORE\config.h is needed.
My patch for C:\Perl\lib\CORE\sys\socket.h is needed when using non-w64 MinGW
(i686-pc-mingw32-gcc).

I wrote another patch based on Gauchyler's patch.  I think the patch 7.3.1198
is not needed after applying his patch.  I also fixed the following problem
in his patch:

> * However, even if the definition of Perl_croak_xs_usage is brought back in 
> * if_perl.xs, the compiler complains about too few arguments for calling 
> * croak_xs_usage and dll_Perl_croak_xs_usage. DO NOT know why.

This is because Perl-5.18 has a different Perl_croak_xs_usage signature.
Please check the attached patch: support-perl5.18.patch

1. If you use MinGW-w64 (i686-w64-mingw32-gcc or maybe x86_64-w64-mingw32-gcc):
   * Apply support-perl5.18.patch.  That's enough.
2. If you use MinGW (i686-pc-mingw32-gcc):
   * Apply support-perl5.18.patch.
   * Apply my previous patch for C:\Perl\lib\CORE\sys\socket.h.
3. If you use MSVC:
   * Apply support-perl5.18.patch.
   * Apply my previous patch for C:\Perl\lib\CORE\config.h.

Additionally, I wrote a patch to fix indents: fix-indent-in-if_perl.patch

Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
# HG changeset patch
# Parent 486655e0c5a21469364d3cf895535137f09b3724

diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak
--- a/src/Make_cyg.mak
+++ b/src/Make_cyg.mak
@@ -155,7 +155,7 @@
 ifeq (yes, $(DYNAMIC_PERL))
 DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
 else
-EXTRA_LIBS += $(PERL)/lib/CORE/perl$(PERL_VER).lib
+EXTRA_LIBS += -L $(PERL)/lib/CORE -lperl$(PERL_VER)
 endif
 endif
 
diff --git a/src/if_perl.xs b/src/if_perl.xs
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -14,7 +14,8 @@
 #define IN_PERL_FILE	/* don't include if_perl.pro from proto.h */
 
 /*
- * Currently 32-bit version of ActivePerl is built with VC6.
+ * Currently 32-bit version of ActivePerl is built with VC6 (or MinGW since
+ * ActivePerl 5.18).
  * (http://community.activestate.com/faq/windows-compilers-perl-modules)
  * It means that time_t should be 32-bit. However the default size of
  * time_t is 64-bit since VC8. So we have to define _USE_32BIT_TIME_T.
@@ -23,6 +24,11 @@
 # define _USE_32BIT_TIME_T
 #endif
 
+/* Work around for perl-5.18.
+ * Don't include "perl\lib\CORE\inline.h" for now,
+ * include it after Perl_sv_free2 is defined. */
+#define PERL_NO_INLINE_FUNCTIONS
+
 #include "vim.h"
 
 #include <EXTERN.h>
@@ -81,10 +87,6 @@
 # define PERL5101_OR_LATER
 #endif
 
-#if (PERL_REVISION == 5) && (PERL_VERSION >= 18)
-# define PERL5180_OR_LATER
-#endif
-
 #ifndef pTHX
 #    define pTHX void
 #    define pTHX_
@@ -145,11 +147,9 @@
 # define perl_free dll_perl_free
 # define Perl_get_context dll_Perl_get_context
 # define Perl_croak dll_Perl_croak
-# ifndef PERL5180_OR_LATER
 # ifdef PERL5101_OR_LATER
 #  define Perl_croak_xs_usage dll_Perl_croak_xs_usage
 # endif
-# endif
 # ifndef PROTO
 #  define Perl_croak_nocontext dll_Perl_croak_nocontext
 #  define Perl_call_argv dll_Perl_call_argv
@@ -262,10 +262,13 @@
 static int (*perl_parse)(PerlInterpreter*, XSINIT_t, int, char**, char**);
 static void* (*Perl_get_context)(void);
 static void (*Perl_croak)(pTHX_ const char*, ...);
-#ifndef PERL5180_OR_LATER
 #ifdef PERL5101_OR_LATER
+/* Perl-5.18 has a different Perl_croak_xs_usage signature. */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 18)
+static void (*Perl_croak_xs_usage)(const CV *const, const char *const params);
+# else
 static void (*Perl_croak_xs_usage)(pTHX_ const CV *const, const char *const params);
-#endif
+# endif
 #endif
 static void (*Perl_croak_nocontext)(const char*, ...);
 static I32 (*Perl_dowantarray)(pTHX);
@@ -337,7 +340,12 @@
 static XPV** (*Perl_TXpv_ptr)(register PerlInterpreter*);
 static STRLEN* (*Perl_Tna_ptr)(register PerlInterpreter*);
 #else
+/* Perl-5.18 has a different Perl_sv_free2 signature. */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 18)
+static void (*Perl_sv_free2)(pTHX_ SV*, const U32);
+# else
 static void (*Perl_sv_free2)(pTHX_ SV*);
+# endif
 static void (*Perl_sys_init)(int* argc, char*** argv);
 static void (*Perl_sys_term)(void);
 static void (*Perl_call_list)(pTHX_ I32, AV*);
@@ -384,11 +392,9 @@
     {"perl_parse", (PERL_PROC*)&perl_parse},
     {"Perl_get_context", (PERL_PROC*)&Perl_get_context},
     {"Perl_croak", (PERL_PROC*)&Perl_croak},
-#ifndef PERL5180_OR_LATER
 #ifdef PERL5101_OR_LATER
     {"Perl_croak_xs_usage", (PERL_PROC*)&Perl_croak_xs_usage},
 #endif
-#endif
     {"Perl_croak_nocontext", (PERL_PROC*)&Perl_croak_nocontext},
     {"Perl_dowantarray", (PERL_PROC*)&Perl_dowantarray},
     {"Perl_free_tmps", (PERL_PROC*)&Perl_free_tmps},
@@ -492,6 +498,14 @@
     {"", NULL},
 };
 
+/* Work around for perl-5.18.
+ * The definitions of S_SvREFCNT_inc and S_SvREFCNT_dec are needed, so include
+ * "perl\lib\CORE\inline.h", after Perl_sv_free2 is defined.
+ * The linker won't complain about undefined __impl_Perl_sv_free2. */
+#if (PERL_REVISION == 5) && (PERL_VERSION >= 18)
+# include <inline.h>
+#endif
+
 /*
  * Make all runtime-links of perl.
  *
# HG changeset patch
# Parent 0c7f80ded4aa721dab0f8a9322dcce8993e977e6
diff --git a/src/if_perl.xs b/src/if_perl.xs
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -124,17 +124,17 @@
 #endif
 
 #ifndef WIN3264
-#include <dlfcn.h>
-#define HANDLE void*
-#define PERL_PROC void*
-#define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
-#define symbol_from_dll dlsym
-#define close_dll dlclose
+# include <dlfcn.h>
+# define HANDLE void*
+# define PERL_PROC void*
+# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
+# define symbol_from_dll dlsym
+# define close_dll dlclose
 #else
-#define PERL_PROC FARPROC
-#define load_dll vimLoadLib
-#define symbol_from_dll GetProcAddress
-#define close_dll FreeLibrary
+# define PERL_PROC FARPROC
+# define load_dll vimLoadLib
+# define symbol_from_dll GetProcAddress
+# define close_dll FreeLibrary
 #endif
 /*
  * Wrapper defines
@@ -174,10 +174,10 @@
 # define Perl_stack_grow dll_Perl_stack_grow
 # define Perl_set_context dll_Perl_set_context
 # if (PERL_REVISION == 5) && (PERL_VERSION >= 14)
-# define Perl_sv_2bool_flags dll_Perl_sv_2bool_flags
-# define Perl_xs_apiversion_bootcheck dll_Perl_xs_apiversion_bootcheck
+#  define Perl_sv_2bool_flags dll_Perl_sv_2bool_flags
+#  define Perl_xs_apiversion_bootcheck dll_Perl_xs_apiversion_bootcheck
 # else
-# define Perl_sv_2bool dll_Perl_sv_2bool
+#  define Perl_sv_2bool dll_Perl_sv_2bool
 # endif
 # define Perl_sv_2iv dll_Perl_sv_2iv
 # define Perl_sv_2mortal dll_Perl_sv_2mortal
@@ -193,10 +193,10 @@
 # else
 #  define Perl_sv_catpvn dll_Perl_sv_catpvn
 # endif
-#ifdef PERL589_OR_LATER
+# ifdef PERL589_OR_LATER
 #  define Perl_sv_2iv_flags dll_Perl_sv_2iv_flags
 #  define Perl_newXS_flags dll_Perl_newXS_flags
-#endif
+# endif
 # define Perl_sv_free dll_Perl_sv_free
 # if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
 #  define Perl_sv_free2 dll_Perl_sv_free2

Raspunde prin e-mail lui