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:
parent
dd06f25930
commit
14c4d4653e
13
Makefile
13
Makefile
@ -8,20 +8,23 @@
|
|||||||
|
|
||||||
PG_CONFIG ?= pg_config
|
PG_CONFIG ?= pg_config
|
||||||
|
|
||||||
SUBDIRS = bin lib
|
|
||||||
|
|
||||||
# Pull out the version number from pg_config
|
# Pull out the version number from pg_config
|
||||||
VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
|
VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
|
||||||
|
ifeq ("$(VERSION)","")
|
||||||
|
$(error pg_config not found)
|
||||||
|
endif
|
||||||
|
|
||||||
# version as a number, e.g. 9.1.4 -> 90104
|
# version as a number, e.g. 9.1.4 -> 901
|
||||||
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/'))))
|
||||||
|
|
||||||
# We support PostgreSQL 8.3 and later.
|
# We support PostgreSQL 8.3 and later.
|
||||||
ifeq ($(shell echo $$(($(INTVERSION) < 80300))),1)
|
ifeq ($(shell echo $$(($(INTVERSION) < 803))),1)
|
||||||
$(error pg_repack requires PostgreSQL 8.3 or later. This is $(VERSION))
|
$(error pg_repack requires PostgreSQL 8.3 or later. This is $(VERSION))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
SUBDIRS = bin lib
|
||||||
|
|
||||||
all install installdirs uninstall distprep clean distclean maintainer-clean debug:
|
all install installdirs uninstall distprep clean distclean maintainer-clean debug:
|
||||||
@for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir $@ || exit; \
|
$(MAKE) -C $$dir $@ || exit; \
|
||||||
|
10
bin/Makefile
10
bin/Makefile
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
PG_CONFIG ?= pg_config
|
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}')
|
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/'))))
|
||||||
|
|
||||||
SRCS = pg_repack.c pgut/pgut.c pgut/pgut-fe.c
|
SRCS = pg_repack.c pgut/pgut.c pgut/pgut-fe.c
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
@ -21,7 +21,7 @@ PROGRAM = pg_repack
|
|||||||
# Test suite
|
# Test suite
|
||||||
#
|
#
|
||||||
|
|
||||||
ifeq ($(shell echo $$(($(INTVERSION) >= 90100))),1)
|
ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1)
|
||||||
REGRESS = init-extension
|
REGRESS = init-extension
|
||||||
else
|
else
|
||||||
REGRESS = init-legacy
|
REGRESS = init-legacy
|
||||||
@ -29,8 +29,8 @@ endif
|
|||||||
|
|
||||||
REGRESS += repack tablespace
|
REGRESS += repack tablespace
|
||||||
|
|
||||||
# This test depends on collate, not supported before 9.0
|
# This test depends on collate, not supported before 9.1
|
||||||
ifeq ($(shell echo $$(($(INTVERSION) >= 90000))),1)
|
ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1)
|
||||||
REGRESS += issue3
|
REGRESS += issue3
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
PG_CONFIG ?= pg_config
|
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}')
|
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
|
EXTENSION = pg_repack
|
||||||
MODULE_big = $(EXTENSION)
|
MODULE_big = $(EXTENSION)
|
||||||
@ -24,7 +24,7 @@ REPACK_VERSION = $(shell grep '"version":' ../META.json | head -1 \
|
|||||||
PG_CPPFLAGS = -DREPACK_VERSION=$(REPACK_VERSION)
|
PG_CPPFLAGS = -DREPACK_VERSION=$(REPACK_VERSION)
|
||||||
|
|
||||||
# Support CREATE EXTENSION for PG >= 9.1 and a simple sql script for PG < 9.1
|
# 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
|
DATA_built = pg_repack--$(REPACK_VERSION).sql pg_repack.control
|
||||||
else
|
else
|
||||||
DATA_built = pg_repack.sql
|
DATA_built = pg_repack.sql
|
||||||
|
Loading…
x
Reference in New Issue
Block a user