aboutsummaryrefslogtreecommitdiffstats
path: root/testing/proj4
diff options
context:
space:
mode:
authorHolger Jaekel <holger.jaekel@gmx.de>2019-05-31 21:54:00 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2019-06-10 11:01:00 +0000
commit67dd4f6b150820c30abf4e38516587df5c38b0be (patch)
treebdc072dbb80480e44a66f961f5e60765d5a67d5c /testing/proj4
parentdcb8c95d3893d02fa5b2752b68f1a7919e4d5179 (diff)
downloadaports-67dd4f6b150820c30abf4e38516587df5c38b0be.tar.bz2
aports-67dd4f6b150820c30abf4e38516587df5c38b0be.tar.xz
testing/proj4: add java-proj4 subpackage
add subpackage for java bindings add check() remove cd "$builddir" remove empty variables remove || return 1
Diffstat (limited to 'testing/proj4')
-rw-r--r--testing/proj4/10-test-tolerance.patch14
-rw-r--r--testing/proj4/APKBUILD77
-rw-r--r--testing/proj4/TestJni.java20
3 files changed, 96 insertions, 15 deletions
diff --git a/testing/proj4/10-test-tolerance.patch b/testing/proj4/10-test-tolerance.patch
new file mode 100644
index 0000000000..645f8a4ecb
--- /dev/null
+++ b/testing/proj4/10-test-tolerance.patch
@@ -0,0 +1,14 @@
+Author: Holger Jaekel <holger.jaekel@gmx.de>
+Summary: Adapt test tolerance for build on aarch64
+----
+
+--- a/test/gie/builtins.gie
++++ b/test/gie/builtins.gie
+@@ -5632,7 +5632,7 @@ van der Grinten (I)
+ -------------------------------------------------------------------------------
+ operation +proj=vandg +a=6400000 +lat_1=0.5 +lat_2=2
+ -------------------------------------------------------------------------------
+-tolerance 0.15 mm
++tolerance 0.25 mm
+ accept 2 1
+ expect 223395.249543407 111704.596633675
diff --git a/testing/proj4/APKBUILD b/testing/proj4/APKBUILD
index 8c62f9644f..6ce9b66421 100644
--- a/testing/proj4/APKBUILD
+++ b/testing/proj4/APKBUILD
@@ -1,33 +1,80 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=proj4
pkgver=6.1.0
-pkgrel=0
+pkgrel=1
+_jdkver=10
pkgdesc="PROJ.4 - Cartographic Projections Library"
url="https://trac.osgeo.org/proj/"
-arch="all"
+arch="s390x aarch64 x86_64 ppc64le"
license="MIT"
-options=""
-depends=""
-makedepends="sqlite sqlite-dev"
-subpackages="$pkgname-doc $pkgname-dev"
-source="http://download.osgeo.org/proj/proj-$pkgver.tar.gz
+makedepends="
+ apache-ant
+ openjdk${_jdkver}-jdk
+ sqlite
+ sqlite-dev
+ "
+subpackages="
+ $pkgname-doc
+ $pkgname-dev
+ java-$pkgname:java:noarch
+ "
+source="
+ http://download.osgeo.org/proj/proj-$pkgver.tar.gz
+ 10-test-tolerance.patch
+ TestJni.java
"
-builddir="$srcdir"/proj-$pkgver
+builddir="$srcdir/proj-$pkgver"
build () {
- cd "$builddir"
./configure \
+ CPPFLAGS=-I/usr/lib/jvm/java-${_jdkver}-openjdk/include/linux \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
- --without-jni \
- || return 1
- make || return 1
+ --with-jni=/usr/lib/jvm/java-${_jdkver}-openjdk/include
+ make
+
+ cd "$builddir/jniwrap"
+ ant compile javadoc
}
package() {
- cd "$builddir"
- mkdir -p $pkgdir/usr/bin
make DESTDIR="$pkgdir" install
+
+ mkdir -p "$pkgdir/usr/share/doc/$pkgname/javadoc"
+ cp -R jniwrap/out/apidocs/* "$pkgdir/usr/share/doc/$pkgname/javadoc"
+ install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
+}
+
+java() {
+ pkgdesc="Cartographic projection library (JNI bindings)"
+ depends="so:libproj.so.15"
+
+ cd "$builddir/jniwrap"
+ mkdir -p "$subpkgdir/usr/share/java/"
+ local _javabindingsver=`grep "name=\"version\"" build.xml | cut -d'"' -f 4`
+ mv out/proj.jar "$subpkgdir/usr/share/java/proj-${_javabindingsver}.jar"
+ ln -s "proj-${_javabindingsver}.jar" "$subpkgdir/usr/share/java/proj.jar"
+
+ local _libfilepath=`ls $pkgdir/usr/lib/libproj.so.??`
+ local _libfilename=`basename $_libfilepath`
+ mkdir -p "$subpkgdir/usr/java/packages/lib/"
+ ln -s "/usr/lib/$_libfilename" "$subpkgdir/usr/java/packages/lib/libproj.so"
+}
+
+check() {
+ make -j1 check
+
+ # Test JNI bindings
+ cp $srcdir/TestJni.java TestJni.java
+ /usr/lib/jvm/default-jvm/bin/javac -cp "$builddir/jniwrap/out/proj.jar" TestJni.java
+ PROJ_LIB="$builddir"/data /usr/lib/jvm/java-${_jdkver}-openjdk/bin/java \
+ -Djava.library.path="$builddir/src/.libs/" \
+ -cp "$builddir/jniwrap/out/proj.jar":. \
+ TestJni | \
+ grep "\[9.0, 0.0, 8.101251062924646, 0.904618578893133, 9.898748937075354, -0.904618578893133\]"
}
-sha512sums="7e7af901031801aa799df5dd2c863f31f0fb98eef7cc6883257bc4778b2df1b8eeee30f8ffca2f882261655ebfb04d46804dd87192bb47a58e9a253d4c461c69 proj-6.1.0.tar.gz"
+
+sha512sums="7e7af901031801aa799df5dd2c863f31f0fb98eef7cc6883257bc4778b2df1b8eeee30f8ffca2f882261655ebfb04d46804dd87192bb47a58e9a253d4c461c69 proj-6.1.0.tar.gz
+d26e7e4c87e322682fad2bb6e4dec09f610dfc9f9d82b3c96fe379167fef47ad67449701c32efc6cd44f66621354585a436130148df3fbbbf085adda1371bf7a 10-test-tolerance.patch
+36fe2482f89c6ca38883db99b7f1bf5c650a499c678f799f6b10040e3c90873f6c8bfae08f80eaca99b8957a5361b6966f1925184b4050885af1808e05d063e9 TestJni.java"
diff --git a/testing/proj4/TestJni.java b/testing/proj4/TestJni.java
new file mode 100644
index 0000000000..6a517849f6
--- /dev/null
+++ b/testing/proj4/TestJni.java
@@ -0,0 +1,20 @@
+import org.proj4.*;
+import java.util.Arrays;
+
+/**
+ * Converts coordinates from EPSG:32632 (WGS 84 / UTM zone 32N) to WGS84,
+ * then prints the result to the standard output stream.
+ */
+public class TestJni {
+ public static void main(String[] args) throws PJException {
+ PJ sourcePJ = new PJ("+init=epsg:32632"); // (x,y) axis order
+ PJ targetPJ = new PJ("+proj=latlong +datum=WGS84"); // (λ,φ) axis order
+ double[] coordinates = {
+ 500000, 0, // First coordinate
+ 400000, 100000, // Second coordinate
+ 600000, -100000 // Third coordinate
+ };
+ sourcePJ.transform(targetPJ, 2, coordinates, 0, 3);
+ System.out.println(Arrays.toString(coordinates));
+ }
+}