1-
2- PGSPHERE_VERSION = 1.1.5
1+ PGSPHERE_VERSION = 1.2.0
32
43# the base dir name may be changed depending on git clone command
54SRC_DIR = $(shell basename $(shell pwd) )
@@ -8,24 +7,48 @@ MODULE_big = pg_sphere
87OBJS = sscan.o sparse.o sbuffer.o vector3d.o point.o \
98 euler.o circle.o line.o ellipse.o polygon.o \
109 path.o box.o output.o gq_cache.o gist.o key.o \
11- gnomo.o
10+ gnomo.o healpix.o moc.o process_moc.o healpix_bare/healpix_bare.o
1211
1312EXTENSION = pg_sphere
14- DATA_built = pg_sphere--1.0.sql
13+ RELEASE_SQL = $(EXTENSION ) --$(PGSPHERE_VERSION ) .sql
14+ DATA_built = $(RELEASE_SQL ) \
15+ pg_sphere--unpackaged--1.1.5beta0gavo.sql \
16+ pg_sphere--1.0--1.0_gavo.sql \
17+ pg_sphere--1.0_gavo--1.1.5beta0gavo.sql \
18+ pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql \
19+ pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql \
20+ pg_sphere--1.1.5beta4gavo--1.2.0.sql
21+
1522DOCS = README.pg_sphere COPYRIGHT.pg_sphere
1623REGRESS = init tables points euler circle line ellipse poly path box index \
17- contains_ops contains_ops_compat bounding_box_gist gnomo
24+ contains_ops contains_ops_compat bounding_box_gist gnomo healpix \
25+ moc
26+
27+ REGRESS_9_5 = index_9.5 # experimental for spoint3
28+
29+ TESTS = init_test tables points euler circle line ellipse poly path box index \
30+ contains_ops contains_ops_compat bounding_box_gist gnomo healpix \
31+ moc
32+
33+ ifndef CXXFLAGS
34+ # no support for CXXFLAGS in PGXS before v11
35+ CXXFLAGS = -Wall -Wpointer-arith -Wendif-labels \
36+ -Wmissing-format-attribute -Wformat-security -g -O2 -fPIC
37+ endif
1838
19- EXTRA_CLEAN = pg_sphere--1.0.sql $(PGS_SQL )
39+ EXTRA_CLEAN = $(PGS_SQL ) pg_sphere.test.sql
2040
21- CRUSH_TESTS = init_extended circle_extended
41+ CRUSH_TESTS = init_extended circle_extended
2242
2343# order of sql files is important
24- PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
44+ PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
2545 pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \
2646 pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql \
2747 pgs_gist.sql gnomo.sql \
48+ healpix.sql pgs_gist_spoint3.sql pgs_moc_type.sql pgs_moc_compat.sql pgs_moc_ops.sql
49+ PGS_SQL_9_5 = pgs_9.5.sql # experimental for spoint3
2850
51+ USE_PGXS = 1
2952ifdef USE_PGXS
3053 ifndef PG_CONFIG
3154 PG_CONFIG := pg_config
@@ -40,11 +63,140 @@ else
4063 include $(top_srcdir ) /contrib/contrib-global.mk
4164endif
4265
66+ # compiler settings
67+ override CPPFLAGS += -I/usr/include/healpix_cxx
68+ SHLIB_LINK += -lhealpix_cxx
69+ LINK.shared = g++ -shared
70+
71+ # healpix_bare.c isn't ours so we refrain from fixing the warnings in there
72+ healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c
73+ $(COMPILE.c ) -Wno-declaration-after-statement -o $@ $^
74+
75+ # experimental for spoint3
76+ pg_version := $(word 2,$(shell $(PG_CONFIG ) --version) )
77+ pg_version_9_5_plus = $(if $(filter-out 9.1% 9.2% 9.3% 9.4% ,$(pg_version ) ) ,y,n)
78+ has_parallel = $(if $(filter-out 9.1% 9.2% 9.3% 9.4% 9.5% ,$(pg_version ) ) ,y,n)
79+ has_explain_summary = $(if $(filter-out 9.% ,$(pg_version ) ) ,y,n)
80+ #
81+
82+ # # the use of spoint 3 is too experimental and preliminary:
83+ # ifeq ($(pg_version_9_5_plus),y)
84+ # REGRESS += $(REGRESS_9_5)
85+ # TESTS += $(REGRESS_9_5)
86+ # PGS_SQL += $(PGS_SQL_9_5)
87+ # endif
88+
4389crushtest : REGRESS += $(CRUSH_TESTS )
4490crushtest : installcheck
4591
46- pg_sphere--1.0.sql : $(addsuffix .in, $(PGS_SQL ) )
92+ ifeq ($(has_explain_summary ) ,y)
93+ REGRESS += moc1 moc100
94+ endif
95+
96+ ifeq ($(pg_version_9_5_plus ) ,y)
97+ PGS_TMP_DIR = --temp-instance=tmp_check
98+ else
99+ PGS_TMP_DIR = --temp-install=tmp_check --top-builddir=test_top_build_dir
100+ endif
101+
102+ test : pg_sphere.test.sql sql/init_test.sql
103+ $(pg_regress_installcheck ) $(PGS_TMP_DIR ) $(REGRESS_OPTS ) $(TESTS )
104+
105+ pg_sphere.test.sql : $(RELEASE_SQL ) $(shlib )
106+ tail -n+3 $< | sed ' s,MODULE_PATHNAME,$(realpath $(shlib)),g' > $@
107+
108+
109+ $(RELEASE_SQL ) : $(addsuffix .in, $(RELEASE_SQL ) $(PGS_SQL ) )
110+ cat $^ > $@
111+ ifeq ($(has_parallel ) , n)
112+ sed -i -e '/PARALLEL/d' $@ # version $(pg_version) does not have support for PARALLEL
113+ endif
114+
115+ # for "create extension from unpacked*":
116+
117+ UPGRADE_UNP_COMMON = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
118+ pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \
119+ pgs_box.sql pgs_contains_ops_compat.sql pgs_gist.sql \
120+ pgs_gist_contains_ops.sql contains-ops-fixes-1.sql
121+
122+ AUGMENT_UNP_COMMON = upgrade_scripts/pgs_pre111.sql pgs_contains_ops.sql \
123+ gnomo.sql
124+ # for vanilla 1.1.1 users
125+ AUGMENT_UNP_111 = $(AUGMENT_UNP_COMMON ) pgs_gist_pointkey.sql
126+
127+ # for 1.1.2+ users: 'from unpacked_1.1.2plus'
128+ AUGMENT_UNP_FOR_112plus = $(AUGMENT_UNP_COMMON )
129+ UPGRADE_UNP_FOR_112plus = pgs_gist_pointkey.sql pgs_gist_drop_spoint2.sql.in
130+
131+ # for "alter extension":
132+
133+ # TODO: add dynamic pl/pgsql to do perform an additional
134+ # "ALTER EXTENSION pg_sphere UPDATE TO '1.1.5_from_before_2016-02-07';"
135+ # if required.
136+ #
137+ # default 1.0 (after 2016-02-07) -> 1.1.5
138+ UPGRADE_1_0_PRE_xxxxxx = contains-ops-fixes-2.sql
139+ # '1.1.5_from_2015-08-31'
140+ AUGMENT_1_0_PRE_AAF2D5 = pgs_contains_ops.sql gnomo.sql
141+ UPGRADE_1_0_PRE_AAF2D5 = contains-ops-fixes-1.sql pgs_gist_drop_spoint2.sql.in \
142+ pgs_gist_contains_ops.sql
143+
144+ # vanilla 'create from unpackaged' must assume 1.1.1
145+ # ...
146+
147+ # create "create extension from unpacked*" files
148+
149+ # create "alter extension" files
150+
151+
152+ ifeq ($(pg_version_9_5_plus ) ,y)
153+ # 1.1.1.5 -> 1.1.5.1 for Postgres 9.5+ features
154+ else
155+ endif
156+
157+ # local stuff follows here, next will be "beta2"
158+
159+ AUGMENT_GAVO_111 = $(AUGMENT_UNP_111 ) healpix.sql # for vanilla 1.1.1 users
160+ UPGRADE_GAVO_111 = $(UPGRADE_UNP_COMMON )
161+
162+ # add new Healpix functions and experimental spoint3
163+ AUGMENT_FROM_GAVO = healpix.sql pgs_gist_spoint3.sql
164+
165+ AUGMENT_UNP_115B0G = $(AUGMENT_UNP_111 ) $(AUGMENT_FROM_GAVO )
166+ UPGRADE_UNP_115B0G = $(UPGRADE_UNP_COMMON )
167+
168+ AUGMENT_1_0_115B0G = $(AUGMENT_FROM_GAVO )
169+ UPGRADE_1_0_115B0G = contains-ops-fixes-2.sql pgs_gist_drop_spoint2.sql
170+
171+ # test installation 0
172+ pg_sphere--unpackaged--1.1.5beta0gavo.sql : $(addsuffix .in, \
173+ $(AUGMENT_GAVO_111 ) \
174+ $(addprefix upgrade_scripts/, $(UPGRADE_GAVO_111 ) ) )
175+ cat upgrade_scripts/$@ .in $^ > $@
176+
177+ # (The upgrade of test installation A has been completed.)
178+
179+ # test installation B (generic)
180+ pg_sphere--1.0--1.0_gavo.sql : # dummy upgrade to allow for descriptive names
181+ cat upgrade_scripts/$@ .in > $@
182+ pg_sphere--1.0_gavo--1.1.5beta0gavo.sql : $(addsuffix .in, \
183+ $(AUGMENT_1_0_115B0G ) \
184+ $(addprefix upgrade_scripts/, $(UPGRADE_1_0_115B0G ) ) )
185+ cat upgrade_scripts/$@ .in $^ > $@
186+
187+ pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql : pgs_moc_type.sql.in
188+ cat upgrade_scripts/$@ .in $^ > $@
189+
190+ pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql : pgs_moc_compat.sql.in
191+ cat upgrade_scripts/$@ .in $^ > $@
192+
193+ pg_sphere--1.1.5beta4gavo--1.2.0.sql : pgs_moc_ops.sql.in
47194 cat $^ > $@
195+ ifeq ($(has_parallel ) , n)
196+ sed -i -e '/PARALLEL/d' $@ # version $(pg_version) does not have support for PARALLEL
197+ endif
198+
199+ # end of local stuff
48200
49201sscan.o : sparse.c
50202
64216
65217dist : clean sparse.c sscan.c
66218 find . -name ' *~' -type f -exec rm {} \;
67- cd .. && tar --transform s/$(SRC_DIR ) /pgsphere-$(PGSPHERE_VERSION ) / --exclude CVS -czf pgsphere-$(PGSPHERE_VERSION ) .tar.gz $(SRC_DIR ) && cd -
219+ cd .. && tar --transform s/$(SRC_DIR ) /pgsphere-$(PGSPHERE_VERSION ) / --exclude CVS --exclude .git - czf pgsphere-$(PGSPHERE_VERSION ) .tar.gz $(SRC_DIR ) && cd -
0 commit comments