aboutsummaryrefslogtreecommitdiffstats
path: root/community/gdal/APKBUILD
blob: a54c83495ff87e7a29b285528fa3e2d9911c687a (plain)
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
# Contributor: Trevor R.H. Clarke <trevor@notcows.com>
# Maintainer: Trevor R.H. Clarke <trevor@notcows.com>
pkgname=gdal
pkgver=3.0.3
pkgrel=0
pkgdesc="A translator library for raster and vector geospatial data formats"
url="https://gdal.org/"
arch="all !s390x !x86 !armhf !armv7"
license="MIT"
depends_dev="gdal"
makedepends="
	apache-ant
	chrpath
	curl-dev
	expat-dev
	geos-dev
	giflib-dev
	json-c-dev
	libpng-dev
	libwebp-dev
	libxml2-dev
	linux-headers
	mariadb-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-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

	./configure \
		CPPFLAGS=-I/usr/include/tirpc \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-cpp14 \
		--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)"

	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="3fe666589cd5d499617880dca2fcd5c7d89cb5613f33a8ae09b729549c6555ed3be50264399c94e033536c02a2f92e08b50a19401cfa87184793c5709a73e32e  gdal-3.0.3.tar.gz
14d080b80a5e499840e7b356acd0a7f6afaec6c65a10d9df864011d89e93310bd3dac22e59ca7c0cd93e6fd2277f85a71920a91ed5afdb352c18e953b2b4783b  10-atoll.patch
4741d6f9f2aaaa80c1ad590073d0b960d4389b8908682de224b476136cc5dd898375ca67498568fac4537a2c23f00e42998618a4a9121ac6d9f82dd61eda15d8  20-userfaultfd-detection.patch"