Adrien Béraud | 04d822c | 2015-04-02 17:44:36 -0400 | [diff] [blame] | 1 | #!/bin/bash - |
| 2 | # |
| 3 | # Copyright (C) 2004-2014 Savoir-Faire Linux Inc. |
| 4 | # |
| 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 | |
| 33 | # input: jni/jni_interface.i |
| 34 | # output: ringservice_loader.c |
| 35 | # ring_wrapper.cpp |
| 36 | # ringservice.java |
| 37 | # ringserviceJNI.java |
| 38 | # ManagerImpl.java |
| 39 | |
Thibault Wittemberg | 25dfc9f | 2016-11-16 18:44:55 -0500 | [diff] [blame] | 40 | SRCDIR=libringclient/src/main/jni |
| 41 | PACKAGE=cx.ring.daemon |
| 42 | PACKAGEDIR=libringclient/src/main/java/cx/ring/daemon |
Adrien Béraud | 04d822c | 2015-04-02 17:44:36 -0400 | [diff] [blame] | 43 | ROOT=`pwd` |
| 44 | |
| 45 | echo "in $ROOT" |
| 46 | |
| 47 | echo "Checking that swig is 2.0.6 or later" |
| 48 | SWIGVER=`swig -version | \ |
| 49 | grep -i "SWIG version" | \ |
| 50 | awk '{print $3}'` |
| 51 | SWIGVER1=`echo $SWIGVER | \ |
| 52 | awk '{split($0, array, ".")} END{print array[1]}'` |
| 53 | SWIGVER2=`echo $SWIGVER | \ |
| 54 | awk '{split($0, array, ".")} END{print array[2]}'` |
| 55 | SWIGVER3=`echo $SWIGVER | \ |
| 56 | awk '{split($0, array, ".")} END{print array[3]}'` |
| 57 | |
| 58 | echo swig-$SWIGVER1.$SWIGVER2.$SWIGVER3 |
| 59 | |
| 60 | if [[ $SWIGVER1 -ge 2 ]]; then |
| 61 | echo "swig version is greater than 2.x" |
| 62 | if [[ $SWIGVER1 -gt 2 ]]; then |
| 63 | echo "swig version is greater than 3.x" |
| 64 | else |
| 65 | if [[ $SWIGVER2 -ge 1 ]]; then |
| 66 | echo "swig version is greater than 2.1" |
| 67 | else |
| 68 | echo "swig version is less than 2.1" |
| 69 | if [[ $SWIGVER3 -ge 6 ]]; then |
| 70 | echo "swig version is greater than 2.0.6" |
| 71 | else |
| 72 | echo "swig version is less than 2.0.6" |
| 73 | echo "exiting..." |
| 74 | exit 4 |
| 75 | fi |
| 76 | fi |
| 77 | fi |
| 78 | else |
| 79 | echo "swig version is less than 2.x" |
| 80 | echo "exiting..." |
| 81 | exit 3 |
| 82 | fi |
| 83 | |
Thibault Wittemberg | 25dfc9f | 2016-11-16 18:44:55 -0500 | [diff] [blame] | 84 | echo "Creating package folder $PACKAGEDIR ..." |
| 85 | |
| 86 | mkdir -p $PACKAGEDIR |
| 87 | |
Adrien Béraud | 04d822c | 2015-04-02 17:44:36 -0400 | [diff] [blame] | 88 | echo "Generating ring_wrapper.cpp..." |
| 89 | |
| 90 | swig -v -c++ -java \ |
| 91 | -package $PACKAGE \ |
| 92 | -outdir $PACKAGEDIR \ |
| 93 | -o $SRCDIR/ring_wrapper.cpp $SRCDIR/jni_interface.i |
| 94 | |
| 95 | echo "Generating ringservice_loader.c..." |
| 96 | python $SRCDIR/JavaJNI2CJNI_Load.py \ |
| 97 | -i $ROOT/$PACKAGEDIR/RingserviceJNI.java \ |
| 98 | -o $SRCDIR/ringservice_loader.c \ |
| 99 | -t $SRCDIR/ringservice.c.template \ |
| 100 | -m Ringservice \ |
| 101 | -p $PACKAGE |
| 102 | |
Adrien Béraud | 87d878d | 2015-06-03 15:09:19 -0400 | [diff] [blame] | 103 | echo "Appending ring_wrapper.cpp..." |
Adrien Béraud | 04d822c | 2015-04-02 17:44:36 -0400 | [diff] [blame] | 104 | cat $SRCDIR/ringservice_loader.c >> $SRCDIR/ring_wrapper.cpp |
| 105 | |
| 106 | echo -n "in " |
| 107 | echo "Done" |
| 108 | exit 0 |