Emeric Vigier | c30b71d | 2012-09-12 14:51:47 -0400 | [diff] [blame] | 1 | #!/bin/bash - |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 2 | # |
Emeric Vigier | c30b71d | 2012-09-12 14:51:47 -0400 | [diff] [blame] | 3 | # Copyright (C) 2004-2012 Savoir-Faire Linux Inc. |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 4 | # |
Emeric Vigier | c30b71d | 2012-09-12 14:51:47 -0400 | [diff] [blame] | 5 | # 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 Savard | ba2cfad | 2012-09-26 17:00:15 -0400 | [diff] [blame] | 33 | # input: jni/sflphone/daemon/src/dbus/jni_interface.i |
Emeric Vigier | c30b71d | 2012-09-12 14:51:47 -0400 | [diff] [blame] | 34 | # output: sflphoneservice_loader.c |
| 35 | # callmanager_wrap.cpp |
| 36 | # sflphoneservice.java |
| 37 | # sflphoneserviceJNI.java |
| 38 | # ManagerImpl.java |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 39 | |
Emeric Vigier | e7ecf33 | 2012-09-12 17:27:45 -0400 | [diff] [blame] | 40 | SRCDIR=jni/sflphone/daemon/src |
| 41 | NATIVE=nativesrc |
| 42 | NATIVEDIR=$SRCDIR/$NATIVE |
Emeric Vigier | 12d61d8 | 2012-09-19 15:08:18 -0400 | [diff] [blame] | 43 | PACKAGE=com.savoirfairelinux.sflphone.service |
| 44 | PACKAGEDIR=src/com/savoirfairelinux/sflphone/service |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 45 | ROOT=`pwd` |
Emeric Vigier | e7ecf33 | 2012-09-12 17:27:45 -0400 | [diff] [blame] | 46 | |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 47 | echo "in $ROOT" |
| 48 | |
Emeric Vigier | cca7f56 | 2012-09-20 14:22:30 -0400 | [diff] [blame] | 49 | echo "Checking that swig is 2.0.6 or later" |
| 50 | SWIGVER=`swig -version | \ |
| 51 | grep -i "SWIG version" | \ |
| 52 | awk '{print $3}'` |
| 53 | SWIGVER1=`echo $SWIGVER | \ |
| 54 | awk '{split($0, array, ".")} END{print array[1]}'` |
| 55 | SWIGVER2=`echo $SWIGVER | \ |
| 56 | awk '{split($0, array, ".")} END{print array[2]}'` |
| 57 | SWIGVER3=`echo $SWIGVER | \ |
| 58 | awk '{split($0, array, ".")} END{print array[3]}'` |
| 59 | |
| 60 | echo swig-$SWIGVER1.$SWIGVER2.$SWIGVER3 |
| 61 | |
| 62 | if [[ $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 |
| 80 | else |
| 81 | echo "swig version is less than 2.x" |
| 82 | echo "exiting..." |
| 83 | exit 3 |
| 84 | fi |
| 85 | |
Emeric Vigier | c30b71d | 2012-09-12 14:51:47 -0400 | [diff] [blame] | 86 | # FIXME |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 87 | echo "Generating callmanager_wrap.cpp..." |
Emeric Vigier | e7ecf33 | 2012-09-12 17:27:45 -0400 | [diff] [blame] | 88 | mkdir -p $NATIVEDIR |
| 89 | swig -v -c++ -java \ |
| 90 | -package $PACKAGE \ |
| 91 | -outdir $PACKAGEDIR \ |
Alexandre Savard | ba2cfad | 2012-09-26 17:00:15 -0400 | [diff] [blame] | 92 | -o $SRCDIR/dbus/callmanager_wrap.cpp $SRCDIR/dbus/jni_interface.i |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 93 | |
Emeric Vigier | e7ecf33 | 2012-09-12 17:27:45 -0400 | [diff] [blame] | 94 | pushd $SRCDIR |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 95 | echo "in $PWD" |
| 96 | |
| 97 | echo "Generating sflphoneservice_loader.c..." |
| 98 | python JavaJNI2CJNI_Load.py \ |
Emeric Vigier | 12d61d8 | 2012-09-19 15:08:18 -0400 | [diff] [blame] | 99 | -i $ROOT/$PACKAGEDIR/SFLPhoneserviceJNI.java \ |
Emeric Vigier | e7ecf33 | 2012-09-12 17:27:45 -0400 | [diff] [blame] | 100 | -o $NATIVE/sflphoneservice_loader.c \ |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 101 | -t sflphoneservice.c.template \ |
Emeric Vigier | 12d61d8 | 2012-09-19 15:08:18 -0400 | [diff] [blame] | 102 | -m SFLPhoneservice \ |
Emeric Vigier | e7ecf33 | 2012-09-12 17:27:45 -0400 | [diff] [blame] | 103 | -p $PACKAGE |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 104 | |
| 105 | echo "Appending callmanager_wrap.cpp..." |
Emeric Vigier | e7ecf33 | 2012-09-12 17:27:45 -0400 | [diff] [blame] | 106 | cat $NATIVE/sflphoneservice_loader.c >> dbus/callmanager_wrap.cpp |
Emeric Vigier | 9701e03 | 2012-09-12 12:38:01 -0400 | [diff] [blame] | 107 | |
| 108 | echo -n "in " && popd |
| 109 | echo "Done" |
Emeric Vigier | cca7f56 | 2012-09-20 14:22:30 -0400 | [diff] [blame] | 110 | exit 0 |