https://rt.cpan.org/Ticket/Display.html?id=125701 >
Hi,
I've noticed changes on Makefile.PL recently.
The commit 1492e disables usestubs on freebsd. However, the freebsd
compilation error only occurred on v1.09 while it had no problem on v1.08. It
should not be a problem of stub. This line
https://github.com/gisle/tcl.pm/blob/7ef5e393ffaedcc0f12e8038ccf2ca583d11c74d/Makefile.PL#L110
, where 'defined($arch)' is always true and tcl-core would be applied
incorrectly on freebsd if usestub. In 1.08 Makefile.PL, 'defined($arch)' is
false on freebsd.
My suggested patch is as attached (also fix a warning on undefined
$tclconfig)
diff --git a/Makefile.PL b/Makefile.PL
index 06262b3..7f518a9 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -10,7 +10,7 @@ use Getopt::Long;
use ExtUtils::MakeMaker;
use Config;
-my $arch = "$^O";
+my $arch;
my $stub = "tclstub8.4";
# These need updating as more platforms are added to tcl-core/ area
@@ -24,7 +24,7 @@ if ($^O eq "MSWin32") {
$arch = "$^O-x86" if ($Config{archname} =~ /86/);
$arch = "$^O-sparc" if ($Config{archname} =~ /sun4/);
} elsif ($^O eq "aix") {
-# $arch = "$^O";
+$arch = "$^O";
} elsif ($^O eq "hpux") {
$arch = "$^O-ia64" if ($Config{archname} =~ /ia64/i);
$arch = "$^O-parisc" if ($Config{archname} =~ /pa-risc/i);
@@ -44,15 +44,13 @@ sub _die ($) {
GetOptions(
"tclsh=s", \(my $tclsh='tclsh'),
"tclconfig=s", \ my $tclconfig,
- "usestubs!", \(my $usestubs = $^O =~ /^solaris|linux|hpux|darwin|cygwin|aix$/? 1 : 0),
+ "usestubs!", \(my $usestubs = $^O =~ /^solaris|linux|hpux|darwin|cygwin|aix|freebsd|netbsd$/? 1 : 0),
# we prefer usestubs, but on windows default is to not use them, because
# stubs lib that come with AS TCL is impossible to link with GCC which
# comes with strawberry perl; Have a ticket for this; (XXX) VKON 27-06-2018
#
- # ... also freebsd, which have problems with stubs currently
- # http://www.cpantesters.org/cpan/report/0bb213fc-7a55-11e8-8df7-db842dc43508
- #
- # ... but also any other $^O which we do not have in 'tcl-core' dir
+ # ... also any other $^O which we do not have in 'tcl-core' dir
+# except freebsd and netbsd
#
"library=s", \ my $libpath,
"include=s", \ my $incpath,
@@ -113,7 +111,7 @@ if (defined($libpath) && defined($incpath)) {
$tclconfig = $tclcfg{'tclConfig.sh'};
}
-if (!defined($tclconfig) && defined($arch) && $usestubs) {
+if (!$tclconfig && $arch && $usestubs) {
$incpath = "-Itcl-core/include";
$libpath = "-Ltcl-core/$arch -l$stub";
if ($^O eq 'darwin') {
@@ -178,7 +176,7 @@ if (defined($libpath) && defined($incpath)) {
print "LIBS = $libpath\n";
print "INC= $incpath\n";
print "DEFINE = $defs\n";
-print "tclConfig.sh = $tclconfig\n";
+print "tclConfig.sh = ", $tclconfig || "", "\n";
if ($^O eq 'darwin') {
# darwin has a broken ranlib that requires you to run it anytime