From 4ea817c67acbb0637159d692922fa81954793ad9 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Mon, 6 Mar 2000 06:31:55 +0000 Subject: [PATCH] vendorlib support for Windows; regen win32/config* p4raw-id: //depot/perl@5574 --- README.win32 | 14 +++++++++----- iperlsys.h | 11 +++++++++-- perl.c | 2 +- win32/config.bc | 6 ++++++ win32/config.gc | 6 ++++++ win32/config.vc | 6 ++++++ win32/config_H.bc | 20 +++++++++++++++++++- win32/config_H.gc | 20 +++++++++++++++++++- win32/config_H.vc | 20 +++++++++++++++++++- win32/config_h.PL | 4 ++-- win32/perlhost.h | 16 ++++++++++++---- win32/win32.c | 48 ++++++++++++++++++++++++++++++++++-------------- win32/win32.h | 6 ++++-- 13 files changed, 146 insertions(+), 33 deletions(-) diff --git a/README.win32 b/README.win32 index 830e129..b39961b 100644 --- a/README.win32 +++ b/README.win32 @@ -275,14 +275,16 @@ C and C. Entries in the former override entries in the latter. One or more of the following entries (of type REG_SZ or REG_EXPAND_SZ) may be set: - lib-$] version-specific path to add to @INC - lib path to add to @INC - sitelib-$] version-specific path to add to @INC - sitelib path to add to @INC + lib-$] version-specific standard library path to add to @INC + lib standard library path to add to @INC + sitelib-$] version-specific site library path to add to @INC + sitelib site library path to add to @INC + vendorlib-$] version-specific vendor library path to add to @INC + vendorlib vendor library path to add to @INC PERL* fallback for all %ENV lookups that begin with "PERL" Note the C<$]> in the above is not literal. Substitute whatever version -of perl you want to honor that entry, e.g. C<5.00502>. Paths must be +of perl you want to honor that entry, e.g. C<5.6.0>. Paths must be separated with semicolons, as usual on win32. =item File Globbing @@ -407,6 +409,8 @@ CPAN: http://www.perl.com/CPAN/authors/id/NI-S/Make-0.03.tar.gz +You may also use dmake. See L above on how to get it. + Note that MakeMaker actually emits makefiles with different syntax depending on what 'make' it thinks you are using. Therefore, it is important that one of the following values appears in Config.pm: diff --git a/iperlsys.h b/iperlsys.h index d07d525..f36dcd5 100644 --- a/iperlsys.h +++ b/iperlsys.h @@ -595,8 +595,9 @@ typedef char* (*LPENVGetenv_len)(struct IPerlEnv*, #endif #ifdef WIN32 typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*); -typedef char* (*LPEnvLibPath)(struct IPerlEnv*, char*); -typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, char*); +typedef char* (*LPEnvLibPath)(struct IPerlEnv*, const char*); +typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, const char*); +typedef char* (*LPEnvVendorLibPath)(struct IPerlEnv*, const char*); typedef void (*LPEnvGetChildIO)(struct IPerlEnv*, child_IO_table*); #endif @@ -619,6 +620,7 @@ struct IPerlEnv LPEnvOsID pEnvOsID; LPEnvLibPath pLibPath; LPEnvSiteLibPath pSiteLibPath; + LPEnvVendorLibPath pVendorLibPath; LPEnvGetChildIO pGetChildIO; #endif }; @@ -665,6 +667,8 @@ struct IPerlEnvInfo (*PL_Env->pLibPath)(PL_Env,(str)) #define PerlEnv_sitelib_path(str) \ (*PL_Env->pSiteLibPath)(PL_Env,(str)) +#define PerlEnv_vendorlib_path(str) \ + (*PL_Env->pVendorLibPath)(PL_Env,(str)) #define PerlEnv_get_child_IO(ptr) \ (*PL_Env->pGetChildIO)(PL_Env, ptr) #endif @@ -690,6 +694,9 @@ struct IPerlEnvInfo #ifdef WIN32 #define PerlEnv_os_id() win32_os_id() +#define PerlEnv_lib_path(str) win32_get_privlib(str) +#define PerlEnv_sitelib_path(str) win32_get_sitelib(str) +#define PerlEnv_vendorlib_path(str) win32_get_vendorlib(str) #define PerlEnv_get_child_IO(ptr) win32_get_child_IO(ptr) #endif diff --git a/perl.c b/perl.c index 7d77f44..ccd1fe2 100644 --- a/perl.c +++ b/perl.c @@ -3269,7 +3269,7 @@ S_init_perllib(pTHX) #endif #ifdef PERL_VENDORARCH_EXP - /* vendorarch is always relative to sitelib on Windows for + /* vendorarch is always relative to vendorlib on Windows for * DLL-based path intuition to work correctly */ # if !defined(WIN32) incpush(PERL_VENDORARCH_EXP, FALSE); diff --git a/win32/config.bc b/win32/config.bc index fdd26de..32fb9d8 100644 --- a/win32/config.bc +++ b/win32/config.bc @@ -349,6 +349,7 @@ d_umask='define' d_uname='define' d_union_semun='define' d_ustat='undef' +d_vendorarch='undef' d_vendorbin='undef' d_vendorlib='undef' d_vfork='undef' @@ -512,6 +513,7 @@ installsitebin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' installsitelib='~INST_TOP~\site~INST_VER~\lib' installstyle='lib' installusrbinperl='undef' +installvendorarch='' installvendorbin='' installvendorlib='' intsize='4' @@ -667,6 +669,7 @@ sitearchexp='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' sitebin='~INST_TOP~\site~INST_VER~\bin~INST_ARCH~' sitebinexp='~INST_TOP~\site~INST_VER~\bin~INST_ARCH~' sitelib='~INST_TOP~\site~INST_VER~\lib' +sitelib_stem='' sitelibexp='~INST_TOP~\site~INST_VER~\lib' siteprefix='~INST_TOP~\site~INST_VER~' siteprefixexp='~INST_TOP~\site~INST_VER~' @@ -751,9 +754,12 @@ uvsize='4' uvtype='unsigned long' uvuformat='"lu"' uvxformat='"lx"' +vendorarch='' +vendorarchexp='' vendorbin='' vendorbinexp='' vendorlib='' +vendorlib_stem='' vendorlibexp='' vendorprefix='' vendorprefixexp='' diff --git a/win32/config.gc b/win32/config.gc index 9df20c2..950a3d7 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -349,6 +349,7 @@ d_umask='define' d_uname='define' d_union_semun='define' d_ustat='undef' +d_vendorarch='undef' d_vendorbin='undef' d_vendorlib='undef' d_vfork='undef' @@ -512,6 +513,7 @@ installsitebin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' installsitelib='~INST_TOP~\site~INST_VER~\lib' installstyle='lib' installusrbinperl='undef' +installvendorarch='' installvendorbin='' installvendorlib='' intsize='4' @@ -667,6 +669,7 @@ sitearchexp='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' sitebin='~INST_TOP~\site~INST_VER~\bin~INST_ARCH~' sitebinexp='~INST_TOP~\site~INST_VER~\bin~INST_ARCH~' sitelib='~INST_TOP~\site~INST_VER~\lib' +sitelib_stem='' sitelibexp='~INST_TOP~\site~INST_VER~\lib' siteprefix='~INST_TOP~\site~INST_VER~' siteprefixexp='~INST_TOP~\site~INST_VER~' @@ -751,9 +754,12 @@ uvsize='4' uvtype='unsigned long' uvuformat='"lu"' uvxformat='"lx"' +vendorarch='' +vendorarchexp='' vendorbin='' vendorbinexp='' vendorlib='' +vendorlib_stem='' vendorlibexp='' vendorprefix='' vendorprefixexp='' diff --git a/win32/config.vc b/win32/config.vc index c3e1f7d..007834e 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -349,6 +349,7 @@ d_umask='define' d_uname='define' d_union_semun='define' d_ustat='undef' +d_vendorarch='undef' d_vendorbin='undef' d_vendorlib='undef' d_vfork='undef' @@ -512,6 +513,7 @@ installsitebin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' installsitelib='~INST_TOP~\site~INST_VER~\lib' installstyle='lib' installusrbinperl='undef' +installvendorarch='' installvendorbin='' installvendorlib='' intsize='4' @@ -667,6 +669,7 @@ sitearchexp='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' sitebin='~INST_TOP~\site~INST_VER~\bin~INST_ARCH~' sitebinexp='~INST_TOP~\site~INST_VER~\bin~INST_ARCH~' sitelib='~INST_TOP~\site~INST_VER~\lib' +sitelib_stem='' sitelibexp='~INST_TOP~\site~INST_VER~\lib' siteprefix='~INST_TOP~\site~INST_VER~' siteprefixexp='~INST_TOP~\site~INST_VER~' @@ -751,9 +754,12 @@ uvsize='4' uvtype='unsigned long' uvuformat='"lu"' uvxformat='"lx"' +vendorarch='' +vendorarchexp='' vendorbin='' vendorbinexp='' vendorlib='' +vendorlib_stem='' vendorlibexp='' vendorprefix='' vendorprefixexp='' diff --git a/win32/config_H.bc b/win32/config_H.bc index 1ec6d55..48fa1ba 100644 --- a/win32/config_H.bc +++ b/win32/config_H.bc @@ -13,7 +13,7 @@ /* * Package name : perl5 * Source directory : - * Configuration time: Sun Mar 5 04:30:07 2000 + * Configuration time: Sun Mar 5 22:28:23 2000 * Configured by : gsar * Target system : */ @@ -2792,8 +2792,14 @@ * This symbol contains the ~name expanded version of SITELIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ +/* SITELIB_STEM: + * This define is SITELIB_EXP with any trailing version-specific component + * removed. The elements in inc_version_list (inc_version_list.U) can + * be tacked onto this variable to generate a list of directories to search. + */ #define SITELIB "c:\\perl\\site\\5.6.0\\lib" /**/ #define SITELIB_EXP (win32_get_sitelib("5.6.0")) /**/ +#define SITELIB_STEM "" /**/ /* Size_t: * This symbol holds the type used to declare length parameters @@ -2942,11 +2948,23 @@ #endif /*#define OLD_PTHREADS_API /**/ +/* PERL_VENDORARCH_EXP: + * This symbol contains the ~name expanded version of PERL_VENDORARCH, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +/*#define PERL_VENDORARCH_EXP "" /**/ + /* PERL_VENDORLIB_EXP: * This symbol contains the ~name expanded version of VENDORLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ +/* PERL_VENDORLIB_STEM: + * This define is PERL_VENDORLIB_EXP with any trailing version-specific component + * removed. The elements in inc_version_list (inc_version_list.U) can + * be tacked onto this variable to generate a list of directories to search. + */ /*#define PERL_VENDORLIB_EXP "" /**/ +/*#define PERL_VENDORLIB_STEM "" /**/ /* VOIDFLAGS: * This symbol indicates how much support of the void type is given by this diff --git a/win32/config_H.gc b/win32/config_H.gc index 5081c37..cb2984d 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -13,7 +13,7 @@ /* * Package name : perl5 * Source directory : - * Configuration time: Sun Mar 5 04:30:17 2000 + * Configuration time: Sun Mar 5 22:28:31 2000 * Configured by : gsar * Target system : */ @@ -2792,8 +2792,14 @@ * This symbol contains the ~name expanded version of SITELIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ +/* SITELIB_STEM: + * This define is SITELIB_EXP with any trailing version-specific component + * removed. The elements in inc_version_list (inc_version_list.U) can + * be tacked onto this variable to generate a list of directories to search. + */ #define SITELIB "c:\\perl\\site\\5.6.0\\lib" /**/ #define SITELIB_EXP (win32_get_sitelib("5.6.0")) /**/ +#define SITELIB_STEM "" /**/ /* Size_t: * This symbol holds the type used to declare length parameters @@ -2942,11 +2948,23 @@ #endif /*#define OLD_PTHREADS_API /**/ +/* PERL_VENDORARCH_EXP: + * This symbol contains the ~name expanded version of PERL_VENDORARCH, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +/*#define PERL_VENDORARCH_EXP "" /**/ + /* PERL_VENDORLIB_EXP: * This symbol contains the ~name expanded version of VENDORLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ +/* PERL_VENDORLIB_STEM: + * This define is PERL_VENDORLIB_EXP with any trailing version-specific component + * removed. The elements in inc_version_list (inc_version_list.U) can + * be tacked onto this variable to generate a list of directories to search. + */ /*#define PERL_VENDORLIB_EXP "" /**/ +/*#define PERL_VENDORLIB_STEM "" /**/ /* VOIDFLAGS: * This symbol indicates how much support of the void type is given by this diff --git a/win32/config_H.vc b/win32/config_H.vc index 0706969..0bb27e9 100644 --- a/win32/config_H.vc +++ b/win32/config_H.vc @@ -13,7 +13,7 @@ /* * Package name : perl5 * Source directory : - * Configuration time: Sun Mar 5 04:30:31 2000 + * Configuration time: Sun Mar 5 22:28:36 2000 * Configured by : gsar * Target system : */ @@ -2792,8 +2792,14 @@ * This symbol contains the ~name expanded version of SITELIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ +/* SITELIB_STEM: + * This define is SITELIB_EXP with any trailing version-specific component + * removed. The elements in inc_version_list (inc_version_list.U) can + * be tacked onto this variable to generate a list of directories to search. + */ #define SITELIB "c:\\perl\\site\\5.6.0\\lib" /**/ #define SITELIB_EXP (win32_get_sitelib("5.6.0")) /**/ +#define SITELIB_STEM "" /**/ /* Size_t: * This symbol holds the type used to declare length parameters @@ -2942,11 +2948,23 @@ #endif /*#define OLD_PTHREADS_API /**/ +/* PERL_VENDORARCH_EXP: + * This symbol contains the ~name expanded version of PERL_VENDORARCH, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +/*#define PERL_VENDORARCH_EXP "" /**/ + /* PERL_VENDORLIB_EXP: * This symbol contains the ~name expanded version of VENDORLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ +/* PERL_VENDORLIB_STEM: + * This define is PERL_VENDORLIB_EXP with any trailing version-specific component + * removed. The elements in inc_version_list (inc_version_list.U) can + * be tacked onto this variable to generate a list of directories to search. + */ /*#define PERL_VENDORLIB_EXP "" /**/ +/*#define PERL_VENDORLIB_STEM "" /**/ /* VOIDFLAGS: * This symbol indicates how much support of the void type is given by this diff --git a/win32/config_h.PL b/win32/config_h.PL index 17f3fc2..5b04506 100644 --- a/win32/config_h.PL +++ b/win32/config_h.PL @@ -49,12 +49,12 @@ while () munge(); s/\\\$/\$/g; s#/[ *\*]*\*/#/**/#; - if (/^\s*#define\s+(PRIVLIB|SITELIB)_EXP/) + if (/^\s*#define\s+(PRIVLIB|SITELIB|VENDORLIB)_EXP/) { $_ = "#define ". $1 . "_EXP (win32_get_". lc($1) . "($patchlevel))\t/**/\n"; } # incpush() handles archlibs, so disable them - elsif (/^\s*#define\s+(ARCHLIB|SITEARCH)_EXP/) + elsif (/^\s*#define\s+(ARCHLIB|SITEARCH|VENDORARCH)_EXP/) { $_ = "/*#define ". $1 . "_EXP \"\"\t/**/\n"; } diff --git a/win32/perlhost.h b/win32/perlhost.h index a3f4c28..02b9cb4 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -17,8 +17,9 @@ #if !defined(PERL_OBJECT) START_EXTERN_C #endif -extern char * g_win32_get_privlib(char *pl); -extern char * g_win32_get_sitelib(char *pl); +extern char * g_win32_get_privlib(const char *pl); +extern char * g_win32_get_sitelib(const char *pl); +extern char * g_win32_get_vendorlib(const char *pl); extern char * g_getlogin(void); extern int do_spawn2(char *cmd, int exectype); #if !defined(PERL_OBJECT) @@ -475,17 +476,23 @@ PerlEnvOsId(struct IPerlEnv* piPerl) } char* -PerlEnvLibPath(struct IPerlEnv* piPerl, char *pl) +PerlEnvLibPath(struct IPerlEnv* piPerl, const char *pl) { return g_win32_get_privlib(pl); } char* -PerlEnvSiteLibPath(struct IPerlEnv* piPerl, char *pl) +PerlEnvSiteLibPath(struct IPerlEnv* piPerl, const char *pl) { return g_win32_get_sitelib(pl); } +char* +PerlEnvVendorLibPath(struct IPerlEnv* piPerl, const char *pl) +{ + return g_win32_get_vendorlib(pl); +} + void PerlEnvGetChildIO(struct IPerlEnv* piPerl, child_IO_table* ptr) { @@ -506,6 +513,7 @@ struct IPerlEnv perlEnv = PerlEnvOsId, PerlEnvLibPath, PerlEnvSiteLibPath, + PerlEnvVendorLibPath, PerlEnvGetChildIO, }; diff --git a/win32/win32.c b/win32/win32.c index 4ccae52..97b51ba 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -84,6 +84,8 @@ int _fcloseall(); # define win32_get_privlib g_win32_get_privlib # undef win32_get_sitelib # define win32_get_sitelib g_win32_get_sitelib +# undef win32_get_vendorlib +# define win32_get_vendorlib g_win32_get_vendorlib # undef do_spawn # define do_spawn g_do_spawn # undef getlogin @@ -107,6 +109,9 @@ static char * get_emd_part(SV **leading, char *trailing, ...); static void remove_dead_process(long deceased); static long find_pid(int pid); static char * qualified_path(const char *cmd); +static char * win32_get_xlib(const char *pl, const char *xlib, + const char *libname); + #ifdef USE_ITHREADS static void remove_dead_pseudo_process(long child); static long find_pseudo_pid(int pid); @@ -265,7 +270,7 @@ get_emd_part(SV **prev_pathp, char *trailing_path, ...) } char * -win32_get_privlib(char *pl) +win32_get_privlib(const char *pl) { dTHXo; char *stdlib = "lib"; @@ -281,11 +286,10 @@ win32_get_privlib(char *pl) return get_emd_part(&sv, stdlib, ARCHNAME, "bin", Nullch); } -char * -win32_get_sitelib(char *pl) +static char * +win32_get_xlib(const char *pl, const char *xlib, const char *libname) { dTHXo; - char *sitelib = "sitelib"; char regstr[40]; char pathstr[MAX_PATH+1]; DWORD datalen; @@ -293,21 +297,22 @@ win32_get_sitelib(char *pl) SV *sv1 = Nullsv; SV *sv2 = Nullsv; - /* $HKCU{"sitelib-$]"} || $HKLM{"sitelib-$]"} . ---; */ - sprintf(regstr, "%s-%s", sitelib, pl); + /* $HKCU{"$xlib-$]"} || $HKLM{"$xlib-$]"} . ---; */ + sprintf(regstr, "%s-%s", xlib, pl); (void)get_regstr(regstr, &sv1); - /* $sitelib .= - * ";$EMD/" . ((-d $EMD/../../../$]) ? "../../.." : "../.."). "/site/$]/lib"; */ - sprintf(pathstr, "site/%s/lib", pl); + /* $xlib .= + * ";$EMD/" . ((-d $EMD/../../../$]) ? "../../.." : "../.."). "/$libname/$]/lib"; */ + sprintf(pathstr, "%s/%s/lib", libname, pl); (void)get_emd_part(&sv1, pathstr, ARCHNAME, "bin", pl, Nullch); - /* $HKCU{'sitelib'} || $HKLM{'sitelib'} . ---; */ - (void)get_regstr(sitelib, &sv2); + /* $HKCU{$xlib} || $HKLM{$xlib} . ---; */ + (void)get_regstr(xlib, &sv2); - /* $sitelib .= - * ";$EMD/" . ((-d $EMD/../../../$]) ? "../../.." : "../.."). "/site/lib"; */ - (void)get_emd_part(&sv2, "site/lib", ARCHNAME, "bin", pl, Nullch); + /* $xlib .= + * ";$EMD/" . ((-d $EMD/../../../$]) ? "../../.." : "../.."). "/$libname/lib"; */ + sprintf(pathstr, "%s/lib", libname); + (void)get_emd_part(&sv2, pathstr, ARCHNAME, "bin", pl, Nullch); if (!sv1 && !sv2) return Nullch; @@ -322,6 +327,21 @@ win32_get_sitelib(char *pl) return SvPVX(sv1); } +char * +win32_get_sitelib(const char *pl) +{ + return win32_get_xlib(pl, "sitelib", "site"); +} + +#ifndef PERL_VENDORLIB_NAME +# define PERL_VENDORLIB_NAME "vendor" +#endif + +char * +win32_get_vendorlib(const char *pl) +{ + return win32_get_xlib(pl, "vendorlib", PERL_VENDORLIB_NAME); +} static BOOL has_shell_metachars(char *ptr) diff --git a/win32/win32.h b/win32/win32.h index a0d0761..1669ea4 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -25,6 +25,7 @@ # endif # define win32_get_privlib PerlEnv_lib_path # define win32_get_sitelib PerlEnv_sitelib_path +# define win32_get_vendorlib PerlEnv_vendorlib_path #endif #ifdef __GNUC__ @@ -312,8 +313,9 @@ extern int my_fclose(FILE *); extern int do_aspawn(void *really, void **mark, void **sp); extern int do_spawn(char *cmd); extern int do_spawn_nowait(char *cmd); -extern char * win32_get_privlib(char *pl); -extern char * win32_get_sitelib(char *pl); +extern char * win32_get_privlib(const char *pl); +extern char * win32_get_sitelib(const char *pl); +extern char * win32_get_vendorlib(const char *pl); extern int IsWin95(void); extern int IsWinNT(void); extern void win32_argv2utf8(int argc, char** argv); -- 2.7.4