Re: [HACKERS] Improvement of versioning on Windows, take two

2014-08-18 Thread Noah Misch
Committed after making several fixes, notably:

On Thu, Aug 14, 2014 at 03:59:57PM +0900, Michael Paquier wrote:
 --- a/src/test/isolation/Makefile
 +++ b/src/test/isolation/Makefile
 @@ -6,12 +6,15 @@ subdir = src/test/isolation
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
 +PGFILEDESC = pg_isolation_tester/isolationtester - isolation regression 
 tests

Typo.

 +PGAPPICON = win32

In the MinGW build, PGAPPICON is ineffective unless set before including
Makefile.global.

 --- a/src/tools/msvc/Mkvcbuild.pm
 +++ b/src/tools/msvc/Mkvcbuild.pm

 @@ -132,6 +133,8 @@ sub mkvcbuild
   return shift !~ /dict_snowball.c$/;
   });
   $snowball-AddIncludeDir('src\include\snowball');
 + $snowball-AddUtilityResourceFile('src\backend\snowball');
 + $snowball-RemoveFile('src\backend\snowball\libstemmer\win32ver.rc');

Augmenting the RelocateFiles callback seemed much more natural.

 @@ -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-AddResourceFile('src\test\regress');

Wrong method name.  (This failed to fail, because the previous project
initialized win32ver.rc in the same directory.)

 --- a/src/tools/msvc/Project.pm
 +++ b/src/tools/msvc/Project.pm
 @@ -303,6 +303,46 @@ sub AddDir
   $/ = $t;
  }
  
 +sub AddUtilityResourceFile
 +{

This function scans a directory's Makefile for PGFILEDESC and PGAPPICON,
passing their content to AddResourceFile().  Compare AddDir(), which scans for
those things and a few more (OBJS, SUBDIRS, etc.).  This function also raises
an error if the directory does not have both settings.  In that light, the
word Utility didn't accurately set this function apart from its peers.  One
uses this function when four-arg AddProject() is inapplicable.  (For example,
when the directory yields multiple .exe and/or .dll products.)  Whether the
directory builds, in some sense, a utility is irrelevant.  Also, let's not
have two copies of the code for extracting PGFILEDESC and PGAPPICON.  I
renamed this to AddDirResourceFile(), extracted the AddDir() implementation,
and made AddDir() call this.

It would be nice to break the build when someone adds a (non-whitelisted)
project that omits version information or the icon.  New violators were
unlikely to be direct AddDirResourceFile() callers, though.

 + open($MF, $dir\\GNUMakefile)
 +   || open($MF, $dir\\Makefile)
 +   || croak Could not open $dir\\Makefile\n;

You swapped the filename preference order compared to AddDir().  Adding that
sort of inconsistency called for a comment.  Since this order is strictly
better, I instead standardized on it.

 + print 'Directory: ' . $dir . \n\r;

Leftover debugging code.

 --- a/src/tools/msvc/clean.bat
 +++ b/src/tools/msvc/clean.bat
 @@ -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\libstemmer\win32ver.rc del /q 
 src\backend\snowball\libstemmer\win32ver.rc

That's not the location of the snowball resource file.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improvement of versioning on Windows, take two

2014-08-18 Thread Michael Paquier
On Tue, Aug 19, 2014 at 12:34 PM, Noah Misch n...@leadboat.com wrote:
 Committed after making several fixes, notably:
Thanks a lot, especially for the additional comments.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improvement of versioning on Windows, take two

2014-08-14 Thread Michael Paquier
On Tue, Aug 12, 2014 at 11:47 PM, MauMau maumau...@gmail.com wrote:
 From: Michael Paquier michael.paqu...@gmail.com
 Yes, the build succeeded.  I confirmed that the following files have version
 info.  However, unlike other files, they don't have file description.  Is
 this intended?
 bin\isolationtester.exe
 bin\pg_isolation_regress
 bin\pg_regress.exe
 bin\pg_regress_ecpg.exe
 bin\zic.exe

No... But after some additional hacking on this, I have been able to
complete that. This has for example required the addition of a new
function called AddUtilityResourceFile in Project.pm that is able to
scan a Makefile within a given folder and to extract PGFILEDESC and
PGAPPICON values that are then used to create a win32ver.rc in the
targetted build folder. Note that on MinGW all those exe/dll had file
description and version number even with previous version.

 lib\regress.dll
With MinGW, this had no file description and no version number. Of
course that was the same with MSVC. Fixed.

 lib\dict_snowball.dll has no version properties.
On MSVC there were no file description and no version number. On
MinGW, I saw a version number. Thanks for spotting that, I've fixed
it.

Regards,
-- 
Michael
diff --git a/src/backend/snowball/Makefile b/src/backend/snowball/Makefile
index ac80efe..577c512 100644
--- a/src/backend/snowball/Makefile
+++ b/src/backend/snowball/Makefile
@@ -10,10 +10,13 @@ subdir = src/backend/snowball
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+PGFILEDESC = snowball - set of dictionary templates
+PGAPPICON = win32
+
 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 \
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index 56f6a17..a2e0a83 100644
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -14,6 +14,7 @@ override CPPFLAGS := \
 	$(CPPFLAGS)
 
 PGFILEDESC = ECPG Test - regression tests for ECPG
+PGAPPICON = win32
 
 # where to find psql for testing an existing installation
 PSQLDIR = $(bindir)
diff --git a/src/test/isolation/Makefile b/src/test/isolation/Makefile
index 26bcf22..77bc43d 100644
--- a/src/test/isolation/Makefile
+++ b/src/test/isolation/Makefile
@@ -6,12 +6,15 @@ subdir = src/test/isolation
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+PGFILEDESC = pg_isolation_tester/isolationtester - isolation regression tests
+PGAPPICON = win32
+
 # where to find psql for testing an existing installation
 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
diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile
index b084e0a..49c46c7 100644
--- a/src/test/regress/GNUmakefile
+++ b/src/test/regress/GNUmakefile
@@ -14,6 +14,9 @@ subdir = src/test/regress
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+PGFILEDESC = pg_regress - regression tests
+PGAPPICON = win32
+
 # file with extra config for temp build
 TEMP_CONF =
 ifdef TEMP_CONFIG
@@ -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
 
diff --git a/src/timezone/Makefile b/src/timezone/Makefile
index ef739e9..ab65d22 100644
--- a/src/timezone/Makefile
+++ b/src/timezone/Makefile
@@ -12,11 +12,14 @@ subdir = src/timezone
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
 
+PGFILEDESC = timezone - timezone database
+PGAPPICON = win32
+
 # files to build into backend
 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 

Re: [HACKERS] Improvement of versioning on Windows, take two

2014-08-14 Thread MauMau
I confirmed that all issues are solved.  The patch content looks good, 
alghouth I'm not confident in Perl.  I marked this patch as ready for 
committer.  I didn't try the patch on MinGW.


Regards
MauMau



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improvement of versioning on Windows, take two

2014-08-12 Thread MauMau

From: Michael Paquier michael.paqu...@gmail.com

Oh yes, right. I don't really know how I missed this error when
testing v1. Adding an explicit call to
RemoveFile('src\timezone\win32ver.rc') for project postgres calms down
the build. Is the attached working for you?


Yes, the build succeeded.  I confirmed that the following files have version 
info.  However, unlike other files, they don't have file description.  Is 
this intended?


bin\isolationtester.exe
bin\pg_isolation_regress
bin\pg_regress.exe
bin\pg_regress_ecpg.exe
bin\zic.exe
lib\regress.dll


lib\dict_snowball.dll has no version properties.

Regards
MauMau




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improvement of versioning on Windows, take two

2014-08-11 Thread Michael Paquier
On Sun, Aug 10, 2014 at 9:31 PM, MauMau maumau...@gmail.com wrote:
 From: Michael Paquier michael.paqu...@gmail.com
  LINK : fatal error LNK1104: ファイル
 '.\release\postgres\src_timezone_win32ver.obj' を開くことができません。
Oh yes, right. I don't really know how I missed this error when
testing v1. Adding an explicit call to
RemoveFile('src\timezone\win32ver.rc') for project postgres calms down
the build. Is the attached working for you?
Regards,
-- 
Michael
From f88aa01e1f6f17d2b1a0cba05fb9efb8fe06e45f Mon Sep 17 00:00:00 2001
From: Michael Paquier mich...@otacoo.com
Date: Tue, 12 Aug 2014 10:02:32 +0900
Subject: [PATCH] Versioning support on MinGW and MSVC for remaining exe and
 dll files

Windows versioning is added for the following files:
- regress.dll (MSVC only)
- isolationtester.exe
- pg_isolation_regress.exe
- pg_regress.exe
- pg_regress_ecpg.exe
- zic.exe
---
 src/interfaces/ecpg/test/Makefile | 1 +
 src/test/isolation/Makefile   | 7 +--
 src/test/regress/GNUmakefile  | 7 +--
 src/timezone/Makefile | 5 -
 src/tools/msvc/Mkvcbuild.pm   | 7 +++
 src/tools/msvc/clean.bat  | 3 +++
 6 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index 56f6a17..a2e0a83 100644
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -14,6 +14,7 @@ override CPPFLAGS := \
 	$(CPPFLAGS)
 
 PGFILEDESC = ECPG Test - regression tests for ECPG
+PGAPPICON = win32
 
 # where to find psql for testing an existing installation
 PSQLDIR = $(bindir)
diff --git a/src/test/isolation/Makefile b/src/test/isolation/Makefile
index 26bcf22..77bc43d 100644
--- a/src/test/isolation/Makefile
+++ b/src/test/isolation/Makefile
@@ -6,12 +6,15 @@ subdir = src/test/isolation
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+PGFILEDESC = pg_isolation_tester/isolationtester - isolation regression tests
+PGAPPICON = win32
+
 # where to find psql for testing an existing installation
 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
diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile
index b084e0a..64c9924 100644
--- a/src/test/regress/GNUmakefile
+++ b/src/test/regress/GNUmakefile
@@ -14,6 +14,9 @@ subdir = src/test/regress
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+PGFILEDESC = pg_regress - regression tests
+PGAPPICON = win32
+
 # file with extra config for temp build
 TEMP_CONF =
 ifdef TEMP_CONFIG
@@ -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
@@ -177,7 +180,7 @@ bigcheck: all tablespace-setup
 clean distclean maintainer-clean: clean-lib
 # things built by `all' target
 	rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX)
-	rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
+	rm -f pg_regress_main.o pg_regress.o pg_regress$(X) $(WIN32RES)
 # things created by various check targets
 	rm -f $(output_files) $(input_files)
 	rm -rf testtablespace
diff --git a/src/timezone/Makefile b/src/timezone/Makefile
index ef739e9..ab65d22 100644
--- a/src/timezone/Makefile
+++ b/src/timezone/Makefile
@@ -12,11 +12,14 @@ subdir = src/timezone
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
 
+PGFILEDESC = timezone - timezone database
+PGAPPICON = win32
+
 # files to build into backend
 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 \
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index e6fb3ec..8026543 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -112,6 +112,7 @@ sub mkvcbuild
 	$postgres-AddFiles('src\backend\utils\misc', 'guc-file.l');
 	$postgres-AddFiles('src\backend\replication', 'repl_scanner.l',
 		'repl_gram.y');
+	$postgres-RemoveFile('src\timezone\win32ver.rc');
 	$postgres-AddDefine('BUILDING_DLL');
 	

Re: [HACKERS] Improvement of versioning on Windows, take two

2014-08-10 Thread MauMau

From: Michael Paquier michael.paqu...@gmail.com

Please find attached a patch finishing the work begun during CF1. This
adds versioning support for all the remaining dll and exe files on
both MinGW and MSVC:
- regress.dll (MSVC only)
- isolationtester.exe
- pg_isolation_regress.exe
- pg_regress.exe
- pg_regress_ecpg.exe
- zic.exe
I will add this patch to CF2. Comments are welcome.


The patch applied cleanly to the latest source code.  But the build failed 
with MSVC 2008 Express due to the exact same LNK1104 error mentioned in:


http://www.postgresql.org/message-id/cab7npqrty1eikqgmz1_wbvhpvfyve9vma67ricepq6d8-eg...@mail.gmail.com

 LINK : fatal error LNK1104: ファイル 
'.\release\postgres\src_timezone_win32ver.obj' を開くことができません。


Regards
MauMau





--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers