#!/bin/sh

# Creates the JNI library used to share the
# images captured from the OpenMHP.

# For defining the shared memory key:
#LIBOPENMHP_PATHNAME=$1
#LIBOPENMHP_PROJID=$2
LIBOPENMHP_PATHNAME=/tmp/openmhp.h
LIBOPENMHP_PROJID=1

# create the header file (to jni subdir)
javah -classpath build -d jni libopenmhp.Grabber

# Compile..
gcc -D'LIBOPENMHP_PATHNAME="'$LIBOPENMHP_PATHNAME'"' \
 -D'LIBOPENMHP_PROJID='$LIBOPENMHP_PROJID'' -fPIC -g -c -Wall \
 jni/grabber_impl.c -o build/jni/grabber.o

# ..and link
ld -shared -soname libgrabber.so -o build/jni/libgrabber.so \
 -lc build/jni/grabber.o
