Skip to content

Commit 79f7c48

Browse files
committed
meson: Basic cygwin support
There likely are further issues, but as evidenced by the CI task proposed by Justin in the referenced thread, this suffices to build and run basic tests in cygwin (some fixes for the test infrastructure are needed, but that's independent of the meson aspect). Author: Justin Pryzby <[email protected]> Reviewed-by: Andres Freund <[email protected]> Discussion: https://postgr.es/m/[email protected]
1 parent a61b1f7 commit 79f7c48

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

meson.build

+6-2
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ if host_system == 'aix'
211211

212212
elif host_system == 'cygwin'
213213
cppflags += '-D_GNU_SOURCE'
214+
dlsuffix = '.dll'
215+
mod_link_args_fmt = ['@0@']
216+
mod_link_with_name = 'lib@[email protected]'
217+
mod_link_with_dir = 'libdir'
214218

215219
elif host_system == 'darwin'
216220
dlsuffix = '.dylib'
@@ -2310,8 +2314,8 @@ gnugetopt_dep = cc.find_library('gnugetopt', required: false)
23102314
# (i.e., allow '-' as a flag character), so use our version on those platforms
23112315
# - We want to use system's getopt_long() only if the system provides struct
23122316
# option
2313-
always_replace_getopt = host_system in ['windows', 'openbsd', 'solaris']
2314-
always_replace_getopt_long = host_system == 'windows' or not cdata.has('HAVE_STRUCT_OPTION')
2317+
always_replace_getopt = host_system in ['windows', 'cygwin', 'openbsd', 'solaris']
2318+
always_replace_getopt_long = host_system in ['windows', 'cygwin'] or not cdata.has('HAVE_STRUCT_OPTION')
23152319

23162320
# Required on BSDs
23172321
execinfo_dep = cc.find_library('execinfo', required: false)

src/port/meson.build

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ if host_system == 'windows'
4040
'win32setlocale.c',
4141
'win32stat.c',
4242
)
43+
elif host_system == 'cygwin'
44+
pgport_sources += files(
45+
'dirmod.c',
46+
)
4347
endif
4448

4549
if cc.get_id() == 'msvc'

src/test/regress/meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ regress_sources = pg_regress_c + files(
1212
host_tuple_cc = cc.get_id()
1313
if host_system == 'windows' and host_tuple_cc == 'gcc'
1414
host_tuple_cc = 'mingw'
15+
elif host_system == 'cygwin' and host_tuple_cc == 'gcc'
16+
host_tuple_cc = 'cygwin'
1517
endif
1618
host_tuple = '@0@-@1@-@2@'.format(host_cpu, host_system, host_tuple_cc)
1719

0 commit comments

Comments
 (0)