From d1ebe856f1f636fa5e0e4b942486378390f8e3e4 Mon Sep 17 00:00:00 2001
From: Luke <fried.roadkill+ght@gmail.com>
Date: Fri, 1 Sep 2017 11:17:00 +0200
Subject: Added libspatialindex, a generic C/C++ library for spatial indexing

---
 src/libspatialindex-1-fixes.patch | 23 +++++++++++++++++++++++
 src/libspatialindex.mk            | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 src/libspatialindex-1-fixes.patch
 create mode 100644 src/libspatialindex.mk

diff --git a/src/libspatialindex-1-fixes.patch b/src/libspatialindex-1-fixes.patch
new file mode 100644
index 0000000..74f2775
--- /dev/null
+++ b/src/libspatialindex-1-fixes.patch
@@ -0,0 +1,23 @@
+This file is part of MXE. See LICENSE.md for licensing information.
+
+Contains ad hoc patches for cross building.
+
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Luke Potgieter <fried.roadkill+ght@gmail.com>
+Date: Thu, 24 Aug 2017 10:53:39 +0200
+Subject: [PATCH] Remove explicit header check - mingw does not ship with this header.
+
+
+diff --git a/configure.ac b/configure.ac
+index 1111111..2222222 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -38,7 +38,7 @@ AC_CHECK_HEADERS(pthread.h, [
+ LIBS="$LIBS -lpthread"
+ #endif])
+ 
+-AC_CHECK_HEADERS(sys/resource.h,, [AC_MSG_ERROR([cannot find sys/resource.h, bailing out])])
++#AC_CHECK_HEADERS(sys/resource.h,, [AC_MSG_ERROR([cannot find sys/resource.h, bailing out])])
+ AC_CHECK_HEADERS(sys/time.h,, [AC_MSG_ERROR([cannot find sys/time.h, bailing out])])
+ AC_CHECK_HEADERS(stdint.h,, [AC_MSG_ERROR([cannot find stdint.h, bailing out])])
+ AC_CHECK_HEADERS(features.h)
diff --git a/src/libspatialindex.mk b/src/libspatialindex.mk
new file mode 100644
index 0000000..60b168c
--- /dev/null
+++ b/src/libspatialindex.mk
@@ -0,0 +1,32 @@
+# This file is part of MXE. See LICENSE.md for licensing information.
+
+PKG             := libspatialindex
+$(PKG)_WEBSITE  := https://libspatialindex.github.io/
+$(PKG)_DESCR    := libspatialindex
+$(PKG)_IGNORE   :=
+$(PKG)_VERSION  := 1.8.5
+$(PKG)_CHECKSUM := 31ec0a9305c3bd6b4ad60a5261cba5402366dd7d1969a8846099717778e9a50a
+$(PKG)_SUBDIR   := spatialindex-src-$($(PKG)_VERSION)
+$(PKG)_FILE     := spatialindex-src-$($(PKG)_VERSION).tar.bz2
+$(PKG)_URL      := http://download.osgeo.org/libspatialindex/$($(PKG)_FILE)
+$(PKG)_DEPS     := gcc pthreads
+
+define $(PKG)_UPDATE
+    $(WGET) -q -O- 'http://download.osgeo.org/libspatialindex/' | \
+    $(SED) -n 's,.*spatialindex-src-\([0-9][^>]*\)\.tar.*,\1,p' | \
+    tail -1
+endef
+
+define $(PKG)_BUILD
+    cd '$(1)' && autoreconf -fi
+    cd '$(1)' && ./configure $(MXE_CONFIGURE_OPTS)
+    $(MAKE) -C '$(1)' -j '$(JOBS)'
+    $(MAKE) -C '$(1)' -j 1 '$(INSTALL_STRIP_LIB)'
+
+    # the test program will return 0 on success; -1 on error (with an error message)
+    '$(TARGET)-gcc' \
+        -W -Wall -ansi -pedantic \
+        '$(1)/test/geometry/Intersection.cc' -o '$(PREFIX)/$(TARGET)/bin/test-libspatialindex.exe'\
+        `'$(TARGET)-pkg-config' libspatialindex --cflags --libs` \
+        -lspatialindex_c -lspatialindex -lstdc++ -pthread
+endef
-- 
cgit v0.12