1
0
forked from gmp/jni
jni/scripts/find_linux_jnih

24 lines
801 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
2020-08-07 08:05:48 -04:00
if [ -z ${JAVA_HOME+x} ]
then
# JAVA_HOME not set. Figure out what to use for it.
JAVA_HOME=$(dirname $(readlink -f $(which java) | sed 's^jre/bin/^^'))
# Handle the case where java is being run from the jdk itself, not from within the jre
2020-08-07 08:21:05 -04:00
JAVA_HOME=$(echo $JAVA_HOME | sed 's^/bin^^')
2020-08-07 08:05:48 -04:00
fi
2020-08-07 08:05:48 -04:00
echo // +build linux,!android > jni_linux.tmp
echo //Generated by scripts/find_linux_jnih >> jni_linux.tmp
echo >> jni_linux.tmp
echo package jni >> jni_linux.tmp
echo >> jni_linux.tmp
echo /\* >> jni_linux.tmp
echo \#cgo CFLAGS: -I$JAVA_HOME/include -I$JAVA_HOME/include/linux >> jni_linux.tmp
echo \#cgo LDFLAGS: -L$JAVA_HOME/lib/server -ljvm >> jni_linux.tmp
echo \*/ >> jni_linux.tmp
echo import \"C\" >> jni_linux.tmp
mv -f jni_linux.go jni_linux.go-old
mv jni_linux.tmp jni_linux.go