Upgrading swish for Mombo

Sam Ruby upgraded mombo April 27th, 2004. In my process of adopting it for my blog, I just did it again.

I'm using

Main changes are:
$ diff -uri . ../../stories/2007/08/06/swish/
diff -uri ./Makefile ../../stories/2007/08/06/swish/Makefile
--- ./Makefile  2007-08-06 21:10:52.000000000 +0200
+++ ../../stories/2007/08/06/swish/Makefile     2007-08-06 21:01:46.000000000 +0200
@@ -1,24 +1,25 @@
 #http://www.swig.org/tutorial.html
 
-SWIG=/home/rubys/setup/SWIG-1.3.21/Lib
-SWISH=/home/rubys/lib
-PYTHON=/usr/local/include/python2.3
-CODEBASE=/usr/rubys/mombo
+SWIG=/usr/share/swig/1.3.31
+SWISH=/usr/lib
+PYTHON=/usr/include/python2.4
+CODEBASE=/home/sgala/public_html/code/mombo
+CXXFLAGS +=  -fPIC #x86_64 at least needs it
 
 all: _swish_e.so swish_e.py test
 
 swish_e.py swish_e_wrap.cxx: swish_e.i
-       swig -c++ -python -I${SWIG} -I${SWIG}/python swish_e.i
+       swig -c++ -python -I${SWIG}/python -I${SWIG} swish_e.i
 
 swish_e_wrap.o: swish_e_wrap.cxx
-       g++ -c swish_e_wrap.cxx -I${PYTHON}
+       g++ ${CXXFLAGS}-c swish_e_wrap.cxx -I${PYTHON}
 
 swish_e.o: swish_e.c
-       g++ -c swish_e.c -I${PYTHON}
+       g++ ${CXXFLAGS} -c swish_e.c -I${PYTHON}
 
 _swish_e.so: swish_e.o swish_e_wrap.o
        g++ -shared swish_e.o swish_e_wrap.o \
-       -R${CODEBASE} -L${SWISH} -lswish-e -lz -lxml2 -o _swish_e.so
+       -L${SWISH} -lswish-e -lz -lxml2 -o _swish_e.so
 
 test: swish_e.py _swish_e.so test.py
        python test.py
diff -uri ./swish_e.i ../../stories/2007/08/06/swish/swish_e.i
--- ./swish_e.i 2007-08-06 21:11:19.000000000 +0200
+++ ../../stories/2007/08/06/swish/swish_e.i    2007-08-06 21:01:46.000000000 +0200
@@ -5,6 +5,9 @@
 %{
   #include <vector>
   #include <string>
+
+extern std::vector<std::string> search(std::string, std::string);
+
 %}
  
 %include stl.i

Basically, and forgetting the paths, an extra reference was needed to the function (or else something complained), -fPIC is really a must for x86-64 and shared libraries, and -R${CODEBASE} I'm not even sure what does apart from aborting, but removing it looked harmless. My guess it was some linker option a la -Wl,-Rpath...

I'm documenting it here, just in case.

Add your comment












Nav Bar