aboutsummaryrefslogtreecommitdiffstats
path: root/community/gdal/APKBUILD
blob: deb14f03d4be08dcf9e30e0250533f07ecac76c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Contributor: Trevor R.H. Clarke <trevor@notcows.com>
# Maintainer: Trevor R.H. Clarke <trevor@notcows.com>
pkgname=gdal
pkgver=3.1.1
pkgrel=0
pkgdesc="A translator library for raster and vector geospatial data formats"
url="https://gdal.org/"
arch="all !s390x !x86 !armhf !armv7 !mips !mips64"
license="MIT"
depends_dev="gdal"
makedepends="
	apache-ant
	cfitsio-dev
	charls-dev
	chrpath
	curl-dev
	expat-dev
	freexl-dev
	geos-dev
	giflib-dev
	hdf5-dev
	json-c-dev
	libdap-dev
	libkml-dev
	libpng-dev
	libwebp-dev
	libxml2-dev
	linux-headers
	mariadb-dev
	netcdf-dev
	openexr-dev
	openjdk8
	openjpeg-dev
	poppler-dev
	postgresql-dev
	proj-dev
	py3-numpy
	py3-numpy-dev
	python3-dev
	sqlite-dev
	swig
	tiff-dev
	unixodbc-dev
	xerces-c-dev
	zlib-dev
	zstd-dev
	"
checkdepends="
	pytest
	"
subpackages="
	$pkgname-static
	$pkgname-dev
	py3-$pkgname:_py3
	java-$pkgname:_java
	$pkgname-tools
	"

source="
	$pkgname-$pkgver.tar.gz::https://github.com/OSGeo/$pkgname/archive/v$pkgver.tar.gz
	10-atoll.patch
	20-userfaultfd-detection.patch
	"

build() {
	cd "$builddir"/gdal

	CPPFLAGS="$CPPFLAGS -I/usr/include/mysql/server -I/usr/include/tirpc" ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-cfitsio=/usr \
		--with-cpp14 \
		--with-dods-root=/usr \
		--with-poppler \
		--with-mysql \
		--with-java=/usr/lib/jvm/java-1.8-openjdk/
	make

	cd "$builddir/gdal/swig/python"
	python3 setup.py build

	cd "$builddir/gdal/swig/java"
	make
}

package() {
	cd "$builddir"/gdal

	make DESTDIR="$pkgdir" install
	chmod -x "$pkgdir"/usr/include/*.h

	cd "$pkgdir/usr/bin"
	mv gdal-config ..
	rm -rf "$pkgdir/usr/bin/"*
	mv ../gdal-config .
}

_py3() {
	pkgdesc="$pkgdesc (Python3 bindings)"
	depends="py3-numpy"

	mkdir -p "$subpkgdir"/usr/lib/
	cd "$builddir"/gdal/swig/python
	python3 setup.py install --prefix=/usr --root="$subpkgdir"
	rm -rf "$subpkgdir/usr/bin"
}

_java() {
	pkgdesc="$pkgdesc (Java bindings)"
	cd "$builddir"/gdal/swig/java
	make

	mkdir -p "$subpkgdir/usr/lib" "$subpkgdir/usr/share/java/"
	chrpath -d .libs/*.so*
	mv .libs/*.so* "$subpkgdir/usr/lib"
	cp gdal.jar "$subpkgdir/usr/share/java/gdal-$pkgver.jar"
	cd "$subpkgdir/usr/share/java/"
	ln -s gdal-$pkgver.jar gdal.jar
}

tools() {
	pkgdesc="$pkgdesc (command line utilities)"
	depends="py3-$pkgname"

	cd "$builddir"/gdal/swig/python
	chmod a+x scripts/*

	install -d "$subpkgdir/usr/bin"
	install -m755 scripts/*.py "$subpkgdir/usr/bin/"

	cd "$builddir"/gdal
	make DESTDIR="$subpkgdir" install
	rm -rf "$subpkgdir/usr/include" "$subpkgdir/usr/lib" "$subpkgdir/usr/share" "$subpkgdir/usr/bin/gdal-config"
}

check() {
	# TODO: https://trac.osgeo.org/gdal/wiki/TestingNotes

	cd "$builddir"/gdal
	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="168fea505a24c937c90c502834e2fb0b7efadc09de14674a3f3c71a80ae362b72ae75540492c45906cd331b60de6bab8952d47fbe94347941c47f162fa79d84a  gdal-3.1.1.tar.gz
14d080b80a5e499840e7b356acd0a7f6afaec6c65a10d9df864011d89e93310bd3dac22e59ca7c0cd93e6fd2277f85a71920a91ed5afdb352c18e953b2b4783b  10-atoll.patch
4741d6f9f2aaaa80c1ad590073d0b960d4389b8908682de224b476136cc5dd898375ca67498568fac4537a2c23f00e42998618a4a9121ac6d9f82dd61eda15d8  20-userfaultfd-detection.patch"