4 # Run SWIG to generate the Java APIs
7 trap 'rm -f $t ; exit 0' 0
8 trap 'rm -f $t ; exit 1' 1 2 3 13 15
11 SWIG_DIR=../libdb_java
12 SWIG_FILE=$SWIG_DIR/db.i
13 PACKAGE="com.sleepycat.db.internal"
20 [ -f $SWIG_FILE ] || die "Must be run from the dist directory"
23 echo "Building $api API"
28 swig_args="-nodefaultctor -nodefaultdtor -package $PACKAGE $args"
32 $SWIG -Wall -$api $swig_args -I$SWIG_DIR \
33 -o ../libdb_$api/db_${api}_wrap.c $SWIG_FILE || exit $?
36 # Skip Java sources if run with "-n"
37 if [ "x$1" = "x-n" ] ; then
38 rm -f $SWIG_DIR/*.java
43 JAVA_SRCTOP=../java/src
44 JAVA_PKGDIR=com/sleepycat/db/internal
45 JAVA_SRCDIR=$JAVA_SRCTOP/$JAVA_PKGDIR
47 # SWIG 1.3.18 puts the Java files in the same directory as the native code.
49 [ -f Db.java ] || exit 1
54 die "Interface contains unresolved types: $f"
57 perl -p $SWIG_DIR/java-post.pl < $f > $JAVA_SRCDIR/$f || exit $?
61 # db_config.h must be the first #include, move it to the top of the file.
63 echo '#include "db_config.h"'
64 sed '/#include "db_config.h"/d' < db_java_wrap.c
65 ) > $t && cp $t db_java_wrap.c
67 # The following might become redundant with newer swig versions.
68 # builds usually already define _CRT_SECURE_NO_DEPRECATE
70 sed -e '/# define _CRT_SECURE_NO_DEPRECATE/i\
71 # undef _CRT_SECURE_NO_DEPRECATE' < db_java_wrap.c
72 ) > $t && cp $t db_java_wrap.c