cartodb-postgresql/Makefile

229 lines
5.0 KiB
Makefile
Raw Normal View History

2013-12-02 23:29:02 +08:00
# cartodb/Makefile
EXTENSION = cartodb
2020-12-03 17:51:34 +08:00
EXTVERSION = 0.37.1
2013-12-02 23:29:02 +08:00
2014-06-04 18:58:19 +08:00
SED = sed
AWK = awk
2013-12-02 23:29:02 +08:00
CDBSCRIPTS = \
scripts-enabled/*.sql \
scripts-available/CDB_SearchPath.sql \
scripts-available/CDB_ExtensionPost.sql \
scripts-available/CDB_ExtensionUtils.sql \
scripts-available/CDB_Helper.sql \
$(END)
UPGRADABLE = \
unpackaged \
0.1.0 \
0.1.1 \
2014-06-09 19:04:42 +08:00
0.2.0 \
0.2.1 \
2014-07-16 18:30:19 +08:00
0.3.0 \
2014-07-28 21:16:19 +08:00
0.3.0dev \
2014-07-28 23:53:19 +08:00
0.3.1 \
0.3.2 \
2014-08-02 00:21:48 +08:00
0.3.3 \
0.3.4 \
2014-08-11 22:18:02 +08:00
0.3.5 \
0.3.6 \
2014-10-21 22:19:44 +08:00
0.4.0 \
0.4.1 \
2014-12-06 00:30:47 +08:00
0.5.0 \
2015-01-30 00:37:59 +08:00
0.5.1 \
2015-02-17 22:47:18 +08:00
0.5.2 \
2015-02-19 00:31:04 +08:00
0.5.3 \
2015-02-19 21:11:54 +08:00
0.6.0 \
2015-02-19 21:34:32 +08:00
0.7.0 \
0.7.1 \
2015-03-04 00:10:56 +08:00
0.7.2 \
0.7.3 \
0.7.4 \
2015-07-07 21:07:41 +08:00
0.8.0 \
2015-07-27 22:12:42 +08:00
0.8.1 \
0.8.2 \
0.9.0 \
2015-08-20 01:42:29 +08:00
0.9.1 \
2015-08-24 21:20:50 +08:00
0.9.2 \
0.9.3 \
0.9.4 \
2015-09-07 19:02:05 +08:00
0.10.0 \
2015-09-16 18:40:14 +08:00
0.10.1 \
0.10.2 \
2015-09-21 18:54:14 +08:00
0.11.0 \
0.11.1 \
2015-10-19 20:35:10 +08:00
0.11.2 \
0.11.3 \
2015-11-25 00:00:45 +08:00
0.11.4 \
0.11.5 \
0.12.0 \
0.13.0 \
0.13.1 \
0.14.0 \
2016-03-07 19:05:14 +08:00
0.14.1 \
2016-03-15 17:52:52 +08:00
0.14.2 \
2016-03-17 17:45:54 +08:00
0.14.3 \
0.14.4 \
0.15.0 \
0.15.1 \
2016-04-19 21:44:37 +08:00
0.16.0 \
2016-04-26 00:47:42 +08:00
0.16.1 \
2016-04-28 00:30:26 +08:00
0.16.2 \
0.16.3 \
2016-05-30 16:45:12 +08:00
0.16.4 \
2016-07-04 19:25:09 +08:00
0.17.0 \
2016-08-16 17:30:06 +08:00
0.17.1 \
2016-10-18 00:03:00 +08:00
0.18.0 \
2016-10-19 19:00:56 +08:00
0.18.1 \
0.18.2 \
0.18.3 \
0.18.4 \
2016-12-01 00:17:45 +08:00
0.18.5 \
2017-04-11 17:22:20 +08:00
0.19.0 \
2017-06-02 19:16:27 +08:00
0.19.1 \
2017-06-30 21:04:35 +08:00
0.19.2 \
2017-11-08 19:50:03 +08:00
0.20.0 \
2018-02-16 00:22:42 +08:00
0.21.0 \
2018-03-14 19:14:50 +08:00
0.22.0 \
2018-05-29 23:10:37 +08:00
0.22.1 \
2018-05-31 23:06:47 +08:00
0.22.2 \
0.23.0 \
2018-07-19 23:11:56 +08:00
0.23.1 \
2018-07-20 20:15:05 +08:00
0.23.2 \
2018-09-13 16:29:24 +08:00
0.24.0 \
2019-01-03 21:46:11 +08:00
0.24.1 \
2019-02-21 22:20:24 +08:00
0.25.0 \
2019-03-11 19:24:14 +08:00
0.26.0 \
2019-03-20 00:43:36 +08:00
0.26.1 \
2019-06-03 18:51:25 +08:00
0.27.0 \
2019-06-03 23:57:42 +08:00
0.27.1 \
2019-06-21 15:19:04 +08:00
0.27.2 \
2019-07-01 16:56:06 +08:00
0.28.0 \
2019-07-12 14:38:21 +08:00
0.28.1 \
2019-07-03 22:48:30 +08:00
0.29.0 \
2019-07-17 15:58:21 +08:00
0.30.0 \
2019-10-08 18:47:32 +08:00
0.31.0 \
2019-11-08 20:09:45 +08:00
0.32.0 \
2019-12-20 19:42:09 +08:00
0.33.0 \
2019-12-24 03:34:11 +08:00
0.34.0 \
2019-12-30 22:37:16 +08:00
0.35.0 \
2020-02-12 22:44:12 +08:00
0.36.0 \
2020-12-03 17:51:34 +08:00
0.37.0 \
$(EXTVERSION)dev \
$(EXTVERSION)next \
$(END)
UPGRADES = \
$(shell echo $(UPGRADABLE) | \
2014-06-04 18:58:19 +08:00
$(SED) 's/^/$(EXTENSION)--/' | \
$(SED) 's/$$/--$(EXTVERSION).sql/' | \
$(SED) 's/ /--$(EXTVERSION).sql $(EXTENSION)--/g')
DATA_built = \
$(EXTENSION)--$(EXTVERSION).sql \
$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql \
$(UPGRADES) \
$(EXTENSION).control
EXTRA_CLEAN = cartodb_version.sql
DOCS = README.md
REGRESS_OLD = $(wildcard test/*.sql)
REGRESS_LEGACY = $(REGRESS_OLD:.sql=)
REGRESS = test/test_setup $(REGRESS_LEGACY)
2013-12-02 23:29:02 +08:00
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
PG_VERSION := $(shell $(PG_CONFIG) --version | $(AWK) '{split($$2,a,"."); print a[1]}')
2019-10-22 21:29:45 +08:00
PG_12_GE := $(shell [ $(PG_VERSION) -ge 12 ] && echo true)
2019-10-22 21:49:31 +08:00
PLPYTHONU := plpythonu
2019-10-22 21:29:45 +08:00
ifeq ($(PG_12_GE), true)
PLPYTHONU := plpython3u
2019-10-22 21:29:45 +08:00
endif
2019-10-29 00:09:51 +08:00
PGPORT ?= '5432'
PGUSER ?= 'postgres'
2017-06-02 19:16:27 +08:00
$(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_version.sql Makefile
echo '\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \quit' > $@
cat $(CDBSCRIPTS) | \
2019-05-31 21:29:28 +08:00
$(SED) -e 's/@extschema@/cartodb/g' \
2019-10-22 21:29:45 +08:00
-e 's/@postgisschema@/public/g' \
2019-12-27 00:48:12 +08:00
-e 's/@@plpythonu@@/$(PLPYTHONU)/g' >> $@
2014-05-05 18:20:38 +08:00
echo "GRANT USAGE ON SCHEMA cartodb TO public;" >> $@
2014-05-08 16:07:47 +08:00
cat cartodb_version.sql >> $@
$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION)--$(EXTVERSION).sql util/create_from_unpackaged.sh Makefile
./util/create_from_unpackaged.sh $(EXTVERSION)
$(EXTENSION)--%--$(EXTVERSION).sql: $(EXTENSION)--$(EXTVERSION).sql
cp $< $@
$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql: $(EXTENSION)--$(EXTVERSION).sql
cp $< $@
$(EXTENSION).control: $(EXTENSION).control.in Makefile
2019-12-27 00:48:12 +08:00
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/g' -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $< > $@
2020-11-24 21:27:13 +08:00
cartodb_version.sql: cartodb_version.sql.in Makefile
2019-12-27 00:48:12 +08:00
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' -e 's/@extschema@/cartodb/g' -e "s/@postgisschema@/public/g" -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $< > $@
2014-05-08 16:07:47 +08:00
# Needed for consistent `echo` results with backslashes
SHELL = bash
legacy_regress: $(REGRESS_OLD) Makefile
mkdir -p sql/test/
mkdir -p expected/test/
mkdir -p results/test/
cat sql/test_setup.sql | \
2019-10-29 00:09:51 +08:00
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' -e 's/@extschema@/cartodb/g' -e "s/@postgisschema@/public/g" -e 's/@@plpythonu@@/$(PLPYTHONU)/g' \
> sql/test/test_setup.sql
cp sql/test_setup_expect expected/test/test_setup.out
for f in $(REGRESS_OLD); do \
tn=`basename $${f} .sql`; \
of=sql/test/$${tn}.sql; \
echo '\set ECHO none' > $${of}; \
echo '\a' >> $${of}; \
echo '\t' >> $${of}; \
echo '\set QUIET off' >> $${of}; \
cat $${f} | \
2019-10-29 00:09:51 +08:00
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' \
-e 's/@extschema@/cartodb/g' \
-e "s/@postgisschema@/public/g" \
-e 's/@@plpythonu@@/$(PLPYTHONU)/g' \
-e 's/@@PGPORT@@/$(PGPORT)/g' \
-e 's/@@PGUSER@@/$(PGUSER)/g' \
>> $${of}; \
exp=expected/test/$${tn}.out; \
echo '\set ECHO none' > $${exp}; \
2019-10-29 00:09:51 +08:00
cat test/$${tn}_expect | \
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' \
-e 's/@extschema@/cartodb/g' \
-e "s/@postgisschema@/public/g" \
-e 's/@@plpythonu@@/$(PLPYTHONU)/g' \
-e 's/@@PGPORT@@/$(PGPORT)/g' \
-e 's/@@PGUSER@@/$(PGUSER)/g' \
>> $${exp}; \
done
test_organization:
bash test/organization/test.sh
test_extension_new:
bash test/extension/test.sh
legacy_tests: legacy_regress $(EXTENSION)--unpackaged--$(EXTVERSION).sql
PGREGRESS := $(shell dirname `$(PG_CONFIG) --pgxs`)/../../src/test/regress/pg_regress
2019-10-29 00:09:51 +08:00
PGBINDIR := $(shell $(PG_CONFIG) --bindir)
2019-10-29 19:34:29 +08:00
PGREGRESSDATABASE = 'contrib_regression'
regress: legacy_tests
2019-10-29 00:09:51 +08:00
PGUSER=$(PGUSER) \
PGPORT=$(PGPORT) \
2019-10-29 19:34:29 +08:00
$(PGREGRESS) --inputdir=./ --bindir='$(PGBINDIR)' --dbname=$(PGREGRESSDATABASE) $(REGRESS)
2019-10-30 01:39:23 +08:00
installcheck: test_extension_new test_organization
$(MAKE) -C . regress