Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.3 KiB

  1. package ExtUtils::MM_Cygwin;
  2. use Config;
  3. #use Cwd;
  4. #use File::Basename;
  5. require Exporter;
  6. Exporter::import('ExtUtils::MakeMaker',
  7. qw( $Verbose &neatvalue));
  8. unshift @MM::ISA, 'ExtUtils::MM_Cygwin';
  9. sub canonpath {
  10. my($self,$path) = @_;
  11. $path =~ s|\\|/|g;
  12. return $self->ExtUtils::MM_Unix::canonpath($path);
  13. }
  14. sub cflags {
  15. my($self,$libperl)=@_;
  16. return $self->{CFLAGS} if $self->{CFLAGS};
  17. my $base =$self->ExtUtils::MM_Unix::cflags($libperl);
  18. foreach (split /\n/, $base) {
  19. / *= */ and $self->{$`} = $';
  20. };
  21. $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true');
  22. return $self->{CFLAGS} = qq{
  23. CCFLAGS = $self->{CCFLAGS}
  24. OPTIMIZE = $self->{OPTIMIZE}
  25. PERLTYPE = $self->{PERLTYPE}
  26. LARGE = $self->{LARGE}
  27. SPLIT = $self->{SPLIT}
  28. };
  29. }
  30. sub manifypods {
  31. my($self, %attribs) = @_;
  32. return "\nmanifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless
  33. %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
  34. my($dist);
  35. my($pod2man_exe);
  36. if (defined $self->{PERL_SRC}) {
  37. $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
  38. } else {
  39. $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
  40. }
  41. unless ($self->perl_script($pod2man_exe)) {
  42. # No pod2man but some MAN3PODS to be installed
  43. print <<END;
  44. Warning: I could not locate your pod2man program. Please make sure,
  45. your pod2man program is in your PATH before you execute 'make'
  46. END
  47. $pod2man_exe = "-S pod2man";
  48. }
  49. my(@m);
  50. push @m,
  51. qq[POD2MAN_EXE = $pod2man_exe\n],
  52. qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n],
  53. q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "],
  54. $self->{MAKEFILE}, q[";' \\
  55. -e 'print "Manifying $$m{$$_}\n"; $$m{$$_} =~ s/::/./g;' \\
  56. -e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
  57. -e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
  58. ];
  59. push @m, "\nmanifypods : pure_all ";
  60. push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
  61. push(@m,"\n");
  62. if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
  63. grep { $self->{MAN1PODS}{$_} =~ s/::/./g } keys %{$self->{MAN1PODS}};
  64. grep { $self->{MAN3PODS}{$_} =~ s/::/./g } keys %{$self->{MAN3PODS}};
  65. push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
  66. push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
  67. }
  68. join('', @m);
  69. }
  70. sub perl_archive
  71. {
  72. return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
  73. }
  74. 1;
  75. __END__
  76. =head1 NAME
  77. ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker
  78. =head1 SYNOPSIS
  79. use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed
  80. =head1 DESCRIPTION
  81. See ExtUtils::MM_Unix for a documentation of the methods provided there.
  82. =over
  83. =item canonpath
  84. replaces backslashes with forward ones. then acts as *nixish.
  85. =item cflags
  86. if configured for dynamic loading, triggers #define EXT in EXTERN.h
  87. =item manifypods
  88. replaces strings '::' with '.' in man page names
  89. =item perl_archive
  90. points to libperl.a
  91. =back
  92. =cut