PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`
+PG_MINORVERSION=`expr "$PACKAGE_VERSION" : '.*\.\([0-9][0-9]*\)'`
+test -n "$PG_MINORVERSION" || PG_MINORVERSION=0
cat >>confdefs.h <<_ACEOF
_ACEOF
+cat >>confdefs.h <<_ACEOF
+#define PG_MAJORVERSION_NUM $PG_MAJORVERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PG_MINORVERSION_NUM $PG_MINORVERSION
+_ACEOF
+
+
# Supply a numeric version string for use by 3rd party add-ons
# awk -F is a regex on some platforms, and not on others, so make "." a tab
-PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
-tr '.' ' ' |
+PG_VERSION_NUM="`echo "$PG_MAJORVERSION $PG_MINORVERSION" |
$AWK '{printf "%d%04d", $1, $2}'`"
cat >>confdefs.h <<_ACEOF
AC_DEFINE_UNQUOTED(CONFIGURE_ARGS, ["$ac_configure_args"], [Saved arguments from configure])
[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`]
+[PG_MINORVERSION=`expr "$PACKAGE_VERSION" : '.*\.\([0-9][0-9]*\)'`]
+test -n "$PG_MINORVERSION" || PG_MINORVERSION=0
AC_SUBST(PG_MAJORVERSION)
AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string])
+AC_DEFINE_UNQUOTED(PG_MAJORVERSION_NUM, $PG_MAJORVERSION, [PostgreSQL major version number])
+AC_DEFINE_UNQUOTED(PG_MINORVERSION_NUM, $PG_MINORVERSION, [PostgreSQL minor version number])
PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
[PG_VERSION="$PACKAGE_VERSION$withval"],
# Supply a numeric version string for use by 3rd party add-ons
# awk -F is a regex on some platforms, and not on others, so make "." a tab
-[PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
-tr '.' ' ' |
+[PG_VERSION_NUM="`echo "$PG_MAJORVERSION $PG_MINORVERSION" |
$AWK '{printf "%d%04d", $1, $2}'`"]
AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number])
AC_SUBST(PG_VERSION_NUM)
my $self = {
projects => {},
options => $options,
- numver => '',
VisualStudioVersion => undef,
MinimumVisualStudioVersion => undef,
vcver => undef,
my $package_version;
my $package_bugreport;
my $package_url;
+ my ($majorver, $minorver);
# Parse configure.in to get version numbers
open(my $c, '<', "configure.in")
{
confess "Bad format of version: $self->{strver}\n";
}
- $self->{numver} = sprintf("%d%04d", $1, $2 ? $2 : 0);
- $self->{majorver} = sprintf("%d", $1);
+ $majorver = sprintf("%d", $1);
+ $minorver = sprintf("%d", $2 ? $2 : 0);
}
}
close($c);
PG_INT128_TYPE => undef,
PG_INT64_TYPE => 'long long int',
PG_KRB_SRVNAM => qq{"postgres"},
- PG_MAJORVERSION => qq{"$self->{majorver}"},
+ PG_MAJORVERSION => qq{"$majorver"},
+ PG_MAJORVERSION_NUM => $majorver,
+ PG_MINORVERSION_NUM => $minorver,
PG_PRINTF_ATTRIBUTE => undef,
PG_USE_STDBOOL => 1,
PG_VERSION => qq{"$package_version$extraver"},
- PG_VERSION_NUM => $self->{numver},
+ PG_VERSION_NUM => sprintf("%d%04d", $majorver, $minorver),
PG_VERSION_STR =>
qq{"PostgreSQL $package_version$extraver, compiled by Visual C++ build " CppAsString2(_MSC_VER) ", $bits-bit"},
PROFILE_PID_DIR => undef,
chdir('src/backend/catalog');
my $bki_srcs = join(' ../../../src/include/catalog/', @bki_srcs);
system(
- "perl genbki.pl --include-path ../../../src/include/ --set-version=$self->{majorver} $bki_srcs"
+ "perl genbki.pl --include-path ../../../src/include/ --set-version=$majorver $bki_srcs"
);
open(my $f, '>', 'bki-stamp')
|| confess "Could not touch bki-stamp";
|| croak "Could not write to version.sgml\n";
print $o <
-self->{majorver}">
+majorver">
EOF
close($o);
return;
my $minor = shift;
defined($minor) || die "$0: missing required argument: minor-version\n";
-my ($dotneeded, $numericminor);
+my ($dotneeded);
if ($minor =~ m/^\d+$/)
{
$dotneeded = 1;
- $numericminor = $minor;
}
elsif ($minor eq "devel")
{
$dotneeded = 0;
- $numericminor = 0;
}
elsif ($minor =~ m/^alpha\d+$/)
{
$dotneeded = 0;
- $numericminor = 0;
}
elsif ($minor =~ m/^beta\d+$/)
{
$dotneeded = 0;
- $numericminor = 0;
}
elsif ($minor =~ m/^rc\d+$/)
{
$dotneeded = 0;
- $numericminor = 0;
}
else
{
{
$fullversion = $majorversion . $minor;
}
-my $numericversion = $majorversion . "." . $numericminor;
-my $padnumericversion = sprintf("%d%04d", $majorversion, $numericminor);
# Get the autoconf version number for eventual nag message
# (this also ensures we're in the right directory)
"-e 's/AC_INIT(\\[PostgreSQL\\], \\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'"
);
-sed_file("src/port/win32ver.rc",
- "-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $majorversion,0,$numericminor,0/' "
- . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $majorversion,0,$numericminor,0/'"
-);
-
print "Stamped these files with version number $fullversion:\n$fixedfiles";
print "Don't forget to run autoconf $aconfver before committing.\n";