summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-07-31 00:45:12 -0400
committerGurusamy Sarathy <gsar@cpan.org>1999-08-01 20:59:59 +0000
commit3cfae81b38bc8edd77142113464ee12c2a2e5af0 (patch)
tree06dfba65718e52a2f5b475c60077ce21639209e6
parent6dce6b70b85ef184fc8b4432d2436d1be5f0b117 (diff)
downloadperl-3cfae81b38bc8edd77142113464ee12c2a2e5af0.tar.gz
slightly modified version of suggested patch
Message-Id: <199907311406.IAA25034@localhost.frii.com> Subject: [PATCH 5.005_58] Fix OS/2 build p4raw-id: //depot/perl@3856
-rw-r--r--Makefile.SH10
-rw-r--r--lib/ExtUtils/MM_OS2.pm10
-rw-r--r--lib/ExtUtils/Mksymlists.pm9
-rw-r--r--makedef.pl85
-rw-r--r--os2/Makefile.SHs10
-rw-r--r--os2/diff.configure26
-rw-r--r--perl.h8
-rw-r--r--sv.h2
8 files changed, 136 insertions, 24 deletions
diff --git a/Makefile.SH b/Makefile.SH
index c8ef6ab4f0..0399902f98 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -357,6 +357,16 @@ perl.exp: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH)
!NO!SUBS!
;;
+os2)
+ $spitshell >>Makefile <<'!NO!SUBS!'
+MINIPERLEXP = miniperl
+
+perl5.def: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH) miniperl.map
+ ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) > perl.exp.tmp
+ sh mv-if-diff perl.exp.tmp perl5.def
+
+!NO!SUBS!
+ ;;
esac
if test -r $Makefile_s ; then
diff --git a/lib/ExtUtils/MM_OS2.pm b/lib/ExtUtils/MM_OS2.pm
index 5d6034ce34..430235a0aa 100644
--- a/lib/ExtUtils/MM_OS2.pm
+++ b/lib/ExtUtils/MM_OS2.pm
@@ -25,13 +25,13 @@ sub dlsyms {
$self->{BASEEXT}.def: Makefile.PL
",
' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
- Mksymlists("NAME" => "', $self->{NAME},
- '", "DLBASE" => "',$self->{DLBASE},
- '", "DL_FUNCS" => ',neatvalue($funcs),
+ Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
+ '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
+ '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
+ '"DL_FUNCS" => ',neatvalue($funcs),
', "FUNCLIST" => ',neatvalue($funclist),
', "IMPORTS" => ',neatvalue($imports),
- ', "VERSION" => "',$self->{VERSION},
- '", "DL_VARS" => ', neatvalue($vars), ');\'
+ ', "DL_VARS" => ', neatvalue($vars), ');\'
');
}
if (%{$self->{IMPORTS}}) {
diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm
index 76535d9386..cfc1e7dff8 100644
--- a/lib/ExtUtils/Mksymlists.pm
+++ b/lib/ExtUtils/Mksymlists.pm
@@ -76,12 +76,19 @@ sub _write_os2 {
($data->{DLBASE} = $data->{NAME}) =~ s/.*:://;
$data->{DLBASE} = substr($data->{DLBASE},0,7) . '_';
}
+ my $distname = $data->{DISTNAME} || $data->{NAME};
+ $distname = "Distribution $distname";
+ my $comment = "Perl (v$]$threaded) module $data->{NAME}";
+ if ($data->{INSTALLDIRS} and $data->{INSTALLDIRS} eq 'perl') {
+ $distname = 'perl5-porters@perl.org';
+ $comment = "Core $comment";
+ }
rename "$data->{FILE}.def", "$data->{FILE}_def.old";
open(DEF,">$data->{FILE}.def")
or croak("Can't create $data->{FILE}.def: $!\n");
print DEF "LIBRARY '$data->{DLBASE}' INITINSTANCE TERMINSTANCE\n";
- print DEF "DESCRIPTION 'Perl (v$]$threaded) module $data->{NAME} v$data->{VERSION}'\n";
+ print DEF "DESCRIPTION '\@#$distname:$data->{VERSION}#\@ $comment'\n";
print DEF "CODE LOADONCALL\n";
print DEF "DATA LOADONCALL NONSHARED MULTIPLE\n";
print DEF "EXPORTS\n ";
diff --git a/makedef.pl b/makedef.pl
index 8a79bae431..a5e7f216c6 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -1,10 +1,11 @@
#
# Create the export list for perl.
#
-# Needed by WIN32 for creating perl.dll and by AIX for creating libperl.a
-# when -Dusershrplib is in effect.
+# Needed by WIN32 and OS/2 for creating perl.dll
+# and by AIX for creating libperl.a when -Dusershrplib is in effect.
#
# reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
+# On OS/2 reads miniperl.map as well
my $PLATFORM;
my $CCTYPE;
@@ -13,11 +14,12 @@ while (@ARGV)
{
my $flag = shift;
$define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
+ $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
$CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
$PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
}
-my @PLATFORM = qw(aix win32);
+my @PLATFORM = qw(aix win32 os2);
my %PLATFORM;
@PLATFORM{@PLATFORM} = ();
@@ -51,6 +53,10 @@ unless ($PLATFORM eq 'win32') {
$_ = $1;
$define{$1} = 1 while /-D(\w+)/g;
}
+ if ($PLATFORM eq 'os2') {
+ $CONFIG_ARGS = $1 if /^(?:config_args)='(.+)'$/;
+ $ARCHNAME = $1 if /^(?:archname)='(.+)'$/;
+ }
}
close(CFG);
}
@@ -93,6 +99,27 @@ if ($PLATFORM eq 'win32') {
}
print "EXPORTS\n";
}
+} elsif ($PLATFORM eq 'os2') {
+ ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
+ $v .= '-thread' if $ARCHNAME =~ /-thread/;
+ #$sum = 0;
+ #for (split //, $v) {
+ # $sum = ($sum * 33) + ord;
+ # $sum &= 0xffffff;
+ #}
+ #$sum += $sum >> 5;
+ #$sum &= 0xffff;
+ #$sum = printf '%X', $sum;
+ ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
+ # print STDERR "'$dll' <= '$define{PERL_DLL}'\n";
+ print <<"---EOP---";
+LIBRARY '$dll' INITINSTANCE TERMINSTANCE
+DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'
+STACKSIZE 32768
+CODE LOADONCALL
+DATA LOADONCALL NONSHARED MULTIPLE
+EXPORTS
+---EOP---
} elsif ($PLATFORM eq 'aix') {
print "#!\n";
}
@@ -190,6 +217,48 @@ PL_sys_intern
)]);
}
+if ($PLATFORM eq 'os2') {
+ emit_symbols([qw(
+ctermid
+get_sysinfo
+Perl_OS2_init
+OS2_Perl_data
+dlopen
+dlsym
+dlerror
+my_tmpfile
+my_tmpnam
+my_flock
+malloc_mutex
+threads_mutex
+nthreads
+nthreads_cond
+os2_cond_wait
+pthread_join
+pthread_create
+pthread_detach
+XS_Cwd_change_drive
+XS_Cwd_current_drive
+XS_Cwd_extLibpath
+XS_Cwd_extLibpath_set
+XS_Cwd_sys_abspath
+XS_Cwd_sys_chdir
+XS_Cwd_sys_cwd
+XS_Cwd_sys_is_absolute
+XS_Cwd_sys_is_relative
+XS_Cwd_sys_is_rooted
+XS_DynaLoader_mod2fname
+XS_File__Copy_syscopy
+Perl_Register_MQ
+Perl_Deregister_MQ
+Perl_Serve_Messages
+Perl_Process_Messages
+init_PMWIN_entries
+PMWIN_entries
+Perl_hab_GET
+)]);
+}
+
if ($define{'PERL_OBJECT'}) {
skip_symbols [qw(
Perl_getenv_len
@@ -554,6 +623,14 @@ win32_os_id
try_symbol($symbol);
}
}
+elsif ($PLATFORM eq 'os2') {
+ open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
+ /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
+ close MAP or die 'Cannot close miniperl.map';
+
+ @missing = grep { !exists $mapped{$_} } keys %export;
+ delete $export{$_} foreach @missing;
+}
# Now all symbols should be defined because
# next we are going to output them.
@@ -595,6 +672,8 @@ sub output_symbol {
# print "\t$symbol\n";
# print "\t_$symbol = $symbol\n";
# }
+ } elsif ($PLATFORM eq 'os2') {
+ print qq( "$symbol"\n);
} elsif ($PLATFORM eq 'aix') {
print "$symbol\n";
}
diff --git a/os2/Makefile.SHs b/os2/Makefile.SHs
index c732aced9f..f7f840258a 100644
--- a/os2/Makefile.SHs
+++ b/os2/Makefile.SHs
@@ -11,7 +11,7 @@ case "$archname" in
*-thread*) perl_fullversion="${perl_fullversion}-threaded";;
esac
-dll_post="`echo $perl_fullversion | sum | awk '{print $1}'`"
+dll_post="`echo $perl_fullversion | sum | sed -e 's/^0*//' | awk '{print $1}'`"
dll_post="`printf '%x' $dll_post | tr '[a-z]' '[A-Z]'`"
$spitshell >>Makefile <<!GROK!THIS!
@@ -62,9 +62,9 @@ t/$(PERL_DLL): $(PERL_DLL)
$(LNS) $(PERL_DLL) t/$(PERL_DLL)
$(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT)
- $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def
+ $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false )
-perl5.def: perl.linkexp
+perl5.olddef: perl.linkexp
echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated, built with $(CONFIG_ARGS)'" >>$@
echo STACKSIZE 32768 >>$@
@@ -96,10 +96,8 @@ perl.linkexp: perl.exports perl.map os2/os2.sym
# We link miniperl statically, since .DLL depends on $(DYNALOADER)
-perl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT)
+miniperl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT)
$(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) $(obj) $(libs) -Zmap -Zlinker /map
- awk '{if ($$3 == "") print $$2}' <miniperl.map | sort | uniq > perl.map
- rm miniperl.map
@./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
depend: os2ish.h dlfcn.h os2thread.h os2.c
diff --git a/os2/diff.configure b/os2/diff.configure
index 62cf1d2031..c8f3b5899b 100644
--- a/os2/diff.configure
+++ b/os2/diff.configure
@@ -1,6 +1,18 @@
---- Configure Wed Feb 25 16:52:55 1998
-+++ Configure.os2 Wed Feb 25 16:52:58 1998
-@@ -1602,7 +1602,7 @@
+--- Configure-pre Sun Jul 25 19:18:02 1999
++++ Configure Wed Jul 28 17:50:14 1999
+@@ -1528,6 +1528,11 @@ if test X"$trnl" = X; then
+ esac
+ fi
+ if test X"$trnl" = X; then
++ case "`echo foo|tr '\r' x 2>/dev/null`" in
++ foox) trnl='\r' ;;
++ esac
++fi
++if test X"$trnl" = X; then
+ cat <<EOM >&2
+
+ $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
+@@ -1844,7 +1849,7 @@ for file in $loclist; do
*)
echo "I don't know where '$file' is, and my life depends on it." >&4
echo "Go find a public domain implementation or fix your PATH setting!" >&4
@@ -9,16 +21,16 @@
;;
esac
done
-@@ -3637,7 +3637,7 @@
+@@ -3688,7 +3693,7 @@ int main() {
exit(0);
}
EOM
--if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
-+if $cc -o gccvers gccvers.c $ldflags >/dev/null 2>&1; then
+-if $cc -o gccvers gccvers.c; then
++if $cc -o gccvers gccvers.c $ldflags; then
gccversion=`./gccvers`
case "$gccversion" in
'') echo "You are not using GNU cc." ;;
-@@ -4434,7 +4434,7 @@
+@@ -4892,7 +4897,7 @@ case "$libc" in
esac
;;
esac
diff --git a/perl.h b/perl.h
index a8cee21a77..0e43ee4b36 100644
--- a/perl.h
+++ b/perl.h
@@ -1445,6 +1445,10 @@ typedef union any ANY;
# endif
#endif
+#if defined(OS2)
+# include "iperlsys.h"
+#endif
+
#if defined(__OPEN_VM)
# include "vmesa/vmesaish.h"
#endif
@@ -1680,7 +1684,9 @@ typedef I32 (*filter_t) (pTHXo_ int, SV *, int);
#define FILTER_DATA(idx) (AvARRAY(PL_rsfp_filters)[idx])
#define FILTER_ISREADER(idx) (idx >= AvFILLp(PL_rsfp_filters))
-#include "iperlsys.h"
+#if !defined(OS2)
+# include "iperlsys.h"
+#endif
#include "regexp.h"
#include "sv.h"
#include "util.h"
diff --git a/sv.h b/sv.h
index 4ba33edee2..476c9418dc 100644
--- a/sv.h
+++ b/sv.h
@@ -692,7 +692,7 @@ struct xpvio {
#define isGV(sv) (SvTYPE(sv) == SVt_PVGV)
-#if !defined(DOSISH) || defined(WIN32)
+#if !defined(DOSISH) || defined(WIN32) || defined(OS2)
# define SvGROW(sv,len) (SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv))
# define Sv_Grow sv_grow
#else