Make the version number arith without using bc

Not as available as I thought.

Can't use the 0 prefix to make the 3rd number optional as $(()) parses is as
octal, so only use the first 2 numbers.

Also fixed collate test: not available on PG 9.0.
This commit is contained in:
Daniele Varrazzo
2013-04-18 01:10:22 +01:00
parent dd06f25930
commit 14c4d4653e
3 changed files with 16 additions and 13 deletions

View File

@ -8,9 +8,9 @@
PG_CONFIG ?= pg_config
# version as a number, e.g. 9.1.4 -> 90104
# version as a number, e.g. 9.1.4 -> 901
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)
INTVERSION := $(shell echo $$(($$(echo $(VERSION) | sed -E 's/([0-9]+)\.([0-9]+).*/\1*100+\2/'))))
EXTENSION = pg_repack
MODULE_big = $(EXTENSION)
@ -24,7 +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
ifeq ($(shell echo $$(($(INTVERSION) >= 90100))),1)
ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1)
DATA_built = pg_repack--$(REPACK_VERSION).sql pg_repack.control
else
DATA_built = pg_repack.sql