forked from paradedb/paradedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (40 loc) · 1.89 KB
/
Copy pathMakefile
File metadata and controls
51 lines (40 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
PG_CONFIG ?= $(shell which pg_config)
DISTNAME = $(shell grep -m 1 '^name' pg_search/Cargo.toml | sed -e 's/[^"]*"\([^"]*\)",\{0,1\}/\1/')
DISTDESC = $(shell grep -m 1 '^description' pg_search/Cargo.toml | sed -e 's/[^"]*"\([^"]*\)",\{0,1\}/\1/')
DISTVERSION = $(shell grep -m 1 '^version' Cargo.toml | sed -e 's/[^"]*"\([^"]*\)",\{0,1\}/\1/')
PGRXV = $(shell perl -nE '/^pgrx\s+=\s"=?([^"]+)/ && do { say $$1; exit }' Cargo.toml)
PGV = $(shell perl -E 'shift =~ /(\d+)/ && say $$1' "$(shell $(PG_CONFIG) --version)")
EXTRA_CLEAN = META.json $(DISTNAME)-$(DISTVERSION).zip target
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
all: package
# Print the current Postgres version reported by pg_config.
.PHONY: pg-version
pg-version:
@echo $(PGV)
# Print the current PGRX version from Cargo.toml
.PHONY: pg-version
pgrx-version:
@echo $(PGRXV)
# Install the version of PGRX specified in Cargo.toml.
.PHONY: install-pgrx
install-pgrx: pg_search/Cargo.toml
@cargo install --locked cargo-pgrx --version "$(PGRXV)"
# Initialize pgrx for the PostgreSQL version identified by pg_config.
.PHONY: pgrx-init
pgrx-init: pg_search/Cargo.toml
@cargo pgrx init "--pg$(PGV)"="$(PG_CONFIG)"
# Install pg_search into the PostgreSQL cluster identified by pg_config.
.PHONY: install
install:
@cargo pgrx install --package pg_search --release --pg-config "$(PG_CONFIG)"
# Build pg_search for the PostgreSQL cluster identified by pg_config.
.DEFAULT_GOAL: package
package:
@cargo pgrx package --package pg_search --pg-config "$(PG_CONFIG)"
META.json: META.json.in pg_search/Cargo.toml
@sed -e "s/@CRATE_DESC@/$(DISTDESC)/g" -e "s/@CRATE_VERSION@/$(DISTVERSION)/g" $< > $@
$(DISTNAME)-$(DISTVERSION).zip: META.json
git archive --format zip --prefix $(DISTNAME)-$(DISTVERSION)/ --add-file $< -o $(DISTNAME)-$(DISTVERSION).zip HEAD
# Create a PGXN-compatible zip file.
dist: $(DISTNAME)-$(DISTVERSION).zip