Patch to add version numbers to libpq.rc - Mailing list pgsql-patches

From Bruce Momjian
Subject Patch to add version numbers to libpq.rc
Date
Msg-id 200412150445.iBF4jsJ20109@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
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"

pgsql-patches by date:

Previous
From: "Korea PostgreSQL Users' Group"
Date:
Subject: Updated Korean server message.
Next
From: hyip@site.uottawa.ca
Date:
Subject: Re: Optional REFERENCES Feature in CREATE TRIGGER Command