Subject: | Tcl on Cygwin |
Guess I'm the first to try your module under Cygwin.
The attached patch contains 3 changes:
1. Makefile.PL uses tclConfig.sh under Cygwin.
2. Uses INT2PTR in Tcl.xs to silence a few compiler warnings.
3. Works around an apparent deficiency in canonpath() for Cygwin in info.t.
Looking forward to using your module. Thanks.
Subject: | tcl.patch |
diff -urN Tcl-0.91/Makefile.PL Tcl-patched/Makefile.PL
--- Tcl-0.91/Makefile.PL 2006-11-13 12:19:00.000000000 -0500
+++ Tcl-patched/Makefile.PL 2007-03-26 10:52:36.000000000 -0400
@@ -42,6 +42,8 @@
$arch = "$^O-i686" if ($Config{archname} =~ /i\d86/);
$arch = "$^O-ia64" if ($Config{archname} =~ /ia64/i);
$arch = "$^O-x86_64" if ($Config{archname} =~ /x86_64/);
+} elsif ($^O eq "cygwin") {
+ $tclconfig = '/usr/lib/tclConfig.sh';
}
GetOptions("tclsh=s", \$tclsh, # Use this tclsh executable as a
diff -urN Tcl-0.91/Tcl.xs Tcl-patched/Tcl.xs
--- Tcl-0.91/Tcl.xs 2006-11-03 13:35:56.000000000 -0400
+++ Tcl-patched/Tcl.xs 2007-03-26 11:01:26.000000000 -0400
@@ -1468,8 +1468,8 @@
CODE:
if (!initialized) { return; }
if (SvIOK(cmdProc))
- Tcl_CreateCommand(interp, cmdName, (Tcl_CmdProc *) SvIV(cmdProc),
- (ClientData) SvIV(clientData), NULL);
+ Tcl_CreateCommand(interp, cmdName, INT2PTR(Tcl_CmdProc *, SvIV(cmdProc)),
+ INT2PTR(ClientData, SvIV(clientData)), NULL);
else {
AV *av = (AV *) SvREFCNT_inc((SV *) newAV());
av_store(av, 0, newSVsv(cmdProc));
@@ -1662,7 +1662,7 @@
sv = *av_fetch(av, 0, FALSE);
if (sv_derived_from(sv, "Tcl")) {
IV tmp = SvIV((SV *) SvRV(sv));
- interp = (Tcl) tmp;
+ interp = INT2PTR(Tcl, tmp);
}
else {
croak("bad object passed to Tcl::Var::FETCH");
@@ -1696,7 +1696,7 @@
sv = *av_fetch(av, 0, FALSE);
if (sv_derived_from(sv, "Tcl")) {
IV tmp = SvIV((SV *) SvRV(sv));
- interp = (Tcl) tmp;
+ interp = INT2PTR(Tcl, tmp);
}
else
croak("bad object passed to Tcl::Var::STORE");
diff -urN Tcl-0.91/t/info.t Tcl-patched/t/info.t
--- Tcl-0.91/t/info.t 2004-12-30 20:05:04.000000000 -0500
+++ Tcl-patched/t/info.t 2007-03-26 11:21:56.000000000 -0400
@@ -11,7 +11,14 @@
my $tcl = Tcl->new;
ok($tcl);
-ok(canonpath($tcl->Eval("info nameofexecutable")), canonpath($^X));
+if ($^O eq 'cygwin') {
+ my $cpath = $tcl->Eval("info nameofexecutable");
+ $cpath = `cygpath -u '$cpath'`;
+ chomp($cpath);
+ ok($cpath, canonpath($^X));
+} else {
+ ok(canonpath($tcl->Eval("info nameofexecutable")), canonpath($^X));
+}
ok($tcl->Eval("info exists tcl_platform"), 1);
my $tclversion = $tcl->Eval("info tclversion");