diff options
author | George Rawlinson | 2021-08-10 21:53:06 +0000 |
---|---|---|
committer | George Rawlinson | 2021-08-10 21:53:06 +0000 |
commit | b28cd767c0a119acd2c5b51b92c496096f68b058 (patch) | |
tree | c16f6d058f16335c20859e4fef0aa89beaf3befc | |
download | aur-b28cd767c0a119acd2c5b51b92c496096f68b058.tar.gz |
addpkg: libpg_query 13.2.0.7-1
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | PKGBUILD | 56 | ||||
-rw-r--r-- | dont-override-opt-level.patch | 11 | ||||
-rw-r--r-- | unbundle-vendor-deps.patch | 36 | ||||
-rw-r--r-- | verbose-build.patch | 25 |
5 files changed, 147 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..0e664f756907 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = libpg_query + pkgdesc = C library for accessing the PostgreSQL parser outside of the server environment + pkgver = 13.2.0.7 + pkgrel = 1 + url = https://github.com/pganalyze/libpg_query + arch = x86_64 + license = BSD + depends = protobuf-c + depends = xxhash + source = libpg_query-13.2.0.7.tar.gz::https://github.com/pganalyze/libpg_query/archive/13-2.0.7.tar.gz + source = dont-override-opt-level.patch + source = verbose-build.patch + source = unbundle-vendor-deps.patch + b2sums = 5e7322d53cce033d6e61060f564b033781a354d1ab32cb1570f4e387f1340ef5d45cc6772354dc2336a6632f6ec508699e617f1aba75e5a450b0fda53c8e9f26 + b2sums = 9c84f1839ff95eb4f20c18fa2f9be49528e550769dcd4a9e2d3a8c9f61d92b787bc412a10ca454f0f3332d03db5149901ccaf1d0d5a1ce7fe49fdf04a1c7ba66 + b2sums = d72739dbacf1aa078164e4fd97cf3bd3f41703006f2d847ed8c66d53c7a55ad20e64467df80402aecd2d52fcb05e503b27181c7f2cd81cbf0550f38f3345ffdf + b2sums = 347df596d122e5d72f419d2dbd5a2e535b2c5a64a2820e68f8592308d6ad6817e2edc94c6a6eba0e084cda57ba3435db839cfd911713b803c74492c1fc23a621 + +pkgname = libpg_query diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..83ea47c3cd9a --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,56 @@ +# Maintainer: George Rawlinson <grawlinson@archlinux.org> +# Contributor: Jakub Jirutka <jakub@jirutka.cz> + +pkgname=libpg_query +# All versions are tagged by the major Postgres version, +# plus an individual semver for this library itself. +pkgver=13.2.0.7 +_pkgver="${pkgver/./-}" +pkgrel=1 +pkgdesc="C library for accessing the PostgreSQL parser outside of the server environment" +arch=('x86_64') +url="https://github.com/pganalyze/libpg_query" +license=('BSD') +depends=('protobuf-c' 'xxhash') +source=( + "$pkgname-$pkgver.tar.gz::$url/archive/$_pkgver.tar.gz" + 'dont-override-opt-level.patch' + 'verbose-build.patch' + 'unbundle-vendor-deps.patch' +) +b2sums=('5e7322d53cce033d6e61060f564b033781a354d1ab32cb1570f4e387f1340ef5d45cc6772354dc2336a6632f6ec508699e617f1aba75e5a450b0fda53c8e9f26' + '9c84f1839ff95eb4f20c18fa2f9be49528e550769dcd4a9e2d3a8c9f61d92b787bc412a10ca454f0f3332d03db5149901ccaf1d0d5a1ce7fe49fdf04a1c7ba66' + 'd72739dbacf1aa078164e4fd97cf3bd3f41703006f2d847ed8c66d53c7a55ad20e64467df80402aecd2d52fcb05e503b27181c7f2cd81cbf0550f38f3345ffdf' + '347df596d122e5d72f419d2dbd5a2e535b2c5a64a2820e68f8592308d6ad6817e2edc94c6a6eba0e084cda57ba3435db839cfd911713b803c74492c1fc23a621') + +prepare() { + cd "$pkgname-$_pkgver" + + patch -p1 -i "$srcdir/dont-override-opt-level.patch" + patch -p1 -i "$srcdir/verbose-build.patch" + patch -p1 -i "$srcdir/unbundle-vendor-deps.patch" + + # remove vendored libraries (protobuf-c & xxhash) + rm -rf vendor +} + +build() { + cd "$pkgname-$_pkgver" + make build_shared +} + +check() { + cd "$pkgname-$_pkgver" + make test +} + +package() { + cd "$pkgname-$_pkgver" + make DESTDIR="$pkgdir" prefix=/usr install + + # license + install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE + + # documentation + install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" *.md +} diff --git a/dont-override-opt-level.patch b/dont-override-opt-level.patch new file mode 100644 index 000000000000..bd338cfbe743 --- /dev/null +++ b/dont-override-opt-level.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -38,7 +38,7 @@ + ifeq ($(VALGRIND),1) + CFLAGS_OPT_LEVEL = -O0 + endif +-override CFLAGS += $(CFLAGS_OPT_LEVEL) ++#override CFLAGS += $(CFLAGS_OPT_LEVEL) + + ifeq ($(DEBUG),1) + # We always add -g, so this only has to enable assertion checking diff --git a/unbundle-vendor-deps.patch b/unbundle-vendor-deps.patch new file mode 100644 index 000000000000..f9999b967776 --- /dev/null +++ b/unbundle-vendor-deps.patch @@ -0,0 +1,36 @@ +--- a/Makefile ++++ b/Makefile +@@ -19,16 +19,18 @@ + SONAME = lib$(TARGET).so.$(SOVERSION) + SOLIB = $(SONAME).$(LIB_VERSION_MINOR).$(LIB_VERSION_PATCH) + +-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" diff --git a/verbose-build.patch b/verbose-build.patch new file mode 100644 index 000000000000..d218c7d45d62 --- /dev/null +++ b/verbose-build.patch @@ -0,0 +1,25 @@ +--- a/Makefile ++++ b/Makefile +@@ -148,18 +148,16 @@ + cp $(PGDIR)/src/test/regress/sql/*.sql ./test/sql/postgres_regress/ + + .c.o: +- @$(ECHO) compiling $(<) +- @$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< ++ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< + + .cc.o: +- @$(ECHO) compiling $(<) +- @$(CXX) $(CXXFLAGS) -o $@ -c $< ++ $(CXX) $(CXXFLAGS) -o $@ -c $< + + $(ARLIB): $(OBJ_FILES) Makefile +- @$(AR) $@ $(OBJ_FILES) ++ $(AR) $@ $(OBJ_FILES) + + $(SOLIB): $(OBJ_FILES) Makefile +- @$(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) $(LDFLAGS) -o $@ $(OBJ_FILES) $(LIBS) ++ $(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) $(LDFLAGS) -o $@ $(OBJ_FILES) $(LIBS) + + protobuf/pg_query.pb-c.c protobuf/pg_query.pb-c.h: protobuf/pg_query.proto + ifneq ($(shell which protoc-gen-c), ) |