blob: 54ea4a3f1b5dfccd40d4ecf34333837ba275321c [file] [log] [blame]
Emeric Vigierc30b71d2012-09-12 14:51:47 -04001#!/bin/bash -
Emeric Vigier9701e032012-09-12 12:38:01 -04002#
Emeric Vigierc30b71d2012-09-12 14:51:47 -04003# Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
Emeric Vigier9701e032012-09-12 12:38:01 -04004#
Emeric Vigierc30b71d2012-09-12 14:51:47 -04005# Author: Emeric Vigier <emeric.vigier@savoirfairelinux.com>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20#
21# Additional permission under GNU GPL version 3 section 7:
22#
23# If you modify this program, or any covered work, by linking or
24# combining it with the OpenSSL project's OpenSSL library (or a
25# modified version of that library), containing parts covered by the
26# terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
27# grants you additional permission to convey the resulting work.
28# Corresponding Source for a non-source form of such a combination
29# shall include the source code for the parts of OpenSSL used as well
30# as that of the covered work.
31#
32
Alexandre Savardba2cfad2012-09-26 17:00:15 -040033# input: jni/sflphone/daemon/src/dbus/jni_interface.i
Emeric Vigierc30b71d2012-09-12 14:51:47 -040034# output: sflphoneservice_loader.c
35# callmanager_wrap.cpp
36# sflphoneservice.java
37# sflphoneserviceJNI.java
38# ManagerImpl.java
Emeric Vigier9701e032012-09-12 12:38:01 -040039
Emeric Vigiere7ecf332012-09-12 17:27:45 -040040SRCDIR=jni/sflphone/daemon/src
alision3ea8f3c2013-07-16 17:35:35 -040041NATIVE=client/android
Emeric Vigiere7ecf332012-09-12 17:27:45 -040042NATIVEDIR=$SRCDIR/$NATIVE
Emeric Vigier12d61d82012-09-19 15:08:18 -040043PACKAGE=com.savoirfairelinux.sflphone.service
44PACKAGEDIR=src/com/savoirfairelinux/sflphone/service
Emeric Vigier9701e032012-09-12 12:38:01 -040045ROOT=`pwd`
Emeric Vigiere7ecf332012-09-12 17:27:45 -040046
Emeric Vigier9701e032012-09-12 12:38:01 -040047echo "in $ROOT"
48
Emeric Vigiercca7f562012-09-20 14:22:30 -040049echo "Checking that swig is 2.0.6 or later"
50SWIGVER=`swig -version | \
51 grep -i "SWIG version" | \
52 awk '{print $3}'`
53SWIGVER1=`echo $SWIGVER | \
54 awk '{split($0, array, ".")} END{print array[1]}'`
55SWIGVER2=`echo $SWIGVER | \
56 awk '{split($0, array, ".")} END{print array[2]}'`
57SWIGVER3=`echo $SWIGVER | \
58 awk '{split($0, array, ".")} END{print array[3]}'`
59
60echo swig-$SWIGVER1.$SWIGVER2.$SWIGVER3
61
62if [[ $SWIGVER1 -ge 2 ]]; then
63 echo "swig version is greater than 2.x"
64 if [[ $SWIGVER1 -gt 2 ]]; then
65 echo "swig version is greater than 3.x"
66 else
67 if [[ $SWIGVER2 -ge 1 ]]; then
68 echo "swig version is greater than 2.1"
69 else
70 echo "swig version is less than 2.1"
71 if [[ $SWIGVER3 -ge 6 ]]; then
72 echo "swig version is greater than 2.0.6"
73 else
74 echo "swig version is less than 2.0.6"
75 echo "exiting..."
76 exit 4
77 fi
78 fi
79 fi
80else
81 echo "swig version is less than 2.x"
82 echo "exiting..."
83 exit 3
84fi
85
alisionf76de3b2013-04-16 15:35:22 -040086
87
88
Emeric Vigierc30b71d2012-09-12 14:51:47 -040089# FIXME
Emeric Vigier9701e032012-09-12 12:38:01 -040090echo "Generating callmanager_wrap.cpp..."
alision3ea8f3c2013-07-16 17:35:35 -040091
Emeric Vigiere7ecf332012-09-12 17:27:45 -040092swig -v -c++ -java \
93-package $PACKAGE \
94-outdir $PACKAGEDIR \
alision3ea8f3c2013-07-16 17:35:35 -040095-o $SRCDIR/client/android/callmanager_wrap.cpp $SRCDIR/client/android/jni_interface.i
Emeric Vigier9701e032012-09-12 12:38:01 -040096
Emeric Vigiere7ecf332012-09-12 17:27:45 -040097pushd $SRCDIR
Emeric Vigier9701e032012-09-12 12:38:01 -040098echo "in $PWD"
99
100echo "Generating sflphoneservice_loader.c..."
alision3ea8f3c2013-07-16 17:35:35 -0400101python client/android/JavaJNI2CJNI_Load.py \
Emeric Vigier12d61d82012-09-19 15:08:18 -0400102-i $ROOT/$PACKAGEDIR/SFLPhoneserviceJNI.java \
Emeric Vigiere7ecf332012-09-12 17:27:45 -0400103-o $NATIVE/sflphoneservice_loader.c \
alision3ea8f3c2013-07-16 17:35:35 -0400104-t client/android/sflphoneservice.c.template \
Emeric Vigier12d61d82012-09-19 15:08:18 -0400105-m SFLPhoneservice \
Emeric Vigiere7ecf332012-09-12 17:27:45 -0400106-p $PACKAGE
Emeric Vigier9701e032012-09-12 12:38:01 -0400107
108echo "Appending callmanager_wrap.cpp..."
alision3ea8f3c2013-07-16 17:35:35 -0400109cat $NATIVE/sflphoneservice_loader.c >> client/android/callmanager_wrap.cpp
Emeric Vigier9701e032012-09-12 12:38:01 -0400110
Adrien BĂ©raud4f518382013-04-18 16:51:59 +1000111
112#if [ "" != "$(find -iname sflphoneservice_loader.c)" ]; then
113 #
114#fi
115# callmanager_wrap.cpp
116# callmanager_wrap.cpp
117# sflphoneservice.java
118# sflphoneserviceJNI.java
119# ManagerImpl.java
120
Emeric Vigier9701e032012-09-12 12:38:01 -0400121echo -n "in " && popd
122echo "Done"
Emeric Vigiercca7f562012-09-20 14:22:30 -0400123exit 0