Integrate perlio:
[p5sagit/p5-mst-13.2.git] / configpm
index e473bb5..a83e866 100755 (executable)
--- a/configpm
+++ b/configpm
@@ -472,7 +472,7 @@ EOF
       ($text ? " or another paragraph of description" : () );
   }
   s/n't/n\00t/g;               # leave can't, won't etc untouched
-  s/^\t\s+(.*)/\n\t$1\n/gm;    # Indented lines ===> paragraphs
+  s/^\t\s+(.*)/\n$1/gm;                # Indented lines ===> new paragraph
   s/^(?<!\n\n)\t(.*)/$1/gm;    # Not indented lines ===> text
   s{([\'\"])(?=[^\'\"\s]*[./][^\'\"\s]*\1)([^\'\"\s]+)\1}(F<$2>)g; # '.o'
   s{([\'\"])([^\'\"\s]+)\1}(C<$2>)g; # "date" command
@@ -500,7 +500,8 @@ EOF
 }
 
 if ($opts{glossary}) {
-  <GLOS>;                              # Skip the preamble
+    <GLOS>;                            # Skip the "DO NOT EDIT"
+    <GLOS>;                            # Skip the preamble
   while (<GLOS>) {
     process;
     print CONFIG;
@@ -527,12 +528,27 @@ close(GLOS);
 # Now create Cross.pm if needed
 if ($opts{cross}) {
   open CROSS, ">lib/Cross.pm" or die "Can not open >lib/Cross.pm: $!";
-  print CROSS <<"EOS";
-sub BEGIN {
-  \@INC = map {/\\blib\\b/?(do{local \$_=\$_;s/\\blib\\b/xlib\\/$opts{cross}/;\$_},\$_):(\$_)} \@INC;
+  my $cross = <<'EOS';
+# typical invocation:
+#   perl -MCross Makefile.PL
+#   perl -MCross=wince -V:cc
+package Cross;
+
+sub import {
+  my ($package,$platform) = @_;
+  unless (defined $platform) {
+    # if $platform is not specified, then use last one when
+    # 'configpm; was invoked with --cross option
+    $platform = '***replace-marker***';
+  }
+  @INC = map {/\blib\b/?(do{local $_=$_;s/\blib\b/xlib\/$platform/;$_},$_):($_)} @INC;
+  $::Cross::platform = $platform;
 }
+
 1;
 EOS
+  $cross =~ s/\*\*\*replace-marker\*\*\*/$opts{cross}/g;
+  print CROSS $cross;
   close CROSS;
 }