aports/community/ruby-pg_query/unbundle-deps.patch
2024-03-31 22:51:37 +00:00

30 lines
1.4 KiB
Diff

Link against system-provided libpg_query and xxhash, and respect our CFLAGS.
--- a/ext/pg_query/extconf.rb
+++ b/ext/pg_query/extconf.rb
@@ -8,10 +8,12 @@
$objs = Dir.glob(File.join(__dir__, '*.c')).map { |f| Pathname.new(f).sub_ext('.o').to_s }
if RUBY_PLATFORM !~ /cygwin|mswin|mingw|bccwin|wince|emx/
- $CFLAGS << " -fvisibility=hidden -O3 -Wall -fno-strict-aliasing -fwrapv -fstack-protector -Wno-unused-function -Wno-unused-variable -Wno-clobbered -Wno-sign-compare -Wno-discarded-qualifiers -Wno-unknown-warning-option -g"
+ $CFLAGS << " #{ENV["CFLAGS"]} -I/usr/include/postgresql/16/server"
+ $CFLAGS << " -O3" unless $CFLAGS[/-O\d/]
+ $CFLAGS << " -fvisibility=hidden -Wall -fno-strict-aliasing -fwrapv -fstack-protector -Wno-unused-function -Wno-unused-variable -Wno-clobbered -Wno-sign-compare -Wno-discarded-qualifiers -Wno-unknown-warning-option -g"
end
-$INCFLAGS = "-I#{File.join(__dir__, 'include')} " + "-I#{File.join(__dir__, 'include', 'postgres')} " + $INCFLAGS
+$LDFLAGS << " -lpg_query -lxxhash"
if RUBY_PLATFORM =~ /cygwin|mswin|mingw|bccwin|wince|emx/
$INCFLAGS = "-I#{File.join(__dir__, 'include', 'postgres', 'port', 'win32')} " + $INCFLAGS
--- a/ext/pg_query/pg_query_ruby.c
+++ b/ext/pg_query/pg_query_ruby.c
@@ -1,5 +1,5 @@
-#include "pg_query.h"
-#include "xxhash/xxhash.h"
+#include <pg_query.h>
+#include <xxhash.h>
#include <ruby.h>
void raise_ruby_parse_error(PgQueryProtobufParseResult result);