Thread: Patch to add version numbers to libpq.rc

Patch to add version numbers to libpq.rc

From
Bruce Momjian
Date:
Bruce Momjian wrote:
> We could do "date '+%y%j' to output 04349.  How many bits do we have for
> that last comma value?  This would work unless you put out two
> installers in the same day.  However, this would not work for VC and BCC
> because they don't have 'date'.  This would give us an ever-increasing
> value for each release.

Here is a sample patch for automatically adding the year/julian date to
the libpq.rc file.  It requires moving libpq.rc to libpq.rc.in and then
making the Makefile modifications attached.  I also included how
libpq.rc changes so you can see the numbers added.

I have used the existing *.def build method but for a final version I
think I have to make it its own rule so it is recreated on every MinGW
build rather than just when exports.txt changes or a package prepdist
build is made.  VC and BCC aleady require a prepdist build so we should
be OK with having this built at that time always.  I can see pginstaller
building from CVS and would like to make sure it has an updated day
stamp so I am thinking it should be recreated every time libpqrc.o is
created.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/interfaces/libpq/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v
retrieving revision 1.122
diff -c -c -r1.122 Makefile
*** src/interfaces/libpq/Makefile    20 Nov 2004 21:13:06 -0000    1.122
--- src/interfaces/libpq/Makefile    15 Dec 2004 04:31:09 -0000
***************
*** 92,98 ****

  .PHONY: def-files

! def-files: $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def

  $(srcdir)/libpqdll.def: exports.txt
      echo '; DEF file for MS VC++' > $@
--- 92,99 ----

  .PHONY: def-files

! def-files: $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def \
!     $(srcdir)/blibpqdll.def $(srcdir)/libpq.rc

  $(srcdir)/libpqdll.def: exports.txt
      echo '; DEF file for MS VC++' > $@
***************
*** 118,123 ****
--- 119,128 ----
      echo '; Aliases for MS compatible names' >> $@
      sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1= _\1/' < $< | sed 's/ *$$//' >> $@

+ $(srcdir)/libpq.rc: libpq.rc.in
+     sed -e 's/\(VERSION.*\)0 *$$/\1'`date '+%y%j'`'/' \
+     -e 's/\(Version.*\)0\\/\1'`date '+%y%j'`'\\/' < $< > $@
+

  ifneq ($(PTHREAD_H_WIN32), "")
  pthread.h: $(top_srcdir)/src/interfaces/libpq/pthread.h.win
***************
*** 145,148 ****
      rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c
md5.cip.c encnames.c wchar.c pthread.h 

  maintainer-clean: distclean
!     rm -f $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def
--- 150,153 ----
      rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c
md5.cip.c encnames.c wchar.c pthread.h 

  maintainer-clean: distclean
!     rm -f $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def $(srcdir)/libpq.rc
Index: src/interfaces/libpq/libpq.rc
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/libpq.rc,v
retrieving revision 1.12
diff -c -c -r1.12 libpq.rc
*** src/interfaces/libpq/libpq.rc    9 Aug 2004 01:55:42 -0000    1.12
--- src/interfaces/libpq/libpq.rc    15 Dec 2004 04:31:09 -0000
***************
*** 1,8 ****
  #include <winver.h>

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION 8,0,0,0
!  PRODUCTVERSION 8,0,0,0
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS__WINDOWS32
--- 1,8 ----
  #include <winver.h>

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION 8,0,0,04349
!  PRODUCTVERSION 8,0,0,04349
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS__WINDOWS32
***************
*** 15,27 ****
          BEGIN
              VALUE "CompanyName", "\0"
              VALUE "FileDescription", "PostgreSQL Access Library\0"
!             VALUE "FileVersion", "8, 0, 0, 0\0"
              VALUE "InternalName", "libpq\0"
              VALUE "LegalCopyright", "Copyright (C) 2004\0"
              VALUE "LegalTrademarks", "\0"
              VALUE "OriginalFilename", "libpq.dll\0"
              VALUE "ProductName", "PostgreSQL\0"
!             VALUE "ProductVersion", "8, 0, 0, 0\0"
          END
      END
      BLOCK "VarFileInfo"
--- 15,27 ----
          BEGIN
              VALUE "CompanyName", "\0"
              VALUE "FileDescription", "PostgreSQL Access Library\0"
!             VALUE "FileVersion", "8, 0, 0, 04349\0"
              VALUE "InternalName", "libpq\0"
              VALUE "LegalCopyright", "Copyright (C) 2004\0"
              VALUE "LegalTrademarks", "\0"
              VALUE "OriginalFilename", "libpq.dll\0"
              VALUE "ProductName", "PostgreSQL\0"
!             VALUE "ProductVersion", "8, 0, 0, 04349\0"
          END
      END
      BLOCK "VarFileInfo"

Re: Patch to add version numbers to libpq.rc

From
"Magnus Hagander"
Date:
>Bruce Momjian wrote:
>> We could do "date '+%y%j' to output 04349.  How many bits do
>we have for
>> that last comma value?  This would work unless you put out two
>> installers in the same day.  However, this would not work
>for VC and BCC
>> because they don't have 'date'.  This would give us an
>ever-increasing
>> value for each release.
>
>Here is a sample patch for automatically adding the year/julian date to
>the libpq.rc file.  It requires moving libpq.rc to libpq.rc.in and then
>making the Makefile modifications attached.  I also included how
>libpq.rc changes so you can see the numbers added.

Patch works as intended - in case you hadn't tested it on win32. I
assume using "%j" will always return "001" and never "1"? My man page
says it does, but I'm not sure if it's portable everywhere.


>I have used the existing *.def build method but for a final version I
>think I have to make it its own rule so it is recreated on every MinGW
>build rather than just when exports.txt changes or a package prepdist
>build is made.

Yes! This is very important!

>VC and BCC aleady require a prepdist build so we should
>be OK with having this built at that time always.

Yes, we no longer support building from cvs on vc/bcc unless you do the
"distprep" step manually using mingw (or unix) first.

> I can see pginstaller
>building from CVS and would like to make sure it has an updated day
>stamp so I am thinking it should be recreated every time libpqrc.o is
>created.

Yes, please!


Thanks a lot for fixing this.
Question: Would it be trivial to add the same thing to the rest of the
DLLs/EXEs? (No need in distprep, just in the general rule). Check
Makefile.global.in around line 405. Since we already have build rules
that 'sed' on the rc file...
If it's a lot of work, leave it for later. But if it's not too much, it
would be quite helpful on these DLLs/EXEs as well.


//Magnus

Re: [pgsql-hackers-win32] Patch to add version numbers to libpq.rc

From
Bruce Momjian
Date:
OK, I have created a final version of the patch, attached, and a new
libpq.rc.in file that goes into src/interfaces/libpq.  It uses date
'+%y%j' to stamp the libpq.rc file, and does the same for win32ver.rc in
/port.

One difficulty was generating a new version of libpq.rc at the proper
time.  I added a prepdist rule just like *.def.  I also added code so
every time you do a 'make clean' or distclean it does a 'touch' on
libpq.rc.in so libpq.rc is rebuilt on the next compile.  That seemed
like the cleanest solution.

---------------------------------------------------------------------------

Magnus Hagander wrote:
> >Bruce Momjian wrote:
> >> We could do "date '+%y%j' to output 04349.  How many bits do
> >we have for
> >> that last comma value?  This would work unless you put out two
> >> installers in the same day.  However, this would not work
> >for VC and BCC
> >> because they don't have 'date'.  This would give us an
> >ever-increasing
> >> value for each release.
> >
> >Here is a sample patch for automatically adding the year/julian date to
> >the libpq.rc file.  It requires moving libpq.rc to libpq.rc.in and then
> >making the Makefile modifications attached.  I also included how
> >libpq.rc changes so you can see the numbers added.
>
> Patch works as intended - in case you hadn't tested it on win32. I
> assume using "%j" will always return "001" and never "1"? My man page
> says it does, but I'm not sure if it's portable everywhere.
>
>
> >I have used the existing *.def build method but for a final version I
> >think I have to make it its own rule so it is recreated on every MinGW
> >build rather than just when exports.txt changes or a package prepdist
> >build is made.
>
> Yes! This is very important!
>
> >VC and BCC aleady require a prepdist build so we should
> >be OK with having this built at that time always.
>
> Yes, we no longer support building from cvs on vc/bcc unless you do the
> "distprep" step manually using mingw (or unix) first.
>
> > I can see pginstaller
> >building from CVS and would like to make sure it has an updated day
> >stamp so I am thinking it should be recreated every time libpqrc.o is
> >created.
>
> Yes, please!
>
>
> Thanks a lot for fixing this.
> Question: Would it be trivial to add the same thing to the rest of the
> DLLs/EXEs? (No need in distprep, just in the general rule). Check
> Makefile.global.in around line 405. Since we already have build rules
> that 'sed' on the rc file...
> If it's a lot of work, leave it for later. But if it's not too much, it
> would be quite helpful on these DLLs/EXEs as well.
>
>
> //Magnus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.207
diff -c -c -r1.207 Makefile.global.in
*** src/Makefile.global.in    16 Dec 2004 18:13:07 -0000    1.207
--- src/Makefile.global.in    16 Dec 2004 23:36:45 -0000
***************
*** 415,423 ****
  PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
  endif
  win32ver.rc: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);'
$(top_builddir)/src/port/win32ver.rc> win32ver.rc 
  win32ver.o: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);'
$(top_builddir)/src/port/win32ver.rc> win32ver.rc 
      windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
      rm -f win32ver.rc
  endif
--- 415,423 ----
  PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
  endif
  win32ver.rc: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0
*$$;\1,'`date'+%y%j'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc 
  win32ver.o: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0
*$$;\1,'`date'+%y%j'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc 
      windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
      rm -f win32ver.rc
  endif
Index: src/interfaces/libpq/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v
retrieving revision 1.122
diff -c -c -r1.122 Makefile
*** src/interfaces/libpq/Makefile    20 Nov 2004 21:13:06 -0000    1.122
--- src/interfaces/libpq/Makefile    16 Dec 2004 23:36:52 -0000
***************
*** 59,65 ****
  endif


! all: $(PTHREAD_H_WIN32) def-files all-lib

  # Shared library stuff
  include $(top_srcdir)/src/Makefile.shlib
--- 59,65 ----
  endif


! all: $(PTHREAD_H_WIN32) def-files $(srcdir)/libpq.rc all-lib

  # Shared library stuff
  include $(top_srcdir)/src/Makefile.shlib
***************
*** 118,123 ****
--- 118,125 ----
      echo '; Aliases for MS compatible names' >> $@
      sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1= _\1/' < $< | sed 's/ *$$//' >> $@

+ $(srcdir)/libpq.rc: libpq.rc.in
+     sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j'`'/' < $< > $@

  ifneq ($(PTHREAD_H_WIN32), "")
  pthread.h: $(top_srcdir)/src/interfaces/libpq/pthread.h.win
***************
*** 143,148 ****
--- 145,152 ----

  clean distclean: clean-lib
      rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c
md5.cip.c encnames.c wchar.c pthread.h 
+     # Force rebuild of libpq to get new stamp, but don't remove in case prepdist needs it
+     touch  $(srcdir)/libpq.rc.in

  maintainer-clean: distclean
      rm -f $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def
Index: src/port/win32ver.rc
===================================================================
RCS file: /cvsroot/pgsql/src/port/win32ver.rc,v
retrieving revision 1.2
diff -c -c -r1.2 win32ver.rc
*** src/port/win32ver.rc    6 Oct 2004 15:23:27 -0000    1.2
--- src/port/win32ver.rc    16 Dec 2004 23:36:53 -0000
***************
*** 2,9 ****
  #include "pg_config.h"

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION    8,0,000,000
!  PRODUCTVERSION 8,0,000,000
   FILEFLAGSMASK  0x17L
   FILEFLAGS      0x0L
   FILEOS         VOS_NT_WINDOWS32
--- 2,9 ----
  #include "pg_config.h"

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION    8,0,0,0
!  PRODUCTVERSION 8,0,0,0
   FILEFLAGSMASK  0x17L
   FILEFLAGS      0x0L
   FILEOS         VOS_NT_WINDOWS32
#include <winver.h>

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 8,0,0,0
 PRODUCTVERSION 8,0,0,0
 FILEFLAGSMASK 0x3fL
 FILEFLAGS 0
 FILEOS VOS__WINDOWS32
 FILETYPE VFT_DLL
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904B0"
        BEGIN
            VALUE "CompanyName", "\0"
            VALUE "FileDescription", "PostgreSQL Access Library\0"
            VALUE "FileVersion", "8.0.0\0"
            VALUE "InternalName", "libpq\0"
            VALUE "LegalCopyright", "Copyright (C) 2004\0"
            VALUE "LegalTrademarks", "\0"
            VALUE "OriginalFilename", "libpq.dll\0"
            VALUE "ProductName", "PostgreSQL\0"
            VALUE "ProductVersion", "8.0.0\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

Re: [pgsql-hackers-win32] Patch to add version numbers to libpq.rc

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> One difficulty was generating a new version of libpq.rc at the proper
> time.  I added a prepdist rule just like *.def.  I also added code so
> every time you do a 'make clean' or distclean it does a 'touch' on
> libpq.rc.in so libpq.rc is rebuilt on the next compile.  That seemed
> like the cleanest solution.

... except CVS will not like it at all.  Why don't you just remove the
libpq.rc file instead?

            regards, tom lane

Re: [pgsql-hackers-win32] Patch to add version numbers to

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > One difficulty was generating a new version of libpq.rc at the proper
> > time.  I added a prepdist rule just like *.def.  I also added code so
> > every time you do a 'make clean' or distclean it does a 'touch' on
> > libpq.rc.in so libpq.rc is rebuilt on the next compile.  That seemed
> > like the cleanest solution.
>
> ... except CVS will not like it at all.  Why don't you just remove the
> libpq.rc file instead?

I am going to remove libpq.rc from CVS because it is now a derived file
from libpq.rc.in.  I don't remove via 'clean' because if someone wants
to build VC or BCC and Win32 with the same tarball then once they do a
'clean' they can't do a VC or BCC compile anymore.

Does that answer your question?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: [pgsql-hackers-win32] Patch to add version numbers to libpq.rc

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> Bruce Momjian <pgman@candle.pha.pa.us> writes:
>>> One difficulty was generating a new version of libpq.rc at the proper
>>> time.  I added a prepdist rule just like *.def.  I also added code so
>>> every time you do a 'make clean' or distclean it does a 'touch' on
>>> libpq.rc.in so libpq.rc is rebuilt on the next compile.  That seemed
>>> like the cleanest solution.
>>
>> ... except CVS will not like it at all.  Why don't you just remove the
>> libpq.rc file instead?

> I am going to remove libpq.rc from CVS because it is now a derived file
> from libpq.rc.in.  I don't remove via 'clean' because if someone wants
> to build VC or BCC and Win32 with the same tarball then once they do a
> 'clean' they can't do a VC or BCC compile anymore.

> Does that answer your question?

Not in the least.

What I'm complaining about is that you can't simply "touch" a file that
is under CVS control; CVS will think it's been modified.

Perhaps it would work to make libpq.rc depend on both libpq.rc.in and
src/Makefile.global; then any re-configure would force it to be rebuilt.

            regards, tom lane

Re: [pgsql-hackers-win32] Patch to add version numbers to

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >>> One difficulty was generating a new version of libpq.rc at the proper
> >>> time.  I added a prepdist rule just like *.def.  I also added code so
> >>> every time you do a 'make clean' or distclean it does a 'touch' on
> >>> libpq.rc.in so libpq.rc is rebuilt on the next compile.  That seemed
> >>> like the cleanest solution.
> >>
> >> ... except CVS will not like it at all.  Why don't you just remove the
> >> libpq.rc file instead?
>
> > I am going to remove libpq.rc from CVS because it is now a derived file
> > from libpq.rc.in.  I don't remove via 'clean' because if someone wants
> > to build VC or BCC and Win32 with the same tarball then once they do a
> > 'clean' they can't do a VC or BCC compile anymore.
>
> > Does that answer your question?
>
> Not in the least.
>
> What I'm complaining about is that you can't simply "touch" a file that
> is under CVS control; CVS will think it's been modified.

Really?  If I touch a file and do a commit I don't see anything happen.
There might be a problem that cvs is going to check that file over and
over again when it doesn't need to and I certainly don't like the touch
solution.

> Perhaps it would work to make libpq.rc depend on both libpq.rc.in and
> src/Makefile.global; then any re-configure would force it to be rebuilt.

Oh, so make it dependent on a file derived from a configure run.  New
patch attached.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.207
diff -c -c -r1.207 Makefile.global.in
*** src/Makefile.global.in    16 Dec 2004 18:13:07 -0000    1.207
--- src/Makefile.global.in    17 Dec 2004 01:13:38 -0000
***************
*** 415,423 ****
  PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
  endif
  win32ver.rc: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);'
$(top_builddir)/src/port/win32ver.rc> win32ver.rc 
  win32ver.o: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);'
$(top_builddir)/src/port/win32ver.rc> win32ver.rc 
      windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
      rm -f win32ver.rc
  endif
--- 415,423 ----
  PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
  endif
  win32ver.rc: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0
*$$;\1,'`date'+%y%j'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc 
  win32ver.o: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0
*$$;\1,'`date'+%y%j'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc 
      windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
      rm -f win32ver.rc
  endif
Index: src/interfaces/libpq/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v
retrieving revision 1.122
diff -c -c -r1.122 Makefile
*** src/interfaces/libpq/Makefile    20 Nov 2004 21:13:06 -0000    1.122
--- src/interfaces/libpq/Makefile    17 Dec 2004 01:13:46 -0000
***************
*** 59,65 ****
  endif


! all: $(PTHREAD_H_WIN32) def-files all-lib

  # Shared library stuff
  include $(top_srcdir)/src/Makefile.shlib
--- 59,65 ----
  endif


! all: $(PTHREAD_H_WIN32) def-files $(srcdir)/libpq.rc all-lib

  # Shared library stuff
  include $(top_srcdir)/src/Makefile.shlib
***************
*** 118,123 ****
--- 118,126 ----
      echo '; Aliases for MS compatible names' >> $@
      sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1= _\1/' < $< | sed 's/ *$$//' >> $@

+ # Force rebuild on re-run of configure
+ $(srcdir)/libpq.rc: $(top_srcdir)/src/Makefile.global libpq.rc.in
+     sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j'`'/' < $< > $@

  ifneq ($(PTHREAD_H_WIN32), "")
  pthread.h: $(top_srcdir)/src/interfaces/libpq/pthread.h.win
Index: src/port/win32ver.rc
===================================================================
RCS file: /cvsroot/pgsql/src/port/win32ver.rc,v
retrieving revision 1.2
diff -c -c -r1.2 win32ver.rc
*** src/port/win32ver.rc    6 Oct 2004 15:23:27 -0000    1.2
--- src/port/win32ver.rc    17 Dec 2004 01:13:47 -0000
***************
*** 2,9 ****
  #include "pg_config.h"

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION    8,0,000,000
!  PRODUCTVERSION 8,0,000,000
   FILEFLAGSMASK  0x17L
   FILEFLAGS      0x0L
   FILEOS         VOS_NT_WINDOWS32
--- 2,9 ----
  #include "pg_config.h"

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION    8,0,0,0
!  PRODUCTVERSION 8,0,0,0
   FILEFLAGSMASK  0x17L
   FILEFLAGS      0x0L
   FILEOS         VOS_NT_WINDOWS32

Re: [pgsql-hackers-win32] Patch to add version numbers to libpq.rc

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> + # Force rebuild on re-run of configure
> + $(srcdir)/libpq.rc: $(top_srcdir)/src/Makefile.global libpq.rc.in
> +     sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j'`'/' < $< > $@

Put Makefile.global second, else $< refers to the wrong file.
Also, it has to be $(top_builddir)/src/Makefile.global, not top_srcdir.
The comment would probably be more useful if a little more verbose:
# depend on Makefile.global to force rebuild on re-run of configure

            regards, tom lane

Re: [pgsql-hackers-win32] Patch to add version numbers to

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > + # Force rebuild on re-run of configure
> > + $(srcdir)/libpq.rc: $(top_srcdir)/src/Makefile.global libpq.rc.in
> > +     sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j'`'/' < $< > $@
>
> Put Makefile.global second, else $< refers to the wrong file.
> Also, it has to be $(top_builddir)/src/Makefile.global, not top_srcdir.
> The comment would probably be more useful if a little more verbose:
> # depend on Makefile.global to force rebuild on re-run of configure

OK, new version attached with adjustments.  I do like the
Makefile.global dependency idea!

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.207
diff -c -c -r1.207 Makefile.global.in
*** src/Makefile.global.in    16 Dec 2004 18:13:07 -0000    1.207
--- src/Makefile.global.in    17 Dec 2004 01:41:35 -0000
***************
*** 415,423 ****
  PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
  endif
  win32ver.rc: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);'
$(top_builddir)/src/port/win32ver.rc> win32ver.rc 
  win32ver.o: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);'
$(top_builddir)/src/port/win32ver.rc> win32ver.rc 
      windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
      rm -f win32ver.rc
  endif
--- 415,423 ----
  PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
  endif
  win32ver.rc: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0
*$$;\1,'`date'+%y%j'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc 
  win32ver.o: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0
*$$;\1,'`date'+%y%j'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc 
      windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
      rm -f win32ver.rc
  endif
Index: src/interfaces/libpq/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v
retrieving revision 1.122
diff -c -c -r1.122 Makefile
*** src/interfaces/libpq/Makefile    20 Nov 2004 21:13:06 -0000    1.122
--- src/interfaces/libpq/Makefile    17 Dec 2004 01:41:40 -0000
***************
*** 59,65 ****
  endif


! all: $(PTHREAD_H_WIN32) def-files all-lib

  # Shared library stuff
  include $(top_srcdir)/src/Makefile.shlib
--- 59,65 ----
  endif


! all: $(PTHREAD_H_WIN32) def-files $(srcdir)/libpq.rc all-lib

  # Shared library stuff
  include $(top_srcdir)/src/Makefile.shlib
***************
*** 118,123 ****
--- 118,126 ----
      echo '; Aliases for MS compatible names' >> $@
      sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1= _\1/' < $< | sed 's/ *$$//' >> $@

+ # depend on Makefile.global to force rebuild on re-run of configure
+ $(srcdir)/libpq.rc: libpq.rc.in $(top_builddir)/src/Makefile.global
+     sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j'`'/' < $< > $@

  ifneq ($(PTHREAD_H_WIN32), "")
  pthread.h: $(top_srcdir)/src/interfaces/libpq/pthread.h.win
Index: src/port/win32ver.rc
===================================================================
RCS file: /cvsroot/pgsql/src/port/win32ver.rc,v
retrieving revision 1.2
diff -c -c -r1.2 win32ver.rc
*** src/port/win32ver.rc    6 Oct 2004 15:23:27 -0000    1.2
--- src/port/win32ver.rc    17 Dec 2004 01:41:40 -0000
***************
*** 2,9 ****
  #include "pg_config.h"

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION    8,0,000,000
!  PRODUCTVERSION 8,0,000,000
   FILEFLAGSMASK  0x17L
   FILEFLAGS      0x0L
   FILEOS         VOS_NT_WINDOWS32
--- 2,9 ----
  #include "pg_config.h"

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION    8,0,0,0
!  PRODUCTVERSION 8,0,0,0
   FILEFLAGSMASK  0x17L
   FILEFLAGS      0x0L
   FILEOS         VOS_NT_WINDOWS32

Re: [pgsql-hackers-win32] Patch to add version numbers to

From
Bruce Momjian
Date:
Applied, version attached.  Magnus tested it.

---------------------------------------------------------------------------

Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > + # Force rebuild on re-run of configure
> > > + $(srcdir)/libpq.rc: $(top_srcdir)/src/Makefile.global libpq.rc.in
> > > +     sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j'`'/' < $< > $@
> >
> > Put Makefile.global second, else $< refers to the wrong file.
> > Also, it has to be $(top_builddir)/src/Makefile.global, not top_srcdir.
> > The comment would probably be more useful if a little more verbose:
> > # depend on Makefile.global to force rebuild on re-run of configure
>
> OK, new version attached with adjustments.  I do like the
> Makefile.global dependency idea!
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.207
diff -c -c -r1.207 Makefile.global.in
*** src/Makefile.global.in    16 Dec 2004 18:13:07 -0000    1.207
--- src/Makefile.global.in    18 Dec 2004 18:19:45 -0000
***************
*** 415,423 ****
  PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
  endif
  win32ver.rc: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);'
$(top_builddir)/src/port/win32ver.rc> win32ver.rc 
  win32ver.o: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);'
$(top_builddir)/src/port/win32ver.rc> win32ver.rc 
      windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
      rm -f win32ver.rc
  endif
--- 415,423 ----
  PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
  endif
  win32ver.rc: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0
*$$;\1,'`date'+%y%j' | sed 's/^0*//'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc 
  win32ver.o: $(top_builddir)/src/port/win32ver.rc
!     sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0
*$$;\1,'`date'+%y%j' | sed 's/^0*//'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc 
      windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
      rm -f win32ver.rc
  endif
Index: src/interfaces/libpq/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v
retrieving revision 1.122
diff -c -c -r1.122 Makefile
*** src/interfaces/libpq/Makefile    20 Nov 2004 21:13:06 -0000    1.122
--- src/interfaces/libpq/Makefile    18 Dec 2004 18:19:52 -0000
***************
*** 59,65 ****
  endif


! all: $(PTHREAD_H_WIN32) def-files all-lib

  # Shared library stuff
  include $(top_srcdir)/src/Makefile.shlib
--- 59,65 ----
  endif


! all: $(PTHREAD_H_WIN32) def-files $(srcdir)/libpq.rc all-lib

  # Shared library stuff
  include $(top_srcdir)/src/Makefile.shlib
***************
*** 118,123 ****
--- 118,126 ----
      echo '; Aliases for MS compatible names' >> $@
      sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1= _\1/' < $< | sed 's/ *$$//' >> $@

+ # depend on Makefile.global to force rebuild on re-run of configure
+ $(srcdir)/libpq.rc: libpq.rc.in $(top_builddir)/src/Makefile.global
+     sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j' | sed 's/^0*//'`'/' < $< > $@

  ifneq ($(PTHREAD_H_WIN32), "")
  pthread.h: $(top_srcdir)/src/interfaces/libpq/pthread.h.win
Index: src/interfaces/libpq/libpq.rc
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/libpq.rc,v
retrieving revision 1.12
diff -c -c -r1.12 libpq.rc
*** src/interfaces/libpq/libpq.rc    9 Aug 2004 01:55:42 -0000    1.12
--- src/interfaces/libpq/libpq.rc    18 Dec 2004 18:19:52 -0000
***************
*** 1,8 ****
  #include <winver.h>

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION 8,0,0,0
!  PRODUCTVERSION 8,0,0,0
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS__WINDOWS32
--- 1,8 ----
  #include <winver.h>

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION 8,0,0,4353
!  PRODUCTVERSION 8,0,0,4353
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS__WINDOWS32
***************
*** 15,27 ****
          BEGIN
              VALUE "CompanyName", "\0"
              VALUE "FileDescription", "PostgreSQL Access Library\0"
!             VALUE "FileVersion", "8, 0, 0, 0\0"
              VALUE "InternalName", "libpq\0"
              VALUE "LegalCopyright", "Copyright (C) 2004\0"
              VALUE "LegalTrademarks", "\0"
              VALUE "OriginalFilename", "libpq.dll\0"
              VALUE "ProductName", "PostgreSQL\0"
!             VALUE "ProductVersion", "8, 0, 0, 0\0"
          END
      END
      BLOCK "VarFileInfo"
--- 15,27 ----
          BEGIN
              VALUE "CompanyName", "\0"
              VALUE "FileDescription", "PostgreSQL Access Library\0"
!             VALUE "FileVersion", "8.0.0\0"
              VALUE "InternalName", "libpq\0"
              VALUE "LegalCopyright", "Copyright (C) 2004\0"
              VALUE "LegalTrademarks", "\0"
              VALUE "OriginalFilename", "libpq.dll\0"
              VALUE "ProductName", "PostgreSQL\0"
!             VALUE "ProductVersion", "8.0.0\0"
          END
      END
      BLOCK "VarFileInfo"
Index: src/port/win32ver.rc
===================================================================
RCS file: /cvsroot/pgsql/src/port/win32ver.rc,v
retrieving revision 1.2
diff -c -c -r1.2 win32ver.rc
*** src/port/win32ver.rc    6 Oct 2004 15:23:27 -0000    1.2
--- src/port/win32ver.rc    18 Dec 2004 18:19:53 -0000
***************
*** 2,9 ****
  #include "pg_config.h"

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION    8,0,000,000
!  PRODUCTVERSION 8,0,000,000
   FILEFLAGSMASK  0x17L
   FILEFLAGS      0x0L
   FILEOS         VOS_NT_WINDOWS32
--- 2,9 ----
  #include "pg_config.h"

  VS_VERSION_INFO VERSIONINFO
!  FILEVERSION    8,0,0,0
!  PRODUCTVERSION 8,0,0,0
   FILEFLAGSMASK  0x17L
   FILEFLAGS      0x0L
   FILEOS         VOS_NT_WINDOWS32