blob: 7f679480f39bd6a8e3bca34d7e5569889ec71c27 [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
41NATIVE=nativesrc
42NATIVEDIR=$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
Emeric Vigierc30b71d2012-09-12 14:51:47 -040086# FIXME
Emeric Vigier9701e032012-09-12 12:38:01 -040087echo "Generating callmanager_wrap.cpp..."
Emeric Vigiere7ecf332012-09-12 17:27:45 -040088mkdir -p $NATIVEDIR
89swig -v -c++ -java \
90-package $PACKAGE \
91-outdir $PACKAGEDIR \
Alexandre Savardba2cfad2012-09-26 17:00:15 -040092-o $SRCDIR/dbus/callmanager_wrap.cpp $SRCDIR/dbus/jni_interface.i
Emeric Vigier9701e032012-09-12 12:38:01 -040093
Emeric Vigiere7ecf332012-09-12 17:27:45 -040094pushd $SRCDIR
Emeric Vigier9701e032012-09-12 12:38:01 -040095echo "in $PWD"
96
97echo "Generating sflphoneservice_loader.c..."
98python JavaJNI2CJNI_Load.py \
Emeric Vigier12d61d82012-09-19 15:08:18 -040099-i $ROOT/$PACKAGEDIR/SFLPhoneserviceJNI.java \
Emeric Vigiere7ecf332012-09-12 17:27:45 -0400100-o $NATIVE/sflphoneservice_loader.c \
Emeric Vigier9701e032012-09-12 12:38:01 -0400101-t sflphoneservice.c.template \
Emeric Vigier12d61d82012-09-19 15:08:18 -0400102-m SFLPhoneservice \
Emeric Vigiere7ecf332012-09-12 17:27:45 -0400103-p $PACKAGE
Emeric Vigier9701e032012-09-12 12:38:01 -0400104
105echo "Appending callmanager_wrap.cpp..."
Emeric Vigiere7ecf332012-09-12 17:27:45 -0400106cat $NATIVE/sflphoneservice_loader.c >> dbus/callmanager_wrap.cpp
Emeric Vigier9701e032012-09-12 12:38:01 -0400107
Adrien BĂ©raud4f518382013-04-18 16:51:59 +1000108
109#if [ "" != "$(find -iname sflphoneservice_loader.c)" ]; then
110 #
111#fi
112# callmanager_wrap.cpp
113# callmanager_wrap.cpp
114# sflphoneservice.java
115# sflphoneserviceJNI.java
116# ManagerImpl.java
117
Emeric Vigier9701e032012-09-12 12:38:01 -0400118echo -n "in " && popd
119echo "Done"
Emeric Vigiercca7f562012-09-20 14:22:30 -0400120exit 0