MODULE_big = pg_orrery EXTENSION = pg_orrery DATA = sql/pg_orrery--0.1.0.sql sql/pg_orrery--0.2.0.sql sql/pg_orrery--0.1.0--0.2.0.sql \ sql/pg_orrery--0.3.0.sql sql/pg_orrery--0.2.0--0.3.0.sql \ sql/pg_orrery--0.4.0.sql sql/pg_orrery--0.3.0--0.4.0.sql \ sql/pg_orrery--0.5.0.sql sql/pg_orrery--0.4.0--0.5.0.sql \ sql/pg_orrery--0.6.0.sql sql/pg_orrery--0.5.0--0.6.0.sql \ sql/pg_orrery--0.7.0.sql sql/pg_orrery--0.6.0--0.7.0.sql \ sql/pg_orrery--0.8.0.sql sql/pg_orrery--0.7.0--0.8.0.sql \ sql/pg_orrery--0.9.0.sql sql/pg_orrery--0.8.0--0.9.0.sql \ sql/pg_orrery--0.10.0.sql sql/pg_orrery--0.9.0--0.10.0.sql # Our extension C sources OBJS = src/pg_orrery.o src/tle_type.o src/eci_type.o src/observer_type.o \ src/sgp4_funcs.o src/coord_funcs.o src/pass_funcs.o src/gist_tle.o \ src/star_funcs.o src/kepler_funcs.o \ src/vsop87.o src/elp82b.o src/elliptic_to_rectangular.o \ src/precession.o src/sidereal_time.o src/planet_funcs.o \ src/tass17.o src/gust86.o src/marssat.o src/l12.o \ src/moon_funcs.o src/radio_funcs.o \ src/lambert.o src/transfer_funcs.o \ src/de_reader.o src/eph_provider.o src/de_funcs.o \ src/od_math.o src/od_iod.o src/od_solver.o src/od_funcs.o \ src/spgist_tle.o \ src/orbital_elements_type.o \ src/equatorial_funcs.o \ src/refraction_funcs.o # Vendored SGP4/SDP4 sources (pure C, from Bill Gray's sat_code, MIT license) SGP4_DIR = src/sgp4 SGP4_SRCS = $(SGP4_DIR)/sgp4.c $(SGP4_DIR)/sdp4.c \ $(SGP4_DIR)/deep.c $(SGP4_DIR)/common.c \ $(SGP4_DIR)/basics.c $(SGP4_DIR)/get_el.c \ $(SGP4_DIR)/tle_out.c SGP4_OBJS = $(SGP4_SRCS:.c=.o) OBJS += $(SGP4_OBJS) # Regression tests REGRESS = tle_parse sgp4_propagate coord_transforms pass_prediction gist_index convenience \ star_observe kepler_comet planet_observe moon_observe lambert_transfer \ de_ephemeris od_fit spgist_tle orbital_elements equatorial refraction \ aberration vallado_518 REGRESS_OPTS = --inputdir=test # Pure C — no C++ runtime needed. LAPACK for OD solver (dgelss_). SHLIB_LINK += -lm -llapack -lblas # Compiler flags PG_CPPFLAGS = -I$(SGP4_DIR) # Use PGXS PG_CONFIG ?= pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) # ── Standalone DE reader unit test (no PostgreSQL dependency) ── # Generates a synthetic DE binary, exercises Chebyshev evaluation, # header parsing, Earth derivation, error paths. test-de-reader: test/test_de_reader.c src/de_reader.c src/de_reader.h $(CC) -Wall -Werror -Isrc -o test/test_de_reader $< src/de_reader.c -lm ./test/test_de_reader .PHONY: test-de-reader # ── Standalone OD math unit test (no PostgreSQL dependency) ── # Element converters, inverse coordinate transforms, Brouwer/Kozai inverse. test-od-math: test/test_od_math.c src/od_math.c src/od_math.h $(CC) -Wall -Werror -Isrc -o test/test_od_math $< src/od_math.c -lm ./test/test_od_math .PHONY: test-od-math # ── Standalone IOD unit test (no PostgreSQL dependency) ── # Gibbs method: 3-position orbit recovery, coplanarity checks. test-od-iod: test/test_od_iod.c src/od_iod.c src/od_iod.h src/od_math.c src/od_math.h $(CC) -Wall -Werror -Isrc -o test/test_od_iod $< src/od_iod.c src/od_math.c -lm ./test/test_od_iod .PHONY: test-od-iod # ── Standalone Gauss IOD unit test (no PostgreSQL dependency) ── # Gauss angles-only IOD, RA/Dec round-trip, Herrick-Gibbs fallback. test-od-gauss: test/test_od_gauss.c src/od_iod.c src/od_iod.h src/od_math.c src/od_math.h $(CC) -Wall -Werror -Isrc -o test/test_od_gauss $< src/od_iod.c src/od_math.c -lm ./test/test_od_gauss .PHONY: test-od-gauss # ── PG version test matrix ───────────────────────────────── PG_TEST_VERSIONS ?= 14 15 16 17 18 test-matrix: PG_VERSIONS="$(PG_TEST_VERSIONS)" bash test/pg-version-matrix.sh test-pg%: PG_VERSIONS="$*" bash test/pg-version-matrix.sh test-matrix-clean: rm -rf test/matrix-logs @for v in $(PG_TEST_VERSIONS); do \ docker rmi "pg_orrery-test:pg$$v" 2>/dev/null || true; \ done .PHONY: test-matrix test-matrix-clean # ── Docker packaging ──────────────────────────────────────── REGISTRY ?= git.supported.systems/warehack.ing IMAGE ?= pg_orrery PG_MAJOR ?= 17 TAG ?= pg$(PG_MAJOR) docker-build: docker build --build-arg PG_MAJOR=$(PG_MAJOR) \ --target artifact -t $(REGISTRY)/$(IMAGE):$(TAG)-artifact . docker build --build-arg PG_MAJOR=$(PG_MAJOR) \ --target standalone -t $(REGISTRY)/$(IMAGE):$(TAG) . docker-push: docker push $(REGISTRY)/$(IMAGE):$(TAG)-artifact docker push $(REGISTRY)/$(IMAGE):$(TAG) docker-test: @echo "Smoke-testing standalone image..." docker run --rm -d --name pg_orrery_test \ -e POSTGRES_PASSWORD=test $(REGISTRY)/$(IMAGE):$(TAG) @echo "Waiting for PostgreSQL to initialize..." @sleep 10 docker exec pg_orrery_test psql -U postgres -tAc \ "SELECT tle_norad_id(E'1 25544U 98067A 24001.50000000 .00016717 00000-0 10270-3 0 9025\n2 25544 51.6400 208.9163 0006703 30.1694 61.7520 15.50100486 00001'::tle);" \ | grep -q 25544 @docker stop pg_orrery_test @echo "Smoke test passed." .PHONY: docker-build docker-push docker-test