summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman@collabora.co.uk>2011-05-13 17:18:46 (GMT)
committerDerek Foreman <derek.foreman@collabora.co.uk>2011-05-13 17:18:46 (GMT)
commitff46d85d59cacefd74c8e33a48525775e21efe6d (patch)
tree2056dc68a869bc2ccb0040b05ad20e046631cb07
parent2a9687fced289571f19c95e0c759ac9eac41940c (diff)
downloadlibgpg-error-ff46d85d59cacefd74c8e33a48525775e21efe6d.tar.gz
libgpg-error-ff46d85d59cacefd74c8e33a48525775e21efe6d.tar.xz
Support building on Android
-rw-r--r--.gitignore1
-rw-r--r--Android.mk33
-rw-r--r--configure.ac14
-rw-r--r--gpg-error-uninstalled.pc.in5
-rw-r--r--gpg-error.pc.in10
-rw-r--r--src/Makefile.am17
-rw-r--r--src/gpg-error-config.in88
7 files changed, 76 insertions, 92 deletions
diff --git a/.gitignore b/.gitignore
index 6b8851e..69fa79b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+Android.mk
Makefile.in
aclocal.m4
autom4te.cache/
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..6ef7794
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,33 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+GPG_ERROR_BUILT_SOURCES := \
+ src/Android.mk
+
+gpg_error-configure-real:
+ cd $(GPG_ERROR_TOP) ; \
+ $(GPG_ERROR_TOP)/autogen.sh && \
+ CC="$(CONFIGURE_CC)" \
+ CFLAGS="$(CONFIGURE_CFLAGS)" \
+ LD=$(TARGET_LD) \
+ LDFLAGS="$(CONFIGURE_LDFLAGS)" \
+ CPP=$(CONFIGURE_CPP) \
+ CPPFLAGS=$(CONFIGURE_CPPFLAGS) \
+ PKG_CONFIG_LIBDIR=$(CONFIGURE_PKG_CONFIG_LIBDIR) \
+ PKG_CONFIG_TOP_BUILD_DIR=$(PKG_CONFIG_TOP_BUILD_DIR) \
+ $(GPG_ERROR_TOP)/configure --host=arm-linux-androideabi \
+ --disable-Werror && \
+ for file in $(GPG_ERROR_BUILT_SOURCES); do \
+ rm -f $$file && \
+ make -C $$(dirname $$file) $$(basename $$file) ; \
+ done
+
+gpg_error-configure: gpg_error-configure-real
+
+.PHONY: gpg_error-configure
+
+CONFIGURE_TARGETS += gpg_error-configure
+
+#include all the subdirs...
+-include $(GPG_ERROR_TOP)/src/Android.mk
diff --git a/configure.ac b/configure.ac
index 5ae5b16..cb3f4f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,7 @@ AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
# Set some internal variables depending on the platform for later use.
have_w32_system=no
have_w32ce_system=no
+have_android_system=no
case "${host}" in
*-mingw32ce*)
have_w32_system=yes
@@ -97,6 +98,9 @@ case "${host}" in
*-mingw32*)
have_w32_system=yes
;;
+ *-android*)
+ have_android_system=yes
+ ;;
*)
;;
esac
@@ -145,10 +149,16 @@ AC_SUBST(GPG_ERROR_CONFIG_LIBS)
AC_SUBST(GPG_ERROR_CONFIG_CFLAGS)
AC_SUBST(GPG_ERROR_CONFIG_ISUBDIRAFTER)
AC_SUBST(GPG_ERROR_CONFIG_HOST)
-AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config])
+AC_CONFIG_FILES([
+ gpg-error.pc
+ gpg-error-uninstalled.pc
+])
# Special defines for certain platforms
+if test "$have_android_system" = yes; then
+ AC_DEFINE(HAVE_ANDROID_SYSTEM,1,[Defined if we run on Android])
+fi
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system])
if test "$have_w32ce_system" = yes; then
@@ -171,7 +181,7 @@ AC_SUBST(BUILD_TIMESTAMP)
AC_SUBST(BUILD_FILEVERSION)
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
-
+AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
AC_ARG_ENABLE(languages,
[ --disable-languages do not build support for other languages than C])
diff --git a/gpg-error-uninstalled.pc.in b/gpg-error-uninstalled.pc.in
new file mode 100644
index 0000000..0a3819b
--- /dev/null
+++ b/gpg-error-uninstalled.pc.in
@@ -0,0 +1,5 @@
+Name: gpg-error Uninstalled
+Description: GPG Error helper library, Not Installed
+Version: @VERSION@
+Libs: -lgpg-error
+Cflags: -I${pcfiledir}/includes
diff --git a/gpg-error.pc.in b/gpg-error.pc.in
new file mode 100644
index 0000000..479b3da
--- /dev/null
+++ b/gpg-error.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gpg-error
+Description: GPG Error Helper Library
+Version: @VERSION@
+Libs: -L${libdir} -lgnutls
+Cflags: -I${includedir}
diff --git a/src/Makefile.am b/src/Makefile.am
index 518a4c0..ab26586 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,8 +26,13 @@ if HAVE_W32CE_SYSTEM
gpg_extra_headers = gpg-extra/errno.h
extra_cppflags = -idirafter gpg-extra
else
-gpg_extra_headers =
-extra_cppflags =
+if HAVE_ANDROID_SYSTEM
+gpg_extra_headers =
+extra_cppflags = -I$(SYSROOT)/usr/include
+else
+gpg_extra_headers =
+extra_cppflags =
+endif
endif
localedir = $(datadir)/locale
@@ -204,6 +209,14 @@ gpg-error.h: Makefile mkheader.awk err-sources.h.in err-codes.h.in \
extra-h.in \
$(srcdir)/gpg-error.h.in > $@
+Android.mk: Makefile.am gpg-error.h code-from-errno.h
+ androgenizer -:PROJECT gpg_error -:SHARED libgpg-error -:TAGS eng debug \
+ -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+ -:SOURCES $(libgpg_error_la_SOURCES) \
+ -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) $(libgpg_error_la_CPPFLAGS) \
+ -:LDFLAGS $(libgpg_error_la_LIBADD) $(libgpg_error_la_LDFLAGS) \
+ > $@
install-data-local:
if HAVE_W32CE_SYSTEM
diff --git a/src/gpg-error-config.in b/src/gpg-error-config.in
deleted file mode 100644
index 14f0625..0000000
--- a/src/gpg-error-config.in
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh
-# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-#
-# This file is free software; as a special exception the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# This file is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-includedir=@includedir@
-libdir=@libdir@
-isubdirafter="@GPG_ERROR_CONFIG_ISUBDIRAFTER@"
-
-output=""
-
-usage()
-{
- cat <<EOF
-Usage: gpg-error-config [OPTIONS]
-Options:
- [--prefix]
- [--exec-prefix]
- [--version]
- [--libs]
- [--cflags]
-EOF
- exit $1
-}
-
-if test $# -eq 0; then
- usage 1 1>&2
-fi
-
-while test $# -gt 0; do
- case "$1" in
- -*=*)
- optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
- ;;
- *)
- optarg=
- ;;
- esac
-
- case $1 in
- --prefix)
- output="$output $prefix"
- ;;
- --exec-prefix)
- output="$output $exec_prefix"
- ;;
- --version)
- echo "@VERSION@"
- exit 0
- ;;
- --cflags)
- if test "x$includedir" != "x/usr/include" -a "x$includedir" != "x/include"; then
- output="$output -I$includedir"
- fi
- # Note: -idirafter is a gcc extension. It is only used on
- # systems where gcc is the only compiler we support.
- for i in $isubdirafter; do
- output="$output -idirafter ${includedir}/${i}"
- done
- output="$output @GPG_ERROR_CONFIG_CFLAGS@"
- ;;
- --libs)
- if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/lib"; then
- output="$output -L$libdir"
- fi
- output="$output @GPG_ERROR_CONFIG_LIBS@"
- ;;
- --host)
- echo "@GPG_ERROR_CONFIG_HOST@"
- exit 0
- ;;
- *)
- usage 1 1>&2
- ;;
- esac
- shift
-done
-
-echo $output