ayaports/backports/postgresql15/pg_config-add-major-version.patch

49 lines
1.8 KiB
Diff

From: Jakub Jirutka <jakub@jirutka.cz>
Date: Tue, 09 Nov 2021 00:33:22 +0100
Subject: [PATCH] pg_config: Add new option --major-version
We use this option in aports for PostgreSQL extensions to easily get major
version of the default postgresql.
--- a/src/bin/pg_config/pg_config.c
+++ b/src/bin/pg_config/pg_config.c
@@ -65,6 +65,7 @@
{"--ldflags_ex", "LDFLAGS_EX"},
{"--ldflags_sl", "LDFLAGS_SL"},
{"--libs", "LIBS"},
+ {"--major-version", "MAJOR-VERSION"},
{"--version", "VERSION"},
{NULL, NULL}
};
@@ -101,6 +102,8 @@
printf(_(" --ldflags_ex show LDFLAGS_EX value used when PostgreSQL was built\n"));
printf(_(" --ldflags_sl show LDFLAGS_SL value used when PostgreSQL was built\n"));
printf(_(" --libs show LIBS value used when PostgreSQL was built\n"));
+ printf(_(" --major-version show the PostgreSQL major version number\n"
+ " (Alpine Linux specific option)\n"));
printf(_(" --version show the PostgreSQL version\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\nWith no arguments, all known items are shown.\n\n"));
--- a/src/common/config_info.c
+++ b/src/common/config_info.c
@@ -38,7 +38,7 @@
int i = 0;
/* Adjust this to match the number of items filled below */
- *configdata_len = 23;
+ *configdata_len = 24;
configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData));
configdata[i].name = pstrdup("BINDIR");
@@ -193,6 +193,11 @@
configdata[i].name = pstrdup("VERSION");
configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION);
+ i++;
+
+ // XXX-Patched: Alpine Linux specific, used in extension aports.
+ configdata[i].name = pstrdup("MAJOR-VERSION");
+ configdata[i].setting = pstrdup(PG_MAJORVERSION);
i++;
Assert(i == *configdata_len);