serval-dna/nacl-jni-prep

36 lines
1.1 KiB
Plaintext
Executable File

# Fetch latest version of source as recommended by nacl installation page
[ -e nacl-source.tar.bz2 ] || \
`wget -q -O - http://nacl.cr.yp.to/install.html | grep wget | sed -e 's/^ *//g' -e 's/^wget /wget -O nacl-source.tar.bz2 /'`
# Extract tarball
bzip2 -d nacl-source.tar.bz2
mkdir nacl-source
cd nacl-source
tar xvf ../nacl-source.tar
nacldir=`echo *`
cd ${nacldir}
# Now build the actual compilable sources using our
# hacked version of NaCl's 'do' script
cp ../../nacl-prepare-sources .
chmod 755 nacl-prepare-sources
./nacl-prepare-sources
cd nacl-source
ls -1 *.h | grep -v mphlr.h | sed -e 's,^,#include ",' -e 's,$,",' > nacl.h
ls -1 *.h >../../../nacl-sources.list
mv *.h ../../../
cd ../../../
rm nacl-source/*/nacl-source/*/measure.c
echo `ls -1 nacl-source/*/nacl-source/*/*.c` >>nacl-sources.list
# Now build Android.mk with the extra .c files listed
sources=`echo nacl-source/*/nacl-source/*/*.c`
echo sed -e 's,LOCAL_SRC_FILES:= \\,LOCAL_SRC_FILES:= '"${sources}"' \\,'
cat Android-without-NaCl.mk | sed -e 's,LOCAL_SRC_FILES:= \\,LOCAL_SRC_FILES:= '"${sources}"' \\,' > Android.mk