diff --git a/projects/github.com/citusdata/citus/package.yml b/projects/github.com/citusdata/citus/package.yml new file mode 100644 index 0000000000..7f7ed84776 --- /dev/null +++ b/projects/github.com/citusdata/citus/package.yml @@ -0,0 +1,100 @@ +# Citus — horizontally-scalable PostgreSQL extension. +# +# Citus extends Postgres into a distributed SQL database by sharding +# tables across worker nodes. It's a drop-in extension: same Postgres, +# same SQL, just transparently parallelised across a cluster. Common +# alternative to CockroachDB / Yugabyte for users who want to stay on +# vanilla Postgres semantics. +# +# Build: PGXS-based extension. Installs no CLI tools — the artefacts +# are a shared library (citus.so) plus extension control/SQL files, +# loaded inside Postgres via `CREATE EXTENSION citus` after adding it +# to shared_preload_libraries. +# +# PostgreSQL compatibility (Citus 14.x): PG 16, 17, 18. + +distributable: + url: https://github.com/citusdata/citus/archive/refs/tags/v{{version}}.tar.gz + strip-components: 1 + +versions: + github: citusdata/citus + +platforms: + - linux/x86-64 + - linux/aarch64 + - darwin/x86-64 + - darwin/aarch64 + +dependencies: + postgresql.org: '>=16<19' + curl.se: '*' # anonymous statistics collection + lz4.org: '*' # column compression + facebook.com/zstd: '*' # column compression + openssl.org: '*' # transitively via libpq / PG + +build: + dependencies: + gnu.org/make: '*' + freedesktop.org/pkg-config: '*' + linux: + # PostgreSQL bottle was built with clang, and Citus extensions + # inherit CFLAGS via `pg_config --cflags` — those carry + # clang-specific warnings (e.g. -Werror=unguarded-availability-new) + # that gcc rejects. Use the same clang to stay compatible. + llvm.org: '*' + script: + # PGXS uses pg_config to determine install dirs. Override `prefix` at + # install time so extension files land in pantry's bottle, not in the + # Postgres dependency's tree. + - ./configure $ARGS + # On darwin, PG's installed Makefile.global hard-codes -isysroot + # /Applications/Xcode.app/.../SDKs/MacOSX15.2.sdk (the SDK PG was + # bottled with). That SDK isn't present on current runners, so + # stdio.h / inttypes.h disappear. Build a sanitised CPPFLAGS string + # by re-reading pg_config --cppflags and rewriting the path, then + # pass it on the make command line so it overrides PG's value + # (PGXS's `override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS)` then + # prepends its own bits, preserving our SDK fix). Linux gets the + # unmodified value, so the rewrite is a no-op there. + - | + PG_CONFIG="{{deps.postgresql.org.prefix}}/bin/pg_config" + CPPFLAGS_PG=$("$PG_CONFIG" --cppflags) + LDFLAGS_PG=$("$PG_CONFIG" --ldflags) + if [ "$(uname)" = "Darwin" ]; then + SDK=$(xcrun --sdk macosx --show-sdk-path) + REWRITE="s|/Applications/Xcode[^[:space:]]*/SDKs/MacOSX[0-9.]+\\.sdk|$SDK|g" + CPPFLAGS_PG=$(printf '%s' "$CPPFLAGS_PG" | sed -E "$REWRITE") + LDFLAGS_PG=$(printf '%s' "$LDFLAGS_PG" | sed -E "$REWRITE") + fi + make --jobs {{ hw.concurrency }} CPPFLAGS="$CPPFLAGS_PG" LDFLAGS="$LDFLAGS_PG" + make install-all prefix={{prefix}} CPPFLAGS="$CPPFLAGS_PG" LDFLAGS="$LDFLAGS_PG" + env: + CC: clang + ARGS: + - PG_CONFIG={{deps.postgresql.org.prefix}}/bin/pg_config + - --prefix={{prefix}} + - --with-libcurl + - --with-lz4 + - --with-zstd + darwin: + # Brewkit's hermetic CPATH masks the Xcode SDK, so Xcode clang's + # #include_next chain can't reach , , etc. + # Point the toolchain at the active SDK explicitly. + SDKROOT: $(xcrun --sdk macosx --show-sdk-path) + +# Citus ships no executables — it's a Postgres extension loaded inside +# the server process. Bottle contents: +# {{prefix}}/lib/postgresql/citus.so +# {{prefix}}/share/postgresql/extension/citus.control +# {{prefix}}/share/postgresql/extension/citus--*.sql +# `provides:` validates bin/sbin paths, so omit the key entirely +# (cf. zlib.net, which is also library-only). + +test: + script: + # PGXS installs the loadable module as citus.so on linux, + # citus.dylib on darwin, both under lib/postgresql when the + # prefix lacks "postgres"/"pgsql" tokens (PGXS convention). + - test -f "{{prefix}}/lib/postgresql/citus.so" -o -f "{{prefix}}/lib/postgresql/citus.dylib" + - test -f "{{prefix}}/share/postgresql/extension/citus.control"