Commit ee9569e4 authored by Noah Misch's avatar Noah Misch

Finish adding file version information to installed Windows binaries.

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.
parent fb2aece8
......@@ -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 \
......
# 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)
......
......@@ -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
......
......@@ -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
......
......@@ -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 \
......
......@@ -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
......
......@@ -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;
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment