@@ -8,23 +8,44 @@ MODULE_big = pg_sphere
88OBJS = sscan.o sparse.o sbuffer.o vector3d.o point.o \
99 euler.o circle.o line.o ellipse.o polygon.o \
1010 path.o box.o output.o gq_cache.o gist.o key.o \
11- gnomo.o
11+ gnomo.o healpix.o moc.o process_moc.o
1212
1313EXTENSION = pg_sphere
14- DATA_built = pg_sphere--1.0.sql
14+ RELEASE_SQL = $(EXTENSION ) --1.1.5beta4gavo.sql
15+ DATA_built = $(RELEASE_SQL ) \
16+ pg_sphere--unpackaged--1.1.5beta0gavo.sql \
17+ pg_sphere--1.0--1.0_gavo.sql \
18+ pg_sphere--1.0_gavo--1.1.5beta0gavo.sql \
19+ pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql \
20+ pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.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
1832
19- EXTRA_CLEAN = pg_sphere--1.0.sql $(PGS_SQL )
33+ SHLIB_LINK += -lchealpix
34+ # no support for CXXFLAGS in PGXS
35+ CXXFLAGS = -Wall -Wpointer-arith -Wendif-labels \
36+ -Wmissing-format-attribute -Wformat-security -g -O0 -fpic
2037
21- CRUSH_TESTS = init_extended circle_extended
38+ EXTRA_CLEAN = $(PGS_SQL ) pg_sphere.test.sql
39+
40+ CRUSH_TESTS = init_extended circle_extended
2241
2342# order of sql files is important
24- PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
43+ PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
2544 pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \
2645 pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql \
27- pgs_gist.sql gnomo.sql \
46+ pgs_gist.sql gnomo.sql pgs_gist_pointkey.sql \
47+ healpix.sql pgs_gist_spoint3.sql pgs_moc_type.sql pgs_moc_compat.sql
48+ PGS_SQL_9_5 = pgs_9.5.sql # experimental for spoint3
2849
2950ifdef USE_PGXS
3051 ifndef PG_CONFIG
@@ -40,11 +61,122 @@ else
4061 include $(top_srcdir ) /contrib/contrib-global.mk
4162endif
4263
64+ # link a second time as PGXS does not allow to change the linker
65+ PGS_LINKER = g++ $(CXXFLAGS ) $(filter-out $(CC ) $(CFLAGS ) , $(LINK.shared ) )
66+ pgs_link : $(shlib ) $(OBJS ) | $(SHLIB_PREREQS )
67+ $(PGS_LINKER ) -o $(shlib ) $(OBJS ) $(LDFLAGS ) $(LDFLAGS_SL ) $(SHLIB_LINK )
68+
69+ # experimental for spoint3
70+ pg_version := $(word 2,$(shell $(PG_CONFIG ) --version) )
71+ pg_version_9_5_plus = $(if $(filter-out 9.1% 9.2% 9.3% 9.4% ,$(pg_version ) ) ,y,n)
72+ #
73+
74+ # # the use of spoint 3 is too experimental and preliminary:
75+ # ifeq ($(pg_version_9_5_plus),y)
76+ # REGRESS += $(REGRESS_9_5)
77+ # TESTS += $(REGRESS_9_5)
78+ # PGS_SQL += $(PGS_SQL_9_5)
79+ # endif
80+
4381crushtest : REGRESS += $(CRUSH_TESTS )
4482crushtest : installcheck
4583
46- pg_sphere--1.0.sql : $(addsuffix .in, $(PGS_SQL ) )
47- cat $^ > $@
84+
85+ ifeq ($(pg_version_9_5_plus ) ,y)
86+ PGS_TMP_DIR = --temp-instance=tmp_check
87+ else
88+ PGS_TMP_DIR = --temp-install=tmp_check --top-builddir=test_top_build_dir
89+ endif
90+
91+ test : pg_sphere.test.sql sql/init_test.sql
92+ $(pg_regress_installcheck ) $(PGS_TMP_DIR ) $(REGRESS_OPTS ) $(TESTS )
93+
94+ pg_sphere.test.sql : $(RELEASE_SQL ) $(shlib )
95+ tail -n+3 $< | sed ' s,MODULE_PATHNAME,$(realpath $(shlib)),g' > $@
96+
97+
98+ $(RELEASE_SQL ) : $(addsuffix .in, $(RELEASE_SQL ) $(PGS_SQL ) ) pgs_link
99+ cat $(filter-out pgs_link, $^ ) > $@
100+
101+ # for "create extension from unpacked*":
102+
103+ UPGRADE_UNP_COMMON = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
104+ pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \
105+ pgs_box.sql pgs_contains_ops_compat.sql pgs_gist.sql \
106+ pgs_gist_contains_ops.sql contains-ops-fixes-1.sql
107+
108+ AUGMENT_UNP_COMMON = upgrade_scripts/pgs_pre111.sql pgs_contains_ops.sql \
109+ gnomo.sql
110+ # for vanilla 1.1.1 users
111+ AUGMENT_UNP_111 = $(AUGMENT_UNP_COMMON ) pgs_gist_pointkey.sql
112+
113+ # for 1.1.2+ users: 'from unpacked_1.1.2plus'
114+ AUGMENT_UNP_FOR_112plus = $(AUGMENT_UNP_COMMON )
115+ UPGRADE_UNP_FOR_112plus = pgs_gist_pointkey.sql pgs_gist_drop_spoint2.sql.in
116+
117+ # for "alter extension":
118+
119+ # TODO: add dynamic pl/pgsql to do perform an additional
120+ # "ALTER EXTENSION pg_sphere UPDATE TO '1.1.5_from_before_2016-02-07';"
121+ # if required.
122+ #
123+ # default 1.0 (after 2016-02-07) -> 1.1.5
124+ UPGRADE_1_0_PRE_xxxxxx = contains-ops-fixes-2.sql
125+ # '1.1.5_from_2015-08-31'
126+ AUGMENT_1_0_PRE_AAF2D5 = pgs_contains_ops.sql gnomo.sql
127+ UPGRADE_1_0_PRE_AAF2D5 = contains-ops-fixes-1.sql pgs_gist_drop_spoint2.sql.in \
128+ pgs_gist_contains_ops.sql
129+
130+ # vanilla 'create from unpackaged' must assume 1.1.1
131+ # ...
132+
133+ # create "create extension from unpacked*" files
134+
135+ # create "alter extension" files
136+
137+
138+ ifeq ($(pg_version_9_5_plus ) ,y)
139+ # 1.1.1.5 -> 1.1.5.1 for Postgres 9.5+ features
140+ else
141+ endif
142+
143+ # local stuff follows here, next will be "beta2"
144+
145+ AUGMENT_GAVO_111 = $(AUGMENT_UNP_111 ) healpix.sql # for vanilla 1.1.1 users
146+ UPGRADE_GAVO_111 = $(UPGRADE_UNP_COMMON )
147+
148+ # add new Healpix functions and experimental spoint3
149+ AUGMENT_FROM_GAVO = healpix.sql pgs_gist_spoint3.sql
150+
151+ AUGMENT_UNP_115B0G = $(AUGMENT_UNP_111 ) $(AUGMENT_FROM_GAVO )
152+ UPGRADE_UNP_115B0G = $(UPGRADE_UNP_COMMON )
153+
154+ AUGMENT_1_0_115B0G = $(AUGMENT_FROM_GAVO )
155+ UPGRADE_1_0_115B0G = contains-ops-fixes-2.sql pgs_gist_drop_spoint2.sql
156+
157+ # test installation 0
158+ pg_sphere--unpackaged--1.1.5beta0gavo.sql : $(addsuffix .in, \
159+ $(AUGMENT_GAVO_111 ) \
160+ $(addprefix upgrade_scripts/, $(UPGRADE_GAVO_111 ) ) )
161+ cat upgrade_scripts/$@ .in $^ > $@
162+
163+ # (The upgrade of test installation A has been completed.)
164+
165+ # test installation B (generic)
166+ pg_sphere--1.0--1.0_gavo.sql : # dummy upgrade to allow for descriptive names
167+ cat upgrade_scripts/$@ .in > $@
168+ pg_sphere--1.0_gavo--1.1.5beta0gavo.sql : $(addsuffix .in, \
169+ $(AUGMENT_1_0_115B0G ) \
170+ $(addprefix upgrade_scripts/, $(UPGRADE_1_0_115B0G ) ) )
171+ cat upgrade_scripts/$@ .in $^ > $@
172+
173+ pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql : pgs_moc_type.sql.in
174+ cat upgrade_scripts/$@ .in $^ > $@
175+
176+ pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql : pgs_moc_compat.sql.in
177+ cat upgrade_scripts/$@ .in $^ > $@
178+
179+ # end of local stuff
48180
49181sscan.o : sparse.c
50182
0 commit comments