Skip to content
Browse files

Parse the version number from the META file

pgmp.control is generated at build time (it is included in the PGXS 'all'
target).
  • Loading branch information...
1 parent 08863e4 commit 48a78e5d333cb9d17d1bdfea6dfe62a2eecfc589 @dvarrazzo committed Apr 22, 2011
Showing with 8 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +6 −3 Makefile
  3. +1 −1 pgmp.control → pgmp.control.in
View
1 .gitignore
@@ -2,6 +2,7 @@ data
tags
pgmp.so
pgmp.sql
+pgmp.control
pgmp--*.sql
results/*.out
regression.diffs
View
9 Makefile
@@ -27,7 +27,7 @@ PG_CONFIG=pg_config
SHLIB_LINK=-lgmp -lm
-PGMP_VERSION=$(shell grep default_version pgmp.control | sed -e "s/default_version = '\(.*\)'/\1/")
+PGMP_VERSION = $(shell grep '"version":' META.json | head -1 | sed -e 's/\s*"version":\s*"\(.*\)",/\1/')
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo pre91 || echo 91)
EXTENSION=pgmp
@@ -42,7 +42,7 @@ TESTFILES = $(wildcard test/sql/*.sql) $(wildcard test/expected/*.out)
DOCS = $(wildcard docs/*.rst) docs/conf.py docs/Makefile docs/_static/pgmp.css
PKGFILES = AUTHORS COPYING README.rst Makefile \
- pgmp.control META.json \
+ META.json pgmp.control.in \
sql/pgmp.pysql sql/uninstall_pgmp.sql \
$(SRCFILES) $(DOCS) $(TESTFILES) \
$(wildcard tools/*.py)
@@ -58,7 +58,7 @@ endif
# the += doesn't work if the user specified his own REGRESS_OPTS
REGRESS = --inputdir=test setup-$(PG91) mpz mpq
-EXTRA_CLEAN = $(INSTALLSCRIPT) $(UPGRADESCRIPT)
+EXTRA_CLEAN = $(INSTALLSCRIPT) $(UPGRADESCRIPT) pgmp.control
PKGNAME = pgmp-$(PGMP_VERSION)
SRCPKG = dist/$(PKGNAME).tar.gz
@@ -70,6 +70,9 @@ include $(PGXS)
# added to the targets defined in pgxs
all: $(INSTALLSCRIPT) $(UPGRADESCRIPT)
+pgmp.control: pgmp.control.in META.json
+ sed 's/VERSION/$(PGMP_VERSION)/g' < $< > $@
+
$(INSTALLSCRIPT): sql/pgmp.pysql
tools/unmix.py < $< > $@
View
2 pgmp.control → pgmp.control.in
@@ -18,7 +18,7 @@
# along with the PostgreSQL GMP Module. If not, see
# http://www.gnu.org/licenses/.
-default_version = '1.0b2'
+default_version = 'VERSION'
comment = 'Multiple Precision Arithmetic extension'
directory = 'pgmp'
relocatable = true

0 comments on commit 48a78e5

Please sign in to comment.
Something went wrong with that request. Please try again.