Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 3cfae81b38bc8edd77142113464ee12c2a2e5af0 1 parent 6dce6b7
Ilya Zakharevich authored Gurusamy Sarathy committed
View
10 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
View
10 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}}) {
View
9 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 ";
View
85 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 @@
{
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 @@
$_ = $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 @@
}
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 @@ sub emit_symbols {
)]);
}
+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 @@ sub try_symbol {
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";
}
View
10 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
View
26 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
View
8 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"
View
2  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
Please sign in to comment.
Something went wrong with that request. Please try again.