diff --git a/lib/.gitignore b/lib/.gitignore index 1c46949..7833838 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1,3 +1,4 @@ /.deps/ /pg_repack.sql /pg_repack--[0-9.]*.sql +/pg_repack.control diff --git a/lib/Makefile b/lib/Makefile index 135daff..045cc0a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -17,12 +17,6 @@ OBJS = repack.o pgut/pgut-be.o pgut/pgut-spi.o REPACK_VERSION = $(shell grep '"version":' ../META.json | head -1 \ | sed -e 's/\s*"version":\s*"\(.*\)",/\1/') -# The version of the extension, read from the .control file. -# Note that it doesn't need to be the same of the library version: it should -# be increased only when the sql changes. -EXTVER = $(shell grep -e '^default_version' $(EXTENSION).control \ - | sed -e "s/[^']*'\([^']*\)'.*/\1/") - PG_CPPFLAGS = -DREPACK_VERSION=$(REPACK_VERSION) # Support CREATE EXTENSION for PG >= 9.1 and a simple sql script for PG < 9.1 @@ -30,7 +24,7 @@ HAVE_EXTENSION = $(shell $(PG_CONFIG) --version \ | grep -qE " 8\.| 9\.0" && echo no || echo yes) ifeq ($(HAVE_EXTENSION),yes) -DATA_built = pg_repack--$(EXTVER).sql +DATA_built = pg_repack--$(REPACK_VERSION).sql pg_repack.control else DATA_built = pg_repack.sql DATA = uninstall_pg_repack.sql @@ -49,5 +43,8 @@ pg_repack.sql: pg_repack.sql.in sed 's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g' $< >> $@; \ echo "\nCOMMIT;" >> $@; -pg_repack--$(EXTVER).sql: pg_repack.sql.in +pg_repack--$(REPACK_VERSION).sql: pg_repack.sql.in cat $< > $@; + +pg_repack.control: pg_repack.control.in + sed 's,REPACK_VERSION,$(REPACK_VERSION),g' $< > $@ diff --git a/lib/pg_repack.control b/lib/pg_repack.control.in similarity index 81% rename from lib/pg_repack.control rename to lib/pg_repack.control.in index 3e932a2..8f9e90c 100644 --- a/lib/pg_repack.control +++ b/lib/pg_repack.control.in @@ -1,5 +1,5 @@ # pg_repack extension comment = 'Reorganize tables in PostgreSQL databases with minimal locks' -default_version = '1.2dev0' +default_version = 'REPACK_VERSION' module_pathname = '$libdir/pg_repack' relocatable = false