From 7d9e7b662e0280889fae27d206b227cda2c08f3b Mon Sep 17 00:00:00 2001 From: Lukas Fittl Date: Mon, 1 Jan 2024 00:28:26 -0800 Subject: [PATCH] WIP --- Makefile | 4 +++ Makefile.msvc | 38 ++++++++++++++--------------- src/postgres/include/pg_config_os.h | 3 +++ 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 532d91fd..7893c50c 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,10 @@ extract_source: $(PGDIR) # Don't mark anything as visible based on how Postgres defines it echo "#undef PGDLLIMPORT" >> ./src/postgres/include/pg_config_os.h echo "#undef PGDLLEXPORT" >> ./src/postgres/include/pg_config_os.h + # Avoid getting incorrect sigsetjmp overrides + echo "#ifdef __clang__" >> ./src/postgres/include/pg_config_os.h + echo "#undef __MINGW64__" >> ./src/postgres/include/pg_config_os.h + echo "#endif /* __clang__ */" >> ./src/postgres/include/pg_config_os.h echo "#endif" >> ./src/postgres/include/pg_config_os.h # Adjust version string to ignore differences in build environments sed -i "" '$(shell echo 's/\#define PG_VERSION_STR .*/#define PG_VERSION_STR "PostgreSQL $(PG_VERSION) \(libpg_query\)"/')' ./src/postgres/include/pg_config.h diff --git a/Makefile.msvc b/Makefile.msvc index 7040a8e1..74b1e304 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -33,22 +33,22 @@ examples: $(EXAMPLES) .\examples\simple_plpgsql examples/simple: examples/simple.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ examples/simple.c $(ARLIB) + $(CC) $(CFLAGS) examples/simple.c $(ARLIB) examples/scan: examples/scan.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ examples/scan.c $(ARLIB) + $(CC) $(CFLAGS) examples/scan.c $(ARLIB) examples/normalize: examples/normalize.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ examples/normalize.c $(ARLIB) + $(CC) $(CFLAGS) examples/normalize.c $(ARLIB) examples/simple_error: examples/simple_error.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ examples/simple_error.c $(ARLIB) + $(CC) $(CFLAGS) examples/simple_error.c $(ARLIB) examples/normalize_error: examples/normalize_error.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ examples/normalize_error.c $(ARLIB) + $(CC) $(CFLAGS) examples/normalize_error.c $(ARLIB) examples/simple_plpgsql: examples/simple_plpgsql.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ examples/simple_plpgsql.c $(ARLIB) + $(CC) $(CFLAGS) examples/simple_plpgsql.c $(ARLIB) TESTS = test/deparse test/fingerprint test/fingerprint_opts test/normalize test/parse test/parse_opts test/parse_protobuf test/parse_protobuf_opts test/parse_plpgsql test/scan test/split test: $(TESTS) @@ -66,43 +66,43 @@ test: $(TESTS) # Doesn't work because of C2026: string too big, trailing characters truncated #test/complex: test/complex.c $(ARLIB) # We have "-Isrc/" because this test uses pg_query_fingerprint_with_opts -# $(CC) $(CFLAGS) /OUT:$@ -Isrc/ test/complex.c $(ARLIB) +# $(CC) $(CFLAGS) -Isrc/ test/complex.c $(ARLIB) # Doesn't work since this requires pthreads #test/concurrency: test/concurrency.c test/parse_tests.c $(ARLIB) -# $(CC) $(CFLAGS) /OUT:$@ test/concurrency.c $(ARLIB) +# $(CC) $(CFLAGS) test/concurrency.c $(ARLIB) test/deparse: test/deparse.c test/deparse_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/deparse.c $(ARLIB) + $(CC) $(CFLAGS) test/deparse.c $(ARLIB) test/fingerprint: test/fingerprint.c test/fingerprint_tests.c $(ARLIB) # We have "-Isrc/" because this test uses pg_query_fingerprint_with_opts - $(CC) $(CFLAGS) /OUT:$@ -Isrc/ test/fingerprint.c $(ARLIB) + $(CC) $(CFLAGS) -Isrc/ test/fingerprint.c $(ARLIB) test/fingerprint_opts: test/fingerprint_opts.c test/fingerprint_opts_tests.c $(ARLIB) # We have "-Isrc/" because this test uses pg_query_fingerprint_with_opts - $(CC) $(CFLAGS) /OUT:$@ -Isrc/ test/fingerprint_opts.c $(ARLIB) + $(CC) $(CFLAGS) -Isrc/ test/fingerprint_opts.c $(ARLIB) test/normalize: test/normalize.c test/normalize_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/normalize.c $(ARLIB) + $(CC) $(CFLAGS) test/normalize.c $(ARLIB) test/parse: test/parse.c test/parse_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/parse.c $(ARLIB) + $(CC) $(CFLAGS) test/parse.c $(ARLIB) test/parse_opts: test/parse_opts.c test/parse_opts_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/parse_opts.c $(ARLIB) + $(CC) $(CFLAGS) test/parse_opts.c $(ARLIB) test/parse_plpgsql: test/parse_plpgsql.c test/parse_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/parse_plpgsql.c $(ARLIB) + $(CC) $(CFLAGS) test/parse_plpgsql.c $(ARLIB) test/parse_protobuf: test/parse_protobuf.c test/parse_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/parse_protobuf.c $(ARLIB) + $(CC) $(CFLAGS) test/parse_protobuf.c $(ARLIB) test/parse_protobuf_opts: test/parse_protobuf_opts.c test/parse_opts_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/parse_protobuf_opts.c $(ARLIB) + $(CC) $(CFLAGS) test/parse_protobuf_opts.c $(ARLIB) test/scan: test/scan.c test/scan_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/scan.c $(ARLIB) + $(CC) $(CFLAGS) test/scan.c $(ARLIB) test/split: test/split.c test/split_tests.c $(ARLIB) - $(CC) $(CFLAGS) /OUT:$@ test/split.c $(ARLIB) + $(CC) $(CFLAGS) test/split.c $(ARLIB) diff --git a/src/postgres/include/pg_config_os.h b/src/postgres/include/pg_config_os.h index 55baecd0..4dc81de2 100644 --- a/src/postgres/include/pg_config_os.h +++ b/src/postgres/include/pg_config_os.h @@ -2,4 +2,7 @@ #include "port/win32.h" #undef PGDLLIMPORT #undef PGDLLEXPORT +#ifdef __clang__ +#undef __MINGW64__ +#endif /* __clang__ */ #endif