From: John Cerney Date: Thu, 3 Apr 1997 08:21:17 +0000 (+0100) Subject: Patch to Build Dynamic-Lib (DLL) version of perl using gnuwin32 b17.1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2a079e0090406b1b2e50643540f149206c9e9de8;p=p5sagit%2Fp5-mst-13.2.git Patch to Build Dynamic-Lib (DLL) version of perl using gnuwin32 b17.1 I have successfully built a dynamic-lib (dll) version of perl version 5.003_94 using the gnuwin32 tools on windows 95 and windows NT 3.51. This port builds all extension libs for perl as DLLs. A patch is attached to this message. Detailed Instructions: The following assumes you have the gnuwin32 (version b17.1) package installed and configured on your system. See http://www.cygnus.com/misc/gnu-win32/ for details on the gnuwin32 package. 1) Obtain perl5.003_94 (from www.perl.com or CPAN) and extract to a directory on your system. 2) cd to the path where perl5.003_94 is installed. e.g, if you installed to /perl5.003_94, then cd to /perl5.003_94. 3) Apply this patch: patch -p1 < dllpatch Note: If you have problems with the patch that comes with the gnuwin32 package, (I have had problems getting it to apply multiple patches in a single file) try the patch located at http://www.simtel.net/pub/simtelnet/win95/prog/gpatch2b.zip. Also, the files pp_sys.c and perl.h that the patch modifies must be in unix format. If your extraction utility (like winzip) converts to dos format, change the format of these files back before applying the patch. 5) Modify the ld2 script Change the PERLPATH variable to the location you extracted perl. for example, if you extracted perl to /perl5.003_94, change so the line looks like: PERLPATH=/perl5.003_94 4) Copy the two scripts ld2, and gcc2 to a directory in your PATH environment variable. For example, copy to /bin, assuming /bin is in your PATH. (These two scripts ld2 and gcc2 are 'wrapper' scripts that encapsulate the multiple-pass dll building steps used by gnuwin32 ld/gcc.) 5) Run the perl Configuration script as stated in the perl README file; e.g. sh Configure select gnuwin32 at this prompt: First time through, eh? I have some defaults handy for the following systems: . . . Which of these apply, if any? The defaults should be OK for everything else, except for the specific pathnames for the gnuwin32 libs, include files, installation dirs, etc on your system. Note: On windows 95, the configuration script only stops every other time for responses from the command line. In this case you can manually edit the gnuwin32.sh hint file for your paths, copy hints/gnuwin32.sh to config.sh, and run Configure non-interactively using sh Configure -d. 6) Do a make, as stated in the perl README file 7) Do a make test. Some test will fail, but you should get around a 83% OK result. (Most failures seem to be due to unix'ism that don't apply for win32.) 8) Do a make install. This will fail about 1/2 of the way thru. It appears that perl can't find itself when it forks because it cd's to another directory during the install process. You get around this by invoking the install script using a full pathname for perl. For example, if perl is extracted to perl5.003_94, do a '/perl5.003_94/perl installperl'. This should complete the install process. p5p-msgid: 199704030821.JAA08762@pluto.tiuk.ti.com --- diff --git a/ext/DynaLoader/dl_gnuwin32.xs b/ext/DynaLoader/dl_gnuwin32.xs new file mode 100644 index 0000000..1d88114 --- /dev/null +++ b/ext/DynaLoader/dl_gnuwin32.xs @@ -0,0 +1,152 @@ +/* dl_gnuwin32.xs + * + * Platform: Win32 (Windows NT/Windows 95) + * Author: Wei-Yuen Tan (wyt@hip.com) + * Created: A warm day in June, 1995 + * + * Modified: + * August 23rd 1995 - rewritten after losing everything when I + * wiped off my NT partition (eek!) + */ +/* Modified from the original dl_win32.xs to work with gnuwin32 + -John Cerney 3/26/97 +*/ +/* Porting notes: + +I merely took Paul's dl_dlopen.xs, took out extraneous stuff and +replaced the appropriate SunOS calls with the corresponding Win32 +calls. + +*/ + +#define WIN32_LEAN_AND_MEAN +// Defines from windows needed for this function only. Can't include full +// gnuwin2 windows headers because of problems with CONTEXT redefinition +// Removed logic to tell not dynamically load static modules. It is assumed that all +// modules are dynamically built. This should be similar to the behavoir on sunOS. +// Leaving in the logic would have required changes to the standard perlmain.c code +// +// // Includes call a dll function to initialize it's impure_ptr. +#include +void (*impure_setupptr)(struct _reent *); // pointer to the impure_setup routine + +//#include +#define LOAD_WITH_ALTERED_SEARCH_PATH (8) +typedef void *HANDLE; +typedef HANDLE HINSTANCE; +#define STDCALL __attribute__ ((stdcall)) +typedef int STDCALL (*FARPROC)(); + +HINSTANCE +STDCALL +LoadLibraryExA( + char* lpLibFileName, + HANDLE hFile, + unsigned int dwFlags + ); +unsigned int +STDCALL +GetLastError( + void + ); +FARPROC +STDCALL +GetProcAddress( + HINSTANCE hModule, + char* lpProcName + ); + +#include + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#include "dlutils.c" /* SaveError() etc */ + +static void +dl_private_init() +{ + (void)dl_generic_private_init(); +} + + +MODULE = DynaLoader PACKAGE = DynaLoader + +BOOT: + (void)dl_private_init(); + +void * +dl_load_file(filename,flags=0) + char * filename + int flags + PREINIT: + CODE: + DLDEBUG(1,fprintf(stderr,"dl_load_file(%s):\n", filename)); + + RETVAL = (void*) LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ; + + DLDEBUG(2,fprintf(stderr," libref=%x\n", RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL){ + SaveError("%d",GetLastError()) ; + } + else{ + // setup the dll's impure_ptr: + impure_setupptr = GetProcAddress(RETVAL, "impure_setup"); + if( impure_setupptr == NULL){ + printf("Gnuwin32 Dynaloader Error, Could not load impure_setup symbol\n"); + RETVAL = NULL; + } + else{ + // setup the DLLs impure_ptr: + (*impure_setupptr)(_impure_ptr); + sv_setiv( ST(0), (IV)RETVAL); + } + } + + + +void * +dl_find_symbol(libhandle, symbolname) + void * libhandle + char * symbolname + CODE: + DLDEBUG(2,fprintf(stderr,"dl_find_symbol(handle=%x, symbol=%s)\n", + libhandle, symbolname)); + RETVAL = (void*) GetProcAddress((HINSTANCE) libhandle, symbolname); + DLDEBUG(2,fprintf(stderr," symbolref = %x\n", RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL) + SaveError("%d",GetLastError()) ; + else + sv_setiv( ST(0), (IV)RETVAL); + + +void +dl_undef_symbols() + PPCODE: + + + +# These functions should not need changing on any platform: + +void +dl_install_xsub(perl_name, symref, filename="$Package") + char * perl_name + void * symref + char * filename + CODE: + DLDEBUG(2,fprintf(stderr,"dl_install_xsub(name=%s, symref=%x)\n", + perl_name, symref)); + ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)())symref, filename))); + + +char * +dl_error() + CODE: + RETVAL = LastError ; + OUTPUT: + RETVAL + +# end. diff --git a/extLibInc.h b/extLibInc.h new file mode 100644 index 0000000..04bf5ca --- /dev/null +++ b/extLibInc.h @@ -0,0 +1,355 @@ +/* include file for building of extension libs using gnuwin32. + This file is included by the extension dlls when they are built. + Global vars defined in perl exe are referenced by the extension module + dll by using __imp_varName, where varName is the name of the global + variable in perl.exe. Gnuwin32 has no equivalent to MSVC's + __declspec(dllimport) keyword to define a imported global, so we have + to use this approach to access globals exported by perl.exe + -jc 4/1/97 +*/ + +#define impure_setupptr (*__imp_impure_setupptr) +#define Perl_reall_srchlen (*__imp_Perl_reall_srchlen) +#define Perl_yychar (*__imp_Perl_yychar) +#define Perl_yycheck (*__imp_Perl_yycheck) +#define Perl_yydebug (*__imp_Perl_yydebug) +#define Perl_yydefred (*__imp_Perl_yydefred) +#define Perl_yydgoto (*__imp_Perl_yydgoto) +#define Perl_yyerrflag (*__imp_Perl_yyerrflag) +#define Perl_yygindex (*__imp_Perl_yygindex) +#define Perl_yylen (*__imp_Perl_yylen) +#define Perl_yylhs (*__imp_Perl_yylhs) +#define Perl_yylval (*__imp_Perl_yylval) +#define Perl_yynerrs (*__imp_Perl_yynerrs) +#define Perl_yyrindex (*__imp_Perl_yyrindex) +#define Perl_yysindex (*__imp_Perl_yysindex) +#define Perl_yytable (*__imp_Perl_yytable) +#define Perl_yyval (*__imp_Perl_yyval) +#define Perl_regarglen (*__imp_Perl_regarglen) +#define Perl_regdummy (*__imp_Perl_regdummy) +#define Perl_regkind (*__imp_Perl_regkind) +#define Perl_simple (*__imp_Perl_simple) +#define Perl_varies (*__imp_Perl_varies) +#define Perl_watchaddr (*__imp_Perl_watchaddr) +#define Perl_watchok (*__imp_Perl_watchok) +#define Argv (*__imp_Argv) +#define Cmd (*__imp_Cmd) +#define DBgv (*__imp_DBgv) +#define DBline (*__imp_DBline) +#define DBsignal (*__imp_DBsignal) +#define DBsingle (*__imp_DBsingle) +#define DBsub (*__imp_DBsub) +#define DBtrace (*__imp_DBtrace) +#define Error (*__imp_Error) +#define Perl_AMG_names (*__imp_Perl_AMG_names) +#define Perl_No (*__imp_Perl_No) +#define Perl_Sv (*__imp_Perl_Sv) +#define Perl_Xpv (*__imp_Perl_Xpv) +#define Perl_Yes (*__imp_Perl_Yes) +#define Perl_amagic_generation (*__imp_Perl_amagic_generation) +#define Perl_an (*__imp_Perl_an) +#define Perl_buf (*__imp_Perl_buf) +#define Perl_bufend (*__imp_Perl_bufend) +#define Perl_bufptr (*__imp_Perl_bufptr) +#define Perl_check (*__imp_Perl_check) +#define Perl_collation_ix (*__imp_Perl_collation_ix) +#define Perl_collation_name (*__imp_Perl_collation_name) +#define Perl_collation_standard (*__imp_Perl_collation_standard) +#define Perl_collxfrm_base (*__imp_Perl_collxfrm_base) +#define Perl_collxfrm_mult (*__imp_Perl_collxfrm_mult) +#define Perl_compcv (*__imp_Perl_compcv) +#define Perl_compiling (*__imp_Perl_compiling) +#define Perl_comppad (*__imp_Perl_comppad) +#define Perl_comppad_name (*__imp_Perl_comppad_name) +#define Perl_comppad_name_fill (*__imp_Perl_comppad_name_fill) +#define Perl_cop_seqmax (*__imp_Perl_cop_seqmax) +#define Perl_curcop (*__imp_Perl_curcop) +#define Perl_curcopdb (*__imp_Perl_curcopdb) +#define Perl_curinterp (*__imp_Perl_curinterp) +#define Perl_curpad (*__imp_Perl_curpad) +#define Perl_dc (*__imp_Perl_dc) +#define Perl_di (*__imp_Perl_di) +#define Perl_ds (*__imp_Perl_ds) +#define Perl_egid (*__imp_Perl_egid) +#define Perl_envgv (*__imp_Perl_envgv) +#define Perl_error_count (*__imp_Perl_error_count) +#define Perl_euid (*__imp_Perl_euid) +#define Perl_evalseq (*__imp_Perl_evalseq) +#define Perl_expect (*__imp_Perl_expect) +#define Perl_fold_locale (*__imp_Perl_fold_locale) +#define Perl_gid (*__imp_Perl_gid) +#define Perl_he_root (*__imp_Perl_he_root) +#define Perl_hexdigit (*__imp_Perl_hexdigit) +#define Perl_hints (*__imp_Perl_hints) +#define Perl_in_my (*__imp_Perl_in_my) +#define Perl_last_lop (*__imp_Perl_last_lop) +#define Perl_last_lop_op (*__imp_Perl_last_lop_op) +#define Perl_last_uni (*__imp_Perl_last_uni) +#define Perl_lex_brackets (*__imp_Perl_lex_brackets) +#define Perl_lex_brackstack (*__imp_Perl_lex_brackstack) +#define Perl_lex_casemods (*__imp_Perl_lex_casemods) +#define Perl_lex_casestack (*__imp_Perl_lex_casestack) +#define Perl_lex_defer (*__imp_Perl_lex_defer) +#define Perl_lex_dojoin (*__imp_Perl_lex_dojoin) +#define Perl_lex_expect (*__imp_Perl_lex_expect) +#define Perl_lex_fakebrack (*__imp_Perl_lex_fakebrack) +#define Perl_lex_formbrack (*__imp_Perl_lex_formbrack) +#define Perl_lex_inpat (*__imp_Perl_lex_inpat) +#define Perl_lex_inwhat (*__imp_Perl_lex_inwhat) +#define Perl_lex_op (*__imp_Perl_lex_op) +#define Perl_lex_repl (*__imp_Perl_lex_repl) +#define Perl_lex_starts (*__imp_Perl_lex_starts) +#define Perl_lex_state (*__imp_Perl_lex_state) +#define Perl_lex_stuff (*__imp_Perl_lex_stuff) +#define Perl_linestr (*__imp_Perl_linestr) +#define Perl_markstack (*__imp_Perl_markstack) +#define Perl_markstack_max (*__imp_Perl_markstack_max) +#define Perl_markstack_ptr (*__imp_Perl_markstack_ptr) +#define Perl_max_intro_pending (*__imp_Perl_max_intro_pending) +#define Perl_maxo (*__imp_Perl_maxo) +#define Perl_min_intro_pending (*__imp_Perl_min_intro_pending) +#define Perl_multi_close (*__imp_Perl_multi_close) +#define Perl_multi_end (*__imp_Perl_multi_end) +#define Perl_multi_open (*__imp_Perl_multi_open) +#define Perl_multi_start (*__imp_Perl_multi_start) +#define Perl_na (*__imp_Perl_na) +#define Perl_nexttoke (*__imp_Perl_nexttoke) +#define Perl_nexttype (*__imp_Perl_nexttype) +#define Perl_nextval (*__imp_Perl_nextval) +#define Perl_nomemok (*__imp_Perl_nomemok) +#define Perl_numeric_local (*__imp_Perl_numeric_local) +#define Perl_numeric_name (*__imp_Perl_numeric_name) +#define Perl_numeric_standard (*__imp_Perl_numeric_standard) +#define Perl_oldbufptr (*__imp_Perl_oldbufptr) +#define Perl_oldoldbufptr (*__imp_Perl_oldoldbufptr) +#define Perl_op (*__imp_Perl_op) +#define Perl_op_desc (*__imp_Perl_op_desc) +#define Perl_op_name (*__imp_Perl_op_name) +#define Perl_op_seqmax (*__imp_Perl_op_seqmax) +#define Perl_opargs (*__imp_Perl_opargs) +#define Perl_origalen (*__imp_Perl_origalen) +#define Perl_origenviron (*__imp_Perl_origenviron) +#define Perl_osname (*__imp_Perl_osname) +#define Perl_padix (*__imp_Perl_padix) +#define Perl_patleave (*__imp_Perl_patleave) +#define Perl_pidstatus (*__imp_Perl_pidstatus) +#define Perl_ppaddr (*__imp_Perl_ppaddr) +#define Perl_profiledata (*__imp_Perl_profiledata) +#define Perl_psig_name (*__imp_Perl_psig_name) +#define Perl_psig_ptr (*__imp_Perl_psig_ptr) +#define Perl_regbol (*__imp_Perl_regbol) +#define Perl_regcode (*__imp_Perl_regcode) +#define Perl_regendp (*__imp_Perl_regendp) +#define Perl_regeol (*__imp_Perl_regeol) +#define Perl_reginput (*__imp_Perl_reginput) +#define Perl_reglastparen (*__imp_Perl_reglastparen) +#define Perl_regnaughty (*__imp_Perl_regnaughty) +#define Perl_regnpar (*__imp_Perl_regnpar) +#define Perl_regparse (*__imp_Perl_regparse) +#define Perl_regprecomp (*__imp_Perl_regprecomp) +#define Perl_regprev (*__imp_Perl_regprev) +#define Perl_regsawback (*__imp_Perl_regsawback) +#define Perl_regsize (*__imp_Perl_regsize) +#define Perl_regstartp (*__imp_Perl_regstartp) +#define Perl_regtill (*__imp_Perl_regtill) +#define Perl_regxend (*__imp_Perl_regxend) +#define Perl_retstack (*__imp_Perl_retstack) +#define Perl_retstack_ix (*__imp_Perl_retstack_ix) +#define Perl_retstack_max (*__imp_Perl_retstack_max) +#define Perl_rsfp (*__imp_Perl_rsfp) +#define Perl_rsfp_filters (*__imp_Perl_rsfp_filters) +#define Perl_savestack (*__imp_Perl_savestack) +#define Perl_savestack_ix (*__imp_Perl_savestack_ix) +#define Perl_savestack_max (*__imp_Perl_savestack_max) +#define Perl_scopestack (*__imp_Perl_scopestack) +#define Perl_scopestack_ix (*__imp_Perl_scopestack_ix) +#define Perl_scopestack_max (*__imp_Perl_scopestack_max) +#define Perl_scrgv (*__imp_Perl_scrgv) +#define Perl_sh_path (*__imp_Perl_sh_path) +#define Perl_sig_name (*__imp_Perl_sig_name) +#define Perl_sig_num (*__imp_Perl_sig_num) +#define Perl_siggv (*__imp_Perl_siggv) +#define Perl_stack_base (*__imp_Perl_stack_base) +#define Perl_stack_max (*__imp_Perl_stack_max) +#define Perl_stack_sp (*__imp_Perl_stack_sp) +#define Perl_statbuf (*__imp_Perl_statbuf) +#define Perl_sub_generation (*__imp_Perl_sub_generation) +#define Perl_subline (*__imp_Perl_subline) +#define Perl_subname (*__imp_Perl_subname) +#define Perl_sv_no (*__imp_Perl_sv_no) +#define Perl_sv_undef (*__imp_Perl_sv_undef) +#define Perl_sv_yes (*__imp_Perl_sv_yes) +#define Perl_tainting (*__imp_Perl_tainting) +#define Perl_thisexpr (*__imp_Perl_thisexpr) +#define Perl_timesbuf (*__imp_Perl_timesbuf) +#define Perl_tokenbuf (*__imp_Perl_tokenbuf) +#define Perl_uid (*__imp_Perl_uid) +#define Perl_vert (*__imp_Perl_vert) +#define Perl_vtbl_amagic (*__imp_Perl_vtbl_amagic) +#define Perl_vtbl_amagicelem (*__imp_Perl_vtbl_amagicelem) +#define Perl_vtbl_arylen (*__imp_Perl_vtbl_arylen) +#define Perl_vtbl_bm (*__imp_Perl_vtbl_bm) +#define Perl_vtbl_collxfrm (*__imp_Perl_vtbl_collxfrm) +#define Perl_vtbl_dbline (*__imp_Perl_vtbl_dbline) +#define Perl_vtbl_env (*__imp_Perl_vtbl_env) +#define Perl_vtbl_envelem (*__imp_Perl_vtbl_envelem) +#define Perl_vtbl_fm (*__imp_Perl_vtbl_fm) +#define Perl_vtbl_glob (*__imp_Perl_vtbl_glob) +#define Perl_vtbl_isa (*__imp_Perl_vtbl_isa) +#define Perl_vtbl_isaelem (*__imp_Perl_vtbl_isaelem) +#define Perl_vtbl_itervar (*__imp_Perl_vtbl_itervar) +#define Perl_vtbl_mglob (*__imp_Perl_vtbl_mglob) +#define Perl_vtbl_nkeys (*__imp_Perl_vtbl_nkeys) +#define Perl_vtbl_pack (*__imp_Perl_vtbl_pack) +#define Perl_vtbl_packelem (*__imp_Perl_vtbl_packelem) +#define Perl_vtbl_pos (*__imp_Perl_vtbl_pos) +#define Perl_vtbl_sig (*__imp_Perl_vtbl_sig) +#define Perl_vtbl_sigelem (*__imp_Perl_vtbl_sigelem) +#define Perl_vtbl_substr (*__imp_Perl_vtbl_substr) +#define Perl_vtbl_sv (*__imp_Perl_vtbl_sv) +#define Perl_vtbl_taint (*__imp_Perl_vtbl_taint) +#define Perl_vtbl_uvar (*__imp_Perl_vtbl_uvar) +#define Perl_vtbl_vec (*__imp_Perl_vtbl_vec) +#define Perl_xiv_arenaroot (*__imp_Perl_xiv_arenaroot) +#define Perl_xiv_root (*__imp_Perl_xiv_root) +#define Perl_xnv_root (*__imp_Perl_xnv_root) +#define Perl_xpv_root (*__imp_Perl_xpv_root) +#define Perl_xrv_root (*__imp_Perl_xrv_root) +#define ampergv (*__imp_ampergv) +#define argvgv (*__imp_argvgv) +#define argvoutgv (*__imp_argvoutgv) +#define basetime (*__imp_basetime) +#define beginav (*__imp_beginav) +#define bodytarget (*__imp_bodytarget) +#define cddir (*__imp_cddir) +#define chopset (*__imp_chopset) +#define comppad_name_floor (*__imp_comppad_name_floor) +#define copline (*__imp_copline) +#define curpm (*__imp_curpm) +#define curstack (*__imp_curstack) +#define curstash (*__imp_curstash) +#define curstname (*__imp_curstname) +#define cxstack (*__imp_cxstack) +#define cxstack_ix (*__imp_cxstack_ix) +#define cxstack_max (*__imp_cxstack_max) +#define dbargs (*__imp_dbargs) +#define debdelim (*__imp_debdelim) +#define debname (*__imp_debname) +#define debstash (*__imp_debstash) +#define debug (*__imp_debug) +#define defgv (*__imp_defgv) +#define defoutgv (*__imp_defoutgv) +#define defstash (*__imp_defstash) +#define delaymagic (*__imp_delaymagic) +#define diehook (*__imp_diehook) +#define dirty (*__imp_dirty) +#define dlevel (*__imp_dlevel) +#define dlmax (*__imp_dlmax) +#define do_undump (*__imp_do_undump) +#define doextract (*__imp_doextract) +#define doswitches (*__imp_doswitches) +#define dowarn (*__imp_dowarn) +#define dumplvl (*__imp_dumplvl) +#define e_fp (*__imp_e_fp) +#define e_tmpname (*__imp_e_tmpname) +#define endav (*__imp_endav) +#define errgv (*__imp_errgv) +#define eval_root (*__imp_eval_root) +#define eval_start (*__imp_eval_start) +#define fdpid (*__imp_fdpid) +#define filemode (*__imp_filemode) +#define firstgv (*__imp_firstgv) +#define forkprocess (*__imp_forkprocess) +#define formfeed (*__imp_formfeed) +#define formtarget (*__imp_formtarget) +#define gensym (*__imp_gensym) +#define in_eval (*__imp_in_eval) +#define incgv (*__imp_incgv) +#define inplace (*__imp_inplace) +#define last_in_gv (*__imp_last_in_gv) +#define lastfd (*__imp_lastfd) +#define lastscream (*__imp_lastscream) +#define lastsize (*__imp_lastsize) +#define lastspbase (*__imp_lastspbase) +#define laststatval (*__imp_laststatval) +#define laststype (*__imp_laststype) +#define leftgv (*__imp_leftgv) +#define lineary (*__imp_lineary) +#define localizing (*__imp_localizing) +#define localpatches (*__imp_localpatches) +#define main_cv (*__imp_main_cv) +#define main_root (*__imp_main_root) +#define main_start (*__imp_main_start) +#define mainstack (*__imp_mainstack) +#define maxscream (*__imp_maxscream) +#define maxsysfd (*__imp_maxsysfd) +#define minus_F (*__imp_minus_F) +#define minus_a (*__imp_minus_a) +#define minus_c (*__imp_minus_c) +#define minus_l (*__imp_minus_l) +#define minus_n (*__imp_minus_n) +#define minus_p (*__imp_minus_p) +#define multiline (*__imp_multiline) +#define mystack_base (*__imp_mystack_base) +#define mystack_max (*__imp_mystack_max) +#define mystack_sp (*__imp_mystack_sp) +#define mystrk (*__imp_mystrk) +#define nice_chunk (*__imp_nice_chunk) +#define nice_chunk_size (*__imp_nice_chunk_size) +#define nrs (*__imp_nrs) +#define ofmt (*__imp_ofmt) +#define ofs (*__imp_ofs) +#define ofslen (*__imp_ofslen) +#define oldlastpm (*__imp_oldlastpm) +#define oldname (*__imp_oldname) +#define op_mask (*__imp_op_mask) +#define origargc (*__imp_origargc) +#define origargv (*__imp_origargv) +#define origfilename (*__imp_origfilename) +#define ors (*__imp_ors) +#define orslen (*__imp_orslen) +#define pad_reset_pending (*__imp_pad_reset_pending) +#define padix_floor (*__imp_padix_floor) +#define parsehook (*__imp_parsehook) +#define patchlevel (*__imp_patchlevel) +#define perl_destruct_level (*__imp_perl_destruct_level) +#define perldb (*__imp_perldb) +#define preambleav (*__imp_preambleav) +#define preambled (*__imp_preambled) +#define preprocess (*__imp_preprocess) +#define regflags (*__imp_regflags) +#define restartop (*__imp_restartop) +#define rightgv (*__imp_rightgv) +#define rs (*__imp_rs) +#define runlevel (*__imp_runlevel) +#define sawampersand (*__imp_sawampersand) +#define sawstudy (*__imp_sawstudy) +#define sawvec (*__imp_sawvec) +#define screamfirst (*__imp_screamfirst) +#define screamnext (*__imp_screamnext) +#define secondgv (*__imp_secondgv) +#define signalstack (*__imp_signalstack) +#define sortcop (*__imp_sortcop) +#define sortstack (*__imp_sortstack) +#define sortstash (*__imp_sortstash) +#define splitstr (*__imp_splitstr) +#define statcache (*__imp_statcache) +#define statgv (*__imp_statgv) +#define statname (*__imp_statname) +#define statusvalue (*__imp_statusvalue) +#define stdingv (*__imp_stdingv) +#define strchop (*__imp_strchop) +#define strtab (*__imp_strtab) +#define sv_arenaroot (*__imp_sv_arenaroot) +#define sv_count (*__imp_sv_count) +#define sv_objcount (*__imp_sv_objcount) +#define sv_root (*__imp_sv_root) +#define tainted (*__imp_tainted) +#define tmps_floor (*__imp_tmps_floor) +#define tmps_ix (*__imp_tmps_ix) +#define tmps_max (*__imp_tmps_max) +#define tmps_stack (*__imp_tmps_stack) +#define top_env (*__imp_top_env) +#define toptarget (*__imp_toptarget) +#define unsafe (*__imp_unsafe) +#define warnhook (*__imp_warnhook) diff --git a/gcc2 b/gcc2 new file mode 100644 index 0000000..f01da9e --- /dev/null +++ b/gcc2 @@ -0,0 +1,19 @@ +#!/bin/sh + + +# gcc wrapper for building dynamic lib version of perl +# if -buildperl found on command line, then all args passed to +# perlgcc, else pass all args to gcc. +# jc 3/24/97 +# +results=`echo "$*" | grep "\-buildperl"` +# echo "results = <$results>" +#if ( "$results" .eq. ""); then +# if `sh -c echo '$*' | grep buildperl >/dev/null 2>&1`; then +case "$results" in + "") gcc $*;; + *) miniperl perlgcc $*;; +esac + + + diff --git a/hints/gnuwin32.sh b/hints/gnuwin32.sh new file mode 100644 index 0000000..abd0210 --- /dev/null +++ b/hints/gnuwin32.sh @@ -0,0 +1,50 @@ +#! /bin/sh +# gnuwin32.sh - hintsfile for building perl on Windows NT using the +# Cygnus Win32 Development Kit. +# See "http://www.cygnus.com/misc/gnu-win32/" to learn about the kit. +# +path_sep=\; +exe_ext='.exe' +firstmakefile='GNUmakefile' +if test -f $sh.exe; then sh=$sh.exe; fi +startsh="#!$sh" +cc='gcc2' +ld='ld2' +usrinc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/include' +libpth='/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib /gnuwin32/H-i386-cygwin32/lib' +libs='-lcygwin -lm -lc -lkernel32' +# dynamic lib stuff +so='dll' +#i_dlfcn='define' +dlsrc='dl_gnuwin32.xs' +usedl='y' +# flag to include the perl.exe export variable translation file extLibInc.h when +# building extension libs +cccdlflags='-DCYGWIN32 -DDLLIMPORT ' +# flag that signals gcc2 to build exportable perl +ccdlflags='-buildperl ' +lddlflags='-L../.. -L/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib -lperlexp -lcygwin' +d_voidsig='undef' +extensions='Fcntl IO Opcode SDBM_File' +lns='cp' +signal_t='int' +useposix='false' +rd_nodata='0' +eagain='EAGAIN' +archname='gnuwin32' +# + +installbin='/usr/local/bin' +installman1dir='' +installman3dir='' +installprivlib='/usr/local/lib/perl5' +installscript='/usr/local/bin' + +installsitelib='/usr/local/lib/perl5/site_perl' +libc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib/libc.a' + +perlpath='/usr/local/bin/perl' + +sitelib='/usr/local/lib/perl5/site_perl' +sitelibexp='/usr/local/lib/perl5/site_perl' +usrinc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/include' diff --git a/ld2 b/ld2 new file mode 100644 index 0000000..65f10b4 --- /dev/null +++ b/ld2 @@ -0,0 +1,4 @@ +#!/bin/sh +PERLPATH=/perl5.003_94 +# pass all args to the perl ld wrapper +$PERLPATH/perl $PERLPATH/perlld $* diff --git a/perl.h b/perl.h index 42740ba..e86f930 100644 --- a/perl.h +++ b/perl.h @@ -995,8 +995,12 @@ union any { #include "form.h" #include "gv.h" #include "cv.h" -#include "opcode.h" #include "op.h" +/* Work Around some problems with importing globals from dlls for cygwin32 */ +#if defined(CYGWIN32) && defined(DLLIMPORT) +# include "extLibInc.h" +#endif +#include "opcode.h" #include "cop.h" #include "av.h" #include "hv.h" diff --git a/perl5.003_94/ext/DynaLoader/dl_gnuwin32.xs b/perl5.003_94/ext/DynaLoader/dl_gnuwin32.xs new file mode 100644 index 0000000..1d88114 --- /dev/null +++ b/perl5.003_94/ext/DynaLoader/dl_gnuwin32.xs @@ -0,0 +1,152 @@ +/* dl_gnuwin32.xs + * + * Platform: Win32 (Windows NT/Windows 95) + * Author: Wei-Yuen Tan (wyt@hip.com) + * Created: A warm day in June, 1995 + * + * Modified: + * August 23rd 1995 - rewritten after losing everything when I + * wiped off my NT partition (eek!) + */ +/* Modified from the original dl_win32.xs to work with gnuwin32 + -John Cerney 3/26/97 +*/ +/* Porting notes: + +I merely took Paul's dl_dlopen.xs, took out extraneous stuff and +replaced the appropriate SunOS calls with the corresponding Win32 +calls. + +*/ + +#define WIN32_LEAN_AND_MEAN +// Defines from windows needed for this function only. Can't include full +// gnuwin2 windows headers because of problems with CONTEXT redefinition +// Removed logic to tell not dynamically load static modules. It is assumed that all +// modules are dynamically built. This should be similar to the behavoir on sunOS. +// Leaving in the logic would have required changes to the standard perlmain.c code +// +// // Includes call a dll function to initialize it's impure_ptr. +#include +void (*impure_setupptr)(struct _reent *); // pointer to the impure_setup routine + +//#include +#define LOAD_WITH_ALTERED_SEARCH_PATH (8) +typedef void *HANDLE; +typedef HANDLE HINSTANCE; +#define STDCALL __attribute__ ((stdcall)) +typedef int STDCALL (*FARPROC)(); + +HINSTANCE +STDCALL +LoadLibraryExA( + char* lpLibFileName, + HANDLE hFile, + unsigned int dwFlags + ); +unsigned int +STDCALL +GetLastError( + void + ); +FARPROC +STDCALL +GetProcAddress( + HINSTANCE hModule, + char* lpProcName + ); + +#include + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#include "dlutils.c" /* SaveError() etc */ + +static void +dl_private_init() +{ + (void)dl_generic_private_init(); +} + + +MODULE = DynaLoader PACKAGE = DynaLoader + +BOOT: + (void)dl_private_init(); + +void * +dl_load_file(filename,flags=0) + char * filename + int flags + PREINIT: + CODE: + DLDEBUG(1,fprintf(stderr,"dl_load_file(%s):\n", filename)); + + RETVAL = (void*) LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ; + + DLDEBUG(2,fprintf(stderr," libref=%x\n", RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL){ + SaveError("%d",GetLastError()) ; + } + else{ + // setup the dll's impure_ptr: + impure_setupptr = GetProcAddress(RETVAL, "impure_setup"); + if( impure_setupptr == NULL){ + printf("Gnuwin32 Dynaloader Error, Could not load impure_setup symbol\n"); + RETVAL = NULL; + } + else{ + // setup the DLLs impure_ptr: + (*impure_setupptr)(_impure_ptr); + sv_setiv( ST(0), (IV)RETVAL); + } + } + + + +void * +dl_find_symbol(libhandle, symbolname) + void * libhandle + char * symbolname + CODE: + DLDEBUG(2,fprintf(stderr,"dl_find_symbol(handle=%x, symbol=%s)\n", + libhandle, symbolname)); + RETVAL = (void*) GetProcAddress((HINSTANCE) libhandle, symbolname); + DLDEBUG(2,fprintf(stderr," symbolref = %x\n", RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL) + SaveError("%d",GetLastError()) ; + else + sv_setiv( ST(0), (IV)RETVAL); + + +void +dl_undef_symbols() + PPCODE: + + + +# These functions should not need changing on any platform: + +void +dl_install_xsub(perl_name, symref, filename="$Package") + char * perl_name + void * symref + char * filename + CODE: + DLDEBUG(2,fprintf(stderr,"dl_install_xsub(name=%s, symref=%x)\n", + perl_name, symref)); + ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)())symref, filename))); + + +char * +dl_error() + CODE: + RETVAL = LastError ; + OUTPUT: + RETVAL + +# end. diff --git a/perl5.003_94/extLibInc.h b/perl5.003_94/extLibInc.h new file mode 100644 index 0000000..04bf5ca --- /dev/null +++ b/perl5.003_94/extLibInc.h @@ -0,0 +1,355 @@ +/* include file for building of extension libs using gnuwin32. + This file is included by the extension dlls when they are built. + Global vars defined in perl exe are referenced by the extension module + dll by using __imp_varName, where varName is the name of the global + variable in perl.exe. Gnuwin32 has no equivalent to MSVC's + __declspec(dllimport) keyword to define a imported global, so we have + to use this approach to access globals exported by perl.exe + -jc 4/1/97 +*/ + +#define impure_setupptr (*__imp_impure_setupptr) +#define Perl_reall_srchlen (*__imp_Perl_reall_srchlen) +#define Perl_yychar (*__imp_Perl_yychar) +#define Perl_yycheck (*__imp_Perl_yycheck) +#define Perl_yydebug (*__imp_Perl_yydebug) +#define Perl_yydefred (*__imp_Perl_yydefred) +#define Perl_yydgoto (*__imp_Perl_yydgoto) +#define Perl_yyerrflag (*__imp_Perl_yyerrflag) +#define Perl_yygindex (*__imp_Perl_yygindex) +#define Perl_yylen (*__imp_Perl_yylen) +#define Perl_yylhs (*__imp_Perl_yylhs) +#define Perl_yylval (*__imp_Perl_yylval) +#define Perl_yynerrs (*__imp_Perl_yynerrs) +#define Perl_yyrindex (*__imp_Perl_yyrindex) +#define Perl_yysindex (*__imp_Perl_yysindex) +#define Perl_yytable (*__imp_Perl_yytable) +#define Perl_yyval (*__imp_Perl_yyval) +#define Perl_regarglen (*__imp_Perl_regarglen) +#define Perl_regdummy (*__imp_Perl_regdummy) +#define Perl_regkind (*__imp_Perl_regkind) +#define Perl_simple (*__imp_Perl_simple) +#define Perl_varies (*__imp_Perl_varies) +#define Perl_watchaddr (*__imp_Perl_watchaddr) +#define Perl_watchok (*__imp_Perl_watchok) +#define Argv (*__imp_Argv) +#define Cmd (*__imp_Cmd) +#define DBgv (*__imp_DBgv) +#define DBline (*__imp_DBline) +#define DBsignal (*__imp_DBsignal) +#define DBsingle (*__imp_DBsingle) +#define DBsub (*__imp_DBsub) +#define DBtrace (*__imp_DBtrace) +#define Error (*__imp_Error) +#define Perl_AMG_names (*__imp_Perl_AMG_names) +#define Perl_No (*__imp_Perl_No) +#define Perl_Sv (*__imp_Perl_Sv) +#define Perl_Xpv (*__imp_Perl_Xpv) +#define Perl_Yes (*__imp_Perl_Yes) +#define Perl_amagic_generation (*__imp_Perl_amagic_generation) +#define Perl_an (*__imp_Perl_an) +#define Perl_buf (*__imp_Perl_buf) +#define Perl_bufend (*__imp_Perl_bufend) +#define Perl_bufptr (*__imp_Perl_bufptr) +#define Perl_check (*__imp_Perl_check) +#define Perl_collation_ix (*__imp_Perl_collation_ix) +#define Perl_collation_name (*__imp_Perl_collation_name) +#define Perl_collation_standard (*__imp_Perl_collation_standard) +#define Perl_collxfrm_base (*__imp_Perl_collxfrm_base) +#define Perl_collxfrm_mult (*__imp_Perl_collxfrm_mult) +#define Perl_compcv (*__imp_Perl_compcv) +#define Perl_compiling (*__imp_Perl_compiling) +#define Perl_comppad (*__imp_Perl_comppad) +#define Perl_comppad_name (*__imp_Perl_comppad_name) +#define Perl_comppad_name_fill (*__imp_Perl_comppad_name_fill) +#define Perl_cop_seqmax (*__imp_Perl_cop_seqmax) +#define Perl_curcop (*__imp_Perl_curcop) +#define Perl_curcopdb (*__imp_Perl_curcopdb) +#define Perl_curinterp (*__imp_Perl_curinterp) +#define Perl_curpad (*__imp_Perl_curpad) +#define Perl_dc (*__imp_Perl_dc) +#define Perl_di (*__imp_Perl_di) +#define Perl_ds (*__imp_Perl_ds) +#define Perl_egid (*__imp_Perl_egid) +#define Perl_envgv (*__imp_Perl_envgv) +#define Perl_error_count (*__imp_Perl_error_count) +#define Perl_euid (*__imp_Perl_euid) +#define Perl_evalseq (*__imp_Perl_evalseq) +#define Perl_expect (*__imp_Perl_expect) +#define Perl_fold_locale (*__imp_Perl_fold_locale) +#define Perl_gid (*__imp_Perl_gid) +#define Perl_he_root (*__imp_Perl_he_root) +#define Perl_hexdigit (*__imp_Perl_hexdigit) +#define Perl_hints (*__imp_Perl_hints) +#define Perl_in_my (*__imp_Perl_in_my) +#define Perl_last_lop (*__imp_Perl_last_lop) +#define Perl_last_lop_op (*__imp_Perl_last_lop_op) +#define Perl_last_uni (*__imp_Perl_last_uni) +#define Perl_lex_brackets (*__imp_Perl_lex_brackets) +#define Perl_lex_brackstack (*__imp_Perl_lex_brackstack) +#define Perl_lex_casemods (*__imp_Perl_lex_casemods) +#define Perl_lex_casestack (*__imp_Perl_lex_casestack) +#define Perl_lex_defer (*__imp_Perl_lex_defer) +#define Perl_lex_dojoin (*__imp_Perl_lex_dojoin) +#define Perl_lex_expect (*__imp_Perl_lex_expect) +#define Perl_lex_fakebrack (*__imp_Perl_lex_fakebrack) +#define Perl_lex_formbrack (*__imp_Perl_lex_formbrack) +#define Perl_lex_inpat (*__imp_Perl_lex_inpat) +#define Perl_lex_inwhat (*__imp_Perl_lex_inwhat) +#define Perl_lex_op (*__imp_Perl_lex_op) +#define Perl_lex_repl (*__imp_Perl_lex_repl) +#define Perl_lex_starts (*__imp_Perl_lex_starts) +#define Perl_lex_state (*__imp_Perl_lex_state) +#define Perl_lex_stuff (*__imp_Perl_lex_stuff) +#define Perl_linestr (*__imp_Perl_linestr) +#define Perl_markstack (*__imp_Perl_markstack) +#define Perl_markstack_max (*__imp_Perl_markstack_max) +#define Perl_markstack_ptr (*__imp_Perl_markstack_ptr) +#define Perl_max_intro_pending (*__imp_Perl_max_intro_pending) +#define Perl_maxo (*__imp_Perl_maxo) +#define Perl_min_intro_pending (*__imp_Perl_min_intro_pending) +#define Perl_multi_close (*__imp_Perl_multi_close) +#define Perl_multi_end (*__imp_Perl_multi_end) +#define Perl_multi_open (*__imp_Perl_multi_open) +#define Perl_multi_start (*__imp_Perl_multi_start) +#define Perl_na (*__imp_Perl_na) +#define Perl_nexttoke (*__imp_Perl_nexttoke) +#define Perl_nexttype (*__imp_Perl_nexttype) +#define Perl_nextval (*__imp_Perl_nextval) +#define Perl_nomemok (*__imp_Perl_nomemok) +#define Perl_numeric_local (*__imp_Perl_numeric_local) +#define Perl_numeric_name (*__imp_Perl_numeric_name) +#define Perl_numeric_standard (*__imp_Perl_numeric_standard) +#define Perl_oldbufptr (*__imp_Perl_oldbufptr) +#define Perl_oldoldbufptr (*__imp_Perl_oldoldbufptr) +#define Perl_op (*__imp_Perl_op) +#define Perl_op_desc (*__imp_Perl_op_desc) +#define Perl_op_name (*__imp_Perl_op_name) +#define Perl_op_seqmax (*__imp_Perl_op_seqmax) +#define Perl_opargs (*__imp_Perl_opargs) +#define Perl_origalen (*__imp_Perl_origalen) +#define Perl_origenviron (*__imp_Perl_origenviron) +#define Perl_osname (*__imp_Perl_osname) +#define Perl_padix (*__imp_Perl_padix) +#define Perl_patleave (*__imp_Perl_patleave) +#define Perl_pidstatus (*__imp_Perl_pidstatus) +#define Perl_ppaddr (*__imp_Perl_ppaddr) +#define Perl_profiledata (*__imp_Perl_profiledata) +#define Perl_psig_name (*__imp_Perl_psig_name) +#define Perl_psig_ptr (*__imp_Perl_psig_ptr) +#define Perl_regbol (*__imp_Perl_regbol) +#define Perl_regcode (*__imp_Perl_regcode) +#define Perl_regendp (*__imp_Perl_regendp) +#define Perl_regeol (*__imp_Perl_regeol) +#define Perl_reginput (*__imp_Perl_reginput) +#define Perl_reglastparen (*__imp_Perl_reglastparen) +#define Perl_regnaughty (*__imp_Perl_regnaughty) +#define Perl_regnpar (*__imp_Perl_regnpar) +#define Perl_regparse (*__imp_Perl_regparse) +#define Perl_regprecomp (*__imp_Perl_regprecomp) +#define Perl_regprev (*__imp_Perl_regprev) +#define Perl_regsawback (*__imp_Perl_regsawback) +#define Perl_regsize (*__imp_Perl_regsize) +#define Perl_regstartp (*__imp_Perl_regstartp) +#define Perl_regtill (*__imp_Perl_regtill) +#define Perl_regxend (*__imp_Perl_regxend) +#define Perl_retstack (*__imp_Perl_retstack) +#define Perl_retstack_ix (*__imp_Perl_retstack_ix) +#define Perl_retstack_max (*__imp_Perl_retstack_max) +#define Perl_rsfp (*__imp_Perl_rsfp) +#define Perl_rsfp_filters (*__imp_Perl_rsfp_filters) +#define Perl_savestack (*__imp_Perl_savestack) +#define Perl_savestack_ix (*__imp_Perl_savestack_ix) +#define Perl_savestack_max (*__imp_Perl_savestack_max) +#define Perl_scopestack (*__imp_Perl_scopestack) +#define Perl_scopestack_ix (*__imp_Perl_scopestack_ix) +#define Perl_scopestack_max (*__imp_Perl_scopestack_max) +#define Perl_scrgv (*__imp_Perl_scrgv) +#define Perl_sh_path (*__imp_Perl_sh_path) +#define Perl_sig_name (*__imp_Perl_sig_name) +#define Perl_sig_num (*__imp_Perl_sig_num) +#define Perl_siggv (*__imp_Perl_siggv) +#define Perl_stack_base (*__imp_Perl_stack_base) +#define Perl_stack_max (*__imp_Perl_stack_max) +#define Perl_stack_sp (*__imp_Perl_stack_sp) +#define Perl_statbuf (*__imp_Perl_statbuf) +#define Perl_sub_generation (*__imp_Perl_sub_generation) +#define Perl_subline (*__imp_Perl_subline) +#define Perl_subname (*__imp_Perl_subname) +#define Perl_sv_no (*__imp_Perl_sv_no) +#define Perl_sv_undef (*__imp_Perl_sv_undef) +#define Perl_sv_yes (*__imp_Perl_sv_yes) +#define Perl_tainting (*__imp_Perl_tainting) +#define Perl_thisexpr (*__imp_Perl_thisexpr) +#define Perl_timesbuf (*__imp_Perl_timesbuf) +#define Perl_tokenbuf (*__imp_Perl_tokenbuf) +#define Perl_uid (*__imp_Perl_uid) +#define Perl_vert (*__imp_Perl_vert) +#define Perl_vtbl_amagic (*__imp_Perl_vtbl_amagic) +#define Perl_vtbl_amagicelem (*__imp_Perl_vtbl_amagicelem) +#define Perl_vtbl_arylen (*__imp_Perl_vtbl_arylen) +#define Perl_vtbl_bm (*__imp_Perl_vtbl_bm) +#define Perl_vtbl_collxfrm (*__imp_Perl_vtbl_collxfrm) +#define Perl_vtbl_dbline (*__imp_Perl_vtbl_dbline) +#define Perl_vtbl_env (*__imp_Perl_vtbl_env) +#define Perl_vtbl_envelem (*__imp_Perl_vtbl_envelem) +#define Perl_vtbl_fm (*__imp_Perl_vtbl_fm) +#define Perl_vtbl_glob (*__imp_Perl_vtbl_glob) +#define Perl_vtbl_isa (*__imp_Perl_vtbl_isa) +#define Perl_vtbl_isaelem (*__imp_Perl_vtbl_isaelem) +#define Perl_vtbl_itervar (*__imp_Perl_vtbl_itervar) +#define Perl_vtbl_mglob (*__imp_Perl_vtbl_mglob) +#define Perl_vtbl_nkeys (*__imp_Perl_vtbl_nkeys) +#define Perl_vtbl_pack (*__imp_Perl_vtbl_pack) +#define Perl_vtbl_packelem (*__imp_Perl_vtbl_packelem) +#define Perl_vtbl_pos (*__imp_Perl_vtbl_pos) +#define Perl_vtbl_sig (*__imp_Perl_vtbl_sig) +#define Perl_vtbl_sigelem (*__imp_Perl_vtbl_sigelem) +#define Perl_vtbl_substr (*__imp_Perl_vtbl_substr) +#define Perl_vtbl_sv (*__imp_Perl_vtbl_sv) +#define Perl_vtbl_taint (*__imp_Perl_vtbl_taint) +#define Perl_vtbl_uvar (*__imp_Perl_vtbl_uvar) +#define Perl_vtbl_vec (*__imp_Perl_vtbl_vec) +#define Perl_xiv_arenaroot (*__imp_Perl_xiv_arenaroot) +#define Perl_xiv_root (*__imp_Perl_xiv_root) +#define Perl_xnv_root (*__imp_Perl_xnv_root) +#define Perl_xpv_root (*__imp_Perl_xpv_root) +#define Perl_xrv_root (*__imp_Perl_xrv_root) +#define ampergv (*__imp_ampergv) +#define argvgv (*__imp_argvgv) +#define argvoutgv (*__imp_argvoutgv) +#define basetime (*__imp_basetime) +#define beginav (*__imp_beginav) +#define bodytarget (*__imp_bodytarget) +#define cddir (*__imp_cddir) +#define chopset (*__imp_chopset) +#define comppad_name_floor (*__imp_comppad_name_floor) +#define copline (*__imp_copline) +#define curpm (*__imp_curpm) +#define curstack (*__imp_curstack) +#define curstash (*__imp_curstash) +#define curstname (*__imp_curstname) +#define cxstack (*__imp_cxstack) +#define cxstack_ix (*__imp_cxstack_ix) +#define cxstack_max (*__imp_cxstack_max) +#define dbargs (*__imp_dbargs) +#define debdelim (*__imp_debdelim) +#define debname (*__imp_debname) +#define debstash (*__imp_debstash) +#define debug (*__imp_debug) +#define defgv (*__imp_defgv) +#define defoutgv (*__imp_defoutgv) +#define defstash (*__imp_defstash) +#define delaymagic (*__imp_delaymagic) +#define diehook (*__imp_diehook) +#define dirty (*__imp_dirty) +#define dlevel (*__imp_dlevel) +#define dlmax (*__imp_dlmax) +#define do_undump (*__imp_do_undump) +#define doextract (*__imp_doextract) +#define doswitches (*__imp_doswitches) +#define dowarn (*__imp_dowarn) +#define dumplvl (*__imp_dumplvl) +#define e_fp (*__imp_e_fp) +#define e_tmpname (*__imp_e_tmpname) +#define endav (*__imp_endav) +#define errgv (*__imp_errgv) +#define eval_root (*__imp_eval_root) +#define eval_start (*__imp_eval_start) +#define fdpid (*__imp_fdpid) +#define filemode (*__imp_filemode) +#define firstgv (*__imp_firstgv) +#define forkprocess (*__imp_forkprocess) +#define formfeed (*__imp_formfeed) +#define formtarget (*__imp_formtarget) +#define gensym (*__imp_gensym) +#define in_eval (*__imp_in_eval) +#define incgv (*__imp_incgv) +#define inplace (*__imp_inplace) +#define last_in_gv (*__imp_last_in_gv) +#define lastfd (*__imp_lastfd) +#define lastscream (*__imp_lastscream) +#define lastsize (*__imp_lastsize) +#define lastspbase (*__imp_lastspbase) +#define laststatval (*__imp_laststatval) +#define laststype (*__imp_laststype) +#define leftgv (*__imp_leftgv) +#define lineary (*__imp_lineary) +#define localizing (*__imp_localizing) +#define localpatches (*__imp_localpatches) +#define main_cv (*__imp_main_cv) +#define main_root (*__imp_main_root) +#define main_start (*__imp_main_start) +#define mainstack (*__imp_mainstack) +#define maxscream (*__imp_maxscream) +#define maxsysfd (*__imp_maxsysfd) +#define minus_F (*__imp_minus_F) +#define minus_a (*__imp_minus_a) +#define minus_c (*__imp_minus_c) +#define minus_l (*__imp_minus_l) +#define minus_n (*__imp_minus_n) +#define minus_p (*__imp_minus_p) +#define multiline (*__imp_multiline) +#define mystack_base (*__imp_mystack_base) +#define mystack_max (*__imp_mystack_max) +#define mystack_sp (*__imp_mystack_sp) +#define mystrk (*__imp_mystrk) +#define nice_chunk (*__imp_nice_chunk) +#define nice_chunk_size (*__imp_nice_chunk_size) +#define nrs (*__imp_nrs) +#define ofmt (*__imp_ofmt) +#define ofs (*__imp_ofs) +#define ofslen (*__imp_ofslen) +#define oldlastpm (*__imp_oldlastpm) +#define oldname (*__imp_oldname) +#define op_mask (*__imp_op_mask) +#define origargc (*__imp_origargc) +#define origargv (*__imp_origargv) +#define origfilename (*__imp_origfilename) +#define ors (*__imp_ors) +#define orslen (*__imp_orslen) +#define pad_reset_pending (*__imp_pad_reset_pending) +#define padix_floor (*__imp_padix_floor) +#define parsehook (*__imp_parsehook) +#define patchlevel (*__imp_patchlevel) +#define perl_destruct_level (*__imp_perl_destruct_level) +#define perldb (*__imp_perldb) +#define preambleav (*__imp_preambleav) +#define preambled (*__imp_preambled) +#define preprocess (*__imp_preprocess) +#define regflags (*__imp_regflags) +#define restartop (*__imp_restartop) +#define rightgv (*__imp_rightgv) +#define rs (*__imp_rs) +#define runlevel (*__imp_runlevel) +#define sawampersand (*__imp_sawampersand) +#define sawstudy (*__imp_sawstudy) +#define sawvec (*__imp_sawvec) +#define screamfirst (*__imp_screamfirst) +#define screamnext (*__imp_screamnext) +#define secondgv (*__imp_secondgv) +#define signalstack (*__imp_signalstack) +#define sortcop (*__imp_sortcop) +#define sortstack (*__imp_sortstack) +#define sortstash (*__imp_sortstash) +#define splitstr (*__imp_splitstr) +#define statcache (*__imp_statcache) +#define statgv (*__imp_statgv) +#define statname (*__imp_statname) +#define statusvalue (*__imp_statusvalue) +#define stdingv (*__imp_stdingv) +#define strchop (*__imp_strchop) +#define strtab (*__imp_strtab) +#define sv_arenaroot (*__imp_sv_arenaroot) +#define sv_count (*__imp_sv_count) +#define sv_objcount (*__imp_sv_objcount) +#define sv_root (*__imp_sv_root) +#define tainted (*__imp_tainted) +#define tmps_floor (*__imp_tmps_floor) +#define tmps_ix (*__imp_tmps_ix) +#define tmps_max (*__imp_tmps_max) +#define tmps_stack (*__imp_tmps_stack) +#define top_env (*__imp_top_env) +#define toptarget (*__imp_toptarget) +#define unsafe (*__imp_unsafe) +#define warnhook (*__imp_warnhook) diff --git a/perl5.003_94/gcc2 b/perl5.003_94/gcc2 new file mode 100644 index 0000000..f01da9e --- /dev/null +++ b/perl5.003_94/gcc2 @@ -0,0 +1,19 @@ +#!/bin/sh + + +# gcc wrapper for building dynamic lib version of perl +# if -buildperl found on command line, then all args passed to +# perlgcc, else pass all args to gcc. +# jc 3/24/97 +# +results=`echo "$*" | grep "\-buildperl"` +# echo "results = <$results>" +#if ( "$results" .eq. ""); then +# if `sh -c echo '$*' | grep buildperl >/dev/null 2>&1`; then +case "$results" in + "") gcc $*;; + *) miniperl perlgcc $*;; +esac + + + diff --git a/perl5.003_94/hints/gnuwin32.sh b/perl5.003_94/hints/gnuwin32.sh new file mode 100644 index 0000000..abd0210 --- /dev/null +++ b/perl5.003_94/hints/gnuwin32.sh @@ -0,0 +1,50 @@ +#! /bin/sh +# gnuwin32.sh - hintsfile for building perl on Windows NT using the +# Cygnus Win32 Development Kit. +# See "http://www.cygnus.com/misc/gnu-win32/" to learn about the kit. +# +path_sep=\; +exe_ext='.exe' +firstmakefile='GNUmakefile' +if test -f $sh.exe; then sh=$sh.exe; fi +startsh="#!$sh" +cc='gcc2' +ld='ld2' +usrinc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/include' +libpth='/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib /gnuwin32/H-i386-cygwin32/lib' +libs='-lcygwin -lm -lc -lkernel32' +# dynamic lib stuff +so='dll' +#i_dlfcn='define' +dlsrc='dl_gnuwin32.xs' +usedl='y' +# flag to include the perl.exe export variable translation file extLibInc.h when +# building extension libs +cccdlflags='-DCYGWIN32 -DDLLIMPORT ' +# flag that signals gcc2 to build exportable perl +ccdlflags='-buildperl ' +lddlflags='-L../.. -L/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib -lperlexp -lcygwin' +d_voidsig='undef' +extensions='Fcntl IO Opcode SDBM_File' +lns='cp' +signal_t='int' +useposix='false' +rd_nodata='0' +eagain='EAGAIN' +archname='gnuwin32' +# + +installbin='/usr/local/bin' +installman1dir='' +installman3dir='' +installprivlib='/usr/local/lib/perl5' +installscript='/usr/local/bin' + +installsitelib='/usr/local/lib/perl5/site_perl' +libc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib/libc.a' + +perlpath='/usr/local/bin/perl' + +sitelib='/usr/local/lib/perl5/site_perl' +sitelibexp='/usr/local/lib/perl5/site_perl' +usrinc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/include' diff --git a/perl5.003_94/ld2 b/perl5.003_94/ld2 new file mode 100644 index 0000000..65f10b4 --- /dev/null +++ b/perl5.003_94/ld2 @@ -0,0 +1,4 @@ +#!/bin/sh +PERLPATH=/perl5.003_94 +# pass all args to the perl ld wrapper +$PERLPATH/perl $PERLPATH/perlld $* diff --git a/perlgcc b/perlgcc new file mode 100644 index 0000000..b34945d --- /dev/null +++ b/perlgcc @@ -0,0 +1,83 @@ +# +# Perl script be a wrapper around the gnu gcc. the exportable perl.exe is built, special +# processing is done +# This script is caled by the gcc2 shell script when the flag -buildperl is passed to gcc2 + + +print "perlgcc: building exportable perl...\n"; +# get all libs: +my @libobs; +my @obs; +my @libFlags; +my $libstring; +foreach (@ARGV){ + if( /\.[a]$/){ + push @libobs,$_; + } + elsif(/^\-l/){ + push @libFlags,$_; + } + if( /\.[o]$/){ + push @obs,$_; + } +} +$libstring = join(" ",@libobs); +$obsString = join(" ",@obs); +$libflagString = join(" ",@libFlags); + +# make exports file +my $command = "echo EXPORTS > perl.def"; +print "$command\n"; +system($command); + +$command ="nm $libstring | grep '^........ [TCD] _'| grep -v _impure_ptr | sed 's/[^_]*_//' >> perl.def"; +print "$command\n"; +system($command); + +# Build the perl.a lib to link to: +$command ="dlltool --as=as --dllname perl.exe --def perl.def --output-lib perl.a"; +print "$command\n"; +system($command); + +# change name of export lib to libperlexp so that is can be understood by ld2/perlld +$command ="mv perl.a libperlexp.a"; +print "$command\n"; +system($command); + +# get the full path name of a few libs: +my $crt0 = `gcc -print-file-name=crt0.o`; +chomp $crt0; +my $libdir = `gcc -print-file-name=libcygwin.a`; +chomp $libdir; +$libdir =~ s/libcygwin\.a//g; + +# Link exe: +$command = "ld --base-file perl.base -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; +print "$command\n"; +system($command); + +$command = "dlltool --as=as --dllname perl.exe --def perl.def --base-file perl.base --output-exp perl.exp"; +print "$command\n"; +system($command); + +$command = "ld --base-file perl.base perl.exp -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; +print "$command\n"; +system($command); + +$command = "dlltool --as=as --dllname perl.exe --def perl.def --base-file perl.base --output-exp perl.exp"; +print "$command\n"; +system($command); + +$command = "ld perl.exp -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; +print "$command\n"; +system($command); + +print "perlgcc: Completed\n"; + + + + + + + + diff --git a/perlld b/perlld new file mode 100644 index 0000000..25acc24 --- /dev/null +++ b/perlld @@ -0,0 +1,206 @@ +# +# Perl script be a wrapper around the gnu ld. When a dll is specified to be built, special +# processing is done, else the standard ld is called. +# +# Modified 3/14/97 to include the impure_ptr setup routine in init.cc +# Modified to make dll in current directory then copy to another dir if +# a path name specified on the command name with the -o parm +my $args = join(" ",@ARGV); # get args +my $arg; + +my @objs; +my @flags; +my $libname; +my $init = "init"; +my $fixup = "fixup"; + +my $path; + + +sub writefixup; +sub writeInit; + +if( $args=~/\-o (.+?)\.dll/i){ + $libname = $1; + # print "libname = <$libname>\n"; + # Check for path: + if( $libname =~ /($\.+?\/)(\w+$)/){ + $path = $1; + $libname = $2; + # print "<$path> <$libname>\n"; + } + + foreach $arg(@ARGV){ + if( $arg=~/\.[oa]$/){ + push @objs,$arg; + next; + } + if( $arg =~/\-o/ or $arg =~ /.+?\.dll/i ){ + next; + } + push @flags,$arg; + } + + writefixup(); + writeInit(); + $command = "gcc -c $fixup.c\n"; + print $command; + system($command); + $command = "gcc -c $init.cc\n"; + print $command; + system($command); + + $command = "echo EXPORTS > $libname.def\n"; + print $command; + system($command); + $command = "nm ".join(" ",@objs)." $init.o $fixup.o | grep '^........ [TCD] _' | sed 's/[^_]*_//' >> $libname.def\n"; + print $command; + system($command); + + $command = "ld --base-file $libname.base --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; + $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; + print $command; + system($command); + + $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --base-file $libname.base --output-exp $libname.exp\n"; + print $command; + system($command); + + $command = "ld --base-file $libname.base $libname.exp --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; + $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; + print $command; + system($command); + + $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --base-file $libname.base --output-exp $libname.exp\n"; + print $command; + system($command); + + $command = "ld $libname.exp --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; + $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; + print $command; + system($command); + + print "Build the import lib\n"; + $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --output-lib $libname.a\n"; + print $command; + system($command); + + # if there was originally a path, copy the dll and a to that location: + if($path && $path ne "./" && $path."\n" ne "`pwd`"){ + $command = "mv $libname.dll $path".$libname.".dll\n"; + print $command; + system($command); + $command = "mv $libname.a $path".$libname.".a\n"; + print $command; + system($command); + + } + +} +else{ # no special processing, just call ld + $command = "ld $args\n"; + print $command; + system($command); +} + +# -------------------------------------------------------------------------------- +sub writeInit{ + +open(OUTFILE,">$init.cc") or die("Can't open $init.cc\n"); + +print OUTFILE <<'EOF'; +/* init.cc for WIN32. + + Copyright 1996 Cygnus Solutions + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +// Added impure_ptr initialization routine. This is needed for any DLL that needs +// to output to the main (calling) executable's stdout, stderr, etc. This routine +// needs to be called from the executable using the DLL before any other DLL +// routines are called. jc 3/14/97 + +#include + +extern "C" +{ + int WINAPI dll_entry (HANDLE h, DWORD reason, void *ptr); + void impure_setup(struct _reent *_impure_ptrMain); +}; + +struct _reent *_impure_ptr; // this will be the Dlls local copy of impure ptr + +int WINAPI dll_entry (HANDLE , + DWORD reason, + void *) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + } + return 1; +} + + +//******************************************** +// Function to set our local (in this dll) copy of impure_ptr to the +// main's (calling executable's) impure_ptr +void impure_setup(struct _reent *_impure_ptrMain){ + + _impure_ptr = _impure_ptrMain; + +} +EOF + +close OUTFILE; + +} + +# ------------------------------------------------------------------------------------------ +sub writefixup{ + +open(OUTFILE,">$fixup.c") or die("Can't open $fixup.c\n"); + +print OUTFILE <<'EOF'; +/* This is needed to terminate the list of inport stuff */ +/* Copied from winsup/dcrt0.cc in the cygwin32 source distribution. */ + asm(".section .idata$3\n" ".long 0,0,0,0, 0,0,0,0"); + +EOF +close OUTFILE; +} + + + + + + + + + + + + + + + + diff --git a/pp_sys.c b/pp_sys.c index f99bf29..f0ac319 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3973,7 +3973,8 @@ PP(pp_gpwent) PP(pp_spwent) { dSP; -#ifdef HAS_PASSWD + /* CYGWIN32 is missing setpwent(), (but has the others!) */ +#if 0 setpwent(); RETPUSHYES; #else