blob: 77619bcb4a49d907d0b0b486d5a883b506c87e49 [file] [log] [blame]
carlosmscabralf40ecd12013-02-01 18:15:58 -02001From 166693d7cb640d4a41251b87e92c52d9c688196b Mon Sep 17 00:00:00 2001
2From: Bob Lantz <rlantz@cs.stanford.edu>
3Date: Mon, 14 May 2012 15:30:44 -0700
4Subject: [PATCH] Hacks to get NOX classic/destiny to compile under Ubuntu
5 12.04
6
7Thanks to Srinivasu R. Kanduru for the initial patch.
8
9Apologies for the hacks - it is my hope that this will be fixed
10upstream eventually.
11
12---
13 config/ac_pkg_swig.m4 | 7 ++++---
14 src/Make.vars | 2 +-
15 src/nox/coreapps/pyrt/deferredcallback.cc | 2 +-
16 src/nox/coreapps/pyrt/pyglue.cc | 2 +-
17 src/nox/coreapps/pyrt/pyrt.cc | 2 +-
18 src/nox/netapps/authenticator/auth.i | 2 ++
19 src/nox/netapps/authenticator/flow_util.i | 1 +
20 src/nox/netapps/routing/routing.i | 2 ++
21 .../switch_management/pyswitch_management.i | 2 ++
22 src/nox/netapps/tests/tests.cc | 2 +-
23 src/nox/netapps/topology/pytopology.i | 2 ++
24 11 files changed, 18 insertions(+), 8 deletions(-)
25
26diff --git a/config/ac_pkg_swig.m4 b/config/ac_pkg_swig.m4
27index d12556e..9b608f2 100644
28--- a/config/ac_pkg_swig.m4
29+++ b/config/ac_pkg_swig.m4
30@@ -78,9 +78,10 @@ AC_DEFUN([AC_PROG_SWIG],[
31 if test -z "$available_patch" ; then
32 [available_patch=0]
33 fi
34- if test $available_major -ne $required_major \
35- -o $available_minor -ne $required_minor \
36- -o $available_patch -lt $required_patch ; then
37+ major_done=`test $available_major -gt $required_major`
38+ minor_done=`test $available_minor -gt $required_minor`
39+ if test !$major_done -a !$minor_done \
40+ -a $available_patch -lt $required_patch ; then
41 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
42 SWIG=''
43 else
44diff --git a/src/Make.vars b/src/Make.vars
45index d70d6aa..93b2879 100644
46--- a/src/Make.vars
47+++ b/src/Make.vars
48@@ -53,7 +53,7 @@ AM_LDFLAGS += -export-dynamic
49 endif
50
51 # set python runtimefiles to be installed in the same directory as pkg
52-pkglib_SCRIPTS = $(NOX_RUNTIMEFILES) $(NOX_PYBUILDFILES)
53+pkgdata_SCRIPTS = $(NOX_RUNTIMEFILES) $(NOX_PYBUILDFILES)
54 BUILT_SOURCES = $(NOX_PYBUILDFILES)
55
56 # Runtime-files build and clean rules
57diff --git a/src/nox/coreapps/pyrt/deferredcallback.cc b/src/nox/coreapps/pyrt/deferredcallback.cc
58index 3a40fa7..111a586 100644
59--- a/src/nox/coreapps/pyrt/deferredcallback.cc
60+++ b/src/nox/coreapps/pyrt/deferredcallback.cc
61@@ -69,7 +69,7 @@ DeferredCallback::get_instance(const Callback& c)
62 DeferredCallback* cb = new DeferredCallback(c);
63
64 // flag as used in *_wrap.cc....correct?
65- return SWIG_Python_NewPointerObj(cb, s, SWIG_POINTER_OWN | 0);
66+ return SWIG_Python_NewPointerObj(m, cb, s, SWIG_POINTER_OWN | 0);
67 }
68
69 bool
70diff --git a/src/nox/coreapps/pyrt/pyglue.cc b/src/nox/coreapps/pyrt/pyglue.cc
71index 48b9716..317fd04 100644
72--- a/src/nox/coreapps/pyrt/pyglue.cc
73+++ b/src/nox/coreapps/pyrt/pyglue.cc
74@@ -874,7 +874,7 @@ to_python(const Flow& flow)
75 if (!s) {
76 throw std::runtime_error("Could not find Flow SWIG type_info");
77 }
78- return SWIG_Python_NewPointerObj(f, s, SWIG_POINTER_OWN | 0);
79+ return SWIG_Python_NewPointerObj(m, f, s, SWIG_POINTER_OWN | 0);
80
81 // PyObject* dict = PyDict_New();
82 // if (!dict) {
83diff --git a/src/nox/coreapps/pyrt/pyrt.cc b/src/nox/coreapps/pyrt/pyrt.cc
84index fbda461..8ec05d6 100644
85--- a/src/nox/coreapps/pyrt/pyrt.cc
86+++ b/src/nox/coreapps/pyrt/pyrt.cc
87@@ -776,7 +776,7 @@ Python_event_manager::create_python_context(const Context* ctxt,
88 pretty_print_python_exception());
89 }
90
91- PyObject* pyctxt = SWIG_Python_NewPointerObj(p, s, 0);
92+ PyObject* pyctxt = SWIG_Python_NewPointerObj(m, p, s, 0);
93 Py_INCREF(pyctxt); // XXX needed?
94
95 //Py_DECREF(m);
96diff --git a/src/nox/netapps/authenticator/auth.i b/src/nox/netapps/authenticator/auth.i
97index 1de1a17..bfa04e2 100644
98--- a/src/nox/netapps/authenticator/auth.i
99+++ b/src/nox/netapps/authenticator/auth.i
100@@ -18,6 +18,8 @@
101
102 %module "nox.netapps.authenticator.pyauth"
103
104+// Hack to get it to compile -BL
105+%include "std_list.i"
106 %{
107 #include "core_events.hh"
108 #include "pyrt/pycontext.hh"
109diff --git a/src/nox/netapps/authenticator/flow_util.i b/src/nox/netapps/authenticator/flow_util.i
110index f67c3ef..2a314e2 100644
111--- a/src/nox/netapps/authenticator/flow_util.i
112+++ b/src/nox/netapps/authenticator/flow_util.i
113@@ -32,6 +32,7 @@ using namespace vigil::applications;
114 %}
115
116 %include "common-defs.i"
117+%include "std_list.i"
118
119 %import "netinet/netinet.i"
120 %import "pyrt/event.i"
121diff --git a/src/nox/netapps/routing/routing.i b/src/nox/netapps/routing/routing.i
122index 44ccb3d..f9221a2 100644
123--- a/src/nox/netapps/routing/routing.i
124+++ b/src/nox/netapps/routing/routing.i
125@@ -17,6 +17,8 @@
126 */
127 %module "nox.netapps.routing.pyrouting"
128
129+// Hack to get it to compile -BL
130+%include "std_list.i"
131 %{
132 #include "pyrouting.hh"
133 #include "routing.hh"
134diff --git a/src/nox/netapps/switch_management/pyswitch_management.i b/src/nox/netapps/switch_management/pyswitch_management.i
135index 72bfed4..ad2c90d 100644
136--- a/src/nox/netapps/switch_management/pyswitch_management.i
137+++ b/src/nox/netapps/switch_management/pyswitch_management.i
138@@ -18,6 +18,8 @@
139
140 %module "nox.netapps.pyswitch_management"
141
142+// Hack to get it to compile -BL
143+%include "std_list.i"
144 %{
145 #include "switch_management_proxy.hh"
146 #include "pyrt/pycontext.hh"
147diff --git a/src/nox/netapps/tests/tests.cc b/src/nox/netapps/tests/tests.cc
148index 20e900d..f027028 100644
149--- a/src/nox/netapps/tests/tests.cc
150+++ b/src/nox/netapps/tests/tests.cc
151@@ -306,7 +306,7 @@ private:
152 throw runtime_error("Could not find PyContext SWIG type_info.");
153 }
154
155- PyObject* pyctxt = SWIG_Python_NewPointerObj(p, s, 0);
156+ PyObject* pyctxt = SWIG_Python_NewPointerObj(m, p, s, 0);
157 assert(pyctxt);
158
159 Py_DECREF(m);
160diff --git a/src/nox/netapps/topology/pytopology.i b/src/nox/netapps/topology/pytopology.i
161index 94a9f4b..7a8cd94 100644
162--- a/src/nox/netapps/topology/pytopology.i
163+++ b/src/nox/netapps/topology/pytopology.i
164@@ -18,6 +18,8 @@
165
166 %module "nox.netapps.topology"
167
168+// Hack to get it to compile -BL
169+%include "std_list.i"
170 %{
171 #include "pytopology.hh"
172 #include "pyrt/pycontext.hh"
173--
1741.7.5.4
175