Check PostgreSQL version number as number in the makefile
Not entirely happy about the solution but I like the uniform tests.
This commit is contained in:
11
lib/Makefile
11
lib/Makefile
@ -6,7 +6,11 @@
|
||||
# Portions Copyright (c) 2012, The Reorg Development Team
|
||||
#
|
||||
|
||||
PG_CONFIG = pg_config
|
||||
PG_CONFIG ?= pg_config
|
||||
|
||||
# version as a number, e.g. 9.1.4 -> 90104
|
||||
VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
|
||||
INTVERSION := $(shell echo $(VERSION) | sed -E 's/([0-9]+)\.([0-9]+)\.?([0-9]+)?.*/(\1*100+\2)*100+0\3/' | bc)
|
||||
|
||||
EXTENSION = pg_repack
|
||||
MODULE_big = $(EXTENSION)
|
||||
@ -20,10 +24,7 @@ REPACK_VERSION = $(shell grep '"version":' ../META.json | head -1 \
|
||||
PG_CPPFLAGS = -DREPACK_VERSION=$(REPACK_VERSION)
|
||||
|
||||
# Support CREATE EXTENSION for PG >= 9.1 and a simple sql script for PG < 9.1
|
||||
HAVE_EXTENSION = $(shell $(PG_CONFIG) --version \
|
||||
| grep -qE " 8\.| 9\.0" && echo no || echo yes)
|
||||
|
||||
ifeq ($(HAVE_EXTENSION),yes)
|
||||
ifeq ($(shell echo $$(($(INTVERSION) >= 90100))),1)
|
||||
DATA_built = pg_repack--$(REPACK_VERSION).sql pg_repack.control
|
||||
else
|
||||
DATA_built = pg_repack.sql
|
||||
|
Reference in New Issue
Block a user