Author: jhoblitt
Date: Wed Jan 11 02:55:06 2006
New Revision: 11080

Modified:
   trunk/config/gen/makefiles/parrot.pc.in
   trunk/lib/Parrot/Configure/Step.pm
Log:
add @foo@ interpolation support to genfile()

Modified: trunk/config/gen/makefiles/parrot.pc.in
==============================================================================
--- trunk/config/gen/makefiles/parrot.pc.in     (original)
+++ trunk/config/gen/makefiles/parrot.pc.in     Wed Jan 11 02:55:06 2006
@@ -1,4 +1,4 @@
-prefix=${prefix}
[EMAIL PROTECTED]@
 exec_prefix=${{prefix}}
 libdir=${{exec_prefix}}/lib
 includedir=${{prefix}}/include
@@ -6,5 +6,5 @@ includedir=${{prefix}}/include
 Name: parrot
 Description: virtual machine to execute bytecode for interpreted languages
 Version: ${VERSION}
-Libs: -L${{libdir}} -lparrot ${icu_shared} ${libs}
+Libs: -L${{libdir}} -lparrot @icu_shared@ @libs@
 Cflags: -I${{includedir}} 

Modified: trunk/lib/Parrot/Configure/Step.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Step.pm  (original)
+++ trunk/lib/Parrot/Configure/Step.pm  Wed Jan 11 02:55:06 2006
@@ -213,7 +213,10 @@ sub genfile
             # OUT was/is used at the output filehandle in eval'ed scripts
             local *OUT = $out;
             my $text = do {local $/; <$in>};
+            # XXX depreciated
             $text =~ s{ \$\{(\w+)\} }{\$conf->data->get("$1")}gx;
+            # interoplate @foo@ values
+            $text =~ s{ \@ (\w+) \@ }{\$conf->data->get("$1")}gx;
             eval $text;
             die $@ if $@;
             last;
@@ -232,6 +235,8 @@ sub genfile
                 $line = $2;
             }
         }
+
+        # XXX depreciated
         $line =~ s{ \$\{(\w+)\} }{
             if(defined(my $val=$conf->data->get($1))) {
                 #use Data::Dumper;warn Dumper("val for $1 is ",$val);
@@ -241,6 +246,18 @@ sub genfile
                 '';
             }
         }egx;
+
+        # interoplate @foo@ values
+        $line =~ s{ \@ (\w+) \@ }{
+            if(defined(my $val=$conf->data->get($1))) {
+                #use Data::Dumper;warn Dumper("val for $1 is ",$val);
+                $val;
+            } else {
+                warn "value for '$1' in $source is undef";
+                '';
+            }
+        }egx;
+
         if ($options{replace_slashes}) {
             $line =~ s{(/+)}{
                 my $len = length $1;
@@ -250,6 +267,8 @@ sub genfile
             # replace \* with \\*, so make will not eat the \
             $line =~ s{(\\\*)}{\\$1}g;
         }
+
+        # XXX depreciated
         # Unquote text quoted using ${{word}} notation
         $line =~ s/\${{(\w+)}}/\${$1}/g;
         print $out $line;

Reply via email to