summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-06-05 10:33:08 +0100
committerAndrzej Hunt <andrzej@ahunt.org>2015-10-20 18:18:42 +0200
commitafebca3e1530a17bfd40345b31f9bf59dd72c916 (patch)
treecd40102b1a203b8febb48e2e674702292c0daf77
parent9374e983c6fb5b341cb19c4ef904fc2473c56bf5 (diff)
WIP: udunits2 build on windows
It now builds, but only produces a static library. libtool (which udunits2 uses for building) doesn't like the inclusion of expat as a static library and refuses to build a dll - I still need to investigate more. Change-Id: Id4ef089fa9ecbf5cac109bf164b3b3278ba74912
-rw-r--r--external/udunits2/ExternalPackage_udunits2.mk2
-rw-r--r--external/udunits2/ExternalProject_udunits2.mk11
-rw-r--r--external/udunits2/UnpackedTarball_udunits2.mk6
-rw-r--r--external/udunits2/udunits2-windows-cygwin.patch.1200
4 files changed, 217 insertions, 2 deletions
diff --git a/external/udunits2/ExternalPackage_udunits2.mk b/external/udunits2/ExternalPackage_udunits2.mk
index 3ac5920b60a7..b3d02619f173 100644
--- a/external/udunits2/ExternalPackage_udunits2.mk
+++ b/external/udunits2/ExternalPackage_udunits2.mk
@@ -12,7 +12,7 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,udunits2,udunits2))
$(eval $(call gb_ExternalPackage_use_external_project,udunits2,udunits2))
ifeq ($(OS)-$(COM),WNT-MSC)
-$(eval $(call gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/iudunits2.dll,lib/.libs/iudunits2.dll))
+$(eval $(call gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/iudunits2.lib,lib/.libs/libudunits2.lib))
else ifeq ($(OS),MACOSX)
$(eval $(call gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/libudunits2.0.dylib,lib/.libs/libudunits2.0.dylib))
else
diff --git a/external/udunits2/ExternalProject_udunits2.mk b/external/udunits2/ExternalProject_udunits2.mk
index ba6479ee8cd1..83dd30be5667 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -13,6 +13,10 @@ $(eval $(call gb_ExternalProject_use_autoconf,udunits2,configure))
$(eval $(call gb_ExternalProject_use_autoconf,udunits2,build))
+$(eval $(call gb_ExternalProject_use_externals,udunits2,\
+ expat \
+))
+
$(eval $(call gb_ExternalProject_register_targets,udunits2,\
configure \
build \
@@ -28,8 +32,13 @@ $(call gb_ExternalProject_get_state_target,udunits2,build) : $(call gb_ExternalP
$(call gb_ExternalProject_get_state_target,udunits2,configure) :
$(call gb_ExternalProject_run,configure,\
- MAKE=$(MAKE) ./configure \
+ MAKE=$(MAKE) \
+ CFLAGS="$(if $(SYSTEM_EXPAT),,-I$(call gb_UnpackedTarball_get_dir,expat)/lib)" \
+ LDFLAGS="$(if $(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR))" \
+ ./configure \
$(if $(ENABLE_DEBUG),--enable-debug) \
+ $(ifeq ($(OS),WNT) --enable-shared) \
+ --enable-shared \
--build=$(if $(filter WNT,$(OS)),i686-pc-cygwin,$(BUILD_PLATFORM)) \
)
diff --git a/external/udunits2/UnpackedTarball_udunits2.mk b/external/udunits2/UnpackedTarball_udunits2.mk
index 820472e80af3..0d688080ddec 100644
--- a/external/udunits2/UnpackedTarball_udunits2.mk
+++ b/external/udunits2/UnpackedTarball_udunits2.mk
@@ -17,4 +17,10 @@ $(eval $(call gb_UnpackedTarball_add_patches,udunits2,\
))
endif
+ifeq ($(OS),WNT)
+$(eval $(call gb_UnpackedTarball_add_patches,udunits2,\
+ external/udunits2/udunits2-windows-cygwin.patch.1 \
+))
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/external/udunits2/udunits2-windows-cygwin.patch.1 b/external/udunits2/udunits2-windows-cygwin.patch.1
new file mode 100644
index 000000000000..3ed69aacee6d
--- /dev/null
+++ b/external/udunits2/udunits2-windows-cygwin.patch.1
@@ -0,0 +1,200 @@
+diff -ur udunits2.org/configure udunits2/configure
+--- udunits2.org/configure 2015-06-04 07:14:02.996631200 -0700
++++ udunits2/configure 2015-06-04 09:34:57.354053000 -0700
+@@ -4704,12 +4704,12 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dirname" >&5
+ $as_echo "$ac_cv_search_dirname" >&6; }
+ ac_res=$ac_cv_search_dirname
+-if test "$ac_res" != no; then :
+- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+-
+-else
+- as_fn_error $? "cannot find function dirname" "$LINENO" 5
+-fi
++#if test "$ac_res" != no; then :
++# test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
++#
++#else
++# as_fn_error $? "cannot find function dirname" "$LINENO" 5
++#fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing log10" >&5
+ $as_echo_n "checking for library containing log10... " >&6; }
+@@ -4762,12 +4762,12 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_log10" >&5
+ $as_echo "$ac_cv_search_log10" >&6; }
+ ac_res=$ac_cv_search_log10
+-if test "$ac_res" != no; then :
+- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+-
+-else
+- as_fn_error $? "cannot find function log10" "$LINENO" 5
+-fi
++#if test "$ac_res" != no; then :
++# test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
++#
++#else
++# as_fn_error $? "cannot find function log10" "$LINENO" 5
++#fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing XML_StopParser" >&5
+ $as_echo_n "checking for library containing XML_StopParser... " >&6; }
+@@ -8463,7 +8463,7 @@
+ enable_dlopen=no
+
+
+- enable_win32_dll=no
++ enable_win32_dll=yes
+
+
+ # Check whether --enable-shared was given.
+diff -ur udunits2.org/lib/idToUnitMap.c udunits2/lib/idToUnitMap.c
+--- udunits2.org/lib/idToUnitMap.c 2015-06-04 07:14:03.043506200 -0700
++++ udunits2/lib/idToUnitMap.c 2015-06-04 09:34:57.385303000 -0700
+@@ -16,11 +16,11 @@
+ #endif
+
+ #include <assert.h>
+-#ifdef _MSC_VER
+-#include "tsearch.h"
+-#else
++//#ifdef _MSC_VER
++//#include "tsearch.h"
++//#else
+ #include <search.h>
+-#endif
++//#endif
+
+ #include <stdlib.h>
+
+diff -ur udunits2.org/lib/Makefile.in udunits2/lib/Makefile.in
+--- udunits2.org/lib/Makefile.in 2015-06-04 07:14:03.059131200 -0700
++++ udunits2/lib/Makefile.in 2015-06-04 09:37:49.791553000 -0700
+@@ -349,7 +349,7 @@
+ #pdf_DATA = udunits2lib.pdf
+ AM_MAKEINFOFLAGS = -I $(top_srcdir)
+ AM_MAKEINFOHTMLFLAGS = --no-split -I $(top_srcdir)
+-libudunits2_la_LDFLAGS = -version-number 0:1:0
++libudunits2_la_LDFLAGS = -version-number 0:1:0 -no-undefined -win32-dll
+ lex_prefix = ut
+ LFLAGS = -d -P$(lex_prefix)
+ include_HEADERS = udunits2.h converter.h $(am__append_2)
+diff -ur udunits2.org/lib/prefix.c udunits2/lib/prefix.c
+--- udunits2.org/lib/prefix.c 2015-06-04 07:14:03.059131200 -0700
++++ udunits2/lib/prefix.c 2015-06-04 09:34:57.385303000 -0700
+@@ -17,11 +17,11 @@
+
+ #include <ctype.h>
+ #include <errno.h>
+-#ifdef _MSC_VER
+-#include "tsearch.h"
+-#else
++//#ifdef _MSC_VER
++//#include "tsearch.h"
++//#else
+ #include <search.h>
+-#endif
++//#endif
+ #include <stdlib.h>
+
+ #include <string.h>
+diff -ur udunits2.org/lib/scanner.c udunits2/lib/scanner.c
+--- udunits2.org/lib/scanner.c 2015-06-04 07:14:03.059131200 -0700
++++ udunits2/lib/scanner.c 2015-06-04 09:34:57.385303000 -0700
+@@ -1047,7 +1047,7 @@
+ * The user has a chance to override it with an option.
+ */
+ /* %if-c-only */
+-#include <unistd.h>
++//#include <unistd.h>
+ /* %endif */
+ /* %if-c++-only */
+ /* %endif */
+diff -ur udunits2.org/lib/systemMap.c udunits2/lib/systemMap.c
+--- udunits2.org/lib/systemMap.c 2015-06-04 07:14:03.152881200 -0700
++++ udunits2/lib/systemMap.c 2015-06-04 09:34:57.385303000 -0700
+@@ -17,11 +17,11 @@
+ # define _XOPEN_SOURCE 500
+ #endif
+
+-#ifdef _MSC_VER
+-#include "tsearch.h"
+-#else
++//#ifdef _MSC_VER
++//#include "tsearch.h"
++//#else
+ #include <search.h>
+-#endif
++//#endif
+ #include <stdlib.h>
+
+ #include "systemMap.h"
+diff -ur udunits2.org/lib/udunits.h udunits2/lib/udunits.h
+--- udunits2.org/lib/udunits.h 2015-06-04 07:14:03.043506200 -0700
++++ udunits2/lib/udunits.h 2015-06-04 09:34:57.385303000 -0700
+@@ -13,7 +13,7 @@
+ #define UT_UNITS_H_INCLUDED
+
+ #ifdef _MSC_VER
+-<io.h>
++#include <io.h>
+ #define snprintf _snprintf
+ #define close _close
+ #define open _open
+diff -ur udunits2.org/lib/udunits-1.c udunits2/lib/udunits-1.c
+--- udunits2.org/lib/udunits-1.c 2015-06-04 07:14:03.059131200 -0700
++++ udunits2/lib/udunits-1.c 2015-06-04 09:34:57.400928000 -0700
+@@ -7,11 +7,11 @@
+ */
+
+ #include <errno.h>
+-#ifdef _MSC_VER
+-#include "tsearch.h"
+-#else
++//#ifdef _MSC_VER
++//#include "tsearch.h"
++//#else
+ #include <search.h>
+-#endif
++//#endif
+ #include <stddef.h>
+ #include <stdlib.h>
+ #include <string.h>
+diff -ur udunits2.org/lib/unitcore.c udunits2/lib/unitcore.c
+--- udunits2.org/lib/unitcore.c 2015-06-04 07:14:03.059131200 -0700
++++ udunits2/lib/unitcore.c 2015-06-04 09:34:57.400928000 -0700
+@@ -56,11 +56,11 @@
+ #include <limits.h>
+ #include <math.h>
+
+-#ifdef _MSC_VER
+-#include "tsearch.h"
+-#else
++//#ifdef _MSC_VER
++//#include "tsearch.h"
++//#else
+ #include <search.h>
+-#endif
++//#endif
+
+ #include <stddef.h>
+ #include <stdio.h>
+diff -ur udunits2.org/lib/unitToIdMap.c udunits2/lib/unitToIdMap.c
+--- udunits2.org/lib/unitToIdMap.c 2015-06-04 07:14:03.059131200 -0700
++++ udunits2/lib/unitToIdMap.c 2015-06-04 09:34:57.400928000 -0700
+@@ -18,11 +18,11 @@
+ #include <assert.h>
+ #include <errno.h>
+
+-#ifdef _MSC_VER
+-#include "tsearch.h"
+-#else
++//#ifdef _MSC_VER
++//#include "tsearch.h"
++//#else
+ #include <search.h>
+-#endif
++//#endif
+
+ #include <stdlib.h>
+