Skip to content

Commit fc7852c

Browse files
committed
meson: Improve PG_VERSION_STR generation
Previously the host operating system and 32/64 bit were not included and the build machine's cpu was used, which is potentially wrong for cross builds. Author: Juan José Santamaría Flecha <[email protected]> Author: Andres Freund <[email protected]> Discussion: https://postgr.es/m/CAC+AXB16gwYhKCdS+t0pk3U7kKtpVj5L-ynmhK3Gbea330At3w@mail.gmail.com
1 parent bad5116 commit fc7852c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

meson.build

+10-2
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,11 @@ cdata.set_quoted('PACKAGE_TARNAME', 'postgresql')
143143

144144
pg_version += get_option('extra_version')
145145
cdata.set_quoted('PG_VERSION', pg_version)
146-
cdata.set_quoted('PG_VERSION_STR', 'PostgreSQL @0@ on @1@, compiled by @2@-@3@'.format(
147-
pg_version, build_machine.cpu_family(), cc.get_id(), cc.version()))
148146
cdata.set_quoted('PG_MAJORVERSION', pg_version_major.to_string())
149147
cdata.set('PG_MAJORVERSION_NUM', pg_version_major)
150148
cdata.set('PG_MINORVERSION_NUM', pg_version_minor)
151149
cdata.set('PG_VERSION_NUM', pg_version_num)
150+
# PG_VERSION_STR is built later, it depends compiler test results
152151
cdata.set_quoted('CONFIGURE_ARGS', '')
153152

154153

@@ -2453,6 +2452,15 @@ cdata.set('MEMSET_LOOP_LIMIT', memset_loop_limit)
24532452
cdata.set_quoted('DLSUFFIX', dlsuffix)
24542453

24552454

2455+
# built later than the rest of the version metadata, we need SIZEOF_VOID_P
2456+
cdata.set_quoted('PG_VERSION_STR',
2457+
'PostgreSQL @0@ on @1@-@2@, compiled by @3@-@4@, @5@-bit'.format(
2458+
pg_version, host_machine.cpu_family(), host_system,
2459+
cc.get_id(), cc.version(), cdata.get('SIZEOF_VOID_P') * 8,
2460+
)
2461+
)
2462+
2463+
24562464

24572465
###############################################################
24582466
# Threading

0 commit comments

Comments
 (0)