From cd4591501f95e6b98d25e7168c794433046f67f8 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 2 Jun 2019 09:51:21 +0200 Subject: [PATCH] Build custom GDAL, GEOS, PROJ.4, PostGIS --- _build/build-all.sh | 18 +++++++++++ apk/gdal/APKBUILD | 76 ++++++++++++++++++++++++++++++++++++++++++++ apk/geos/APKBUILD | 55 ++++++++++++++++++++++++++++++++ apk/postgis/APKBUILD | 38 ++++++++++++++++++++++ apk/proj4/APKBUILD | 33 +++++++++++++++++++ 5 files changed, 220 insertions(+) create mode 100644 apk/gdal/APKBUILD create mode 100644 apk/geos/APKBUILD create mode 100644 apk/postgis/APKBUILD create mode 100644 apk/proj4/APKBUILD diff --git a/_build/build-all.sh b/_build/build-all.sh index 93ce714..49db7e3 100755 --- a/_build/build-all.sh +++ b/_build/build-all.sh @@ -14,6 +14,24 @@ tar cpf /srv/build/_vm.tar * # Build native apps cd ${ROOT}/apk/acme-sh abuild -F + +cd ${ROOT}/apk/geos +apk add swig python2-dev +abuild -F + +cd ${ROOT}/apk/gdal +apk add curl-dev giflib-dev jpeg-dev libjpeg-turbo-dev libpng-dev linux-headers postgresql-dev python2-dev sqlite-dev swig tiff-dev zlib-dev +apk add --repository /srv/build/apk geos-dev +abuild -F + +cd ${ROOT}/apk/proj4 +abuild -F + +cd ${ROOT}/apk/postgis +apk add postgresql-dev libxml2-dev perl-dev json-c-dev pcre-dev postgresql perl +apk add --repository /srv/build/apk geos-dev gdal-dev proj4-dev +abuild -F + cd ${ROOT}/apk/vmmgr abuild -F diff --git a/apk/gdal/APKBUILD b/apk/gdal/APKBUILD new file mode 100644 index 0000000..7ba80dd --- /dev/null +++ b/apk/gdal/APKBUILD @@ -0,0 +1,76 @@ +# Contributor: Trevor R.H. Clarke +# Maintainer: Trevor R.H. Clarke +pkgname=gdal +pkgver=2.4.0 +pkgrel=1 +pkgdesc="A translator library for raster and vector geospatial data formats" +url="http://gdal.org" +arch="x86 x86_64" +license="MIT" +depends="" +depends_dev="gdal" +makedepends=" + curl-dev + geos-dev + giflib-dev + jpeg-dev + libjpeg-turbo-dev + libpng-dev + linux-headers + postgresql-dev + python2-dev + sqlite-dev + swig + tiff-dev + zlib-dev + " +subpackages=" + $pkgname-dev + py-$pkgname:py + " + +source="http://download.osgeo.org/$pkgname/$pkgver/$pkgname-$pkgver.tar.xz" +builddir="$srcdir/$pkgname-$pkgver" + +build() { + cd "$builddir" + + ./configure --prefix=/usr \ + --with-curl=/usr/bin/curl-config + make + + cd swig/python + python2 setup.py build +} + +package() { + cd "$builddir" + + make DESTDIR="$pkgdir" install + chmod -x "$pkgdir"/usr/include/*.h +} + +py() { + pkgdesc="$pkgname (python bindings)" + + cd "$builddir"/swig/python + python2 setup.py install --prefix=/usr --root="$subpkgdir" + + chmod a+x scripts/* + install -d "$subpkgdir"/usr/bin + install -m755 scripts/*.py "$subpkgdir"/usr/bin/ +} + +check() { + # TODO: https://trac.osgeo.org/gdal/wiki/TestingNotes + + cd "$builddir" + apps/gdal-config --version | grep "$pkgver" + + # confirms MBTiles support + apps/gdal_translate --formats | grep "MBTiles -raster,vector- (rw+v): MBTiles" + + # confirms PostgreSQL/PostGIS support + apps/ogr2ogr --formats | grep "PostgreSQL -vector- (rw+): PostgreSQL/PostGIS" +} +sha512sums="d4eb6535043b1495f691ab96aa8087d9254aa01efbc57a4051f8b9f4f6b2537719d7bf03ff82c3f6cfd0499a973c491fa9da9f5854dbd9863a0ec9796d3642bb gdal-2.4.0.tar.xz" diff --git a/apk/geos/APKBUILD b/apk/geos/APKBUILD new file mode 100644 index 0000000..5c7c097 --- /dev/null +++ b/apk/geos/APKBUILD @@ -0,0 +1,55 @@ +# Contributor: Eric Kidd +# Maintainer: +pkgname=geos +pkgver=3.7.1 +pkgrel=0 +pkgdesc="GEOS is a library providing OpenGIS and JTS spatial operations in C++." +url="https://trac.osgeo.org/geos/" +# test fails on other archs +arch="x86 x86_64" +license="LGPL-2.1" +makedepends="swig python2-dev" +subpackages="py-$pkgname:py $pkgname-dev" +source="http://download.osgeo.org/geos/geos-$pkgver.tar.bz2" +builddir="$srcdir/$pkgname-$pkgver" + +build() { + cd "$builddir" + + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --enable-python + + # --enable-ruby produces a gem which crashes, and which seems to + # mostly ignored in favor of the rgeo and ffi-geos modules, anyway. + + make +} + +check() { + cd "$builddir" + + make check +} + +package() { + cd "$builddir" + + make DESTDIR="$pkgdir" install + install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING +} + +py() { + pkgdesc="$pkgname Python bindings" + + cd "$builddir" + install -d "$subpkgdir"/usr/lib + mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/ +} + +sha512sums="01e8087bcd3cb8f873adb7b56910e1575ccb3336badfdd3f13bc6792095b7010e5ab109ea0d0cd3d1459e2e526e83bcf64d6ee3f7eb47be75639becdaacd2a87 geos-3.7.1.tar.bz2" diff --git a/apk/postgis/APKBUILD b/apk/postgis/APKBUILD new file mode 100644 index 0000000..52328ee --- /dev/null +++ b/apk/postgis/APKBUILD @@ -0,0 +1,38 @@ +# Contributor: Bjoern Schilberg +# Maintainer: Bjoern Schilberg +pkgname=postgis +pkgver=2.5.1 +pkgrel=1 +pkgdesc="PostGIS is a spatial database extender for PostgreSQL object-relational database." +url="https://postgis.net/" +# geos test fails on other archs +arch="x86 x86_64" # fails on x86* +license="GPL-2.0-or-later" +depends="postgresql perl" +makedepends="postgresql-dev geos-dev gdal-dev libxml2-dev proj4-dev perl-dev + json-c-dev pcre-dev" +subpackages="$pkgname-dev $pkgname-doc" +source="http://download.osgeo.org/postgis/source/$pkgname-$pkgver.tar.gz" +options="!check" # tests depends on a running PostgreSQL server + +build() { + cd "$builddir" + + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --disable-gtktest \ + --disable-nls \ + --disable-rpath \ + --without-protobuf + make -j1 +} + +package() { + cd "$builddir" + + make DESTDIR="$pkgdir" install +} + +sha512sums="c6c9c8c5befd945614e92d1062df1d753ca8b7fd69b70226065c2dac77a59783b14ece4da994187079b683ee090ba5a79389ba679f22fce8c20a5afc2c8dfca0 postgis-2.5.1.tar.gz" diff --git a/apk/proj4/APKBUILD b/apk/proj4/APKBUILD new file mode 100644 index 0000000..e6e6240 --- /dev/null +++ b/apk/proj4/APKBUILD @@ -0,0 +1,33 @@ +# Maintainer: Natanael Copa +pkgname=proj4 +pkgver=5.2.0 +pkgrel=0 +pkgdesc="PROJ.4 - Cartographic Projections Library" +url="https://trac.osgeo.org/proj/" +arch="all" +license="MIT" +options="" +depends="" +makedepends="" +subpackages="$pkgname-doc $pkgname-dev" +source="http://download.osgeo.org/proj/proj-$pkgver.tar.gz + " + +builddir="$srcdir"/proj-$pkgver +build () { + cd "$builddir" + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --without-jni \ + || return 1 + make || return 1 +} + +package() { + cd "$builddir" + mkdir -p $pkgdir/usr/bin + make DESTDIR="$pkgdir" install +} +sha512sums="f773117d22309d4ee8dbedc2a7b6ba27e8cd032e1bd0af3c98f270bf7b7ab3353be0b04d91202a1f137fc45164c8e8a52712bb06281948008160d08f9f9074ba proj-5.2.0.tar.gz"