Finish adding file version information to installed Windows binaries.
authorNoah Misch <noah@leadboat.com>
Tue, 19 Aug 2014 02:59:53 +0000 (22:59 -0400)
committerNoah Misch <noah@leadboat.com>
Tue, 19 Aug 2014 02:59:53 +0000 (22:59 -0400)
In support of this, have the MSVC build follow GNU make in preferring
GNUmakefile over Makefile when a directory contains both.

Michael Paquier, reviewed by MauMau.

src/backend/snowball/Makefile
src/interfaces/ecpg/test/Makefile
src/test/isolation/Makefile
src/test/regress/GNUmakefile
src/timezone/Makefile
src/tools/msvc/Mkvcbuild.pm
src/tools/msvc/Project.pm
src/tools/msvc/clean.bat

index ac80efeb7d1fe975772d804ac4dc396239b07039..50cbace41da73723dc7eafd05b51a2eaa30e52b6 100644 (file)
@@ -6,6 +6,9 @@
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "snowball - natural language stemmers"
+PGAPPICON = win32
+
 subdir = src/backend/snowball
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
@@ -13,7 +16,7 @@ include $(top_builddir)/src/Makefile.global
 override CPPFLAGS := -I$(top_srcdir)/src/include/snowball \
    -I$(top_srcdir)/src/include/snowball/libstemmer $(CPPFLAGS)
 
-OBJS= dict_snowball.o api.o utilities.o \
+OBJS= $(WIN32RES) dict_snowball.o api.o utilities.o \
    stem_ISO_8859_1_danish.o \
    stem_ISO_8859_1_dutch.o \
    stem_ISO_8859_1_english.o \
index 56f6a17c34e38e0d22c3c63c328d3fc678334308..387729bda34429fc087a748879c358c1a4c54ecc 100644 (file)
@@ -1,5 +1,8 @@
 # src/interfaces/ecpg/test/Makefile
 
+PGFILEDESC = "ECPG Test - regression tests for ECPG"
+PGAPPICON = win32
+
 subdir = src/interfaces/ecpg/test
 top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
@@ -13,8 +16,6 @@ override CPPFLAGS := \
    '-DDLSUFFIX="$(DLSUFFIX)"' \
    $(CPPFLAGS)
 
-PGFILEDESC = "ECPG Test - regression tests for ECPG"
-
 # where to find psql for testing an existing installation
 PSQLDIR = $(bindir)
 
index 26bcf22392a2232a07cf188f294685d4bc02b399..a88257a562c996cb8b8a1c338a34cb19f3667f33 100644 (file)
@@ -2,6 +2,9 @@
 # Makefile for isolation tests
 #
 
+PGFILEDESC = "pg_isolation_regress/isolationtester - multi-client test driver"
+PGAPPICON = win32
+
 subdir = src/test/isolation
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
@@ -11,7 +14,7 @@ PSQLDIR = $(bindir)
 
 override CPPFLAGS := -I$(srcdir) -I$(libpq_srcdir) -I$(srcdir)/../regress $(CPPFLAGS)
 
-OBJS =  specparse.o isolationtester.o
+OBJS =  specparse.o isolationtester.o $(WIN32RES)
 
 all: isolationtester$(X) pg_isolation_regress$(X)
 
@@ -21,7 +24,7 @@ submake-regress:
 pg_regress.o: | submake-regress
    rm -f $@ && $(LN_S) $(top_builddir)/src/test/regress/pg_regress.o .
 
-pg_isolation_regress$(X): isolation_main.o pg_regress.o
+pg_isolation_regress$(X): isolation_main.o pg_regress.o $(WIN32RES)
    $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
 
 isolationtester$(X): $(OBJS) | submake-libpq submake-libpgport
index b084e0a831eb82168d1c4599974ed4520feb6c33..b40b37c0b7420c9112a99ea19d41499a1e320a76 100644 (file)
@@ -10,6 +10,9 @@
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "pg_regress - test driver"
+PGAPPICON = win32
+
 subdir = src/test/regress
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
@@ -43,7 +46,7 @@ EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
 
 all: pg_regress$(X)
 
-pg_regress$(X): pg_regress.o pg_regress_main.o | submake-libpgport
+pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport
    $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
 
 # dependencies ensure that path changes propagate
@@ -66,7 +69,7 @@ uninstall:
 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
 
 NAME = regress
-OBJS = regress.o
+OBJS = $(WIN32RES) regress.o
 
 include $(top_srcdir)/src/Makefile.shlib
 
index ef739e9d098833898403c7f1c238a82d296d0293..a289050d82cb98b18c8af6bd0afdd14bd7f5b46f 100644 (file)
@@ -8,6 +8,9 @@
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "zic - time zone compiler"
+PGAPPICON = win32
+
 subdir = src/timezone
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
@@ -16,7 +19,7 @@ include $(top_builddir)/src/Makefile.global
 OBJS= localtime.o strftime.o pgtz.o
 
 # files needed to build zic utility program
-ZICOBJS= zic.o ialloc.o scheck.o localtime.o
+ZICOBJS= zic.o ialloc.o scheck.o localtime.o $(WIN32RES)
 
 # timezone data files
 TZDATA = africa antarctica asia australasia europe northamerica southamerica \
index e6fb3ecdecf8e8ffc0d07df4fb70b845fb97f089..004942ca07af83dc18e857ff0492618109997f1d 100644 (file)
@@ -106,6 +106,9 @@ sub mkvcbuild
    $postgres->AddFiles('src\port',   @pgportfiles);
    $postgres->AddFiles('src\common', @pgcommonbkndfiles);
    $postgres->AddDir('src\timezone');
+   # We need source files from src\timezone, but that directory's resource
+   # file pertains to "zic", not to the backend.
+   $postgres->RemoveFile('src\timezone\win32ver.rc');
    $postgres->AddFiles('src\backend\parser', 'scan.l', 'gram.y');
    $postgres->AddFiles('src\backend\bootstrap', 'bootscanner.l',
        'bootparse.y');
@@ -126,10 +129,11 @@ sub mkvcbuild
 
    my $snowball = $solution->AddProject('dict_snowball', 'dll', '',
        'src\backend\snowball');
+   # This Makefile uses VPATH to find most source files in a subdirectory.
    $snowball->RelocateFiles(
        'src\backend\snowball\libstemmer',
        sub {
-           return shift !~ /dict_snowball.c$/;
+           return shift !~ /(dict_snowball.c|win32ver.rc)$/;
        });
    $snowball->AddIncludeDir('src\include\snowball');
    $snowball->AddReference($postgres);
@@ -341,6 +345,7 @@ sub mkvcbuild
    $pgregress_ecpg->AddIncludeDir('src\test\regress');
    $pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
    $pgregress_ecpg->AddDefine('FRONTEND');
+   $pgregress_ecpg->AddDirResourceFile('src\interfaces\ecpg\test');
    $pgregress_ecpg->AddReference($libpgcommon, $libpgport);
 
    my $isolation_tester =
@@ -356,6 +361,7 @@ sub mkvcbuild
    $isolation_tester->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
    $isolation_tester->AddDefine('FRONTEND');
    $isolation_tester->AddLibrary('ws2_32.lib');
+   $isolation_tester->AddDirResourceFile('src\test\isolation');
    $isolation_tester->AddReference($libpq, $libpgcommon, $libpgport);
 
    my $pgregress_isolation =
@@ -366,6 +372,7 @@ sub mkvcbuild
    $pgregress_isolation->AddIncludeDir('src\test\regress');
    $pgregress_isolation->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
    $pgregress_isolation->AddDefine('FRONTEND');
+   $pgregress_isolation->AddDirResourceFile('src\test\isolation');
    $pgregress_isolation->AddReference($libpgcommon, $libpgport);
 
    # src/bin
@@ -448,6 +455,7 @@ sub mkvcbuild
    my $zic = $solution->AddProject('zic', 'exe', 'utils');
    $zic->AddFiles('src\timezone', 'zic.c', 'ialloc.c', 'scheck.c',
        'localtime.c');
+   $zic->AddDirResourceFile('src\timezone');
    $zic->AddReference($libpgcommon, $libpgport);
 
    if ($solution->{options}->{xml})
@@ -582,14 +590,14 @@ sub mkvcbuild
        $proj->AddIncludeDir('src\bin\pg_dump');
        $proj->AddIncludeDir('src\bin\psql');
        $proj->AddReference($libpq, $libpgcommon, $libpgport);
-       $proj->AddResourceFile('src\bin\scripts', 'PostgreSQL Utility',
-           'win32');
+       $proj->AddDirResourceFile('src\bin\scripts');
        $proj->AddLibrary('ws2_32.lib');
    }
 
    # Regression DLL and EXE
    my $regress = $solution->AddProject('regress', 'dll', 'misc');
    $regress->AddFile('src\test\regress\regress.c');
+   $regress->AddDirResourceFile('src\test\regress');
    $regress->AddReference($postgres);
 
    my $pgregress = $solution->AddProject('pg_regress', 'exe', 'misc');
@@ -597,6 +605,7 @@ sub mkvcbuild
    $pgregress->AddFile('src\test\regress\pg_regress_main.c');
    $pgregress->AddIncludeDir('src\port');
    $pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
+   $pgregress->AddDirResourceFile('src\test\regress');
    $pgregress->AddReference($libpgcommon, $libpgport);
 
    # fix up pg_xlogdump once it's been set up
index f343b2b9b8c4319151c88a9143de8fefd4a83169..b9b5a239d8af82eb2566ce239e9f302eeed59ff3 100644 (file)
@@ -183,15 +183,7 @@ sub UseDef
 sub AddDir
 {
    my ($self, $reldir) = @_;
-   my $MF;
-
-   my $t = $/;
-   undef $/;
-   open($MF, "$reldir\\Makefile")
-     || open($MF, "$reldir\\GNUMakefile")
-     || croak "Could not open $reldir\\Makefile\n";
-   my $mf = <$MF>;
-   close($MF);
+   my $mf = read_makefile($reldir);
 
    $mf =~ s{\\\r?\n}{}g;
    if ($mf =~ m{^(?:SUB)?DIRS[^=]*=\s*(.*)$}mg)
@@ -292,7 +284,15 @@ sub AddDir
        $mf =~ s{$replace_re}{}m;
    }
 
-   # See if this Makefile contains a description, and should have a RC file
+   $self->AddDirResourceFile($reldir);
+}
+
+# If the directory's Makefile bears a description string, add a resource file.
+sub AddDirResourceFile
+{
+   my ($self, $reldir) = @_;
+   my $mf = read_makefile($reldir);
+
    if ($mf =~ /^PGFILEDESC\s*=\s*\"([^\"]+)\"/m)
    {
        my $desc = $1;
@@ -300,7 +300,6 @@ sub AddDir
        if ($mf =~ /^PGAPPICON\s*=\s*(.*)$/m) { $ico = $1; }
        $self->AddResourceFile($reldir, $desc, $ico);
    }
-   $/ = $t;
 }
 
 sub AddResourceFile
@@ -409,4 +408,21 @@ sub read_file
    return $txt;
 }
 
+sub read_makefile
+{
+   my $reldir = shift;
+   my $F;
+   my $t = $/;
+
+   undef $/;
+   open($F, "$reldir\\GNUmakefile")
+     || open($F, "$reldir\\Makefile")
+     || croak "Could not open $reldir\\Makefile\n";
+   my $txt = <$F>;
+   close($F);
+   $/ = $t;
+
+   return $txt;
+}
+
 1;
index b76eea99eda0f460afe6df33797a862d314b46a0..9c7ea4292bf5a69adbe9483b5f7a5051833e5404 100755 (executable)
@@ -20,10 +20,16 @@ del /s /q src\bin\win32ver.rc 2> NUL
 del /s /q src\interfaces\win32ver.rc 2> NUL
 if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
 if exist src\backend\replication\libpqwalreceiver\win32ver.rc del /q src\backend\replication\libpqwalreceiver\win32ver.rc
+if exist src\backend\snowball\win32ver.rc del /q src\backend\snowball\win32ver.rc
+if exist src\interfaces\ecpg\test\win32ver.rc del /q src\interfaces\ecpg\test\win32ver.rc
 if exist src\pl\plperl\win32ver.rc del /q src\pl\plperl\win32ver.rc
 if exist src\pl\plpgsql\src\win32ver.rc del /q src\pl\plpgsql\src\win32ver.rc
 if exist src\pl\plpython\win32ver.rc del /q src\pl\plpython\win32ver.rc
 if exist src\pl\tcl\win32ver.rc del /q src\pl\tcl\win32ver.rc
+if exist src\test\isolation\win32ver.rc del /q src\test\isolation\win32ver.rc
+if exist src\test\regress\win32ver.rc del /q src\test\regress\win32ver.rc
+if exist src\timezone\win32ver.rc del /q src\timezone\win32ver.rc
+
 for /d %%f in (src\interfaces\ecpg\*) do if exist %%f\win32ver.rc del /q %%f\win32ver.rc
 for /d %%f in (contrib\*) do if exist %%f\win32ver.rc del /q %%f\win32ver.rc
 for /d %%f in (src\backend\utils\mb\conversion_procs\*) do if exist %%f\win32ver.rc del /q %%f\win32ver.rc