Re: [pgsql-hackers-win32] Patch to add version numbers to libpq.rc - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: [pgsql-hackers-win32] Patch to add version numbers to libpq.rc |
Date | |
Msg-id | 200412162338.iBGNcgR11394@candle.pha.pa.us Whole thread Raw |
In response to | Re: Patch to add version numbers to libpq.rc ("Magnus Hagander" <mha@sollentuna.net>) |
Responses |
Re: [pgsql-hackers-win32] Patch to add version numbers to libpq.rc
|
List | pgsql-patches |
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
pgsql-patches by date: