aports/community/libpg_query/unbundle-vendor-deps.patch
2022-11-19 00:25:34 +00:00

39 lines
1.5 KiB
Diff

Link against system provided protobuf-c and xxhash libraries.
--- a/Makefile
+++ b/Makefile
@@ -29,16 +29,18 @@
SOFLAG = -soname
endif
-SRC_FILES := $(wildcard src/*.c src/postgres/*.c) vendor/protobuf-c/protobuf-c.c vendor/xxhash/xxhash.c protobuf/pg_query.pb-c.c
+SRC_FILES := $(wildcard src/*.c src/postgres/*.c) protobuf/pg_query.pb-c.c
NOT_OBJ_FILES := src/pg_query_enum_defs.o src/pg_query_fingerprint_defs.o src/pg_query_fingerprint_conds.o src/pg_query_outfuncs_defs.o src/pg_query_outfuncs_conds.o src/pg_query_readfuncs_defs.o src/pg_query_readfuncs_conds.o src/postgres/guc-file.o src/postgres/scan.o src/pg_query_json_helper.o
OBJ_FILES := $(filter-out $(NOT_OBJ_FILES), $(SRC_FILES:.c=.o))
-override CFLAGS += -g -I. -I./vendor -I./src/postgres/include -Wall -Wno-unused-function -Wno-unused-value -Wno-unused-variable -fno-strict-aliasing -fwrapv -fPIC
+LIBS = -lxxhash -lprotobuf-c
+override CFLAGS += -g -I. -I./src/postgres/include -Wall -Wno-unused-function -Wno-unused-value -Wno-unused-variable -fno-strict-aliasing -fwrapv -fPIC
+
override PG_CONFIGURE_FLAGS += -q --without-readline --without-zlib
-override TEST_CFLAGS += -I. -I./vendor -g
-override TEST_LDFLAGS += -pthread
+override TEST_CFLAGS += -I. -g
+override TEST_LDFLAGS += -pthread $(LIBS)
CFLAGS_OPT_LEVEL = -O3
ifeq ($(DEBUG),1)
--- a/src/pg_query_fingerprint.c
+++ b/src/pg_query_fingerprint.c
@@ -7,7 +7,7 @@
#include "pg_query_fingerprint.h"
#include "postgres.h"
-#include "xxhash/xxhash.h"
+#include <xxhash.h>
#include "lib/ilist.h"
#include "parser/parser.h"