@@ -36,16 +36,19 @@ my @contrib_uselibpgport = ('oid2name', 'pg_standby', 'vacuumlo');
3636my @contrib_uselibpgcommon = (' oid2name' ,' pg_standby' ,' vacuumlo' );
3737my $contrib_extralibs =undef ;
3838my $contrib_extraincludes =
39- {' tsearch2' => [' contrib/tsearch2' ],' dblink' => [' src/backend' ] };
39+ {' tsearch2' => [' contrib/tsearch2' ],' dblink' => [' src/backend' ],
40+ ' jsquery' => [' contrib/jsquery' ] };
4041my $contrib_extrasource = {
4142' cube' => [' contrib/cube/cubescan.l' ,' contrib/cube/cubeparse.y' ],
42- ' seg' => [' contrib/seg/segscan.l' ,' contrib/seg/segparse.y' ], };
43+ ' seg' => [' contrib/seg/segscan.l' ,' contrib/seg/segparse.y' ],
44+ ' jsquery' => [' contrib/jsquery/jsquery_scan.l' ,' contrib/jsquery/jsquery_gram.y' ] };
4345my @contrib_excludes = (
4446' commit_ts' ,' hstore_plperl' ,
4547' hstore_plpython' ,' intagg' ,
4648' ltree_plpython' ,' pgcrypto' ,
4749' sepgsql' ,' brin' ,
4850' test_extensions' ,' test_pg_dump' ,
51+ ' pg_arman' ,
4952' snapshot_too_old' );
5053
5154# Set of variables for frontend modules
@@ -579,8 +582,8 @@ sub mkvcbuild
579582}
580583$plperl -> AddReference($postgres );
581584my @perl_libs =
582- grep {/ perl\d +. lib$ / }
583- glob ($solution -> {options }-> {perl } .' \lib\CORE\perl*.lib ' );
585+ grep {/ perl\d +\. ( lib|a) $ / }
586+ glob ($solution -> {options }-> {perl } .' \lib\CORE\*.* ' );
584587if (@perl_libs == 1)
585588{
586589$plperl -> AddLibrary($perl_libs [0]);
@@ -782,6 +785,10 @@ sub AddContrib
782785my $proj =$solution -> AddProject($1 ,' exe' ,' contrib' ," $subdir /$n " );
783786AdjustContribProj($proj );
784787}
788+ elsif ($mf =~/ ^DATA_TSEARCH\s *=\s *(.*)$ /mg )
789+ {
790+ # This is ispell dictionary project
791+ }
785792else
786793{
787794croak" Could not determine contrib module type for$n \n " ;
@@ -791,50 +798,91 @@ sub AddContrib
791798GenerateContribSqlFiles($n ,$mf );
792799}
793800
794- sub GenerateContribSqlFiles
795- {
796- my $n =shift ;
797- my $mf =shift ;
798- $mf =~s {\\\r ?\n } {} g ;
799- if ($mf =~/ ^DATA_built\s *=\s *(.*)$ /mg )
800- {
801- my $l =$1 ;
802-
803- # Strip out $(addsuffix) rules
804- if (index ($l ,' $(addsuffix' ) >= 0)
805- {
806- my $pcount = 0;
807- my $i ;
808- for ($i =index ($l ,' $(addsuffix' ) + 12;$i <length ($l );$i ++)
809- {
810- $pcount ++if (substr ($l ,$i , 1)eq ' (' );
811- $pcount --if (substr ($l ,$i , 1)eq ' )' );
812- last if ($pcount < 0);
801+ sub SubstituteMakefileVariables {
802+ local $_ =shift ;# Line to substitue
803+ my $mf =shift ;# Makefile text
804+ while (/ \$\( (\w +)\) / ) {
805+ my $varname =$1 ;
806+ if ($mf =~/ ^$varname \s *=\s *(.*)$ /mg ) {
807+ my $varvalue =$1 ;
808+ s /\$\( $varname\) / $varvalue / g ;
813809}
814- $l =
815- substr ($l , 0,index ($l ,' $(addsuffix' )) .substr ($l ,$i + 1);
816- }
817-
818- foreach my $d (split /\s +/,$l )
819- {
820- my $in =" $d .in" ;
821- my $out =" $d " ;
810+ }
811+ return $_ ;
812+ }
822813
823- if (Solution::IsNewer(" contrib/$n /$out " ," contrib/$n /$in " ))
824- {
825- print " Building$out from$in (contrib/$n )...\n " ;
826- my $cont = Project::read_file(" contrib/$n /$in " );
827- my $dn =$out ;
828- $dn =~s /\. sql$// ;
829- $cont =~s / MODULE_PATHNAME/ \$ libdir\/ $dn / g ;
814+ sub GenerateContribSqlFiles
815+ {
816+ my $n =shift ;
817+ my $mf =shift ;
818+ $mf =~s {\\\r ?\n } {} g ;
819+ if ($mf =~/ ^DATA_built\s *=\s *(.*)$ /mg )
820+ {
821+ my $l =$1 ;
822+ # Strip out $(addsuffix) rules
823+ if (index ($l ,' $(addsuffix' ) >= 0)
824+ {
825+ my $pcount = 0;
826+ my $i ;
827+ for ($i =index ($l ,' $(addsuffix' ) + 12;$i <length ($l );$i ++)
828+ {
829+ $pcount ++if (substr ($l ,$i , 1)eq ' (' );
830+ $pcount --if (substr ($l ,$i , 1)eq ' )' );
831+ last if ($pcount < 0);
832+ }
833+ $l =
834+ substr ($l , 0,index ($l ,' $(addsuffix' )) .substr ($l ,$i + 1);
835+ }
836+ # perform variable substitutions in the makefile
837+ $l = SubstituteMakefileVariables($l ,$mf );
838+ foreach my $d (split /\s +/,$l )
839+ {
840+ print STDERR " Generating file$d \n " ;
841+ if (-f " $d .in" ) {
842+ my $in =" $d .in" ;
843+ my $out =" $d " ;
844+ if (Solution::IsNewer(" contrib/$n /$out " ," contrib/$n /$in " ))
845+ {
846+ print " Building$out from$in (contrib/$n )...\n " ;
847+ my $cont = Project::read_file(" contrib/$n /$in " );
848+ my $dn =$out ;
849+ $dn =~s /\. sql$// ;
850+ $cont =~s / MODULE_PATHNAME/ \$ libdir\/ $dn / g ;
851+ my $o ;
852+ open ($o ," >contrib/$n /$out " )
853+ || croak" Could not write to contrib/$n /$d " ;
854+ print $o $cont ;
855+ close ($o );
856+ }
857+ }else {
858+ # Search for makefile rule.
859+ # For now we do not process rule command and assume
860+ # that we should just concatenate all prerequisites
861+ #
862+ my @prereq = ();
863+ my $target ;
864+ my @rules =$mf =~/ ^(\S +)\s *:\s *([^=].*)$ /mg ;
865+ RULE:
866+ while (@rules ) {
867+ $target = SubstituteMakefileVariables(shift @rules ,$mf );
868+ @prereq =split (/ \s +/ ,SubstituteMakefileVariables(shift @rules ,$mf ));
869+ last RULEif ($target eq $d );
870+ @prereq = ();
871+ }
872+ croak" Don't know how to build contrib/$n /$d " unless @prereq ;
873+ print STDERR " building$d from@prereq \n " ;
830874my $o ;
831- open ($o ," >contrib/$n /$out " )
832- || croak" Could not write to contrib/$n /$d " ;
833- print $o $cont ;
834- close ($o );
875+ open $o ," >contrib/$n /$d "
876+ or croak(" Couldn't write to contrib/$n /$d :$! " );
877+ for my $in (@prereq ) {
878+ my $data = Project::read_file(" contrib/$n /$in " );
879+ print $o $data ;
880+ }
881+ close $o ;
882+
835883}
836- }
837- }
884+ }
885+ }
838886}
839887
840888sub AdjustContribProj