Print this page
3900 illumos will not build against gcc compiled perl

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/perl/contrib/Sun/Solaris/PerlGcc/Makefile.PL
          +++ new/usr/src/cmd/perl/contrib/Sun/Solaris/PerlGcc/Makefile.PL
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15  # If applicable, add the following below this CDDL HEADER, with the
  16   16  # fields enclosed by brackets "[]" replaced with your own identifying
  17   17  # information: Portions Copyright [yyyy] [name of copyright owner]
  18   18  #
  19   19  # CDDL HEADER END
  20   20  #
  21   21  
  22   22  #
  23   23  # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
       24 +# Copyright (c) 2013 Racktop Systems.
  24   25  #
  25   26  
  26      -require 5.8.4;
       27 +require 5.0010;
  27   28  use strict;
  28   29  use warnings;
  29   30  use ExtUtils::MakeMaker;
       31 +use Config;
  30   32  
  31   33  #
  32   34  # Compare OS versions.
  33   35  #
  34   36  sub cmp_os_ver
  35   37  {
  36   38          our ($a, $b);
  37   39          my @v1 = split(/\./, $a);
  38   40          my @v2 = split(/\./, $b);
  39   41          my $diff = 0;
↓ open down ↓ 2 lines elided ↑ open up ↑
  42   44          }
  43   45          return ($diff);
  44   46  }
  45   47  
  46   48  # Check we are on a supported OS version.
  47   49  my $rel = qx{uname -r}; chomp($rel);
  48   50  my $arch = qx{uname -p}; chomp($arch);
  49   51  my $pver = sprintf('%vd', $^V);
  50   52  
  51   53  # Figure out the appropriate Config.pm.  Use an older version if necessary.
  52      -my $perlarch = ($arch eq "sparc") ? "sun4-solaris-64int":"i86pc-solaris-64int";
  53      -
  54      -my $configpm = "/usr/perl5/$pver/lib/$perlarch/Config.pm";
       54 +my $configpm = $Config{'archlibexp'} . "/Config.pm";
  55   55  if (! -f $configpm) {
  56   56          my $p = "config/$pver";
  57   57          my $dh;
  58   58          opendir($dh, $p) || die("Can't read directory $_: $!\n");
  59   59          my $old_rel = (sort(cmp_os_ver
  60   60              grep(-d "$p/$_" && $_ =~ /^\d[\d.]+\d$/, readdir($dh))))[-1];
  61   61          closedir($dh);
  62   62          if (defined($old_rel)) {
  63   63                  print(STDERR "Warning: No config file for OS version $rel, " .
  64   64                      "using $old_rel file\n");
↓ open down ↓ 11 lines elided ↑ open up ↑
  76   76                          s/=>\s*'cc/=> 'gcc/;
  77   77                          s/=\s*'cc/='gcc/;
  78   78                  }
  79   79                  print CONFIGPM_OUT $_;
  80   80          }
  81   81          close CONFIGPM;
  82   82          close CONFIGPM_OUT;
  83   83          $configpm = "Config.pm";
  84   84  }
  85   85  
       86 +# Figure out the appropriate Config_heavy.pl.  Use an older version if necessary.
       87 +my $configpl = $Config{'archlibexp'} . "/Config_heavy.pl";
       88 +if (! -f $configpl) {
       89 +        my $p = "config/$pver";
       90 +        my $dh;
       91 +        opendir($dh, $p) || die("Can't read directory $_: $!\n");
       92 +        my $old_rel = (sort(cmp_os_ver
       93 +            grep(-d "$p/$_" && $_ =~ /^\d[\d.]+\d$/, readdir($dh))))[-1];
       94 +        closedir($dh);
       95 +        if (defined($old_rel)) {
       96 +                print(STDERR "Warning: No config file for OS version $rel, " .
       97 +                    "using $old_rel file\n");
       98 +                $rel = $old_rel;
       99 +                $configpl = "config/$pver/$rel/$arch/Config_heavy.pl";
      100 +        } else {
      101 +                die("Unsupported version of Perl/OS/Architecture " .
      102 +                    "$pver/$rel/$arch\n");
      103 +        }
      104 +} else {
      105 +        open CONFIGPL, "<", $configpl or die $!;
      106 +        open CONFIGPL_OUT, ">", "Config_heavy.pl" or die $!;
      107 +        while(<CONFIGPL>) {
      108 +                if (/^cccdlflags=/) {
      109 +                        print CONFIGPL_OUT "cccdlflags='-fPIC'\n";
      110 +                } elsif (/^optimize=/) {
      111 +                        print CONFIGPL_OUT "optimize='-O2 -fno-strict-aliasing'\n";
      112 +                } else {
      113 +                        print CONFIGPL_OUT $_;
      114 +                }
      115 +        }
      116 +        close CONFIGPL;
      117 +        close CONFIGPL_OUT;
      118 +        $configpl = "Config_heavy.pl";
      119 +}
      120 +
  86  121  our %man1pods;
  87  122  # Only install the pods for onn-ON builds.
  88  123  if (! exists($ENV{CODEMGR_WS}) && ! exists($ENV{ENVCPPFLAGS1})) {
  89  124          $man1pods{'pod/perlgcc.pod'} = '$(INST_MAN1DIR)/perlgcc.$(MAN1EXT)';
  90  125  }
  91  126  
  92  127  WriteMakefile(
  93  128      NAME         => 'Sun::Solaris::PerlGcc',
  94  129      VERSION_FROM => 'perlgcc.PL',
  95  130      PL_FILES     => { 'perlgcc.PL' => 'perlgcc' },
  96  131      EXE_FILES    => [ 'perlgcc' ],
  97      -    PM           => { $configpm => '$(INST_LIBDIR)/PerlGcc/Config.pm' },
      132 +    PM           => { $configpm => '$(INST_LIBDIR)/PerlGcc/Config.pm',
      133 +                      $configpl => '$(INST_LIBDIR)/PerlGcc/Config_heavy.pl' },
  98  134      MAN1PODS     => \%man1pods,
  99  135      MAN3PODS     => { }, # Stop autopodification.
 100  136      clean        => { FILES => 'perlgcc' },
 101  137  );
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX