Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2c4cd20

Browse files
authored
Merge pull request#26 from esabol/issue-19-make-healpix-moc-optional
[ISSUE#19] Make HEALPix/MOC support optional
2 parentse679906 +8465435 commit2c4cd20

9 files changed

+190
-86
lines changed

‎.travis.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ script:
2424
-make PROFILE="-Werror"
2525
-sudo make install
2626
-pg_virtualenv make installcheck
27-
-if test -s regression.diffs; then cat regression.diffs; fi
27+
-if test -s regression.diffs; then cat regression.diffs; exit 1; fi
28+
-pg_virtualenv make test
29+
-if test -s regression.diffs; then cat regression.diffs; exit 1; fi
30+
-pg_virtualenv make crushtest
31+
-if test -s regression.diffs; then cat regression.diffs; exit 1; fi
32+
-make clean
33+
-make PROFILE="-Werror" USE_HEALPIX=0
34+
-sudo make USE_HEALPIX=0 install
35+
-pg_virtualenv make USE_HEALPIX=0 installcheck
36+
-if test -s regression.diffs; then cat regression.diffs; exit 1; fi
37+
-pg_virtualenv make USE_HEALPIX=0 test
38+
-if test -s regression.diffs; then cat regression.diffs; exit 1; fi
39+
-pg_virtualenv make USE_HEALPIX=0 crushtest
40+
-if test -s regression.diffs; then cat regression.diffs; exit 1; fi
2841
-make -C doc
2942
-sudo make -C doc install

‎Makefile

Lines changed: 82 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
PGSPHERE_VERSION = 1.2.2
2+
EXTENSION = pg_sphere
3+
RELEASE_SQL =$(EXTENSION)--$(PGSPHERE_VERSION).sql
4+
USE_PGXS = 1
5+
USE_HEALPIX =? 1
26

37
# the base dir name may be changed depending on git clone command
48
SRC_DIR =$(shell basename$(shell pwd))
@@ -7,11 +11,13 @@ MODULE_big = pg_sphere
711
OBJS = src/sscan.o src/sparse.o src/sbuffer.o src/vector3d.o src/point.o\
812
src/euler.o src/circle.o src/line.o src/ellipse.o src/polygon.o\
913
src/path.o src/box.o src/output.o src/gq_cache.o src/gist.o\
10-
src/key.o src/gnomo.o src/healpix.o src/moc.o src/process_moc.o\
11-
healpix_bare/healpix_bare.o src/epochprop.o
14+
src/key.o src/gnomo.o src/epochprop.o
15+
16+
ifneq ($(USE_HEALPIX),0)
17+
OBJS += src/healpix.o src/moc.o src/process_moc.o\
18+
healpix_bare/healpix_bare.o
19+
endif
1220

13-
EXTENSION = pg_sphere
14-
RELEASE_SQL =$(EXTENSION)--$(PGSPHERE_VERSION).sql
1521
DATA_built =$(RELEASE_SQL)\
1622
pg_sphere--unpackaged--1.1.5beta0gavo.sql\
1723
pg_sphere--1.0--1.0_gavo.sql\
@@ -24,14 +30,21 @@ DATA_built = $(RELEASE_SQL) \
2430

2531
DOCS = README.pg_sphere COPYRIGHT.pg_sphere
2632
REGRESS = init tables points euler circle line ellipse poly path box index\
27-
contains_ops contains_ops_compat bounding_box_gist gnomo healpix\
28-
moc mocautocast epochprop
33+
contains_ops contains_ops_compat bounding_box_gist gnomo epochprop
34+
35+
ifneq ($(USE_HEALPIX),0)
36+
REGRESS += healpix moc mocautocast
37+
endif
2938

3039
REGRESS_9_5 = index_9.5# experimental for spoint3
3140

32-
TESTS = init_test tables points euler circle line ellipse poly path box index\
33-
contains_ops contains_ops_compat bounding_box_gist gnomo healpix\
34-
moc mocautocast epochprop
41+
TESTS = init_test tables points euler circle line ellipse poly path box\
42+
index contains_ops contains_ops_compat bounding_box_gist gnomo\
43+
epochprop
44+
45+
ifneq ($(USE_HEALPIX),0)
46+
TESTS += healpix moc mocautocast
47+
endif
3548

3649
PG_CFLAGS+= -DPGSPHERE_VERSION=$(PGSPHERE_VERSION)
3750
PG_CPPFLAGS+= -DPGSPHERE_VERSION=$(PGSPHERE_VERSION)
@@ -48,17 +61,28 @@ CRUSH_TESTS = init_extended circle_extended
4861

4962
# order of sql files is important
5063
PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql\
51-
pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql\
52-
pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql\
53-
pgs_gist.sql gnomo.sql\
54-
healpix.sql pgs_gist_spoint3.sql pgs_moc_type.sql pgs_moc_compat.sql pgs_moc_ops.sql\
55-
pgs_moc_geo_casts.sql pgs_epochprop.sql
64+
pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql\
65+
pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql\
66+
pgs_gist.sql gnomo.sql
67+
68+
ifneq ($(USE_HEALPIX),0)
69+
PGS_SQL += healpix.sql
70+
endif
71+
72+
PGS_SQL += pgs_gist_spoint3.sql
73+
74+
ifneq ($(USE_HEALPIX),0)
75+
PGS_SQL += pgs_moc_type.sql pgs_moc_compat.sql pgs_moc_ops.sql\
76+
pgs_moc_geo_casts.sql
77+
endif
78+
79+
PGS_SQL += pgs_epochprop.sql
80+
5681
PGS_SQL_9_5 = pgs_9.5.sql# experimental for spoint3
5782

58-
USE_PGXS = 1
5983
ifdefUSE_PGXS
6084
ifndef PG_CONFIG
61-
PG_CONFIG:= pg_config
85+
PG_CONFIG = pg_config
6286
endif
6387
PGXS :=$(shell$(PG_CONFIG) --pgxs)
6488
include$(PGXS)
@@ -70,11 +94,13 @@ else
7094
include$(top_srcdir)/contrib/contrib-global.mk
7195
endif
7296

73-
# compiler settings
74-
PKG_CONFIG = pkg-config
97+
ifneq ($(USE_HEALPIX),0)
98+
# compiler settings for linking with libhealpix_cxx
99+
PKG_CONFIG ?= pkg-config
75100
overrideCPPFLAGS +=$(shell$(PKG_CONFIG) --cflags healpix_cxx)
76101
SHLIB_LINK +=$(shell$(PKG_CONFIG) --libs healpix_cxx)
77102
LINK.shared = g++ -shared
103+
endif
78104

79105
# healpix_bare.c isn't ours so we refrain from fixing the warnings in there
80106
healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c
@@ -84,7 +110,6 @@ healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c
84110
pg_version :=$(word 2,$(shell$(PG_CONFIG) --version))
85111
pg_version_9_5_plus =$(if$(filter-out 9.1% 9.2% 9.3% 9.4%,$(pg_version)),y,n)
86112
has_explain_summary =$(if$(filter-out 9.%,$(pg_version)),y,n)
87-
#
88113

89114
## the use of spoint 3 is too experimental and preliminary:
90115
#ifeq ($(pg_version_9_5_plus),y)
@@ -96,9 +121,11 @@ has_explain_summary = $(if $(filter-out 9.%,$(pg_version)),y,n)
96121
crushtest: REGRESS +=$(CRUSH_TESTS)
97122
crushtest: installcheck
98123

124+
ifneq ($(USE_HEALPIX),0)
99125
ifeq ($(has_explain_summary),y)
100126
REGRESS += moc1 moc100
101127
endif
128+
endif
102129

103130
ifeq ($(pg_version_9_5_plus),y)
104131
PGS_TMP_DIR = --temp-instance=tmp_check
@@ -107,6 +134,10 @@ else
107134
endif
108135

109136
test: pg_sphere.test.sql sql/init_test.sql
137+
cp expected/init_test.out.in expected/init_test.out
138+
ifneq ($(USE_HEALPIX),0)
139+
cat expected/init_test_healpix.out.in >> expected/init_test.out
140+
endif
110141
$(pg_regress_installcheck) $(PGS_TMP_DIR) $(REGRESS_OPTS) $(TESTS)
111142

112143
pg_sphere.test.sql:$(RELEASE_SQL)$(shlib)
@@ -118,14 +149,14 @@ $(RELEASE_SQL): $(addsuffix .in, $(RELEASE_SQL) $(PGS_SQL))
118149

119150
# for "create extension from unpacked*":
120151

121-
UPGRADE_UNP_COMMON =pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql\
152+
UPGRADE_UNP_COMMON = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql\
122153
pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql\
123154
pgs_box.sql pgs_contains_ops_compat.sql pgs_gist.sql\
124155
pgs_gist_contains_ops.sql contains-ops-fixes-1.sql
125156

126157
AUGMENT_UNP_COMMON = upgrade_scripts/pgs_pre111.sql pgs_contains_ops.sql\
127158
gnomo.sql
128-
# for vanilla 1.1.1 users
159+
# for vanilla 1.1.1 users:
129160
AUGMENT_UNP_111 =$(AUGMENT_UNP_COMMON) pgs_gist_pointkey.sql
130161

131162
# for 1.1.2+ users: 'from unpacked_1.1.2plus'
@@ -159,12 +190,17 @@ else
159190
endif
160191

161192
# local stuff follows here
162-
163-
AUGMENT_GAVO_111 =$(AUGMENT_UNP_111) healpix.sql# for vanilla 1.1.1 users
193+
AUGMENT_GAVO_111 =$(AUGMENT_UNP_111)# for vanilla 1.1.1 users
194+
ifneq ($(USE_HEALPIX),0)
195+
AUGMENT_GAVO_111 += healpix.sql
196+
endif
164197
UPGRADE_GAVO_111 =$(UPGRADE_UNP_COMMON)
165198

166-
# add new Healpix functions and experimental spoint3
167-
AUGMENT_FROM_GAVO = healpix.sql pgs_gist_spoint3.sql
199+
# add new HEALPix functions and experimental spoint3
200+
ifneq ($(USE_HEALPIX),0)
201+
AUGMENT_FROM_GAVO = healpix.sql
202+
endif
203+
AUGMENT_FROM_GAVO += pgs_gist_spoint3.sql
168204

169205
AUGMENT_UNP_115B0G =$(AUGMENT_UNP_111)$(AUGMENT_FROM_GAVO)
170206
UPGRADE_UNP_115B0G =$(UPGRADE_UNP_COMMON)
@@ -188,20 +224,37 @@ pg_sphere--1.0_gavo--1.1.5beta0gavo.sql: $(addsuffix .in, \
188224
$(addprefix upgrade_scripts/,$(UPGRADE_1_0_115B0G)))
189225
cat upgrade_scripts/$@.in$^>$@
190226

227+
ifneq ($(USE_HEALPIX),0)
191228
pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql: pgs_moc_type.sql.in
192229
cat upgrade_scripts/$@.in$^>$@
193230

194231
pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql: pgs_moc_compat.sql.in
195232
cat upgrade_scripts/$@.in$^>$@
196233

197234
pg_sphere--1.1.5beta4gavo--1.2.0.sql: pgs_moc_ops.sql.in
198-
cat$^>$@
235+
catupgrade_scripts/$@.in$^>$@
199236

200237
pg_sphere--1.2.0--1.2.1.sql: pgs_moc_geo_casts.sql.in pgs_epochprop.sql.in
201-
cat$^>$@
238+
catupgrade_scripts/$@.in$^>$@
202239

203-
pg_sphere--1.2.1--1.2.2.sql: upgrade_scripts/pg_sphere--1.2.1--1.2.2.sql.in
204-
cat$^>$@
240+
pg_sphere--1.2.1--1.2.2.sql: upgrade_scripts/pg_sphere--1.2.1--1.2.2-healpix.sql.in
241+
cat upgrade_scripts/$@.in$^>$@
242+
else
243+
pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql:
244+
cat upgrade_scripts/$@.in>$@
245+
246+
pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql:
247+
cat upgrade_scripts/$@.in>$@
248+
249+
pg_sphere--1.1.5beta4gavo--1.2.0.sql:
250+
cat upgrade_scripts/$@.in>$@
251+
252+
pg_sphere--1.2.0--1.2.1.sql: pgs_epochprop.sql.in
253+
cat upgrade_scripts/$@.in$^>$@
254+
255+
pg_sphere--1.2.1--1.2.2.sql:
256+
cat upgrade_scripts/$@.in>$@
257+
endif
205258

206259
# end of local stuff
207260

‎README.pg_sphere

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,67 @@ It provides:
99
* Object rotation by Euler angles
1010
* Indexing of spherical data types
1111

12-
This is an R-Tree implementation using GiST for spherical objects
13-
like spherical points and spherical circles with
14-
useful functions and operators.
12+
This is an R-Tree implementation using GiST for spherical objects like
13+
spherical points and spherical circles with useful functions and operators.
1514

1615
NOTICE:
17-
This version will work only withpostgresql version 9.1 and above.
16+
This version will work only withPostgreSQL version 9.6 and above.
1817

1918
INSTALLATION:
2019

21-
-- build and install
22-
gmake USE_PGXS=1 PG_CONFIG=/usr/bin/pg_config
23-
gmake USE_PGXS=1 PG_CONFIG=/usr/bin/pg_config install
24-
-- load extension
20+
-- Build and install
21+
22+
make
23+
make install
24+
25+
-- HEALPix/MOC support is included by default. If your platform does not
26+
-- have the required libhealpix_cxx dependency, you can optionally build
27+
-- pgSphere without HEALPix/MOC support, like this:
28+
29+
make USE_HEALPIX=0
30+
make USE_HEALPIX=0 install
31+
32+
-- Load extension
33+
2534
psql -c "CREATE EXTENSION pg_sphere;" <database>
2635

27-
REGRESSION TEST (as the same user as the currently running postgresql server):
36+
UPDATING AN EXISTING INSTALLATION:
37+
38+
-- If you are updating from a previous version of pgSphere, perform the
39+
-- same make and make install steps as above, but, instead of the CREATE
40+
-- EXTENSION step, you need to do:
41+
42+
psql -c "ALTER EXTENSION q3c UPDATE TO 'A.B.C';" <database>
43+
44+
-- where A.B.C is a placeholder for the current version.
45+
-- You also may want to check what version of pgSphere is installed using
46+
either or both of the following commands:
2847

29-
make USE_PGXS=1 installcheck
48+
psql -c "SELECT pg_sphere_version();" <database>
49+
psql -c "SELECT * FROM pg_available_extension_versions WHERE name = 'pg_sphere';"
50+
51+
REGRESSION TEST (as the same user as the currently running PostgreSQL server):
52+
53+
make installcheck
54+
55+
-- or --
56+
57+
make USE_HEALPIX=0 installcheck
3058

3159
LONG REGRESSION TEST:
3260

33-
makeUSE_PGXS=1crushtest
61+
make crushtest
3462

35-
The 'make' program must be compatible with GNU make.
63+
-- or --
3664

37-
For more information, have a look at http://pgsphere.projects.postgresql.org
38-
and https://github.com/akorotkov/pgsphere
65+
make USE_HEALPIX=0 crushtest
3966

40-
Have a lot of fun!
67+
The 'make' program used in all of the above commands must be compatible with
68+
GNU make.
69+
70+
For more information or to report issues or to help with development, please
71+
refer to https://github.com/postgrespro/pgsphere/
4172

73+
Original repository for pgSphere: https://github.com/akorotkov/pgsphere
74+
75+
Have a lot of fun!

‎expected/init_test.outrenamed to‎expected/init_test.out.in

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ psql:pg_sphere.test.sql:159: NOTICE: argument type spath is only a shell
2424
psql:pg_sphere.test.sql:178: NOTICE: type "sbox" is not yet defined
2525
DETAIL: Creating a shell type definition.
2626
psql:pg_sphere.test.sql:185: NOTICE: argument type sbox is only a shell
27-
psql:pg_sphere.test.sql:8541: NOTICE: type "spherekey" is not yet defined
27+
psql:pg_sphere.test.sql:8540: NOTICE: type "spherekey" is not yet defined
2828
DETAIL: Creating a shell type definition.
29-
psql:pg_sphere.test.sql:8548: NOTICE: argument type spherekey is only a shell
30-
psql:pg_sphere.test.sql:8562: NOTICE: type "pointkey" is not yet defined
29+
psql:pg_sphere.test.sql:8547: NOTICE: argument type spherekey is only a shell
30+
psql:pg_sphere.test.sql:8561: NOTICE: type "pointkey" is not yet defined
3131
DETAIL: Creating a shell type definition.
32-
psql:pg_sphere.test.sql:8569: NOTICE: argument type pointkey is only a shell
33-
psql:pg_sphere.test.sql:8575: NOTICE: argument type pointkey is only a shell
34-
psql:pg_sphere.test.sql:8581: NOTICE: argument type pointkey is only a shell
35-
psql:pg_sphere.test.sql:8587: NOTICE: argument type pointkey is only a shell
36-
psql:pg_sphere.test.sql:9154: NOTICE: return type smoc is only a shell
37-
psql:pg_sphere.test.sql:9160: NOTICE: argument type smoc is only a shell
32+
psql:pg_sphere.test.sql:8568: NOTICE: argument type pointkey is only a shell
33+
psql:pg_sphere.test.sql:8574: NOTICE: argument type pointkey is only a shell
34+
psql:pg_sphere.test.sql:8580: NOTICE: argument type pointkey is only a shell
35+
psql:pg_sphere.test.sql:8586: NOTICE: argument type pointkey is only a shell

‎expected/init_test_healpix.out.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
psql:pg_sphere.test.sql:9153: NOTICE: return type smoc is only a shell
2+
psql:pg_sphere.test.sql:9159: NOTICE: argument type smoc is only a shell
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- complain if this upgrade script is run via psql
2+
\echo Use "ALTER EXTENSION pg_sphere UPDATE TO '1.2.0'" to load this file. \quit
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- complain if this upgrade script is run via psql
2+
\echo Use "ALTER EXTENSION pg_sphere UPDATE TO '1.2.1'" to load this file. \quit
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- healpix
2+
ALTER FUNCTION nest2ring(integer, bigint) PARALLEL SAFE;
3+
ALTER FUNCTION ring2nest(integer, bigint) PARALLEL SAFE;
4+
ALTER FUNCTION healpix_convert_nest(integer, integer, bigint) PARALLEL SAFE;
5+
ALTER FUNCTION healpix_convert_ring(integer, integer, bigint) PARALLEL SAFE;
6+
ALTER FUNCTION nside2order(bigint) PARALLEL SAFE;
7+
ALTER FUNCTION order2nside(integer) PARALLEL SAFE;
8+
ALTER FUNCTION nside2npix(bigint) PARALLEL SAFE;
9+
ALTER FUNCTION npix2nside(bigint) PARALLEL SAFE;
10+
ALTER FUNCTION healpix_nest(integer, spoint) PARALLEL SAFE;
11+
ALTER FUNCTION healpix_ring(integer, spoint) PARALLEL SAFE;
12+
ALTER FUNCTION centre_of_healpix_nest(integer, bigint) PARALLEL SAFE;
13+
ALTER FUNCTION centre_of_healpix_ring(integer, bigint) PARALLEL SAFE;
14+
ALTER FUNCTION center_of_healpix_nest(integer, bigint) PARALLEL SAFE;
15+
ALTER FUNCTION center_of_healpix_ring(integer, bigint) PARALLEL SAFE;
16+
17+
-- moc_type
18+
ALTER FUNCTION smoc_in(cstring) PARALLEL SAFE;
19+
ALTER FUNCTION smoc_out(smoc) PARALLEL SAFE;
20+
ALTER FUNCTION moc_debug() PARALLEL SAFE;
21+
ALTER FUNCTION set_smoc_output_type(integer) PARALLEL SAFE;
22+
ALTER FUNCTION max_order(smoc) PARALLEL SAFE;
23+
ALTER FUNCTION healpix_subset_smoc(bigint, smoc) PARALLEL SAFE;
24+
ALTER FUNCTION healpix_not_subset_smoc(bigint, smoc) PARALLEL SAFE;
25+
ALTER FUNCTION smoc_superset_healpix(smoc, bigint) PARALLEL SAFE;
26+
ALTER FUNCTION smoc_not_superset_healpix(smoc, bigint) PARALLEL SAFE;
27+
ALTER FUNCTION spoint_subset_smoc(spoint, smoc) PARALLEL SAFE;
28+
ALTER FUNCTION spoint_not_subset_smoc(spoint, smoc) PARALLEL SAFE;
29+
ALTER FUNCTION smoc_superset_spoint(smoc, spoint) PARALLEL SAFE;
30+
ALTER FUNCTION smoc_not_superset_spoint(smoc, spoint) PARALLEL SAFE;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp