summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-08-13 17:17:40 (GMT)
committerTobias Markmann <tm@ayena.de>2013-08-13 17:40:43 (GMT)
commit437e70ff9d254b11a30a4926010a91543d7f282c (patch)
tree123ef9476d89ad32643356ea11c52d212d2d03ad /3rdParty
parent3eefe28a2f6cc1e33d9d2b0bad7f9c6f2146352f (diff)
downloadswift-437e70ff9d254b11a30a4926010a91543d7f282c.zip
swift-437e70ff9d254b11a30a4926010a91543d7f282c.tar.bz2
Adding basic support for Android and Unbound (No IPv6 yet).
Change-Id: I1d74324515b20e0dc3d0ef4aa2f556fea7b4bee3 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.s
Diffstat (limited to '3rdParty')
-rw-r--r--3rdParty/Boost/02_android_compilation_fixes.diff36
-rw-r--r--3rdParty/Ldns/01_andoird_compilation_fixes.diff15
-rw-r--r--3rdParty/Ldns/SConscript70
-rwxr-xr-x3rdParty/Ldns/prepare_ldns.sh5
-rw-r--r--3rdParty/LibMiniUPnPc/01_android_compilation_fixes.diff16
-rw-r--r--3rdParty/LibNATPMP/01_android_compilation_fix.diff34
-rw-r--r--3rdParty/Unbound/01_android_fixes.diff13
-rw-r--r--3rdParty/Unbound/SConscript108
-rwxr-xr-x3rdParty/Unbound/prepare_unbound.sh5
9 files changed, 302 insertions, 0 deletions
diff --git a/3rdParty/Boost/02_android_compilation_fixes.diff b/3rdParty/Boost/02_android_compilation_fixes.diff
new file mode 100644
index 0000000..9aba7e1
--- /dev/null
+++ b/3rdParty/Boost/02_android_compilation_fixes.diff
@@ -0,0 +1,36 @@
+diff --git a/3rdParty/Boost/src/boost/detail/endian.hpp b/3rdParty/Boost/src/boost/detail/endian.hpp
+index 98c870c..ac77a2e 100644
+--- a/3rdParty/Boost/src/boost/detail/endian.hpp
++++ b/3rdParty/Boost/src/boost/detail/endian.hpp
+@@ -66,8 +66,8 @@
+ || defined(_M_ALPHA) || defined(__amd64) \
+ || defined(__amd64__) || defined(_M_AMD64) \
+ || defined(__x86_64) || defined(__x86_64__) \
+- || defined(_M_X64) || defined(__bfin__)
+-
++ || defined(_M_X64) || defined(__bfin__) \
++ || defined(ANDROID)
+ # define BOOST_LITTLE_ENDIAN
+ # define BOOST_BYTE_ORDER 1234
+ #else
+diff --git a/3rdParty/Boost/src/libs/filesystem/src/operations.cpp b/3rdParty/Boost/src/libs/filesystem/src/operations.cpp
+index 16a336f..d066e40 100644
+--- a/3rdParty/Boost/src/libs/filesystem/src/operations.cpp
++++ b/3rdParty/Boost/src/libs/filesystem/src/operations.cpp
+@@ -73,10 +73,14 @@ using std::wstring;
+ const fs::path dot_dot_path("..");
+ # include <sys/types.h>
+ # include <sys/stat.h>
+-# if !defined(__APPLE__) && !defined(__OpenBSD__)
++# if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(ANDROID)
+ # include <sys/statvfs.h>
+ # define BOOST_STATVFS statvfs
+ # define BOOST_STATVFS_F_FRSIZE vfs.f_frsize
++# elif defined (ANDROID)
++# include <sys/vfs.h>
++# define BOOST_STATVFS statfs
++# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>(vfs.f_bsize)
+ # else
+ # ifdef __OpenBSD__
+ # include <sys/param.h>
+ -- \ No newline at end of file
diff --git a/3rdParty/Ldns/01_andoird_compilation_fixes.diff b/3rdParty/Ldns/01_andoird_compilation_fixes.diff
new file mode 100644
index 0000000..9d6ec08
--- /dev/null
+++ b/3rdParty/Ldns/01_andoird_compilation_fixes.diff
@@ -0,0 +1,15 @@
+--- 3rdParty/Ldns/src/ldns/ldns/ldns.h 2013-04-12 14:30:16.000000000 +0200
++++ 3rdParty/Ldns/src/ldns/ldns/ldns.h 2013-04-12 14:30:48.000000000 +0200
+@@ -123,6 +123,12 @@
+ #include <ldns/sha1.h>
+ #include <ldns/sha2.h>
+
++#ifdef __ANDROID__
++#ifndef in_port_t
++#define in_port_t uint16_t
++#endif
++#endif
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
diff --git a/3rdParty/Ldns/SConscript b/3rdParty/Ldns/SConscript
new file mode 100644
index 0000000..a43bde7
--- /dev/null
+++ b/3rdParty/Ldns/SConscript
@@ -0,0 +1,70 @@
+Import("env")
+
+if env.get("LDNS_BUNDLED", False) :
+
+ if env["PLATFORM"] == "win32" :
+ cppflags = ["/I" + Dir("#/3rdParty/Ldns/src/ldns").abspath]
+ else :
+ cppflags = [("-isystem", Dir("#/3rdParty/Ldns/src/ldns").abspath)]
+
+
+################################################################################
+# Flags
+################################################################################
+
+ if env["SCONS_STAGE"] == "flags" :
+ env["LDNS_FLAGS"] = {
+ "CPPPATH": [Dir("src/ldns")],
+ "CPPFLAGS": cppflags,
+ "LIBPATH": [env.Dir(".")],
+ "LIBS": ["Swiften_Ldns"],
+ }
+ if env["target"] == "android" :
+ env["LDNS_FLAGS"]["CPPPATH"].append(Dir("src/android"))
+
+################################################################################
+# Build
+################################################################################
+
+ if env["SCONS_STAGE"] == "build" :
+ myenv = env.Clone()
+ myenv.Append(CPPDEFINES = [("LDNS_STATICLIB")])
+ myenv.Append(CPPPATH = ["src/ldns", "."])
+ if env["target"] == "android" :
+ myenv.Append(CPPPATH = ["src/android"])
+ myenv.UseFlags(env["OPENSSL_FLAGS"])
+
+ env["LDNS_OBJECTS"] = myenv.SwiftenObject([
+ "src/ldns/compat/b32_ntop.c",
+ "src/ldns/compat/b32_pton.c",
+ "src/ldns/compat/b64_ntop.c",
+ "src/ldns/compat/b64_pton.c",
+ "src/ldns/buffer.c",
+ "src/ldns/dname.c",
+ "src/ldns/dnssec_sign.c",
+ "src/ldns/dnssec_verify.c",
+ "src/ldns/dnssec_zone.c",
+ "src/ldns/dnssec.c",
+ "src/ldns/error.c",
+ "src/ldns/higher.c",
+ "src/ldns/host2str.c",
+ "src/ldns/host2wire.c",
+ "src/ldns/keys.c",
+ "src/ldns/linktest.c",
+ "src/ldns/net.c",
+ "src/ldns/packet.c",
+ "src/ldns/parse.c",
+ "src/ldns/rbtree.c",
+ "src/ldns/rdata.c",
+ "src/ldns/resolver.c",
+ "src/ldns/rr_functions.c",
+ "src/ldns/rr.c",
+ "src/ldns/sha1.c",
+ "src/ldns/sha2.c",
+ "src/ldns/str2host.c",
+ "src/ldns/tsig.c",
+ "src/ldns/update.c",
+ "src/ldns/util.c",
+ "src/ldns/wire2host.c",
+ "src/ldns/zone.c",
+ ])
diff --git a/3rdParty/Ldns/prepare_ldns.sh b/3rdParty/Ldns/prepare_ldns.sh
new file mode 100755
index 0000000..e057301
--- /dev/null
+++ b/3rdParty/Ldns/prepare_ldns.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+curl -o src/ldns-1.6.16.tar.gz http://www.nlnetlabs.nl/downloads/ldns/ldns-1.6.16.tar.gz
+cd src
+tar -xf ldns-1.6.16.tar.gz
+mv ldns-1.6.16 ldns \ No newline at end of file
diff --git a/3rdParty/LibMiniUPnPc/01_android_compilation_fixes.diff b/3rdParty/LibMiniUPnPc/01_android_compilation_fixes.diff
new file mode 100644
index 0000000..4d7ade5
--- /dev/null
+++ b/3rdParty/LibMiniUPnPc/01_android_compilation_fixes.diff
@@ -0,0 +1,16 @@
+diff --git a/3rdParty/LibMiniUPnPc/src/miniupnpc/miniwget.c b/3rdParty/LibMiniUPnPc/src/miniupnpc/miniwget.c
+index 87f6155..0c31416 100644
+--- a/3rdParty/LibMiniUPnPc/src/miniupnpc/miniwget.c
++++ b/3rdParty/LibMiniUPnPc/src/miniupnpc/miniwget.c
+@@ -44,6 +44,10 @@
+ #define MIN(x,y) (((x)<(y))?(x):(y))
+ #endif
+
++#ifdef __ANDROID__
++#define MIN(x,y) (((x)<(y))?(x):(y))
++#endif
++
+ #include "miniupnpcstrings.h"
+ #include "miniwget.h"
+ #include "connecthostport.h"
+-- \ No newline at end of file
diff --git a/3rdParty/LibNATPMP/01_android_compilation_fix.diff b/3rdParty/LibNATPMP/01_android_compilation_fix.diff
new file mode 100644
index 0000000..78943aa
--- /dev/null
+++ b/3rdParty/LibNATPMP/01_android_compilation_fix.diff
@@ -0,0 +1,34 @@
+diff --git a/3rdParty/LibNATPMP/src/libnatpmp/getgateway.h b/3rdParty/LibNATPMP/src/libnatpmp/getgateway.h
+index 9432528..51dadb7 100644
+--- a/3rdParty/LibNATPMP/src/libnatpmp/getgateway.h
++++ b/3rdParty/LibNATPMP/src/libnatpmp/getgateway.h
+@@ -27,6 +27,11 @@ typedef unsigned short uint16_t;
+ #endif
+ #include "declspec.h"
+
++#ifdef ANDROID
++#include <arpa/inet.h>
++#define in_addr_t uint32_t
++#endif
++
+ /* getdefaultgateway() :
+ * return value :
+ * 0 : success
+diff --git a/3rdParty/LibNATPMP/src/libnatpmp/natpmp.h b/3rdParty/LibNATPMP/src/libnatpmp/natpmp.h
+index 1175b58..c870371 100644
+--- a/3rdParty/LibNATPMP/src/libnatpmp/natpmp.h
++++ b/3rdParty/LibNATPMP/src/libnatpmp/natpmp.h
+@@ -39,6 +39,12 @@ typedef unsigned short uint16_t;
+ #include <netinet/in.h>
+ #endif
+
++#ifdef ANDROID
++#include <arpa/inet.h>
++#define in_addr_t uint32_t
++#endif
++
++
+ typedef struct {
+ int s; /* socket */
+ in_addr_t gateway; /* default gateway (IPv4) */
+-- \ No newline at end of file
diff --git a/3rdParty/Unbound/01_android_fixes.diff b/3rdParty/Unbound/01_android_fixes.diff
new file mode 100644
index 0000000..c8144ad
--- /dev/null
+++ b/3rdParty/Unbound/01_android_fixes.diff
@@ -0,0 +1,13 @@
+--- a/3rdParty/Unbound/src/unbound/libunbound/libunbound.c
++++ b/3rdParty/Unbound/src/unbound/libunbound/libunbound.c
+@@ -812,6 +812,10 @@ ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname)
+ char* parse, *addr;
+ int r;
+
++#ifdef __ANDROID__
++ ub_ctx_set_fwd(ctx, "8.8.8.8");
++ ub_ctx_set_fwd(ctx, "8.8.4.4");
++#endif
+ if(fname == NULL) {
+ #if !defined(UB_ON_WINDOWS) || !defined(HAVE_WINDOWS_H)
+ fname = "/etc/resolv.conf"; \ No newline at end of file
diff --git a/3rdParty/Unbound/SConscript b/3rdParty/Unbound/SConscript
new file mode 100644
index 0000000..99cd6a3
--- /dev/null
+++ b/3rdParty/Unbound/SConscript
@@ -0,0 +1,108 @@
+Import("env")
+
+if env.get("UNBOUND_BUNDLED", False) :
+
+ if env["PLATFORM"] == "win32" :
+ cppflags = ["/I" + Dir("#/3rdParty/Unbound/src/unbound").abspath]
+ else :
+ cppflags = [("-isystem", Dir("#/3rdParty/Unbound/src/unbound").abspath)]
+
+
+################################################################################
+# Flags
+################################################################################
+
+ if env["SCONS_STAGE"] == "flags" :
+ env["UNBOUND_FLAGS"] = {
+ "CPPPATH": [Dir("src/unbound/libunbound")],
+ "CPPFLAGS": cppflags,
+ "LIBPATH": [env.Dir(".")],
+ "LIBS": ["Swiften_Unbound"],
+ }
+ if env["target"] == "android" :
+ env["UNBOUND_FLAGS"]["CPPPATH"].append(Dir("src/android/compat"))
+
+################################################################################
+# Build
+################################################################################
+
+ if env["SCONS_STAGE"] == "build" :
+ myenv = env.Clone()
+ myenv.Append(CPPDEFINES = [("UNBOUND_STATICLIB")])
+ myenv.Append(CPPPATH = ["../Ldns/src/ldns", "src/unbound", "."])
+ if env["target"] == "android" :
+ myenv.Append(CPPPATH = ["src/android/compat", "src/android/config"])
+ myenv.Append(CPPPATH = ["../Ldns/src/android"])
+ myenv.UseFlags(env["OPENSSL_FLAGS"])
+
+ unbound_objects = [
+ "src/unbound/daemon/acl_list.c",
+ "src/unbound/daemon/cachedump.c",
+ "src/unbound/daemon/daemon.c",
+ "src/unbound/daemon/remote.c",
+ "src/unbound/daemon/stats.c",
+ "src/unbound/daemon/unbound.c",
+ # duplicate symbols: "src/src/daemon/worker.c",
+ "src/unbound/iterator/iter_delegpt.c",
+ "src/unbound/iterator/iter_donotq.c",
+ "src/unbound/iterator/iter_fwd.c",
+ "src/unbound/iterator/iter_hints.c",
+ "src/unbound/iterator/iter_priv.c",
+ "src/unbound/iterator/iter_resptype.c",
+ "src/unbound/iterator/iter_scrub.c",
+ "src/unbound/iterator/iter_utils.c",
+ "src/unbound/iterator/iterator.c",
+ "src/unbound/libunbound/context.c",
+ "src/unbound/libunbound/libunbound.c",
+ "src/unbound/libunbound/libworker.c",
+ "src/unbound/services/cache/dns.c",
+ "src/unbound/services/cache/infra.c",
+ "src/unbound/services/cache/rrset.c",
+ "src/unbound/services/listen_dnsport.c",
+ "src/unbound/services/localzone.c",
+ "src/unbound/services/mesh.c",
+ "src/unbound/services/modstack.c",
+ "src/unbound/services/outbound_list.c",
+ "src/unbound/services/outside_network.c",
+ "src/unbound/util/alloc.c",
+ "src/unbound/util/config_file.c",
+ "src/unbound/util/configlexer.c",
+ "src/unbound/util/configparser.c",
+ "src/unbound/util/data/dname.c",
+ "src/unbound/util/data/msgencode.c",
+ "src/unbound/util/data/msgparse.c",
+ "src/unbound/util/data/msgreply.c",
+ "src/unbound/util/data/packed_rrset.c",
+ "src/unbound/util/fptr_wlist.c",
+ "src/unbound/util/locks.c",
+ "src/unbound/util/log.c",
+ "src/unbound/util/mini_event.c",
+ "src/unbound/util/module.c",
+ "src/unbound/util/net_help.c",
+ "src/unbound/util/netevent.c",
+ "src/unbound/util/random.c",
+ "src/unbound/util/rbtree.c",
+ "src/unbound/util/regional.c",
+ "src/unbound/util/rtt.c",
+ "src/unbound/util/storage/dnstree.c",
+ "src/unbound/util/storage/lookup3.c",
+ "src/unbound/util/storage/lruhash.c",
+ "src/unbound/util/storage/slabhash.c",
+ "src/unbound/util/timehist.c",
+ "src/unbound/util/tube.c",
+ #src/unbound/util/winsock_event.c
+ "src/unbound/validator/autotrust.c",
+ "src/unbound/validator/val_anchor.c",
+ "src/unbound/validator/val_kcache.c",
+ "src/unbound/validator/val_kentry.c",
+ "src/unbound/validator/val_neg.c",
+ "src/unbound/validator/val_nsec.c",
+ "src/unbound/validator/val_nsec3.c",
+ "src/unbound/validator/val_secalgo.c",
+ "src/unbound/validator/val_sigcrypt.c",
+ "src/unbound/validator/val_utils.c",
+ "src/unbound/validator/validator.c",
+ ]
+ if env["target"] == "android" :
+ unbound_objects.append("src/android/compat/glob.c")
+ env["UNBOUND_OBJECTS"] = myenv.SwiftenObject(unbound_objects)
diff --git a/3rdParty/Unbound/prepare_unbound.sh b/3rdParty/Unbound/prepare_unbound.sh
new file mode 100755
index 0000000..b506ae4
--- /dev/null
+++ b/3rdParty/Unbound/prepare_unbound.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+curl -o src/unbound-1.4.20.tar.gz http://www.unbound.net/downloads/unbound-1.4.20.tar.gz
+cd src
+tar -xf unbound-1.4.20.tar.gz
+mv unbound-1.4.20 unbound \ No newline at end of file