diff --git a/.gitignore b/.gitignore index d71adf6..24e6c22 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ Makefile */*/Makefile pgsql/pointcloud.control pgsql/pointcloud--* +pgsql_postgis/pointcloud_postgis.control +pgsql_postgis/pointcloud_postgis--* diff --git a/pgsql_postgis/Makefile b/pgsql_postgis/Makefile index 8f17bf9..605262b 100644 --- a/pgsql_postgis/Makefile +++ b/pgsql_postgis/Makefile @@ -4,8 +4,12 @@ include ../config.mk #MODULE_big = pointcloud_postgis #OBJS = +SED = sed EXTENSION = pointcloud_postgis -DATA = $(EXTENSION)--1.0.sql +EXTVERSION=$(shell cat ../Version.config) +DATA_built = \ + $(EXTENSION).control \ + $(EXTENSION)--$(EXTVERSION).sql #REGRESS = pointcloud @@ -15,3 +19,9 @@ DATA = $(EXTENSION)--1.0.sql # We are going to use PGXS for sure include $(PGXS) + +$(EXTENSION).control: $(EXTENSION).control.in Makefile + $(SED) -e 's/@POINTCLOUD_VERSION@/$(EXTVERSION)/' $< > $@ + +$(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql.in Makefile + $(SED) -e 's/@POINTCLOUD_VERSION@/$(EXTVERSION)/' $< > $@ diff --git a/pgsql_postgis/pointcloud_postgis.control b/pgsql_postgis/pointcloud_postgis.control.in similarity index 82% rename from pgsql_postgis/pointcloud_postgis.control rename to pgsql_postgis/pointcloud_postgis.control.in index 01431da..25771d0 100644 --- a/pgsql_postgis/pointcloud_postgis.control +++ b/pgsql_postgis/pointcloud_postgis.control.in @@ -1,6 +1,6 @@ # pointcloud postgis integration extension comment = 'integration for pointcloud LIDAR data and PostGIS geometry data' -default_version = '1.0' +default_version = '@POINTCLOUD_VERSION@' relocatable = true superuser = false requires = 'postgis, pointcloud' diff --git a/pgsql_postgis/pointcloud_postgis--1.0.sql b/pgsql_postgis/pointcloud_postgis.sql.in similarity index 88% rename from pgsql_postgis/pointcloud_postgis--1.0.sql rename to pgsql_postgis/pointcloud_postgis.sql.in index 27b1ecd..408c45b 100644 --- a/pgsql_postgis/pointcloud_postgis--1.0.sql +++ b/pgsql_postgis/pointcloud_postgis.sql.in @@ -72,3 +72,10 @@ CREATE OR REPLACE FUNCTION PC_BoundingDiagonalGeometry(pcpatch) SELECT ST_GeomFromEWKB(PC_BoundingDiagonalAsBinary($1)) $$ LANGUAGE 'sql'; + +----------------------------------------------------------------------------- +-- Function returning the version number +-- +CREATE OR REPLACE FUNCTION PC_PostGIS_Version() + RETURNS text AS $$ SELECT '@POINTCLOUD_VERSION@'::text $$ + LANGUAGE 'sql' IMMUTABLE STRICT;