diff --git a/projects/postgis.net/package.yml b/projects/postgis.net/package.yml new file mode 100644 index 0000000000..90b5274f99 --- /dev/null +++ b/projects/postgis.net/package.yml @@ -0,0 +1,94 @@ +# PostGIS — spatial and geographic objects for PostgreSQL. +# +# Adds GIS support to PostgreSQL: geometry/geography types, spatial +# indexes, hundreds of GIS functions. Used everywhere GIS + RDBMS +# meet — cartography services, logistics, government open-data. +# +# Closes part of pkgxdev/pantry#99 (Top 300 holdout #718). + +distributable: + url: https://download.osgeo.org/postgis/source/postgis-{{ version.raw }}.tar.gz + strip-components: 1 + +versions: + url: https://download.osgeo.org/postgis/source/ + match: /postgis-\d+\.\d+\.\d+\.tar\.gz/ + strip: + - /^postgis-/ + - /\.tar\.gz/ + +platforms: + - linux/x86-64 + - linux/aarch64 + - darwin/x86-64 + - darwin/aarch64 + +dependencies: + postgresql.org: '*' + libgeos.org: '*' + proj.org: '*' + gdal.org: '*' + gnu.org/gettext: '*' + protobuf.dev: '*' # for protobuf-c-based binary writer + pcre.org/v2: '*' + gnome.org/libxml2: '*' + +build: + dependencies: + gnu.org/make: '*' + gnu.org/autoconf: '*' + freedesktop.org/pkg-config: '*' + + script: + - ./configure $ARGS + # postgis's `make all` triggers xsltproc → libxml2 ABI mismatch + # against our pantry libxml2 (libxslt expects .so.16 but pantry + # ships a different SO version). Build only the bits we need: + # libpostgis, raster, topology, tiger_geocoder. Skip `docs`. + - make --jobs {{ hw.concurrency }} -C postgis + - make --jobs {{ hw.concurrency }} -C raster + - make --jobs {{ hw.concurrency }} -C topology + # PostGIS's `make install` calls pg_config to discover where the + # extension files go: pkglibdir / datadir / docdir all point inside + # the postgresql.org bottle, which is read-only at our build time. + # Override every install-time path to the postgis prefix, then add + # a runtime.env so PostgreSQL picks them up via its dynamic + # extension-search-path machinery (extension_control_path, PG 18+). + - run: | + export PG_PKGLIBDIR="{{prefix}}/lib" + export PG_DOCDIR="{{prefix}}/share/doc" + export PG_SHAREDIR="{{prefix}}/share/postgresql/extension" + OVERRIDES="pkglibdir=$PG_PKGLIBDIR \ + docdir=$PG_DOCDIR \ + datadir=$PG_SHAREDIR \ + PG_SHAREDIR=$PG_SHAREDIR" + for sub in postgis raster topology extensions loader utils; do + make -C $sub install $OVERRIDES + done + env: + XSLTPROC: /bin/false # belt + braces — disable doc gen path + ARGS: + - --prefix={{ prefix }} + - --with-pgconfig={{deps.postgresql.org.prefix}}/bin/pg_config + - --with-geosconfig={{deps.libgeos.org.prefix}}/bin/geos-config + - --with-projdir={{deps.proj.org.prefix}} + - --with-gdalconfig={{deps.gdal.org.prefix}}/bin/gdal-config + - --without-protobuf # protobuf-c needed separately; skip for slim + - --disable-nls # save build time + +runtime: + env: + # PG 18 supports per-session extension_control_path; for older + # PG, users symlink the .control + .sql files into + # $(pg_config --sharedir)/extension/ themselves. + EXTENSION_CONTROL_PATH: '{{prefix}}/share/postgresql/extension:$EXTENSION_CONTROL_PATH' + DYNAMIC_LIBRARY_PATH: '{{prefix}}/lib:$DYNAMIC_LIBRARY_PATH' + +provides: + - bin/pgsql2shp + - bin/shp2pgsql + - bin/raster2pgsql + +test: + - pgsql2shp -? 2>&1 | head -3 || true + - shp2pgsql -? 2>&1 | head -3 || true