App-perlall

 view release on metacpan or  search on metacpan

script/perlall  view on Meta::CPAN

      #close F;
    }
  }
  if ($^O eq 'msys') { # msys: mingw bootstrapping
    push @conf, "-Dlibc=/usr/lib.libmsys-1.0.dll.a", "-Dusenm=no";
  }
  if ($cc =~ /clang/) { # our macros are just too bad
    #if (grep /^-[DA]ccflags/, @conf) {
    push @conf, "-Accflags=-Wno-unused-value"; # this belongs into Configure and cflags.SH
    #}
  }

  if ($^O ne 'MSWin32') {
    $c->_system1( @conf);
    $c->_fail("Configure failed") unless -f 'config.sh' or $dryrun;
  } else {
    my ($w64, $config);
    my $aperl = $make eq 'nmake';
    $c->_system1("chdir","win32");
    # XXX check which config and makefile we will need
    my $makefile = $aperl ? 'Makefile' : 'makefile.mk';
    # XXX copy and tune config.h and Makefile (INST_DRV, INST_TOP)
    if ($ENV{WIN64}) { # XXX check if our compiler can do 64bit, else unset WIN64
      $w64++;
      warn "WIN64 not yet tested";
    }
    if ($w64) { $config = $aperl ? 'config.vc64' : 'config.gc64'; }
    else {$config = $aperl ? 'config.vc' : 'config.gc';}
    $c->_log(1,"win32 configure $config $make");
    $c->_system1($cp, $config, 'config.h');
    $dryrun = 1; # hack to skip post-configure patchups
  }
  $c->_log(1,"post-configure fixes");

  # fix libs on debug and git-stuff
  $archname = $dryrun ? "fake-arch"
    : $c->_grep("/^archname='(.+?)'\$/ and print \$1", "config.sh");
  my $new = $archname;
  for my $d (@{$c->options->{D}}) {
    if ($d =~ /^archname/) {
      $new = $d;
      $new =~ s/^archname=//;
      $new =~ s/'//g;
    }
  }
  if (($new ne $archname) or $archsuffix or $debug) {
    if ($new eq $archname) {
      if ($archname =~ /-thread-multi/ and !$c->_older($ps,"5.10.0")) {
        $new =~ s/-thread-multi/-thread/;
      }
      $new .= "-debug" if $debug and $archname !~ /-debug/;
      $new .= $archsuffix if $archsuffix and $archname !~ /$archsuffix$/;
      if (!$ithreads and $new =~ /-thread/) {
	$new =~ s/-thread//;
      } elsif ($ithreads and $new !~ /-thread/) {
	$new .= "-thread";
      }
    }
    $c->debug("post-configure archname fixes: $archname => $new");
    $c->_fail("archname not detected in config.sh") unless $archname;
    # This was very fragile: e.g. archname=darwin or mach
    # FIXME libpth was changed to /usr/lib/x86_64-linux-debug-gnu
    if ($archname and $archname ne $new) { # Time to make this stable
      $new =~ s/([\$\%\@])/\\$1/g;
      # which keys exactly? only those keys.
      # maybe redo the whole Configure step again
      $c->_grep("-i s|(\\d)/$archname'|\\1/$new'|;"
		. " s|(\\d)/$archname\"|\\1/$new\"|;"
		. " s|/$archname/CORE|/$new/CORE|;"
		. " s|define ARCHNAME \"$archname\"|define ARCHNAME \"$new\"|;"
		. " s|archname=$archname,|archname=$new,|;"
		. " s|archname='$archname'|archname='$new'|; print",
		qw(config.h config.sh Policy.sh myconfig));
    }
  }
  if (!$dryrun and $c->_older($p,'5.14')) { #seems to be <=5.6.2 only
    # remove archs from inc_version_list
    if ($c->_grep('m|inc_version_list.+(\d\.\d\d?\.\d\d?)/'.$archname.' | and print $1',
		  "config.sh")) {
      $c->debug("post-configure remove archlibs from inc_version_list");
      $c->_grep('-i s|(\d\.\d\d?\.\d\d?)/'.$archname.' ||;'
		. ' s|"(\d\.\d\d?\.\d\d?)/'.$archname.'",||;'
		. " print",
		qw(config.h config.sh));
    }
  }
  if ($archname and $archname ne $new) {
    $archname = $new;
  }

  if ($^O =~ /cygwin|msys/) {
    $c->debug("post-configure perl.dll fixes");
    # libperl really is libperl.a. Should be libperl.dll.a at least. we use the dll.
    my $dll = $dryrun ? "fake.dll"
      : $c->_grep("/^libperl='(.+?)'\$/ and print \$1", "config.sh");
    if ($libperl eq $dll) {
      $c->_log('',"configure did keep our libperl, good");
    } elsif ($libperl and $dll) {
      $libperl =~ s/([\.\$\%\@])/\\$1/g;
      $c->_grep("-i s,$dll,$libperl,; print",
		qw(config.sh config.h Makefile GNUmakefile myconfig));
      if ($^O eq 'cygwin') {
	$c->_grep("-i s,libperl='libperl\.a',libperl='$libperl',; print",
		  qw(config.sh));
	$c->_grep("-i s,libperl=libperl\.a,libperl=$libperl,; print",
		  qw(myconfig));
      }
    }
    if ($^O eq 'cygwin' and !$dryrun) {
      my $cygmk = 'cygwin/Makefile.SHs';
      my $dll = substr($libperl,0,-4);
      if ($c->_older($p,'5.8.9')) {
	if (-e $cygmk and $c->_grep("/^linklibperl=(-l)/ and print \$1", $cygmk)) {
	  $c->debug("post-configure LLIBPERL llibperl fixes");
	  $c->_grep("-i s/^LLIBPERL= \$linklibperl/DLLNAME= $dll/; print", $cygmk);
	  $c->_grep('-i s/^-o $(LIBPERL)$(DLSUFFIX)/-o $(DLLNAME)$(DLSUFFIX)/; print', $cygmk);
	  $c->_grep('-i s/^$(LIBPERL).dll$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2/'
		         .'libperl.dll$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj)/; print;', $cygmk);
	  $c->_grep('-i s/$(LDLIBPTH) ld2 $(SHRPLDFLAGS) -o $(LIBPERL)$(DLSUFFIX)/'
		        .'$(LDLIBPTH) $(CC) $(SHRPLDFLAGS) -o $(DLLNAME)$(DLSUFFIX) -Wl,--out-implib=$@/; print', $cygmk);
	}



( run in 1.645 second using v1.01-cache-2.11-cpan-b16cb0d3907 )