Subject: | Text::Iconv 1.44 patch for compile and test on VMS |
Text-Iconv-1_4
Perl 5.87 on VMS
Please find a patch attached.
Summary of changes.
Check object file extension.
Remove period (.) from file linktest as this results in an invalid
file on VMS (two periods).
Removed linker options from compile line if VMS.
If VMS pipe compile line to NL:
Thanks,
Peter (Stig) Edwards
Subject: | Text-Iconv-1_4.diff |
--- Text-Iconv-1_4/Iconv.xs 2006-04-09 19:10:20.1144609820 -0400
+++ Text-Iconv-1_4/Iconv.xs 2006-04-10 09:45:18.1144662318 -0400
@@ -106,7 +106,7 @@
while(inbytesleft != 0)
{
-#if (defined(__hpux) || defined(__linux)) && ! defined(_LIBICONV_VERSION)
+#if (defined(__hpux) || defined(__linux) || defined(VMS)) && ! defined(_LIBICONV_VERSION)
/* Even in HP-UX 11.00, documentation and header files do not agree */
/* glibc doesn't seem care too much about standards */
ret = iconv(obj->handle, &icursor, &inbytesleft,
@@ -239,7 +239,7 @@
croak("Insufficient memory to initialize conversion: %s",
strerror(errno));
case EINVAL:
- croak("Unsupported conversion: %s", strerror(errno));
+ croak("Unsupported conversion from: '%s' to: '%s' : %s", fromcode, tocode, strerror(errno));
default:
croak("Couldn't initialize conversion: %s", strerror(errno));
}
--- Text-Iconv-1_4/Makefile.PL 2006-04-09 19:10:20.1144609820 -0400
+++ Text-Iconv-1_4/Makefile.PL 2006-04-09 20:10:38.1144613438 -0400
@@ -27,6 +27,16 @@
$i++;
}
+my $obj_ext = '.o';
+if ($^O eq 'VMS') {
+ # check the object extension
+ if ($Config{ccflags} =~ m/obj=([a-z0-9\.]+)/) {
+ $obj_ext = $1;
+ } else {
+ $obj_ext = '.obj';
+ }
+}
+
###############################################################################
# Check for iconv.
@@ -98,7 +108,7 @@
my $libs = shift;
my $incs = shift;
- my $file = '.linktest';
+ my $file = 'linktest';
my $prog = <<EOT;
#include <iconv.h>
@@ -108,15 +118,23 @@
}
EOT
- my $compile = join ' ', $Config{cc}, $incs, $Config{ccflags},
- $Config{ldflags}, $libs;
- # print "Compiler: $compile\n";
- open LINKTEST, '>', "$file.c" or die "Can't create test file";
+ my $compile;
+ if ($^O ne 'VMS') {
+ $compile = join ' ', $Config{cc}, $incs, $Config{ccflags}, $Config{ldflags}, $libs;
+ } else {
+ $compile = join ' ', $Config{cc}, $incs, $Config{ccflags}, $libs;
+ }
+ print "\nCompiler:'$compile'\n";
+ open LINKTEST, '>', "$file.c" or die "Can't create test file '$file.c'.";
print LINKTEST $prog;
close LINKTEST;
-
- my $result = system("$compile -o $file $file.c $libs 2> /dev/null") / 256;
- unlink $file, "$file.c", "$file.o";
+ my $compile_line = "$compile -o $file $file.c $libs 2> /dev/null";
+ if ($^O eq 'VMS') {
+ $compile_line = "pipe $compile $file.c $libs 2> NL:";
+ }
+ print "Compile line:'$compile_line'\n";
+ my $result = system($compile_line) / 256;
+ unlink $file, "$file.c", "$file$obj_ext";
if ($result == 0)
{
--- Text-Iconv-1_4/t/01_charsets.t 2006-04-09 19:10:20.1144609820 -0400
+++ Text-Iconv-1_4/t/01_charsets.t 2006-04-09 20:10:38.1144613438 -0400
@@ -8,6 +8,8 @@
Text::Iconv->raise_error(1);
+# Note on VMS codepages are found in SYS$I18N_ICONV
+
%codesets = ('iso88591' => [qw(iso88591 iso8859-1 iso-8859-1 ISO88591
ISO8859-1 ISO-8859-1 88591 8859-1)],
'cp037' => [qw(cp037 CP037 ibm037 IBM037 ibm-037 IBM-037)],
@@ -39,6 +41,7 @@
elsif ($c1 == 0 or $c2 == 0)
{
print "ok $test_no \t # skip ($source <-> $target conversion not supported by iconv library)\n";
+ print STDERR "source '$source' <-> target '$target' conversion not supported by iconv library.\n";
}
else
{
@@ -55,11 +58,12 @@
elsif ($r2 eq $strings{$source})
{
print "ok $test_no \t # ($source <-> $target)", $c1->retval, "/", $c2->retval,"\n";
+ print STDERR "source '$source' <-> target '$target' conversion OK.\n";
}
else
{
print "not ok $test_no \t # ($source <-> $target roundtrip failed)\n";
-print $c1->retval, "/", $c2->retval,"\n";
+ print $c1->retval, "/", $c2->retval,"\n";
}
}
}