Phase 1 — Stars, comets, Keplerian propagation: - star_observe() / star_observe_safe(): fixed star alt/az via IAU 1976 precession, equatorial-to-horizontal transform - kepler_propagate(): two-body Keplerian orbit propagation for elliptic, parabolic, and hyperbolic orbits - comet_observe(): observe comets/asteroids from orbital elements - heliocentric type: ecliptic J2000 position (x, y, z in AU) Phase 2 — VSOP87 planets, ELP82B Moon, Sun: - planet_heliocentric(): VSOP87 heliocentric ecliptic J2000 positions for Mercury through Neptune (Bretagnon & Francou, MIT) - planet_observe(): full observation pipeline for any planet - sun_observe(): Sun position from negated Earth VSOP87 - moon_observe(): ELP2000-82B lunar position (Chapront-Touzé, MIT) - Clean-room precession (IAU 2006) and sidereal time (IERS 2010) - elliptic_to_rectangular utility (Stellarium, MIT) All Stellarium extractions are MIT-licensed, thread-safe (static caching removed for PARALLEL SAFE), zero external data files. All 9 regression tests pass (90ms total).
71 lines
2.5 KiB
Makefile
71 lines
2.5 KiB
Makefile
MODULE_big = pg_orbit
|
|
EXTENSION = pg_orbit
|
|
DATA = sql/pg_orbit--0.1.0.sql sql/pg_orbit--0.2.0.sql sql/pg_orbit--0.1.0--0.2.0.sql
|
|
|
|
# Our extension C sources
|
|
OBJS = src/pg_orbit.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
|
|
|
|
# sat_code C++ sources (compiled with g++, linked with extern "C" symbols)
|
|
SAT_CODE_DIR = lib/sat_code
|
|
SAT_CODE_SRCS = $(SAT_CODE_DIR)/sgp4.cpp $(SAT_CODE_DIR)/sdp4.cpp \
|
|
$(SAT_CODE_DIR)/deep.cpp $(SAT_CODE_DIR)/common.cpp \
|
|
$(SAT_CODE_DIR)/basics.cpp $(SAT_CODE_DIR)/get_el.cpp \
|
|
$(SAT_CODE_DIR)/tle_out.cpp
|
|
SAT_CODE_OBJS = $(SAT_CODE_SRCS:.cpp=.o)
|
|
|
|
OBJS += $(SAT_CODE_OBJS)
|
|
|
|
# Regression tests
|
|
REGRESS = tle_parse sgp4_propagate coord_transforms pass_prediction gist_index convenience \
|
|
star_observe kepler_comet planet_observe
|
|
REGRESS_OPTS = --inputdir=test
|
|
|
|
# Need C++ runtime for sat_code
|
|
SHLIB_LINK += -lstdc++ -lm
|
|
|
|
# Compiler flags
|
|
PG_CPPFLAGS = -I$(SAT_CODE_DIR)
|
|
|
|
# Use PGXS
|
|
PG_CONFIG ?= pg_config
|
|
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
|
include $(PGXS)
|
|
|
|
# Rule for compiling sat_code C++ files
|
|
$(SAT_CODE_DIR)/%.o: $(SAT_CODE_DIR)/%.cpp
|
|
$(CXX) $(CXXFLAGS) -fPIC -I$(SAT_CODE_DIR) -c -o $@ $<
|
|
|
|
# ── Docker packaging ────────────────────────────────────────
|
|
REGISTRY ?= git.supported.systems/warehack.ing
|
|
IMAGE ?= pg_orbit
|
|
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_orbit_test \
|
|
-e POSTGRES_PASSWORD=test $(REGISTRY)/$(IMAGE):$(TAG)
|
|
@echo "Waiting for PostgreSQL to initialize..."
|
|
@sleep 10
|
|
docker exec pg_orbit_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_orbit_test
|
|
@echo "Smoke test passed."
|
|
|
|
.PHONY: docker-build docker-push docker-test
|