Merge branch 'funky-version-check'

Conflicts:
	bin/expected/repack.out
	bin/sql/repack.sql
This commit is contained in:
Daniele Varrazzo
2013-05-05 00:09:39 +01:00
12 changed files with 132 additions and 120 deletions

View File

@ -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 -> 901
VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
INTVERSION := $(shell echo $$(($$(echo $(VERSION) | sed -E 's/([0-9]+)\.([0-9]+).*/\1*100+\2/'))))
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) >= 901))),1)
DATA_built = pg_repack--$(REPACK_VERSION).sql pg_repack.control
else
DATA_built = pg_repack.sql