aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2022-12-06 11:25:54 -0800
committerAndres Freund <andres@anarazel.de>2022-12-06 11:25:54 -0800
commit79f7c482f6745959f7aeea4f7386fceb02ad8889 (patch)
tree00f2920f57b14c41c8e9273ff78ef4e7765da4ac
parenta61b1f74823c9c4f79c95226a461f1e7a367764b (diff)
downloadpostgresql-79f7c482f6745959f7aeea4f7386fceb02ad8889.tar.gz
postgresql-79f7c482f6745959f7aeea4f7386fceb02ad8889.zip
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 <pryzby@telsasoft.com> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20221021034040.GT16921@telsasoft.com
-rw-r--r--meson.build8
-rw-r--r--src/port/meson.build4
-rw-r--r--src/test/regress/meson.build2
3 files changed, 12 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 725e10d815c..172c1441352 100644
--- a/meson.build
+++ b/meson.build
@@ -211,6 +211,10 @@ if host_system == 'aix'
elif host_system == 'cygwin'
cppflags += '-D_GNU_SOURCE'
+ dlsuffix = '.dll'
+ mod_link_args_fmt = ['@0@']
+ mod_link_with_name = 'lib@0@.exe.a'
+ mod_link_with_dir = 'libdir'
elif host_system == 'darwin'
dlsuffix = '.dylib'
@@ -2310,8 +2314,8 @@ gnugetopt_dep = cc.find_library('gnugetopt', required: false)
# (i.e., allow '-' as a flag character), so use our version on those platforms
# - We want to use system's getopt_long() only if the system provides struct
# option
-always_replace_getopt = host_system in ['windows', 'openbsd', 'solaris']
-always_replace_getopt_long = host_system == 'windows' or not cdata.has('HAVE_STRUCT_OPTION')
+always_replace_getopt = host_system in ['windows', 'cygwin', 'openbsd', 'solaris']
+always_replace_getopt_long = host_system in ['windows', 'cygwin'] or not cdata.has('HAVE_STRUCT_OPTION')
# Required on BSDs
execinfo_dep = cc.find_library('execinfo', required: false)
diff --git a/src/port/meson.build b/src/port/meson.build
index c2222696f1b..0ba83cc7930 100644
--- a/src/port/meson.build
+++ b/src/port/meson.build
@@ -40,6 +40,10 @@ if host_system == 'windows'
'win32setlocale.c',
'win32stat.c',
)
+elif host_system == 'cygwin'
+ pgport_sources += files(
+ 'dirmod.c',
+ )
endif
if cc.get_id() == 'msvc'
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index f1adcd9198c..72a23737fa7 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -12,6 +12,8 @@ regress_sources = pg_regress_c + files(
host_tuple_cc = cc.get_id()
if host_system == 'windows' and host_tuple_cc == 'gcc'
host_tuple_cc = 'mingw'
+elif host_system == 'cygwin' and host_tuple_cc == 'gcc'
+ host_tuple_cc = 'cygwin'
endif
host_tuple = '@0@-@1@-@2@'.format(host_cpu, host_system, host_tuple_cc)