diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 355b6f7..02c23a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,8 +32,6 @@ jobs: with: path: ptrack - - name: Apply ptrack patch - run: | - echo var=${PG_BRANCH} - git apply --verbose --3way ../ptrack/patches/${PG_BRANCH}-ptrack-core.diff + - name: Apply ptrack patches + run: make patch working-directory: postgres diff --git a/Makefile b/Makefile index 7100bec..5d7311c 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,20 @@ PG_CONFIG ?= pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else -subdir = contrib/ptrack -top_builddir = ../.. -include $(top_builddir)/src/Makefile.global -include $(top_srcdir)/contrib/contrib-global.mk +top_builddir ?= ../postgres +include $(POSTGRES_DIR)/src/Makefile.global +include $(POSTGRES_DIR)/contrib/contrib-global.mk +endif + +ifndef PG_BRANCH +$(error PG_BRANCH is not defined. Set it to the desired PostgreSQL repository branch name (e.g. REL_15_STABLE).) +endif + +patch: + @cd $(top_builddir) && \ + echo Applying the ptrack patch... && \ + git apply --verbose --3way $(CURDIR)/patches/${PG_BRANCH}-ptrack-core.diff +ifeq ($(MODE), paranoia) + @echo Applying turn-off-hint-bits.diff for the paranoia mode... && \ + git apply --verbose --3way $(CURDIR)/patches/turn-off-hint-bits.diff endif