Extending MSVC scripts to support --with-extra-version
Hi all,
Please find attached a patch extending support of --with-extra-version
in the MSVC scripts. This is something I have been using internally,
and I believe that it is useful for Windows packagers.
Similarly to the other options, a new field called extraver is added
in config_default.pl and it can be overwritten in config.pl to have an
additional version string, similarly to what is currently doable with
./configure.
I'll add this patch to the next commit fest.
Regards,
--
Michael
Attachments:
20140527_msvc_extra_ver.patchtext/x-patch; charset=US-ASCII; name=20140527_msvc_extra_ver.patchDownload
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 283d399..a2e84a5 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -166,7 +166,7 @@ sub GenerateFiles
{
s{PG_VERSION "[^"]+"}{PG_VERSION "$self->{strver}"};
s{PG_VERSION_NUM \d+}{PG_VERSION_NUM $self->{numver}};
-s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER) ", $bits-bit"};
+s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}$self->{options}->{extraver}, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER) ", $bits-bit"};
print O;
}
print O "#define PG_MAJORVERSION \"$self->{majorver}\"\n";
@@ -624,14 +624,15 @@ sub GetFakeConfigure
$cfg .= ' --enable-nls' if ($self->{options}->{nls});
$cfg .= ' --with-ldap' if ($self->{options}->{ldap});
$cfg .= ' --without-zlib' unless ($self->{options}->{zlib});
- $cfg .= ' --with-openssl' if ($self->{options}->{ssl});
- $cfg .= ' --with-ossp-uuid' if ($self->{options}->{uuid});
- $cfg .= ' --with-libxml' if ($self->{options}->{xml});
- $cfg .= ' --with-libxslt' if ($self->{options}->{xslt});
- $cfg .= ' --with-gssapi' if ($self->{options}->{gss});
- $cfg .= ' --with-tcl' if ($self->{options}->{tcl});
- $cfg .= ' --with-perl' if ($self->{options}->{perl});
- $cfg .= ' --with-python' if ($self->{options}->{python});
+ $cfg .= ' --with-extra-version' if ($self->{options}->{extraver});
+ $cfg .= ' --with-openssl' if ($self->{options}->{ssl});
+ $cfg .= ' --with-ossp-uuid' if ($self->{options}->{uuid});
+ $cfg .= ' --with-libxml' if ($self->{options}->{xml});
+ $cfg .= ' --with-libxslt' if ($self->{options}->{xslt});
+ $cfg .= ' --with-gssapi' if ($self->{options}->{gss});
+ $cfg .= ' --with-tcl' if ($self->{options}->{tcl});
+ $cfg .= ' --with-perl' if ($self->{options}->{perl});
+ $cfg .= ' --with-python' if ($self->{options}->{python});
return $cfg;
}
diff --git a/src/tools/msvc/config_default.pl b/src/tools/msvc/config_default.pl
index ebb47ab..20aee8b 100644
--- a/src/tools/msvc/config_default.pl
+++ b/src/tools/msvc/config_default.pl
@@ -10,17 +10,18 @@ our $config = {
# blocksize => 8, # --with-blocksize, 8kB by default
# wal_blocksize => 8, # --with-wal-blocksize, 8kB by default
# wal_segsize => 16, # --with-wal-segsize, 16MB by default
- ldap => 1, # --with-ldap
- nls => undef, # --enable-nls=<path>
- tcl => undef, # --with-tls=<path>
- perl => undef, # --with-perl
- python => undef, # --with-python=<path>
- openssl => undef, # --with-ssl=<path>
- uuid => undef, # --with-ossp-uuid
- xml => undef, # --with-libxml=<path>
- xslt => undef, # --with-libxslt=<path>
- iconv => undef, # (not in configure, path to iconv)
- zlib => undef # --with-zlib=<path>
+ ldap => 1, # --with-ldap
+ extraver => undef, # --with-extra-version=<string>
+ nls => undef, # --enable-nls=<path>
+ tcl => undef, # --with-tls=<path>
+ perl => undef, # --with-perl
+ python => undef, # --with-python=<path>
+ openssl => undef, # --with-ssl=<path>
+ uuid => undef, # --with-ossp-uuid
+ xml => undef, # --with-libxml=<path>
+ xslt => undef, # --with-libxslt=<path>
+ iconv => undef, # (not in configure, path to iconv)
+ zlib => undef # --with-zlib=<path>
};
1;
Hi,
I have spent some time reviewing the code. It applies well and PG master
branch build fine with setting extraver or keep it undefined. I have
observed the following output applying the patch i.e.
*Keeping extraver undefined* :
C:\PG\postgresql\inst_withpatch_no_extra-version>bin\psql.exe -d postgres
psql (9.5devel)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=# select version();
version
----------------------------------------------------------------
PostgreSQL 9.5devel, compiled by Visual C++ build 1600, 64-bit
(1 row)
C:\PG\postgresql\inst_withpatch_no_extra-version>bin\initdb.exe -V
initdb (PostgreSQL) 9.5devel
*Setting extraver as ‘June27’* :
C:\PG\postgresql\inst_withpatch_extra-version>bin\psql -d postgres
psql (9.5devel)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=# select version();
version
----------------------------------------------------------------------
PostgreSQL 9.5develJune27, compiled by Visual C++ build 1600, 64-bit
(1 row)C:\PG\postgresql\inst_withpatch_extra-version>bin\initdb.exe -V
initdb (PostgreSQL) 9.5devel
It seems that extraver information only appears when version function is
being used. If we use -V (--version) with pg utilities/binaries, it does
not include additional provided information.
Can you please guide how can I perform similar functionality via configure
script (that can be used on Unix like OS/MinGW) or It is intended for
Window specific requirement ?. Thanks.
Regards,
Muhammad Asif Naeem
On Tue, May 27, 2014 at 5:58 AM, Michael Paquier <michael.paquier@gmail.com>
wrote:
Show quoted text
Hi all,
Please find attached a patch extending support of --with-extra-version
in the MSVC scripts. This is something I have been using internally,
and I believe that it is useful for Windows packagers.
Similarly to the other options, a new field called extraver is added
in config_default.pl and it can be overwritten in config.pl to have an
additional version string, similarly to what is currently doable with
./configure.I'll add this patch to the next commit fest.
Regards,
--
Michael--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Jun 27, 2014 at 8:26 AM, Asif Naeem <anaeem.it@gmail.com> wrote:
I have spent some time reviewing the code. It applies well and PG master
branch build fine with setting extraver or keep it undefined.
Thanks for reviewing that.
I have observed the following output applying the patch i.e.
It seems that extraver information only appears when version function is
being used. If we use -V (--version) with pg utilities/binaries, it does
not include additional provided information.
You are right. The first version of this patch updates PG_VERSION_STR but
not PG_VERSION, which is the string used for all the binaries to report the
version.
Can you please guide how can I perform similar functionality via
configure script (that can be used on Unix like OS/MinGW) or It is intended
for Window specific requirement ?. Thanks.
Sure, you can do the equivalent with plain configure like that:
./configure --with-extra-version="-foo" --prefix=/to/path/
And here is the output that I get with such options on OSX for example:
$ psql -c 'select substring(version(), 1, 52)'
substring
------------------------------------------------------
PostgreSQL 9.5devel-foo on x86_64-apple-darwin13.2.0
(1 row)
$ initdb --version
initdb (PostgreSQL) 9.5devel-foo
With the new patch attached, the following output is generated for an MSVC
build:
$ psql -c 'select version()'
version
--------------------------------------------------------------------
PostgreSQL 9.5devel-foo, compiled by Visual C++ build 1600, 64-bit
(1 row)
$ initdb --version
initdb (PostgreSQL) 9.5devel-foo
Regards,
--
Michael
Attachments:
20140627_msvc_extra_version_v2.patchtext/x-patch; charset=US-ASCII; name=20140627_msvc_extra_version_v2.patchDownload
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index f7a5abb..d53803e 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -164,9 +164,9 @@ sub GenerateFiles
|| confess "Could not write to pg_config.h\n";
while (<I>)
{
- s{PG_VERSION "[^"]+"}{PG_VERSION "$self->{strver}"};
+ s{PG_VERSION "[^"]+"}{PG_VERSION "$self->{strver}$self->{options}->{extraver}"};
s{PG_VERSION_NUM \d+}{PG_VERSION_NUM $self->{numver}};
-s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER) ", $bits-bit"};
+ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}$self->{options}->{extraver}, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER) ", $bits-bit"};
print O;
}
print O "#define PG_MAJORVERSION \"$self->{majorver}\"\n";
@@ -625,14 +625,15 @@ sub GetFakeConfigure
$cfg .= ' --enable-nls' if ($self->{options}->{nls});
$cfg .= ' --with-ldap' if ($self->{options}->{ldap});
$cfg .= ' --without-zlib' unless ($self->{options}->{zlib});
- $cfg .= ' --with-openssl' if ($self->{options}->{ssl});
- $cfg .= ' --with-ossp-uuid' if ($self->{options}->{uuid});
- $cfg .= ' --with-libxml' if ($self->{options}->{xml});
- $cfg .= ' --with-libxslt' if ($self->{options}->{xslt});
- $cfg .= ' --with-gssapi' if ($self->{options}->{gss});
- $cfg .= ' --with-tcl' if ($self->{options}->{tcl});
- $cfg .= ' --with-perl' if ($self->{options}->{perl});
- $cfg .= ' --with-python' if ($self->{options}->{python});
+ $cfg .= ' --with-extra-version' if ($self->{options}->{extraver});
+ $cfg .= ' --with-openssl' if ($self->{options}->{ssl});
+ $cfg .= ' --with-ossp-uuid' if ($self->{options}->{uuid});
+ $cfg .= ' --with-libxml' if ($self->{options}->{xml});
+ $cfg .= ' --with-libxslt' if ($self->{options}->{xslt});
+ $cfg .= ' --with-gssapi' if ($self->{options}->{gss});
+ $cfg .= ' --with-tcl' if ($self->{options}->{tcl});
+ $cfg .= ' --with-perl' if ($self->{options}->{perl});
+ $cfg .= ' --with-python' if ($self->{options}->{python});
return $cfg;
}
diff --git a/src/tools/msvc/config_default.pl b/src/tools/msvc/config_default.pl
index ebb47ab..20aee8b 100644
--- a/src/tools/msvc/config_default.pl
+++ b/src/tools/msvc/config_default.pl
@@ -10,17 +10,18 @@ our $config = {
# blocksize => 8, # --with-blocksize, 8kB by default
# wal_blocksize => 8, # --with-wal-blocksize, 8kB by default
# wal_segsize => 16, # --with-wal-segsize, 16MB by default
- ldap => 1, # --with-ldap
- nls => undef, # --enable-nls=<path>
- tcl => undef, # --with-tls=<path>
- perl => undef, # --with-perl
- python => undef, # --with-python=<path>
- openssl => undef, # --with-ssl=<path>
- uuid => undef, # --with-ossp-uuid
- xml => undef, # --with-libxml=<path>
- xslt => undef, # --with-libxslt=<path>
- iconv => undef, # (not in configure, path to iconv)
- zlib => undef # --with-zlib=<path>
+ ldap => 1, # --with-ldap
+ extraver => undef, # --with-extra-version=<string>
+ nls => undef, # --enable-nls=<path>
+ tcl => undef, # --with-tls=<path>
+ perl => undef, # --with-perl
+ python => undef, # --with-python=<path>
+ openssl => undef, # --with-ssl=<path>
+ uuid => undef, # --with-ossp-uuid
+ xml => undef, # --with-libxml=<path>
+ xslt => undef, # --with-libxslt=<path>
+ iconv => undef, # (not in configure, path to iconv)
+ zlib => undef # --with-zlib=<path>
};
1;
Thank you for sharing updated patch. I have compared it with MSVC and
configure generated build i.e.
*MacOSX (*--with-extra-version "-30JUN"*)*
pc1dotnetpk:inst asif$ ./bin/psql -d postgres
psql (9.5devel-30JUN)
Type "help" for help.
postgres=# select version();
version--------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.5devel-30JUN on x86_64-apple-darwin13.2.0, compiled by Apple
LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn), 64-bit
(1 row)
pc1dotnetpk:inst asif$ ./bin/initdb -V
initdb (PostgreSQL) 9.5devel-30JUN
*Windows7 64bit (*extraver => '-30JUN'*)*
C:\PG\postgresql\inst_withpatch_v2_extra-version>bin\psql -d postgres
psql (9.5devel-30JUN)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=# select version();
version
----------------------------------------------------------------------
PostgreSQL 9.5devel-30JUN, compiled by Visual C++ build 1600, 64-bit
(1 row)
C:\PG\postgresql\inst_withpatch_v2_extra-version>bin\initdb.exe -V
initdb (PostgreSQL) 9.5devel-30JUN
Patch looks good to me. I think it is ready for committer. Thanks.
Regards,
Muhammad Asif Naeem
On Fri, Jun 27, 2014 at 5:00 AM, Michael Paquier <michael.paquier@gmail.com>
wrote:
Show quoted text
On Fri, Jun 27, 2014 at 8:26 AM, Asif Naeem <anaeem.it@gmail.com> wrote:
I have spent some time reviewing the code. It applies well and PG master
branch build fine with setting extraver or keep it undefined.Thanks for reviewing that.
I have observed the following output applying the patch i.e.
It seems that extraver information only appears when version function is
being used. If we use -V (--version) with pg utilities/binaries, it does
not include additional provided information.You are right. The first version of this patch updates PG_VERSION_STR but
not PG_VERSION, which is the string used for all the binaries to report the
version.Can you please guide how can I perform similar functionality via
configure script (that can be used on Unix like OS/MinGW) or It is intended
for Window specific requirement ?. Thanks.Sure, you can do the equivalent with plain configure like that:
./configure --with-extra-version="-foo" --prefix=/to/path/
And here is the output that I get with such options on OSX for example:
$ psql -c 'select substring(version(), 1, 52)'
substring
------------------------------------------------------
PostgreSQL 9.5devel-foo on x86_64-apple-darwin13.2.0
(1 row)
$ initdb --version
initdb (PostgreSQL) 9.5devel-fooWith the new patch attached, the following output is generated for an MSVC
build:
$ psql -c 'select version()'
version
--------------------------------------------------------------------
PostgreSQL 9.5devel-foo, compiled by Visual C++ build 1600, 64-bit
(1 row)
$ initdb --version
initdb (PostgreSQL) 9.5devel-fooRegards,
--
Michael
On Mon, Jun 30, 2014 at 7:05 PM, Asif Naeem <anaeem.it@gmail.com> wrote:
Patch looks good to me. I think it is ready for committer. Thanks.
Thanks for the extra checks and for taking the time to review it.
--
Michael
On Mon, Jun 30, 2014 at 1:43 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Mon, Jun 30, 2014 at 7:05 PM, Asif Naeem <anaeem.it@gmail.com> wrote:
Patch looks good to me. I think it is ready for committer. Thanks.
Thanks for the extra checks and for taking the time to review it.
Applied, thanks!
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sun, Jul 13, 2014 at 2:39 AM, Magnus Hagander <magnus@hagander.net>
Applied, thanks!.
Thanks.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers