perl/perl-5.8.8-incpush.patch
2006-02-01 15:55:58 +00:00

64 lines
1.9 KiB
Diff

--- perl-5.8.7/perl.c.orig 2005-04-22 17:14:27.000000000 +0300
+++ perl-5.8.7/perl.c 2005-06-17 22:31:31.000000000 +0300
@@ -109,6 +109,7 @@
#endif
static I32 read_e_script(pTHX_ int idx, SV *buf_sv, int maxlen);
+STATIC void incpush_oldversion(pTHX_ char *dir);
#ifdef IAMSUID
#ifndef DOSUID
@@ -4435,6 +4436,7 @@
* DLL-based path intuition to work correctly */
# if !defined(WIN32)
incpush(SITEARCH_EXP, FALSE, FALSE, TRUE);
+ incpush_oldversion(aTHX_ SITEARCH_EXP);
# endif
#endif
@@ -4456,6 +4458,7 @@
* DLL-based path intuition to work correctly */
# if !defined(WIN32)
incpush(PERL_VENDORARCH_EXP, FALSE, FALSE, TRUE);
+ incpush_oldversion(aTHX_ PERL_VENDORARCH_EXP);
# endif
#endif
@@ -4497,6 +4500,36 @@
# define PERLLIB_MANGLE(s,n) (s)
#endif
+#define VERSION_DIRECTORY_STRING "/" STRINGIFY(PERL_REVISION) "." STRINGIFY(PERL_VERSION) "." STRINGIFY(PERL_SUBVERSION)
+STATIC void
+incpush_oldversion(pTHX_ char *dir)
+{
+#ifdef PERL_INC_VERSION_LIST
+ const char *incverlist[] = { PERL_INC_VERSION_LIST };
+ const char **incver;
+ const char *verdir;
+
+ verdir = strstr(dir, VERSION_DIRECTORY_STRING);
+ if (!verdir)
+ return;
+
+ for (incver = incverlist; *incver; incver++) {
+ char *new_dir = malloc(strlen(dir) + strlen(*incver) + 2);
+ char *p = new_dir;
+
+ strcpy(new_dir, dir);
+ p += verdir - dir + 1; /* advance to char following '/' in VERSION_DIRECTORY_STRING */
+ memcpy(p, *incver, strlen(*incver)); /* copy incver there instead */
+ p += strlen(*incver); /* advance past version we just copied */
+ strcpy(p, verdir + strlen(VERSION_DIRECTORY_STRING)); /* and copy the rest of the original dir */
+
+ incpush(new_dir, FALSE, FALSE, FALSE);
+ free(new_dir);
+ }
+#endif
+}
+
+
/* Push a directory onto @INC if it exists.
Generate a new SV if we do this, to save needing to copy the SV we push
onto @INC */