Skip to content

Some refactoring of existing project tree #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 35 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
PGSPHERE_VERSION = 1.2.1

# the base dir name may be changed depending on git clone command
SRC_DIR = $(shell basename $(shell pwd))
SRC_DIR = $(shell basename $(shell pwd))

MODULE_big = pg_sphere
OBJS = sscan.o sparse.o sbuffer.o vector3d.o point.o \
euler.o circle.o line.o ellipse.o polygon.o \
path.o box.o output.o gq_cache.o gist.o key.o \
gnomo.o healpix.o moc.o process_moc.o healpix_bare/healpix_bare.o
MODULE_big = pg_sphere

OBJS = src/sscan.o src/sparse.o src/sbuffer.o src/vector3d.o src/point.o \
src/euler.o src/circle.o src/line.o src/ellipse.o src/polygon.o \
src/path.o src/box.o src/output.o src/gq_cache.o src/gist.o src/key.o \
src/gnomo.o \
src/healpix.o src/moc.o src/process_moc.o \
healpix_bare/healpix_bare.o

EXTENSION = pg_sphere
RELEASE_SQL = $(EXTENSION)--$(PGSPHERE_VERSION).sql
Expand All @@ -25,6 +28,9 @@ REGRESS = init tables points euler circle line ellipse poly path box index \
contains_ops contains_ops_compat bounding_box_gist gnomo healpix \
moc mocautocast

PG_CFLAGS += -Isrc -DPGSPHERE_VERSION=${PGSPHERE_VERSION}
PG_CXXFLAGS += -Isrc -DPGSPHERE_VERSION=${PGSPHERE_VERSION}

REGRESS_9_5 = index_9.5 # experimental for spoint3

TESTS = init_test tables points euler circle line ellipse poly path box index \
Expand All @@ -45,9 +51,10 @@ CRUSH_TESTS = init_extended circle_extended
PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \
pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql \
pgs_gist.sql gnomo.sql \
pgs_gist.sql pgs_gnomo.sql \
healpix.sql pgs_gist_spoint3.sql pgs_moc_type.sql pgs_moc_compat.sql pgs_moc_ops.sql \
pgs_moc_geo_casts.sql

PGS_SQL_9_5 = pgs_9.5.sql # experimental for spoint3

USE_PGXS = 1
Expand Down Expand Up @@ -123,39 +130,41 @@ UPGRADE_UNP_COMMON = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
pgs_gist_contains_ops.sql contains-ops-fixes-1.sql

AUGMENT_UNP_COMMON = upgrade_scripts/pgs_pre111.sql pgs_contains_ops.sql \
gnomo.sql
pgs_gnomo.sql

# for vanilla 1.1.1 users
AUGMENT_UNP_111 = $(AUGMENT_UNP_COMMON) pgs_gist_pointkey.sql

# TODO: Clean up the commented code below.
# for 1.1.2+ users: 'from unpacked_1.1.2plus'
AUGMENT_UNP_FOR_112plus = $(AUGMENT_UNP_COMMON)
UPGRADE_UNP_FOR_112plus = pgs_gist_pointkey.sql pgs_gist_drop_spoint2.sql.in

#AUGMENT_UNP_FOR_112plus = $(AUGMENT_UNP_COMMON)
#UPGRADE_UNP_FOR_112plus = pgs_gist_pointkey.sql pgs_gist_drop_spoint2.sql.in
#
# for "alter extension":

#
# TODO: add dynamic pl/pgsql to do perform an additional
# "ALTER EXTENSION pg_sphere UPDATE TO '1.1.5_from_before_2016-02-07';"
# if required.
#
# default 1.0 (after 2016-02-07) -> 1.1.5
UPGRADE_1_0_PRE_xxxxxx = contains-ops-fixes-2.sql
#UPGRADE_1_0_PRE_xxxxxx = contains-ops-fixes-2.sql
# '1.1.5_from_2015-08-31'
AUGMENT_1_0_PRE_AAF2D5 = pgs_contains_ops.sql gnomo.sql
UPGRADE_1_0_PRE_AAF2D5 = contains-ops-fixes-1.sql pgs_gist_drop_spoint2.sql.in \
pgs_gist_contains_ops.sql

#AUGMENT_1_0_PRE_AAF2D5 = pgs_contains_ops.sql gnomo.sql
#UPGRADE_1_0_PRE_AAF2D5 = contains-ops-fixes-1.sql pgs_gist_drop_spoint2.sql.in \#
# pgs_gist_contains_ops.sql
#
# vanilla 'create from unpackaged' must assume 1.1.1
# ...

#
# create "create extension from unpacked*" files

#
# create "alter extension" files


ifeq ($(pg_version_9_5_plus),y)
# 1.1.1.5 -> 1.1.5.1 for Postgres 9.5+ features
else
endif
#
#
#ifeq ($(pg_version_9_5_plus),y)
## 1.1.1.5 -> 1.1.5.1 for Postgres 9.5+ features
#else
#endif

# local stuff follows here

Expand All @@ -182,6 +191,7 @@ pg_sphere--unpackaged--1.1.5beta0gavo.sql: $(addsuffix .in, \
# test installation B (generic)
pg_sphere--1.0--1.0_gavo.sql: # dummy upgrade to allow for descriptive names
cat upgrade_scripts/$@.in > $@

pg_sphere--1.0_gavo--1.1.5beta0gavo.sql: $(addsuffix .in, \
$(AUGMENT_1_0_115B0G) \
$(addprefix upgrade_scripts/, $(UPGRADE_1_0_115B0G)))
Expand Down
6 changes: 6 additions & 0 deletions expected/init.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
-- does not depend on contents of pg_sphere.sql.
--
CREATE EXTENSION pg_sphere;
select pg_sphere_version();
pg_sphere_version
-------------------
1.2.1
(1 row)

File renamed without changes.
1 change: 1 addition & 0 deletions sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
-- does not depend on contents of pg_sphere.sql.
--
CREATE EXTENSION pg_sphere;
select pg_sphere_version();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions gnomo.c → src/gnomo.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <postgres.h>
#include <fmgr.h>

#include <gnomo.h>
#include <point.h> /* SPoint from pgsphere */
#include "gnomo.h"
#include "point.h" /* SPoint from pgsphere */

#include <math.h>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion output.c → src/output.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "types.h"

#if !defined(PGSPHERE_VERSION)
#error "PGSPHERE_VERSION macro is not set"
#endif

#define PGSPHERE_STRINGIFY_INTERNAL(x) #x
#define PGSPHERE_STRINGIFY(x) PGSPHERE_STRINGIFY_INTERNAL(x)

/* Output functions */


Expand Down Expand Up @@ -528,6 +535,6 @@ Datum
pg_sphere_version(PG_FUNCTION_ARGS)
{
char *buffer = (char *) palloc(20);
sprintf(buffer, "1.1.5");
sprintf(buffer, PGSPHERE_STRINGIFY(PGSPHERE_VERSION));
PG_RETURN_CSTRING(buffer);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.