summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-10-19 20:29:39 +0200
committerGravatar Matt Colyer2009-10-22 07:52:53 -0700
commit544215cd776c1db58ce8e8a3db6457b5d977e421 (patch)
tree806a0dd662396f717eb428b349e4aa6e59cde47a
parent4740e30d178c8a588f522586a817039d6be8da3b (diff)
downloadlibimobiledevice-544215cd776c1db58ce8e8a3db6457b5d977e421.tar.gz
libimobiledevice-544215cd776c1db58ce8e8a3db6457b5d977e421.tar.bz2
Update swig header and autotools to compile with latest libplist API.
[#77 state:resolved] Signed-off-by: Matt Colyer <matt@colyer.name>
-rw-r--r--configure.ac7
-rw-r--r--m4/ax_swig_enable_cxx.m451
-rw-r--r--swig/Makefile.am10
-rw-r--r--swig/iphone.i63
4 files changed, 108 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac
index 29d3154..d3b5105 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,16 +9,15 @@ AC_CONFIG_SRCDIR([src/])
9AC_CONFIG_HEADERS([config.h]) 9AC_CONFIG_HEADERS([config.h])
10AC_CONFIG_MACRO_DIR([m4]) 10AC_CONFIG_MACRO_DIR([m4])
11 11
12AC_PROG_LIBTOOL
13
14AM_PATH_PYTHON(2.3) 12AM_PATH_PYTHON(2.3)
15AC_PROG_SWIG(1.3.21) 13AC_PROG_SWIG(1.3.21)
14AX_SWIG_ENABLE_CXX
16SWIG_PYTHON 15SWIG_PYTHON
17 16
18
19# Checks for programs. 17# Checks for programs.
20AC_PROG_CC 18AC_PROG_CC
21AM_PROG_CC_C_O 19AM_PROG_CC_C_O
20AC_PROG_LIBTOOL
22 21
23# Checks for libraries. 22# Checks for libraries.
24PKG_CHECK_MODULES(libusbmuxd, libusbmuxd >= 0.1.4) 23PKG_CHECK_MODULES(libusbmuxd, libusbmuxd >= 0.1.4)
@@ -26,7 +25,7 @@ PKG_CHECK_MODULES(libglib2, glib-2.0 >= 2.14.1)
26PKG_CHECK_MODULES(libgthread2, gthread-2.0 >= 2.14.1) 25PKG_CHECK_MODULES(libgthread2, gthread-2.0 >= 2.14.1)
27PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3 ) 26PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3 )
28PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1) 27PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1)
29PKG_CHECK_MODULES(libplist, libplist >= 0.13) 28PKG_CHECK_MODULES(libplist, libplist >= 0.15)
30AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libgcrypt is required to build libiphone"]) 29AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libgcrypt is required to build libiphone"])
31 30
32# Checks for header files. 31# Checks for header files.
diff --git a/m4/ax_swig_enable_cxx.m4 b/m4/ax_swig_enable_cxx.m4
new file mode 100644
index 0000000..722caeb
--- /dev/null
+++ b/m4/ax_swig_enable_cxx.m4
@@ -0,0 +1,51 @@
1# ===========================================================================
2# http://www.nongnu.org/autoconf-archive/ax_swig_enable_cxx.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7# AX_SWIG_ENABLE_CXX
8#
9# DESCRIPTION
10#
11# Enable SWIG C++ support. This affects all invocations of $(SWIG).
12#
13# LICENSE
14#
15# Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>
16# Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
17# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
18# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
19#
20# This program is free software; you can redistribute it and/or modify it
21# under the terms of the GNU General Public License as published by the
22# Free Software Foundation; either version 2 of the License, or (at your
23# option) any later version.
24#
25# This program is distributed in the hope that it will be useful, but
26# WITHOUT ANY WARRANTY; without even the implied warranty of
27# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
28# Public License for more details.
29#
30# You should have received a copy of the GNU General Public License along
31# with this program. If not, see <http://www.gnu.org/licenses/>.
32#
33# As a special exception, the respective Autoconf Macro's copyright owner
34# gives unlimited permission to copy, distribute and modify the configure
35# scripts that are the output of Autoconf when processing the Macro. You
36# need not follow the terms of the GNU General Public License when using
37# or distributing such scripts, even though portions of the text of the
38# Macro appear in them. The GNU General Public License (GPL) does govern
39# all other use of the material that constitutes the Autoconf Macro.
40#
41# This special exception to the GPL applies to versions of the Autoconf
42# Macro released by the Autoconf Archive. When you make and distribute a
43# modified version of the Autoconf Macro, you may extend this special
44# exception to the GPL to apply to your modified version as well.
45
46AU_ALIAS([SWIG_ENABLE_CXX], [AX_SWIG_ENABLE_CXX])
47AC_DEFUN([AX_SWIG_ENABLE_CXX],[
48 AC_REQUIRE([AC_PROG_SWIG])
49 AC_REQUIRE([AC_PROG_CXX])
50 SWIG="$SWIG -c++"
51])
diff --git a/swig/Makefile.am b/swig/Makefile.am
index d65b984..f3f9714 100644
--- a/swig/Makefile.am
+++ b/swig/Makefile.am
@@ -1,6 +1,6 @@
1INCLUDES = -I$(top_srcdir)/include $(libplist_CFLAGS) -I$(oldincludedir) 1INCLUDES = -I$(top_srcdir)/include $(libplist_CFLAGS) $(SWIG_PYTHON_CPPFLAGS) -I$(oldincludedir)
2 2
3BUILT_SOURCES = iphone_wrap.c 3BUILT_SOURCES = iphone_wrap.cxx
4SWIG_SOURCES = iphone.i 4SWIG_SOURCES = iphone.i
5 5
6CLEANFILES = \ 6CLEANFILES = \
@@ -8,7 +8,7 @@ CLEANFILES = \
8 *.pyo \ 8 *.pyo \
9 _iPhone.so \ 9 _iPhone.so \
10 iPhone.py \ 10 iPhone.py \
11 iphone_wrap.c 11 iphone_wrap.cxx
12 12
13EXTRA_DIST = \ 13EXTRA_DIST = \
14 __init__.py \ 14 __init__.py \
@@ -21,11 +21,11 @@ iPhonedir = $(pyexecdir)/libiphone
21iPhone_PYTHON = __init__.py 21iPhone_PYTHON = __init__.py
22nodist_iPhone_PYTHON = iPhone.py 22nodist_iPhone_PYTHON = iPhone.py
23iPhone_LTLIBRARIES = _iPhone.la 23iPhone_LTLIBRARIES = _iPhone.la
24nodist__iPhone_la_SOURCES = iphone_wrap.c $(SWIG_SOURCES) 24nodist__iPhone_la_SOURCES = iphone_wrap.cxx $(SWIG_SOURCES)
25_iPhone_la_CFLAGS = $(PYTHON_CPPFLAGS) -I$(top_srcdir)/src 25_iPhone_la_CFLAGS = $(PYTHON_CPPFLAGS) -I$(top_srcdir)/src
26_iPhone_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) 26_iPhone_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
27_iPhone_la_LIBADD = $(top_builddir)/src/libiphone.la 27_iPhone_la_LIBADD = $(top_builddir)/src/libiphone.la
28 28
29iphone_wrap.c : $(SWIG_SOURCES) 29iphone_wrap.cxx : $(SWIG_SOURCES)
30 $(SWIG) $(SWIG_PYTHON_OPT) $(INCLUDES) -I$(top_srcdir)/src -o $@ $< 30 $(SWIG) $(SWIG_PYTHON_OPT) $(INCLUDES) -I$(top_srcdir)/src -o $@ $<
31 31
diff --git a/swig/iphone.i b/swig/iphone.i
index ba6345a..6604c63 100644
--- a/swig/iphone.i
+++ b/swig/iphone.i
@@ -7,6 +7,7 @@
7 #include <libiphone/lockdown.h> 7 #include <libiphone/lockdown.h>
8 #include <libiphone/mobilesync.h> 8 #include <libiphone/mobilesync.h>
9 #include <plist/plist.h> 9 #include <plist/plist.h>
10 #include <plist/plist++.h>
10 #include "../src/utils.h" 11 #include "../src/utils.h"
11 typedef struct { 12 typedef struct {
12 iphone_device_t dev; 13 iphone_device_t dev;
@@ -27,6 +28,7 @@ void my_delete_iPhone(iPhone* dev);
27Lockdownd* my_new_Lockdownd(iPhone* phone); 28Lockdownd* my_new_Lockdownd(iPhone* phone);
28void my_delete_Lockdownd(Lockdownd* lckd); 29void my_delete_Lockdownd(Lockdownd* lckd);
29MobileSync* my_new_MobileSync(Lockdownd* lckd); 30MobileSync* my_new_MobileSync(Lockdownd* lckd);
31PList::Node* new_node_from_plist(plist_t node);
30 32
31 %} 33 %}
32/* Parse the header file to generate wrappers */ 34/* Parse the header file to generate wrappers */
@@ -98,6 +100,41 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
98 return client; 100 return client;
99} 101}
100 102
103PList::Node* new_node_from_plist(plist_t node)
104{
105 PList::Node* ret = NULL;
106 plist_type subtype = plist_get_node_type(node);
107 switch(subtype)
108 {
109 case PLIST_DICT:
110 ret = new PList::Dictionary(node);
111 break;
112 case PLIST_ARRAY:
113 ret = new PList::Array(node);
114 break;
115 case PLIST_BOOLEAN:
116 ret = new PList::Boolean(node);
117 break;
118 case PLIST_UINT:
119 ret = new PList::Integer(node);
120 break;
121 case PLIST_REAL:
122 ret = new PList::Real(node);
123 break;
124 case PLIST_STRING:
125 ret = new PList::String(node);
126 break;
127 case PLIST_DATE:
128 ret = new PList::Date(node);
129 break;
130 case PLIST_DATA:
131 ret = new PList::Data(node);
132 break;
133 default:
134 break;
135 }
136 return ret;
137}
101%} 138%}
102 139
103 140
@@ -154,15 +191,14 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
154 my_delete_Lockdownd($self); 191 my_delete_Lockdownd($self);
155 } 192 }
156 193
157 void send(PListNode* node) { 194 void send(PList::Node* node) {
158 lockdownd_send($self->client, node->node); 195 lockdownd_send($self->client, node->GetPlist());
159 } 196 }
160 197
161 PListNode* receive() { 198 PList::Node* receive() {
162 PListNode* node = (PListNode*)malloc(sizeof(PListNode)); 199 plist_t node = NULL;
163 node->node = NULL; 200 lockdownd_recv($self->client, &node);
164 lockdownd_recv($self->client, &(node->node)); 201 return new_node_from_plist(node);
165 return node;
166 } 202 }
167 203
168 MobileSync* get_mobilesync_client() { 204 MobileSync* get_mobilesync_client() {
@@ -180,15 +216,14 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
180 free($self); 216 free($self);
181 } 217 }
182 218
183 void send(PListNode* node) { 219 void send(PList::Node* node) {
184 mobilesync_send($self->client, node->node); 220 mobilesync_send($self->client, node->GetPlist());
185 } 221 }
186 222
187 PListNode* receive() { 223 PList::Node* receive() {
188 PListNode* node = (PListNode*)malloc(sizeof(PListNode)); 224 plist_t node = NULL;
189 node->node = NULL; 225 mobilesync_recv($self->client, &node);
190 mobilesync_recv($self->client, &(node->node)); 226 return new_node_from_plist(node);
191 return node;
192 } 227 }
193}; 228};
194 229