third_party: add libpg_query and sqlc
This adds sqlc, a SQL query code generator for Go (and other languages).
It in turn requires pganalyze's libpg_query, which is a C library for
parsing PostgreSQL queries.
To test:
$ bazel build @com_github_kyleconroy_sqlc//cmd/sqlc
In the future this will be used by Bazel rules to generate sources at
build time.
Change-Id: I369c9ab503e8ce6952fd3f73c233dd3d59922358
Reviewed-on: https://review.monogon.dev/c/monogon/+/882
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/third_party/go/patches/pganalyze-add-cdeps.patch b/third_party/go/patches/pganalyze-add-cdeps.patch
new file mode 100644
index 0000000..350219b
--- /dev/null
+++ b/third_party/go/patches/pganalyze-add-cdeps.patch
@@ -0,0 +1,13 @@
+--- a/parser/BUILD.bazel 2022-09-05 14:33:25.825959896 +0200
++++ b/parser/BUILD.bazel 2022-09-05 14:33:51.071298361 +0200
+@@ -86,6 +86,9 @@
+ "xxhash.c",
+ ],
+ cgo = True,
++ cdeps = [
++ "@libpg_query//:libpg_query",
++ ],
+ clinkopts = [""],
+ copts = ["-Iparser/include -g -fstack-protector -std=gnu99"],
+ importpath = "github.com/pganalyze/pg_query_go/v2/parser",
+