Replace use of 'sed' with 'perl -pe' to avoid sed incompatibilities on BSD-flavoured OS's like OSX and Solaris

git-svn-id: http://svn.osgeo.org/postgis/trunk@14743 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Paul Ramsey 2016-03-03 21:17:13 +00:00
parent 724fd69136
commit a37e4f75d9
2 changed files with 17 additions and 17 deletions

View file

@ -4,20 +4,23 @@ EXTENSION = postgis
EXTVERSION = @POSTGIS_LIB_VERSION@
MINORVERSION = @POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
GREP = @GREP@
PERL=@PERL@
PERL = @PERL@
MICRO_NUMBER = $(shell echo $(EXTVERSION) | \
$(PERL) -pe 's/\d.\d.(\d+)[a-zA-Z]*\d*/$1/'
MICRO_NUMBER = $(shell echo $(EXTVERSION) | sed "s/[0-9]\.[0-9]\.\([0-9]*\)[a-zA-Z]*[0-9]*/\1/")
PREREL_NUMBER = $(shell echo $(EXTVERSION) | \
sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
$(PERL) -pe 's/\d\.\d\.(.*)/\1/' | \
$(GREP) "[a-zA-Z]" | \
sed "s/[0-9][a-zA-Z]\([0-9]*\)[a-zA-Z]*/\1/")
$(PERL) -pe 's/\d+[a-zA-Z]+(\d+)/\1/'
MICRO_PREV = $(shell if test "$(MICRO_NUMBER)x" != "x"; then expr $(MICRO_NUMBER) - 1; fi)
PREREL_PREV = $(shell if test "$(PREREL_NUMBER)x" != "x"; then expr $(PREREL_NUMBER) - 1; fi)
PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
$(PERL) -pe 's/\d\.\d\.(.*)/\1/' | \
$(GREP) "[a-zA-Z]" | \
sed "s/\([0-9][a-zA-Z]*\)[0-9]*/\1/")
$(PERL) -pe 's/(\d+[a-zA-Z]+)\d*/\1/'
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
@ -55,12 +58,12 @@ sql/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql: sql_bits/postgis_extensi
#strip BEGIN/COMMIT since these are not allowed in extensions
sql_bits/spatial_ref_sys.sql: ../../spatial_ref_sys.sql
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' $< > $@
$(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
#strip BEGIN/COMMIT since these are not allowed in extensions
sql_bits/postgis.sql: ../../postgis/postgis.sql
mkdir -p sql_bits/
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' $< > $@
$(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
../../doc/postgis_comments.sql:
$(MAKE) -C ../../doc comments
@ -70,20 +73,16 @@ sql_bits/postgis_comments.sql: ../../doc/postgis_comments.sql
#strip BEGIN/COMMIT since these are not allowed in extensions
sql_bits/rtpostgis.sql: ../../raster/rt_pg/rtpostgis.sql
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' $< > $@
$(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
sql_bits/spatial_ref_sys_config_dump.sql: ../../spatial_ref_sys.sql ../../utils/create_spatial_ref_sys_config_dump.pl
../../utils/create_spatial_ref_sys_config_dump.pl $< > $@
sql_bits/rtpostgis_upgrade.sql: ../../raster/rt_pg/rtpostgis_upgrade.sql
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' \
-e "s/^\(DROP .*\);/SELECT postgis_extension_drop_if_exists('${EXTENSION}', '\1');\n\1;/" \
$< > $@
$(PERL) -pe "s/BEGIN\;//g ; s/COMMIT\;//g; s/^(DROP .*)\;/SELECT postgis_extension_drop_if_exists('$(EXTENSION)', '\1');\n\1\;/" $< > $@
sql_bits/postgis_upgrade.sql: ../../postgis/postgis_upgrade.sql
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' \
-e "s/^\(DROP .*\);/SELECT postgis_extension_drop_if_exists('${EXTENSION}', '\1');\n\1;/" \
$< > $@
$(PERL) -pe "s/BEGIN\;//g ; s/COMMIT\;//g; s/^(DROP .*)\;/SELECT postgis_extension_drop_if_exists('$(EXTENSION)', '\1');\n\1\;/" $< > $@
../../doc/raster_comments.sql:
@ -111,4 +110,4 @@ distclean: clean
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
PERL=@PERL@
PERL = @PERL@

View file

@ -18,7 +18,8 @@ UPGRADEABLE_VERSIONS = \
2.1.8 \
2.1.9 \
2.2.0 \
2.2.1
2.2.1 \
2.2.2
# This is to avoid forcing "check-installed-upgrades" as a default
# rule, see https://trac.osgeo.org/postgis/ticket/3420